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

            // 受注日
            if (this.datOrderYmd_F.Text.Trim() != "")
            {
                strWhrer        += "   AND T.ORDER_YMD >= " + ExEscape.zRepStr(this.datOrderYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "[受注日 " + ExEscape.zRepStrNoQuota(this.datOrderYmd_F.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "[受注日 未指定~";
            }
            if (this.datOrderYmd_T.Text.Trim() != "")
            {
                strWhrer        += "   AND T.ORDER_YMD <= " + ExEscape.zRepStr(this.datOrderYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExEscape.zRepStrNoQuota(this.datOrderYmd_T.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 受注番号
            if (this.utlOrderNo_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO >= " + ExCast.zCLng(this.utlOrderNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [受注番号 " + this.utlOrderNo_F.txtID.Text.Trim() + "~";
            }
            else
            {
                strWhrerString1 += "] [受注番号 未指定~";
            }
            if (this.utlOrderNo_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO <= " + ExCast.zCLng(this.utlOrderNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += this.utlOrderNo_T.txtID.Text.Trim();
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 納入指定日
            if (this.datNokiYmd_F.Text.Trim() != "")
            {
                strWhrer        += "   AND T.SUPPLY_YMD >= " + ExEscape.zRepStr(this.datNokiYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [納入指定日 " + ExEscape.zRepStrNoQuota(this.datNokiYmd_F.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "] [納入指定日 未指定~";
            }
            if (this.datNokiYmd_T.Text.Trim() != "")
            {
                strWhrer        += "   AND T.SUPPLY_YMD <= " + ExEscape.zRepStr(this.datNokiYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExEscape.zRepStrNoQuota(this.datNokiYmd_T.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 見積番号
            if (this.utlEstimateNo_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.ESTIMATENO >= " + ExCast.zCLng(this.utlEstimateNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [見積番号 " + this.utlEstimateNo_F.txtID.Text.Trim() + "~";
            }
            else
            {
                strWhrerString1 += "] [見積番号 未指定~";
            }
            if (this.utlEstimateNo_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.ESTIMATENO <= " + ExCast.zCLng(this.utlEstimateNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += this.utlEstimateNo_T.txtID.Text.Trim() + "]";
            }
            else
            {
                strWhrerString1 += "未指定]";
            }

            // 入力担当者
            if (this.utlPerson_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID >= " + ExCast.zCLng(this.utlPerson_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += "[入力担当者 " + this.utlPerson_F.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_F.txtNm.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString2 += "[入力担当者 未指定~";
            }
            if (this.utlPerson_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID <= " + ExCast.zCLng(this.utlPerson_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += this.utlPerson_T.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_T.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "未指定";
            }

            // 得意先
            if (this.utlCustomer.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlCustomer.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "] [得意先 " + ExEscape.zRepStrNoQuota(this.utlCustomer.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlCustomer.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "] [得意先 未指定";
            }

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

            // 商品コード
            if (this.utlCommodity.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND EXISTS (SELECT 1 " + Environment.NewLine;
                strWhrer        += "                 FROM T_ORDER_D AS OOD " + Environment.NewLine;
                strWhrer        += "                WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                strWhrer        += "                  AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                strWhrer        += "                  AND OOD.ORDER_ID = T.ID " + Environment.NewLine;
                strWhrer        += "                  AND OOD.COMMODITY_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlCommodity.txtID.Text.Trim())) + Environment.NewLine;
                strWhrer        += "                  ) " + Environment.NewLine;
                strWhrerString2 += "] [商品コード " + ExEscape.zRepStrNoQuota(this.utlCommodity.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlCommodity.txtNm.Text.Trim()) + "]";
            }
            else
            {
                strWhrerString2 += "] [商品コード 未指定" + "]";
            }

            // 取引区分
            string _buf = "";

            if (this.chkKake.IsChecked == true)
            {
                // 掛売上
                strWhrer += "   AND (T.BUSINESS_DIVISION_ID = 1";
                _buf     += " [取引区分 掛売上";
            }
            if (this.chkCash.IsChecked == true)
            {
                // 現金
                if (_buf == "")
                {
                    strWhrer += "   AND (T.BUSINESS_DIVISION_ID = 2";
                    _buf     += " [取引区分 現金";
                }
                else
                {
                    strWhrer += " OR T.BUSINESS_DIVISION_ID = 2";
                    _buf     += " 現金";
                }
            }
            if (_buf == "")
            {
                _buf += " [取引区分 指定無し]";
            }
            else
            {
                strWhrer += ")" + Environment.NewLine;
                _buf     += "]";
            }
            strWhrerString2 += _buf;
            _buf             = "";

            // 完納区分
            if (this.chkUnDelivary.IsChecked == true)
            {
                // 未納
                strWhrer += "   AND (EXISTS (SELECT 1 " + Environment.NewLine;
                strWhrer += "                  FROM T_ORDER_D AS OOD " + Environment.NewLine;
                strWhrer += "                 WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                strWhrer += "                   AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                strWhrer += "                   AND OOD.ORDER_ID = T.ID " + Environment.NewLine;
                strWhrer += "                   AND OOD.DELIVER_DIVISION_ID = 1 " + Environment.NewLine;
                strWhrer += "                   ) " + Environment.NewLine;
                _buf     += " [完納区分 未納";
            }
            if (this.chkPartDelivary.IsChecked == true)
            {
                // 一部納品
                if (_buf == "")
                {
                    strWhrer += "   AND (EXISTS (SELECT 1 " + Environment.NewLine;
                    strWhrer += "                  FROM T_ORDER_D AS OOD " + Environment.NewLine;
                    strWhrer += "                 WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.ORDER_ID = T.ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.DELIVER_DIVISION_ID = 2 " + Environment.NewLine;
                    strWhrer += "                   ) " + Environment.NewLine;
                    _buf     += " [完納区分 分納";
                }
                else
                {
                    strWhrer += "OR EXISTS (SELECT 1 " + Environment.NewLine;
                    strWhrer += "             FROM T_ORDER_D AS OOD " + Environment.NewLine;
                    strWhrer += "            WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.ORDER_ID = T.ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.DELIVER_DIVISION_ID = 2 " + Environment.NewLine;
                    strWhrer += "              ) " + Environment.NewLine;
                    _buf     += " 分納";
                }
            }
            if (this.chkFullDelivary.IsChecked == true)
            {
                // 完納
                if (_buf == "")
                {
                    strWhrer += "   AND (EXISTS (SELECT 1 " + Environment.NewLine;
                    strWhrer += "                  FROM T_ORDER_D AS OOD " + Environment.NewLine;
                    strWhrer += "                 WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.ORDER_ID = T.ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.DELIVER_DIVISION_ID = 3 " + Environment.NewLine;
                    strWhrer += "                   ) " + Environment.NewLine;
                    _buf     += " [完納区分 完納";
                }
                else
                {
                    strWhrer += "OR EXISTS (SELECT 1 " + Environment.NewLine;
                    strWhrer += "             FROM T_ORDER_D AS OOD " + Environment.NewLine;
                    strWhrer += "            WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.ORDER_ID = T.ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.DELIVER_DIVISION_ID = 3 " + Environment.NewLine;
                    strWhrer += "              ) " + Environment.NewLine;
                    _buf     += " 完納";
                }
            }
            if (this.chkTorikeshi.IsChecked == true)
            {
                // 取消
                if (_buf == "")
                {
                    strWhrer += "   AND (EXISTS (SELECT 1 " + Environment.NewLine;
                    strWhrer += "                  FROM T_ORDER_D AS OOD " + Environment.NewLine;
                    strWhrer += "                 WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.ORDER_ID = T.ID " + Environment.NewLine;
                    strWhrer += "                   AND OOD.DELIVER_DIVISION_ID = 4 " + Environment.NewLine;
                    strWhrer += "                   ) " + Environment.NewLine;
                    _buf     += " [完納区分 取消";
                }
                else
                {
                    strWhrer += "OR EXISTS (SELECT 1 " + Environment.NewLine;
                    strWhrer += "             FROM T_ORDER_D AS OOD " + Environment.NewLine;
                    strWhrer += "            WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.ORDER_ID = T.ID " + Environment.NewLine;
                    strWhrer += "              AND OOD.DELIVER_DIVISION_ID = 4 " + Environment.NewLine;
                    strWhrer += "              ) " + Environment.NewLine;
                    _buf     += " 取消";
                }
            }
            if (_buf == "")
            {
                _buf += " [完納区分 指定無し]";
            }
            else
            {
                strWhrer += ")" + Environment.NewLine;
                _buf     += "]";
            }
            strWhrerString2 += _buf;

            _buf = "";

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

            UpdPrintNo = "";
            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)
                    {
                        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))
                {
                    UpdPrintNo = _no;
                    strWhrer  += "   AND T.NO IN (" + _no + ")" + Environment.NewLine;
                }
            }

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



            if (Common.gWinType == Common.geWinType.ListCollectPlan)
            {
                #region 回収予定日

                if (this.datCollectPlanYmd_F.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.COLLECT_PLAN_DAY >= " + ExEscape.zRepStr(this.datCollectPlanYmd_F.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += "[回収予定日 " + ExEscape.zRepStrNoQuota(this.datCollectPlanYmd_F.Text.Trim()) + "~";
                }
                else
                {
                    strWhrerString1 += "[回収予定日 未指定~";
                }
                if (this.datCollectPlanYmd_T.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.COLLECT_PLAN_DAY <= " + ExEscape.zRepStr(this.datCollectPlanYmd_T.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += ExEscape.zRepStrNoQuota(this.datCollectPlanYmd_T.Text.Trim()) + "]";
                }
                else
                {
                    strWhrerString1 += "未指定]";
                }

                #endregion

                #region 請求先

                if (this.utlInvoice_F.txtID.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.INVOICE_ID >= " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlInvoice_F.txtID.Text.Trim())) + Environment.NewLine;
                    strWhrerString1 += "] [請求先 " + ExEscape.zRepStrNoQuota(this.utlInvoice_F.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlInvoice_F.txtNm.Text.Trim()) + "~";
                }
                else
                {
                    strWhrerString1 += "] [請求先 未指定~";
                }
                if (this.utlInvoice_T.txtID.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.INVOICE_ID >= " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlInvoice_T.txtID.Text.Trim())) + Environment.NewLine;
                    strWhrerString1 += ExEscape.zRepStrNoQuota(this.utlInvoice_T.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlInvoice_T.txtNm.Text.Trim()) + "]";
                }
                else
                {
                    strWhrerString1 += "未指定]";
                }

                #endregion
            }
            else if (Common.gWinType == Common.geWinType.ListPaymentPlan)
            {
                #region 支払予定日

                if (this.datCollectPlanYmd_F.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.PAYMENT_PLAN_DAY >= " + ExEscape.zRepStr(this.datCollectPlanYmd_F.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += "[支払予定日 " + ExEscape.zRepStrNoQuota(this.datCollectPlanYmd_F.Text.Trim()) + "~";
                }
                else
                {
                    strWhrerString1 += "[支払予定日 未指定~";
                }
                if (this.datCollectPlanYmd_T.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.PAYMENT_PLAN_DAY <= " + ExEscape.zRepStr(this.datCollectPlanYmd_T.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += ExEscape.zRepStrNoQuota(this.datCollectPlanYmd_T.Text.Trim()) + "]";
                }
                else
                {
                    strWhrerString1 += "未指定]";
                }

                #endregion

                #region 仕入先

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

                #endregion
            }

            string _buf = "";

            //if (Common.gWinType == Common.geWinType.ListSalesDay)
            //{
            //    strWhrer += "<group kbn>1";
            //}
            //else if (Common.gWinType == Common.geWinType.ListSalesMonth)
            //{
            //    strWhrer += "<group kbn>2";
            //}
            //else if (Common.gWinType == Common.geWinType.ListSalesChange)
            //{
            //    strWhrer += "<group kbn>3";
            //}

            strWhrer = strWhrer.Replace(",", "<<@escape_comma@>>");

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

            #region 出金番号

            if (this.utlPaymentCashNo_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO >= " + ExCast.zCLng(this.utlPaymentCashNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "[出金番号 " + ExEscape.zRepStrNoQuota(this.utlPaymentCashNo_F.txtID.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "[出金番号 未指定~";
            }
            if (this.utlPaymentCashNo_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO <= " + ExCast.zCLng(this.utlPaymentCashNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExEscape.zRepStrNoQuota(this.utlPaymentCashNo_T.txtID.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            #endregion

            #region 出金日

            if (Common.gWinType == Common.geWinType.ListPaymentCashMonth)
            {
                if (this.datPaymentCashYmd_F.Text.Trim() != "")
                {
                    strWhrer        += "   AND replace(date_format(T.PAYMENT_CASH_YMD , " + ExEscape.SQL_YM + "), '0000/00', '') >= " + ExEscape.zRepStr(this.datPaymentCashYmd_F.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += "] [出金日 " + ExEscape.zRepStrNoQuota(this.datPaymentCashYmd_F.Text.Trim()) + "~";
                }
                else
                {
                    strWhrerString1 += "] [出金日 未指定~";
                }
                if (this.datPaymentCashYmd_T.Text.Trim() != "")
                {
                    strWhrer        += "   AND replace(date_format(T.PAYMENT_CASH_YMD , " + ExEscape.SQL_YM + "), '0000/00', '') <= " + ExEscape.zRepStr(this.datPaymentCashYmd_T.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += ExEscape.zRepStrNoQuota(this.datPaymentCashYmd_T.Text.Trim()) + "]";
                }
                else
                {
                    strWhrerString1 += "未指定]";
                }
            }
            else
            {
                if (this.datPaymentCashYmd_F.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.PAYMENT_CASH_YMD >= " + ExEscape.zRepStr(this.datPaymentCashYmd_F.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += "] [出金日 " + ExEscape.zRepStrNoQuota(this.datPaymentCashYmd_F.Text.Trim()) + "~";
                }
                else
                {
                    strWhrerString1 += "] [出金日 未指定~";
                }
                if (this.datPaymentCashYmd_T.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.PAYMENT_CASH_YMD <= " + ExEscape.zRepStr(this.datPaymentCashYmd_T.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += ExEscape.zRepStrNoQuota(this.datPaymentCashYmd_T.Text.Trim()) + "]";
                }
                else
                {
                    strWhrerString1 += "未指定]";
                }
            }

            #endregion

            #region 入力担当者

            if (this.utlPerson_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID >= " + ExCast.zCLng(this.utlPerson_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += "[入力担当者 " + this.utlPerson_F.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_F.txtNm.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString2 += "[入力担当者 未指定~";
            }
            if (this.utlPerson_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID <= " + ExCast.zCLng(this.utlPerson_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += this.utlPerson_T.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_T.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "未指定";
            }

            #endregion

            #region 仕入先

            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 += "] [仕入先 未指定]";
            }

            #endregion

            if (Common.gWinType == Common.geWinType.ListPaymentCashDay)
            {
                strWhrer += "<group kbn>1";
            }
            else if (Common.gWinType == Common.geWinType.ListPaymentCashMonth)
            {
                strWhrer += "<group kbn>2";
            }

            strWhrer = strWhrer.Replace(",", "<<@escape_comma@>>");

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

            // 見積番号
            if (this.utlEstimateNo_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO >= " + ExCast.zCLng(this.utlEstimateNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "[見積番号 " + this.utlEstimateNo_F.txtID.Text.Trim() + "~";
            }
            else
            {
                strWhrerString1 += "[見積番号 未指定~";
            }
            if (this.utlEstimateNo_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO <= " + ExCast.zCLng(this.utlEstimateNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += this.utlEstimateNo_T.txtID.Text.Trim();
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 見積日
            if (this.datEstimateYmd_F.Text.Trim() != "")
            {
                strWhrer        += "   AND T.ESTIMATE_YMD >= " + ExEscape.zRepStr(this.datEstimateYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [見積日 " + ExEscape.zRepStrNoQuota(this.datEstimateYmd_F.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "] [見積日 未指定~";
            }
            if (this.datEstimateYmd_T.Text.Trim() != "")
            {
                strWhrer        += "   AND T.ESTIMATE_YMD <= " + ExEscape.zRepStr(this.datEstimateYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExEscape.zRepStrNoQuota(this.datEstimateYmd_T.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 納入指定日
            if (this.datNokiYmd_F.Text.Trim() != "")
            {
                strWhrer        += "   AND T.SUPPLY_YMD >= " + ExEscape.zRepStr(this.datNokiYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [納入指定日 " + ExEscape.zRepStrNoQuota(this.datNokiYmd_F.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "] [納入指定日 未指定~";
            }
            if (this.datNokiYmd_T.Text.Trim() != "")
            {
                strWhrer        += "   AND T.SUPPLY_YMD <= " + ExEscape.zRepStr(this.datNokiYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExEscape.zRepStrNoQuota(this.datNokiYmd_T.Text.Trim()) + "]";
            }
            else
            {
                strWhrerString1 += "未指定]";
            }

            // 入力担当者
            if (this.utlPerson_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID >= " + ExCast.zCLng(this.utlPerson_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += "[入力担当者 " + this.utlPerson_F.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_F.txtNm.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString2 += "[入力担当者 未指定~";
            }
            if (this.utlPerson_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID <= " + ExCast.zCLng(this.utlPerson_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += this.utlPerson_T.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_T.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "未指定";
            }

            // 得意先
            if (this.utlCustomer.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlCustomer.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "] [得意先 " + ExEscape.zRepStrNoQuota(this.utlCustomer.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlCustomer.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "] [得意先 未指定";
            }

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

            // 商品コード
            if (this.utlCommodity.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND OD.COMMODITY_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlCommodity.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "] [商品コード " + ExEscape.zRepStrNoQuota(this.utlCommodity.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlCommodity.txtNm.Text.Trim()) + "]";
            }
            else
            {
                strWhrerString2 += "] [商品コード 未指定" + "]";
            }

            // 取引区分
            string _buf = "";

            if (this.chkKake.IsChecked == true)
            {
                // 掛売上
                strWhrer += "   AND (T.BUSINESS_DIVISION_ID = 1";
                _buf     += " [取引区分 掛売上";
            }
            if (this.chkCash.IsChecked == true)
            {
                // 現金
                if (_buf == "")
                {
                    strWhrer += "   AND (T.BUSINESS_DIVISION_ID = 2";
                    _buf     += " [取引区分 現金";
                }
                else
                {
                    strWhrer += " OR T.BUSINESS_DIVISION_ID = 2";
                    _buf     += " 現金";
                }
            }
            if (_buf == "")
            {
                _buf += " [取引区分 指定無し]";
            }
            else
            {
                strWhrer += ")" + Environment.NewLine;
                _buf     += "]";
            }
            strWhrerString2 += _buf;
            _buf             = "";

            // 承認状態
            if (Common.gintEstimateApprovalFlg == 1)
            {
                if (this.chkStillApproval.IsChecked == true)
                {
                    // 未承認
                    strWhrer += "   AND (T.STATE = 0";
                    _buf     += " [承認状態 未承認";
                }
                if (this.chkApproval.IsChecked == true)
                {
                    // 承認
                    if (_buf == "")
                    {
                        strWhrer += "   AND (T.STATE = 1";
                        _buf     += " [承認状態 承認";
                    }
                    else
                    {
                        strWhrer += " OR T.STATE = 1";
                        _buf     += " 承認";
                    }
                }
                if (this.chkResevation.IsChecked == true)
                {
                    // 保留
                    if (_buf == "")
                    {
                        strWhrer += "   AND (T.STATE = 2";
                        _buf     += " [承認状態 保留";
                    }
                    else
                    {
                        strWhrer += " OR T.STATE = 2";
                        _buf     += " 保留";
                    }
                }
                if (this.chkRejetion.IsChecked == true)
                {
                    // 取消
                    if (_buf == "")
                    {
                        strWhrer += "   AND (T.STATE = 3";
                        _buf     += " [承認状態 取消";
                    }
                    else
                    {
                        strWhrer += " OR T.STATE = 3";
                        _buf     += " 取消";
                    }
                }

                if (_buf == "")
                {
                    _buf += " [承認状態 指定無し]";
                }
                else
                {
                    strWhrer += ")" + Environment.NewLine;
                    _buf     += "]";
                }
                strWhrerString2 += _buf;
            }

            _buf = "";

            // 見積書発行
            if (this.borPrint.Visibility == System.Windows.Visibility.Visible)
            {
                if (this.chkPrintNo.IsChecked == true)
                {
                    strWhrer += "   AND (T.ESTIMATE_PRINT_FLG = 0";
                    _buf     += " [見積書発行 発行未";
                }
                if (this.chkPrintYes.IsChecked == true)
                {
                    if (_buf == "")
                    {
                        strWhrer += "   AND (T.ESTIMATE_PRINT_FLG = 1";
                        _buf     += " [見積書発行 発行済";
                    }
                    else
                    {
                        strWhrer += " OR T.ESTIMATE_PRINT_FLG = 1";
                        _buf     += " 発行済";
                    }
                }
                if (_buf == "")
                {
                    _buf += " [見積書発行 指定無し]";
                }
                else
                {
                    strWhrer += ")" + Environment.NewLine;
                    _buf     += "]";
                }
                strWhrerString2 += _buf;
                _buf             = "";
            }


            UpdPrintNo = "";
            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)
                    {
                        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))
                {
                    UpdPrintNo = _no;
                    strWhrer  += "   AND T.NO IN (" + _no + ")" + Environment.NewLine;
                }
            }

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

            #region 入金番号

            if (this.utlReceiptNo_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO >= " + ExCast.zCLng(this.utlReceiptNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "[入金番号 " + ExEscape.zRepStrNoQuota(this.utlReceiptNo_F.txtID.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "[入金番号 未指定~";
            }
            if (this.utlReceiptNo_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO <= " + ExCast.zCLng(this.utlReceiptNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExEscape.zRepStrNoQuota(this.utlReceiptNo_T.txtID.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            #endregion

            #region 入金日

            if (Common.gWinType == Common.geWinType.ListReceiptMonth)
            {
                if (this.datReceiptYmd_F.Text.Trim() != "")
                {
                    strWhrer        += "   AND replace(date_format(T.RECEIPT_YMD , " + ExEscape.SQL_YM + "), '0000/00', '') >= " + ExEscape.zRepStr(this.datReceiptYmd_F.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += "] [入金年月 " + ExEscape.zRepStrNoQuota(this.datReceiptYmd_F.Text.Trim()) + "~";
                }
                else
                {
                    strWhrerString1 += "] [入金年月 未指定~";
                }
                if (this.datReceiptYmd_T.Text.Trim() != "")
                {
                    strWhrer        += "   AND replace(date_format(T.RECEIPT_YMD , " + ExEscape.SQL_YM + "), '0000/00', '') <= " + ExEscape.zRepStr(this.datReceiptYmd_T.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += ExEscape.zRepStrNoQuota(this.datReceiptYmd_T.Text.Trim()) + "]";
                }
                else
                {
                    strWhrerString1 += "未指定]";
                }
            }
            else
            {
                if (this.datReceiptYmd_F.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.RECEIPT_YMD >= " + ExEscape.zRepStr(this.datReceiptYmd_F.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += "] [入金日 " + ExEscape.zRepStrNoQuota(this.datReceiptYmd_F.Text.Trim()) + "~";
                }
                else
                {
                    strWhrerString1 += "] [入金日 未指定~";
                }
                if (this.datReceiptYmd_T.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.RECEIPT_YMD <= " + ExEscape.zRepStr(this.datReceiptYmd_T.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += ExEscape.zRepStrNoQuota(this.datReceiptYmd_T.Text.Trim()) + "]";
                }
                else
                {
                    strWhrerString1 += "未指定]";
                }
            }

            #endregion

            #region 入力担当者

            if (this.utlPerson_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID >= " + ExCast.zCLng(this.utlPerson_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += "[入力担当者 " + this.utlPerson_F.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_F.txtNm.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString2 += "[入力担当者 未指定~";
            }
            if (this.utlPerson_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID <= " + ExCast.zCLng(this.utlPerson_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += this.utlPerson_T.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_T.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "未指定";
            }

            #endregion

            #region 請求先

            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 += "] [請求先 未指定]";
            }

            #endregion

            if (Common.gWinType == Common.geWinType.ListReceiptDay)
            {
                strWhrer += "<group kbn>1";
            }
            else if (Common.gWinType == Common.geWinType.ListReceiptMonth)
            {
                strWhrer += "<group kbn>2";
            }

            strWhrer = strWhrer.Replace(",", "<<@escape_comma@>>");

            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);
        }
        // 条件句SQL設定
        private string GetSQLWhere()
        {
            string strWhrer        = "";
            string strWhrerString1 = "";
            string strWhrerString2 = "";

            if (Common.gWinGroupType == Common.geWinGroupType.InpList)
            {
                strWhrer += "   AND T.IN_OUT_DELIVERY_PROC_KBN = 1 " + Environment.NewLine;
            }

            // 入出庫日
            if (this.datInOutDeliveryYmd_F.Text.Trim() != "")
            {
                strWhrer        += "   AND T.IN_OUT_DELIVERY_YMD >= " + ExEscape.zRepStr(this.datInOutDeliveryYmd_F.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "[入出庫日 " + ExEscape.zRepStrNoQuota(this.datInOutDeliveryYmd_F.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString1 += "[入出庫日 未指定~";
            }
            if (this.datInOutDeliveryYmd_T.Text.Trim() != "")
            {
                strWhrer        += "   AND T.IN_OUT_DELIVERY_YMD <= " + ExEscape.zRepStr(this.datInOutDeliveryYmd_T.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += ExEscape.zRepStrNoQuota(this.datInOutDeliveryYmd_T.Text.Trim());
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            // 入出庫番号
            if (this.utlNo_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO >= " + ExCast.zCLng(this.utlNo_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += "] [入出庫番号 " + this.utlNo_F.txtID.Text.Trim() + "~";
            }
            else
            {
                strWhrerString1 += "] [入出庫番号 未指定~";
            }
            if (this.utlNo_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.NO <= " + ExCast.zCLng(this.utlNo_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString1 += this.utlNo_T.txtID.Text.Trim();
            }
            else
            {
                strWhrerString1 += "未指定";
            }

            if (Common.gWinGroupType != Common.geWinGroupType.InpList)
            {
                // 元伝票番号
                if (this.utlCauseNo_F.txtID.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.CAUSE_NO >= " + ExCast.zCLng(this.utlCauseNo_F.txtID.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += "] [元伝票番号 " + this.utlCauseNo_F.txtID.Text.Trim() + "~";
                }
                else
                {
                    strWhrerString1 += "] [元伝票番号 未指定~";
                }
                if (this.utlCauseNo_T.txtID.Text.Trim() != "")
                {
                    strWhrer        += "   AND T.CAUSE_NO <= " + ExCast.zCLng(this.utlCauseNo_T.txtID.Text.Trim()) + Environment.NewLine;
                    strWhrerString1 += this.utlCauseNo_T.txtID.Text.Trim() + "]";
                }
                else
                {
                    strWhrerString1 += "未指定]";
                }
            }

            // 入力担当者
            if (this.utlPerson_F.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID >= " + ExCast.zCLng(this.utlPerson_F.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += "[入力担当者 " + this.utlPerson_F.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_F.txtNm.Text.Trim()) + "~";
            }
            else
            {
                strWhrerString2 += "[入力担当者 未指定~";
            }
            if (this.utlPerson_T.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.PERSON_ID <= " + ExCast.zCLng(this.utlPerson_T.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += this.utlPerson_T.txtID.Text.Trim() + ":" + ExEscape.zRepStrNoQuota(this.utlPerson_T.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "未指定";
            }

            // 入出庫区分
            if (this.utlInOutDeliveryKbn.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.IN_OUT_DELIVERY_KBN = " + ExCast.zCLng(this.utlInOutDeliveryKbn.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += "] [入出庫区分 " + ExCast.zCLng(this.utlInOutDeliveryKbn.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlInOutDeliveryKbn.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "] [入出庫区分 未指定";
            }

            // 入出庫先区分
            if (this.utlInOutDeliveryToKbn.txtID.Text.Trim() != "")
            {
                strWhrerString2 += "] [入出庫先区分 " + ExCast.zCLng(this.utlInOutDeliveryToKbn.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlInOutDeliveryToKbn.txtNm.Text.Trim());
            }

            // 会社グループ
            if (this.utlCompanyGroup.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.GROUP_ID_TO = " + ExCast.zCLng(this.utlCompanyGroup.txtID.Text.Trim()) + Environment.NewLine;
                strWhrerString2 += "] [会社グループ " + ExCast.zCLng(this.utlCompanyGroup.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlCompanyGroup.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "] [会社グループ 未指定";
            }

            // 得意先
            if (this.utlCustomer.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND T.CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlCustomer.txtID.Text.Trim())) + Environment.NewLine;
                strWhrerString2 += "] [得意先 " + ExEscape.zRepStrNoQuota(this.utlCustomer.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlCustomer.txtNm.Text.Trim());
            }
            else
            {
                strWhrerString2 += "] [得意先 未指定";
            }

            // 仕入先
            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.utlCommodity.txtID.Text.Trim() != "")
            {
                strWhrer        += "   AND EXISTS (SELECT 1 " + Environment.NewLine;
                strWhrer        += "                 FROM T_IN_OUT_DELIVERY_D AS OOD " + Environment.NewLine;
                strWhrer        += "                WHERE OOD.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine;
                strWhrer        += "                  AND OOD.GROUP_ID = T.GROUP_ID " + Environment.NewLine;
                strWhrer        += "                  AND OOD.IN_OUT_DELIVERY_ID = T.ID " + Environment.NewLine;
                strWhrer        += "                  AND OOD.COMMODITY_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(this.utlCommodity.txtID.Text.Trim())) + Environment.NewLine;
                strWhrer        += "                  ) " + Environment.NewLine;
                strWhrerString2 += "] [商品コード " + ExEscape.zRepStrNoQuota(this.utlCommodity.txtID.Text.Trim()) + ":" + ExEscape.zRepStrNoQuota(this.utlCommodity.txtNm.Text.Trim()) + "]";
            }
            else
            {
                strWhrerString2 += "] [商品コード 未指定" + "]";
            }

            string _buf = "";

            if (Common.gWinGroupType != Common.geWinGroupType.InpList)
            {
                // 入出庫処理区分
                if (this.chkInOutDelivery.IsChecked == true)
                {
                    // 入出庫
                    strWhrer += "   AND (T.IN_OUT_DELIVERY_PROC_KBN = 1";
                    _buf     += " [入出庫処理区分 入出庫";
                }
                if (this.chkSales.IsChecked == true)
                {
                    // 売上
                    if (_buf == "")
                    {
                        strWhrer += "   AND (T.IN_OUT_DELIVERY_PROC_KBN = 2";
                        _buf     += " [入出庫処理区分 売上";
                    }
                    else
                    {
                        strWhrer += " OR T.IN_OUT_DELIVERY_PROC_KBN = 2";
                        _buf     += " 売上";
                    }
                }
                if (this.chkPurchase.IsChecked == true)
                {
                    // 仕入
                    if (_buf == "")
                    {
                        strWhrer += "   AND (T.IN_OUT_DELIVERY_PROC_KBN = 3";
                        _buf     += " [入出庫処理区分 仕入";
                    }
                    else
                    {
                        strWhrer += " OR T.IN_OUT_DELIVERY_PROC_KBN = 3";
                        _buf     += " 仕入";
                    }
                }
                if (_buf == "")
                {
                    _buf += " [入出庫処理区分 指定無し]";
                }
                else
                {
                    strWhrer += ")" + Environment.NewLine;
                    _buf     += "]";
                }
                strWhrerString2 += _buf;
            }

            _buf = "";

            UpdPrintNo = "";
            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)
                    {
                        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))
                {
                    UpdPrintNo = _no;
                    strWhrer  += "   AND T.NO IN (" + _no + ")" + Environment.NewLine;
                }
            }

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