// 条件句SQL設定
        private string GetSQLWhere()
        {
            string strWhrer = "";
            string strWhrerString1 = "";
            string strWhrerString2 = "";

            // 支払書番号
            if (this.utlPaymentNo_F.txtID.Text.Trim() != "")
            {
                strWhrer += "   AND T.NO >= " + ExCast.zCLng(this.utlPaymentNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "[支払書番号 " + ExCast.zCLng(this.utlPaymentNo_F.txtID.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "[支払書番号 未指定~";
            }
            if (this.utlPaymentNo_T.txtID.Text.Trim() != "")
            {
                strWhrer += "   AND T.NO <= " + ExCast.zCLng(this.utlPaymentNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExCast.zCLng(this.utlPaymentNo_T.txtID.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 支払締日
            if (this.datPaymentCloseYmd_F.Text.Trim() != "")
            {
                strWhrer += "   AND T.PAYMENT_YYYYMMDD >= " + ExEscape.zRepStr(this.datPaymentCloseYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [支払締日 " + this.datPaymentCloseYmd_F.Text.Trim() + "~";
            }
            else
            {
                strWhrerString1 += "] [支払締日 未指定~";
            }
            if (this.datPaymentCloseYmd_T.Text.Trim() != "")
            {
                strWhrer += "   AND T.PAYMENT_YYYYMMDD <= " + ExEscape.zRepStr(this.datPaymentCloseYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += this.datPaymentCloseYmd_T.Text.Trim();
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 仕入先
            if (this.utlPurchase.txtID.Text.Trim() != "")
            {
                strWhrer += "   AND T.PURCHASE_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlPurchase.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "[仕入先 " + ExEscape.zRepStrNoQuota(this.utlPurchase.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlPurchase.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "[仕入先 未指定";
            }

            // 締区分
            if (this.utlSummingUp.txtID.Text.Trim() != "")
            {
                strWhrer += "   AND T.SUMMING_UP_GROUP_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlSummingUp.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "] [締区分 " + ExEscape.zRepStrNoQuota(this.utlSummingUp.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlSummingUp.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "] [締区分 未指定";
            }

            string _buf = "";

            // 支払書発行
            if (borPrint.Visibility == System.Windows.Visibility.Visible)
            {
                if (this.chkPrintNo.IsChecked == true)
                {
                    // 発行済を除く
                    strWhrer += "   AND (T.PAYMENT_PRINT_FLG = 0";
                    _buf += " [支払書発行 発行未";
                }
                if (this.chkPrintYes.IsChecked == true)
                {
                    // 都度請求
                    if (_buf == "")
                    {
                        strWhrer += "   AND (T.PAYMENT_PRINT_FLG = 1";
                        _buf += " [支払書発行 発行済";
                    }
                    else
                    {
                        strWhrer += " OR T.PAYMENT_PRINT_FLG = 1";
                        _buf += " 発行済";
                    }
                }
                if (_buf == "")
                {
                    _buf += " [支払書発行 指定無し]";
                }
                else
                {
                    strWhrer += ")" + Environment.NewLine;
                    _buf += "]";
                }
                strWhrerString2 += _buf;
            }

            _buf = "";

            // 出金消込
            if (borReceipt.Visibility == System.Windows.Visibility.Visible)
            {
                if (this.chkPaymentNo.IsChecked == true)
                {
                    strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) = 0";
                    _buf += " [出金消込 消込未";
                }
                if (this.chkPaymentPlace.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) < IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf += " [出金消込 一部消込";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) < IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf += " 一部消込";
                    }
                }
                if (this.chkPaymentYes.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) = IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf += " [出金消込 消込済";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) = IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf += " 消込済";
                    }
                }
                if (this.chkPaymentOver.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) > IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf += " [出金消込 超過消込";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) > IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf += " 超過消込";
                    }
                }
                if (_buf == "")
                {
                    _buf += " [出金消込 指定無し]";
                }
                else
                {
                    strWhrer += ")" + Environment.NewLine;
                    _buf += "]";
                }
                strWhrerString2 += _buf;
            }

            _buf = "";

            lstUpd.Clear();
            if (this.ProcKbn == eProcKbn.Report)
            {
                strWhrer = "";
                strWhrerString1 = "";
                strWhrerString2 = "";

                string _no = "";
                for (int i = 0; i <= lst.Count - 1; i++)
                {
                    if (lst[i].exec_flg == true)
                    {
                        EntityPaymentClose entityUpd = new EntityPaymentClose();
                        entityUpd._no = lst[i].no;
                        lstUpd.Add(entityUpd);

                        if (string.IsNullOrEmpty(_no))
                        {
                            _no += ExCast.zCLng(this.lst[i].no).ToString();
                        }
                        else
                        {
                            _no += "<<@escape_comma@>>" + ExCast.zCLng(this.lst[i].no).ToString();
                        }
                    }
                }
                if (!string.IsNullOrEmpty(_no))
                {
                    strWhrer += "   AND T.NO IN (" + _no + ")" + Environment.NewLine;
                }

                if (datIssueYmd.SelectedDate != null)
                {
                    strWhrer += "<issue ymd>" + ((DateTime)datIssueYmd.SelectedDate).ToString("yyyy/MM/dd");
                }

            }

            return strWhrer + "WhereString =>" + strWhrerString1 + ";" + strWhrerString2;
        }
        // 条件句SQL設定
        private string GetSQLWhere()
        {
            string strWhrer        = "";
            string strWhrerString1 = "";
            string strWhrerString2 = "";

            // 支払書番号
            if (this.utlPaymentNo_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO >= " + ExCast.zCLng(this.utlPaymentNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "[支払書番号 " + ExCast.zCLng(this.utlPaymentNo_F.txtID.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "[支払書番号 未指定~";
            }
            if (this.utlPaymentNo_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO <= " + ExCast.zCLng(this.utlPaymentNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExCast.zCLng(this.utlPaymentNo_T.txtID.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 支払締日
            if (this.datPaymentCloseYmd_F.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PAYMENT_YYYYMMDD >= " + ExEscape.zRepStr(this.datPaymentCloseYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [支払締日 " + this.datPaymentCloseYmd_F.Text.Trim() + "~";
            }
            else
            {
                strWhrerString1 += "] [支払締日 未指定~";
            }
            if (this.datPaymentCloseYmd_T.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PAYMENT_YYYYMMDD <= " + ExEscape.zRepStr(this.datPaymentCloseYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += this.datPaymentCloseYmd_T.Text.Trim();
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 仕入先
            if (this.utlPurchase.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PURCHASE_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlPurchase.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "[仕入先 " + ExEscape.zRepStrNoQuota(this.utlPurchase.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlPurchase.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "[仕入先 未指定";
            }

            // 締区分
            if (this.utlSummingUp.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.SUMMING_UP_GROUP_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlSummingUp.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "] [締区分 " + ExEscape.zRepStrNoQuota(this.utlSummingUp.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlSummingUp.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "] [締区分 未指定";
            }

            string _buf = "";

            // 支払書発行
            if (borPrint.Visibility == System.Windows.Visibility.Visible)
            {
                if (this.chkPrintNo.IsChecked == true)
                {
                    // 発行済を除く
                    strWhrer += "   AND (T.PAYMENT_PRINT_FLG = 0";
                    _buf     += " [支払書発行 発行未";
                }
                if (this.chkPrintYes.IsChecked == true)
                {
                    // 都度請求
                    if (_buf == "")
                    {
                        strWhrer += "   AND (T.PAYMENT_PRINT_FLG = 1";
                        _buf     += " [支払書発行 発行済";
                    }
                    else
                    {
                        strWhrer += " OR T.PAYMENT_PRINT_FLG = 1";
                        _buf     += " 発行済";
                    }
                }
                if (_buf == "")
                {
                    _buf += " [支払書発行 指定無し]";
                }
                else
                {
                    strWhrer += ")" + Environment.NewLine;
                    _buf     += "]";
                }
                strWhrerString2 += _buf;
            }

            _buf = "";

            // 出金消込
            if (borReceipt.Visibility == System.Windows.Visibility.Visible)
            {
                if (this.chkPaymentNo.IsChecked == true)
                {
                    strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) = 0";
                    _buf     += " [出金消込 消込未";
                }
                if (this.chkPaymentPlace.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) < IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf     += " [出金消込 一部消込";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) < IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf     += " 一部消込";
                    }
                }
                if (this.chkPaymentYes.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) = IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf     += " [出金消込 消込済";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) = IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf     += " 消込済";
                    }
                }
                if (this.chkPaymentOver.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) > IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf     += " [出金消込 超過消込";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) > IFNULL(T.PAYMENT_PRICE, 0)";
                        _buf     += " 超過消込";
                    }
                }
                if (_buf == "")
                {
                    _buf += " [出金消込 指定無し]";
                }
                else
                {
                    strWhrer += ")" + Environment.NewLine;
                    _buf     += "]";
                }
                strWhrerString2 += _buf;
            }

            _buf = "";

            lstUpd.Clear();
            if (this.ProcKbn == eProcKbn.Report)
            {
                strWhrer        = "";
                strWhrerString1 = "";
                strWhrerString2 = "";

                string _no = "";
                for (int i = 0; i <= lst.Count - 1; i++)
                {
                    if (lst[i].exec_flg == true)
                    {
                        EntityPaymentClose entityUpd = new EntityPaymentClose();
                        entityUpd._no = lst[i].no;
                        lstUpd.Add(entityUpd);

                        if (string.IsNullOrEmpty(_no))
                        {
                            _no += ExCast.zCLng(this.lst[i].no).ToString();
                        }
                        else
                        {
                            _no += "<<@escape_comma@>>" + ExCast.zCLng(this.lst[i].no).ToString();
                        }
                    }
                }
                if (!string.IsNullOrEmpty(_no))
                {
                    strWhrer += "   AND T.NO IN (" + _no + ")" + Environment.NewLine;
                }

                if (datIssueYmd.SelectedDate != null)
                {
                    strWhrer += "<issue ymd>" + ((DateTime)datIssueYmd.SelectedDate).ToString("yyyy/MM/dd");
                }
            }

            return(strWhrer + "WhereString =>" + strWhrerString1 + ";" + strWhrerString2);
        }