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

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

            // 請求締日
            if (this.datInvoiceCloseYmd_F.Text.Trim() != "")
            {
                strWhrer += "   AND T.INVOICE_YYYYMMDD >= " + ExEscape.zRepStr(this.datInvoiceCloseYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [請求締日 " + this.datInvoiceCloseYmd_F.Text.Trim() + "~";
            }
            else
            {
                strWhrerString1 += "] [請求締日 未指定~";
            }
            if (this.datInvoiceCloseYmd_T.Text.Trim() != "")
            {
                strWhrer += "   AND T.INVOICE_YYYYMMDD <= " + ExEscape.zRepStr(this.datInvoiceCloseYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += this.datInvoiceCloseYmd_T.Text.Trim();
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 請求先
            if (this.utlInvoice.txtID.Text.Trim() != "")
            {
                strWhrer += "   AND T.INVOICE_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlInvoice.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "[請求先 " + ExEscape.zRepStrNoQuota(this.utlInvoice.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlInvoice.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 (this.chkSime.IsChecked == true)
            {
                // 締請求
                strWhrer += "   AND (T.INVOICE_KBN = 0";
                _buf += " [請求区分 締請求";
            }
            if (this.chkKake.IsChecked == true)
            {
                // 都度請求
                if (_buf == "")
                {
                    strWhrer += "   AND (T.INVOICE_KBN = 1";
                    _buf += " [請求区分 都度請求";
                }
                else
                {
                    strWhrer += " OR T.INVOICE_KBN = 1";
                    _buf += " 都度請求";
                }
            }
            if (_buf == "")
            {
                _buf += " [請求区分 指定無し]";
            }
            else
            {
                strWhrer += ")" + Environment.NewLine;
                _buf += "]";
            }
            strWhrerString2 += _buf;
            _buf = "";

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

            _buf = "";

            // 入金消込
            if (borReceipt.Visibility == System.Windows.Visibility.Visible)
            {
                if (this.chkReceiptNo.IsChecked == true)
                {
                    strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) = 0";
                    _buf += " [入金消込 消込未";
                }
                if (this.chkReceiptPlace.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) < IFNULL(T.INVOICE_PRICE, 0)";
                        _buf += " [入金消込 一部消込";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) < IFNULL(T.INVOICE_PRICE, 0)";
                        _buf += " 一部消込";
                    }
                }
                if (this.chkReceiptYes.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) = IFNULL(T.INVOICE_PRICE, 0)";
                        _buf += " [入金消込 消込済";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) = IFNULL(T.INVOICE_PRICE, 0)";
                        _buf += " 消込済";
                    }
                }
                if (this.chkReceiptOver.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) > IFNULL(T.INVOICE_PRICE, 0)";
                        _buf += " [入金消込 超過消込";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) > IFNULL(T.INVOICE_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)
                    {
                        EntityInvoiceClose entityUpd = new EntityInvoiceClose();
                        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.utlInvoiceNo_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO >= " + ExCast.zCLng(this.utlInvoiceNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "[請求書番号 " + ExCast.zCLng(this.utlInvoiceNo_F.txtID.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "[請求書番号 未指定~";
            }
            if (this.utlInvoiceNo_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO <= " + ExCast.zCLng(this.utlInvoiceNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExCast.zCLng(this.utlInvoiceNo_T.txtID.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 請求締日
            if (this.datInvoiceCloseYmd_F.Text.Trim() != "")
            {
                strWhrer        += "   AND T.INVOICE_YYYYMMDD >= " + ExEscape.zRepStr(this.datInvoiceCloseYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [請求締日 " + this.datInvoiceCloseYmd_F.Text.Trim() + "~";
            }
            else
            {
                strWhrerString1 += "] [請求締日 未指定~";
            }
            if (this.datInvoiceCloseYmd_T.Text.Trim() != "")
            {
                strWhrer        += "   AND T.INVOICE_YYYYMMDD <= " + ExEscape.zRepStr(this.datInvoiceCloseYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += this.datInvoiceCloseYmd_T.Text.Trim();
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 請求先
            if (this.utlInvoice.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.INVOICE_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlInvoice.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "[請求先 " + ExEscape.zRepStrNoQuota(this.utlInvoice.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlInvoice.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 (this.chkSime.IsChecked == true)
            {
                // 締請求
                strWhrer += "   AND (T.INVOICE_KBN = 0";
                _buf     += " [請求区分 締請求";
            }
            if (this.chkKake.IsChecked == true)
            {
                // 都度請求
                if (_buf == "")
                {
                    strWhrer += "   AND (T.INVOICE_KBN = 1";
                    _buf     += " [請求区分 都度請求";
                }
                else
                {
                    strWhrer += " OR T.INVOICE_KBN = 1";
                    _buf     += " 都度請求";
                }
            }
            if (_buf == "")
            {
                _buf += " [請求区分 指定無し]";
            }
            else
            {
                strWhrer += ")" + Environment.NewLine;
                _buf     += "]";
            }
            strWhrerString2 += _buf;
            _buf             = "";

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

            _buf = "";

            // 入金消込
            if (borReceipt.Visibility == System.Windows.Visibility.Visible)
            {
                if (this.chkReceiptNo.IsChecked == true)
                {
                    strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) = 0";
                    _buf     += " [入金消込 消込未";
                }
                if (this.chkReceiptPlace.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) < IFNULL(T.INVOICE_PRICE, 0)";
                        _buf     += " [入金消込 一部消込";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) < IFNULL(T.INVOICE_PRICE, 0)";
                        _buf     += " 一部消込";
                    }
                }
                if (this.chkReceiptYes.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) = IFNULL(T.INVOICE_PRICE, 0)";
                        _buf     += " [入金消込 消込済";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) = IFNULL(T.INVOICE_PRICE, 0)";
                        _buf     += " 消込済";
                    }
                }
                if (this.chkReceiptOver.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (IFNULL(RP_SUM.SUM_PRICE, 0) > IFNULL(T.INVOICE_PRICE, 0)";
                        _buf     += " [入金消込 超過消込";
                    }
                    else
                    {
                        strWhrer += " OR IFNULL(RP_SUM.SUM_PRICE, 0) > IFNULL(T.INVOICE_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)
                    {
                        EntityInvoiceClose entityUpd = new EntityInvoiceClose();
                        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);
        }