Example #1
0
        /// <summary>
        /// CAA02報表
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable CAA20_1(ArrayList ParameterList)
        {
            #region 宣告變數

            BCO.CAACommon CAAComm = new BCO.CAACommon();
            ArrayList arl_ReportService = new ArrayList();
            DataTable dt_Return = new DataTable();

            #endregion

            #region 傳入參數

            arl_ReportService.Clear();
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[0].ToString(), "string", false));//[收票日]起
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[1].ToString(), "string", false));//[收票日]迄
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[2].ToString(), "string", false));//[託收日]起
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[3].ToString(), "string", false));//[託收日]迄
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[4].ToString(), "date", false));//[收款單號日期]起
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[5].ToString(), "date", false));//[收款單號日期]迄
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[6].ToString(), "string", false));//[營業所]起
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[7].ToString(), "string", false));//[營業所]迄
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[8].ToString(), "string", false));//[營業人員]
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[9].ToString(), "string", false));//[帳務人員]

            #endregion

            #region 連結資料庫

            BCO.MaintainBondMain bco = new BCO.MaintainBondMain(ConntionDB);
            dt_Return = bco.BondReport(arl_ReportService);

            #endregion

            #region 檢查回傳資料

            if (dt_Return.Rows.Count == 0)
            { throw new Exception("查無資料"); }
            else
            { return dt_Return; }

            #endregion
        }
Example #2
0
        /// <summary>
        /// CAA34報表
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable CAA34_1(ArrayList ParameterList)
        {
            #region 宣告變數

            BCO.CAACommon CAAComm = new BCO.CAACommon();
            ArrayList arl_ReportService = new ArrayList();
            DataTable dt_Return = new DataTable();

            #endregion

            #region 傳入參數

            arl_ReportService.Clear();
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[0].ToString(), "date", false));//[結帳日期]起(1)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[1].ToString(), "date", false));//[結帳日期]迄(2)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[2].ToString(), "string", false));//[利潤中心](3)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[3].ToString(), "string", false));//[利潤中心](4)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[4].ToString(), "string", false));//[科目別]起(5)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[5].ToString(), "string", false));//[開立別]迄(6)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[6].ToString(), "string", false));//[登入人員](7)

            #endregion

            #region 連結資料庫

            BCO.CAA34_BCO bco = new BCO.CAA34_BCO(ConntionDB);
            dt_Return = bco.QueryReport(arl_ReportService);

            #endregion

            #region 檢查回傳資料

            if (dt_Return.Rows.Count == 0)
            { throw new Exception("查無資料"); }
            else
            { return dt_Return; }

            #endregion
        }
Example #3
0
    private bool Check_BOND_Monthly()
    {
        bool bResult = false;

        #region 傳入參數

        BCO.CAACommon CAAComm = new BCO.CAACommon();

        ParameterList.Clear();
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_ACCEPT_BOND_DATE.Text, "date", false));//20091223改為利用[收票日]來判斷

        #endregion

        #region 連結資料庫

        string str_Result = string.Empty;
        BCO.MaintainBondRecord BCO = new BCO.MaintainBondRecord(ConntionDB);
        str_Result = BCO.CheckBondRecord(ParameterList);

        #endregion

        #region 檢查回傳資料

        if (str_Result == "Y")
        { bResult = true; }

        #endregion

        return bResult;
    }
Example #4
0
    private bool Check_StoreDate(string s_Store_Id, DateTime d_Date)
    {
        bool bResult = false;

        #region 傳入參數

        BCO.CAACommon CAAComm = new BCO.CAACommon();

        ParameterList.Clear();
        ParameterList.Add(CAAComm.GetValueSetParameter(s_Store_Id, "string", false));//店號
        ParameterList.Add(CAAComm.GetValueSetParameter(d_Date.ToString(), "datetime", false));//時間
        ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//登入人員

        #endregion

        #region 連結資料庫

        DataTable dt_Return = new DataTable();
        BCO.MaintainBondRecord bco = new BCO.MaintainBondRecord(ConntionDB);
        dt_Return = bco.GET_STORE_RELATE_DATA(ParameterList);

        #endregion

        #region 檢查回傳資料

        if (dt_Return.Rows.Count == 1)
        { bResult = true; }

        #endregion

        return bResult;
    }
Example #5
0
    /// <summary>
    /// BUTTON [查詢]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Query_Click(object sender, EventArgs e)
    {
        try
        {
            #region 設定變數

            DataTable dt_Return_UP = new DataTable();

            #endregion

            #region 檢查條件

            BCO_CAA.CAACommon CAAComm = new BCO_CAA.CAACommon();
            ArrayList arl_Check_Condition = Check_Condition("BUTTON [查詢]鈕");

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CGD261", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            #region 取得欄位[條碼][二段條碼][品名][品號][期別]

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_FULL_BARCODE.Text, "string", false));//[商品條碼]

            #endregion

            #region 連接資料庫

            BCO_IVM.MaintainDataTrans bco_IVM = new BCO_IVM.MaintainDataTrans(ConntionDB);
            dt_Return_UP = bco_IVM.GetItemByBarCode(ParameterList);

            #endregion

            #region 檢查回傳資料

            if (dt_Return_UP.Rows.Count == 0)
            {
                this.ErrorMsgLabel.Text = "查無資料";

                dt_Result = null;

                this.Repeater1.DataSource = dt_Result;
                this.Repeater1.DataBind();

                this.txt_BARCODE.Text = string.Empty;//條碼
                this.txt_PERIOD_BARCODE.Text = string.Empty;//二段條碼
                this.txt_ITEM_NAME.Text = string.Empty;//品名
                this.txt_ITEM.Text = string.Empty;//品號
                this.txt_PERIOD.Text = string.Empty;//期別           

                return;
            }

            #endregion

            #region 將資料寫入欄位

            this.txt_BARCODE.Text = dt_Return_UP.Rows[0]["BARCODE"].ToString();
            this.txt_PERIOD_BARCODE.Text = dt_Return_UP.Rows[0]["PERIOD_BARCODE"].ToString();
            this.txt_ITEM_NAME.Text = dt_Return_UP.Rows[0]["ITEM_NAME"].ToString();
            this.txt_ITEM.Text = dt_Return_UP.Rows[0]["ITEM"].ToString();
            this.txt_PERIOD.Text = dt_Return_UP.Rows[0]["PERIOD"].ToString();

            #endregion

            #endregion

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false));//[門市進貨日]
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_PICK_BATCH.Text, "string", false));//[理貨批次]
            ParameterList.Add(CAAComm.GetValueSetParameter(this.ddl_LINE_B.SelectedValue, "string", false));//[理貨線]起
            ParameterList.Add(CAAComm.GetValueSetParameter(this.ddl_LINE_E.SelectedValue, "string", false));//[理貨線]迄
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_ITEM.Text, "string", false));//[品號]
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_PERIOD.Text, "string", false));//[期別]
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

            #endregion

            #region 連接資料庫

            BCO_CGD.CGD26_BCO bco_CGD = new BCO_CGD.CGD26_BCO(ConntionDB);
            dt_Result = bco_CGD.QUERY_CGD26_DATA(ParameterList);

            #endregion

            #region 資料載入畫面

            this.Repeater1.DataSource = dt_Result;
            this.Repeater1.DataBind();

            #endregion

            #region 檢查回傳資料

            if (dt_Result.Rows.Count == 0)
            {
                this.ErrorMsgLabel.Text = "查無資料";
                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CGD261_FOCUS", "setTimeout(function(){document.getElementById('" + txt_FULL_BARCODE.ClientID + "').focus();},10);", true);
            }
            else
            {
                string s_Filter_Expression = string.Empty;//篩選資料SQL

                s_Filter_Expression = "ROW_TYPE = 'ITEM'";
                DataRow[] dr_IMG = dt_Result.Select(s_Filter_Expression);

                if (dr_IMG.Length == 1)
                {

                }
                else
                {
                    this.ErrorMsgLabel.Text = "該筆資料查無商品的資料。";
                }

                txt_FULL_BARCODE.Text = "";
                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CGD261_FOCUS", "setTimeout(function(){document.getElementById('" + but_Out.ClientID + "').focus();},10);", true);
            }

            #endregion

        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #6
0
    /// <summary>
    /// 按下BUTTON[儲存]鈕,將更改資料寫入TempTable
    /// </summary>
    /// <param name="dr_Detl"></param>
    /// <param name="dt_Update_Inv"></param>
    /// <param name="s_Now"></param>
    private void Set_NewItem_To_Temp_For_INV_MAIN(DataRow dr_Detl, DataTable dt_Update_Inv, string s_Now)
    {
        BCO.CAACommon CAAComm = new BCO.CAACommon();
        DataRow dr_Update_Inv = dt_Update_Inv.NewRow();

        //New Data
        dr_Update_Inv["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
        dr_Update_Inv["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
        dr_Update_Inv["NEW_NON_INV_UAMT"] = dr_Detl["NON_INV_UAMT"];//畫面上發票餘額(未稅)
        dr_Update_Inv["NEW_NON_INV_TAX"] = dr_Detl["NON_INV_TAX"];//畫面上發票稅額

        //Old Data
        dr_Update_Inv["ID"] = dr_Detl["ID"];
        dr_Update_Inv["CODE"] = dr_Detl["CODE"];
        dr_Update_Inv["CLOSE_MONTH"] = dr_Detl["CLOSE_MONTH"];
        dr_Update_Inv["INV_DATE"] = dr_Detl["INV_DATE"];
        dr_Update_Inv["INV_NO"] = dr_Detl["INV_NO"];
        dr_Update_Inv["IS_SCHEDULE"] = dr_Detl["IS_SCHEDULE"];
        dr_Update_Inv["INV_CHKNO"] = dr_Detl["INV_CHKNO"];
        dr_Update_Inv["INVOICE_DATE_RANGE"] = dr_Detl["INVOICE_DATE_RANGE"];
        dr_Update_Inv["FORM_NO"] = dr_Detl["FORM_NO"];
        dr_Update_Inv["SOURCE_TYPE"] = dr_Detl["SOURCE_TYPE"];
        dr_Update_Inv["INV_KIND"] = dr_Detl["INV_KIND"];
        dr_Update_Inv["TAX_TYPE"] = dr_Detl["TAX_TYPE"];
        dr_Update_Inv["ITEM_NAME"] = dr_Detl["ITEM_NAME"];
        dr_Update_Inv["INV_UAMT"] = dr_Detl["INV_UAMT"];
        dr_Update_Inv["INV_TAX"] = dr_Detl["INV_TAX"];
        dr_Update_Inv["INV_AMT"] = dr_Detl["INV_AMT"];
        dr_Update_Inv["MEMO"] = dr_Detl["MEMO"];
        dr_Update_Inv["CANCEL_FLG"] = dr_Detl["CANCEL_FLG"];
        dr_Update_Inv["PRINT_FLG"] = dr_Detl["PRINT_FLG"];
        dr_Update_Inv["JUMP_FLG"] = dr_Detl["JUMP_FLG"];
        dr_Update_Inv["CANCEL_DATE"] = dr_Detl["CANCEL_DATE"];
        dr_Update_Inv["OLD_INV_NO"] = dr_Detl["OLD_INV_NO"];
        dr_Update_Inv["STORE_ID"] = dr_Detl["STORE_ID"];
        dr_Update_Inv["ROOT_NO"] = dr_Detl["ROOT_NO"];
        dr_Update_Inv["KEYIN_DATE"] = dr_Detl["KEYIN_DATE"];
        dr_Update_Inv["CHG_INV_TYPE"] = dr_Detl["CHG_INV_TYPE"];
        dr_Update_Inv["CREATEDATE"] = dr_Detl["CREATEDATE"];
        dr_Update_Inv["CREATEUID"] = dr_Detl["CREATEUID"];
        dr_Update_Inv["UPDATEDATE"] = dr_Detl["UPDATEDATE"];
        dr_Update_Inv["UPDATEUID"] = dr_Detl["UPDATEUID"];
        dr_Update_Inv["ENABLE"] = dr_Detl["ENABLE"];
        dr_Update_Inv["INV_FORM"] = dr_Detl["INV_FORM"];
        dr_Update_Inv["NON_INV_UAMT"] = dr_Detl["ORIGINAL_NON_INV_UAMT"]; //原始發票餘額(未稅)
        dr_Update_Inv["NON_INV_TAX"] = dr_Detl["ORIGINAL_NON_INV_TAX"]; //原始發票稅額
        dr_Update_Inv["INV_VERSION"] = dr_Detl["INV_VERSION"];
        dr_Update_Inv["INV_REMAIN_AMT"] = dr_Detl["INV_REMAIN_AMT"];
        dr_Update_Inv["DUE_DATE"] = dr_Detl["DUE_DATE"];
        dr_Update_Inv["INDEED_DATE"] = dr_Detl["INDEED_DATE"];
        dr_Update_Inv["WASH_STATUS"] = dr_Detl["WASH_STATUS"];
        dr_Update_Inv["VOUCH_DOC"] = dr_Detl["VOUCH_DOC"];
        dr_Update_Inv["VOUCH_RFNO"] = dr_Detl["VOUCH_RFNO"];

        dt_Update_Inv.Rows.Add(dr_Update_Inv);
    }
Example #7
0
    /// <summary>
    /// 取得頁面上的資料
    /// </summary>
    /// <param name="s_DISC_NO">折讓單號</param>
    private void Get_PageDataMainAndDetl(string s_DISC_NO)
    {
        #region 傳入參數

        BCO.CAACommon CAAComm = new BCO.CAACommon();

        ParameterList.Clear();
        ParameterList.Add(CAAComm.GetValueSetParameter(s_DISC_NO, "string", false));//[折讓單號]
        ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

        #endregion

        #region 連結資料庫

        BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
        DataSet ds_Return = bco.QueryDataByView(ParameterList);

        #endregion

        #region 將資料寫入相關欄位 MAIN

        string s_RequestString = Request.QueryString["CAA182_Type"];

        if (ds_Return.Tables["MAIN"].Rows.Count != 1 && s_RequestString != "ToolBar")
        { throw new Exception("查無折讓單號:" + s_DISC_NO + "的相關資料"); }
        else if (ds_Return.Tables["MAIN"].Rows.Count != 1 && s_RequestString == "ToolBar")
        { throw new Exception("查無此筆資料或已被其他使用者刪除,請點選上一筆/下一筆鈕或回查詢頁重新查詢!"); }

        DataRow dr_Return_Main = ds_Return.Tables["MAIN"].Rows[0];

        this.txt_DISC_NO.Text = dr_Return_Main["DISC_NO"].ToString();//折讓單號
        this.slp_DISC_FORM.Text = dr_Return_Main["DISC_FORM"].ToString();//格式代號
        this.slp_DISC_SOURCE.Text = dr_Return_Main["DISC_SOURCE"].ToString();//來源
        this.slp_GROUP_NO.Text = dr_Return_Main["GROUP_NO"].ToString();//店群
        this.slp_STORE_ID.Text = dr_Return_Main["STORE_ID"].ToString();//店號
        this.slp_Z_O.Text = dr_Return_Main["Z_O"].ToString();//營業所
        this.slp_DISC_TYPE.Text = dr_Return_Main["DISC_TYPE"].ToString();//型式
        this.slp_ROOT_NO.Text = dr_Return_Main["ROOT_NO"].ToString();//商品群分類
        this.slp_TAX_TYPE.Text = dr_Return_Main["TAX_TYPE"].ToString();//稅別
        this.slp_SAL_ID.Text = dr_Return_Main["SAL_ID"].ToString();//營業人員
        this.slp_AC_UID.Text = dr_Return_Main["AC_UID"].ToString();//帳務人員
        this.slp_DISC_DATE.Text = dr_Return_Main["DISC_DATE"].ToString();//折讓日期
        this.txt_ACT_DISC_NO.Text = dr_Return_Main["ACT_DISC_NO"].ToString();//財會折讓單號
        this.slp_CHG_DISC_DATE.Text = dr_Return_Main["CHG_DISC_DATE"].ToString();//異動折讓日期
        if (dr_Return_Main["PROOF_FLG"].ToString() != "0" && dr_Return_Main["PROOF_FLG"].ToString() != "1")
        { throw new Exception("折讓單號:" + dr_Return_Main["DISC_NO"].ToString() + ",資料庫欄位[PROOF_FLG]資料錯誤"); }
        else
        { this.chb_PROOF_FLG.Checked = dr_Return_Main["PROOF_FLG"].ToString() == "0" ? false : true; }//憑證已回
        this.slp_PROOF_DATE.Text = dr_Return_Main["PROOF_DATE"].ToString();//憑證已回日期
        if (dr_Return_Main["REPROOF_FLG"].ToString() != "0" && dr_Return_Main["REPROOF_FLG"].ToString() != "1")
        { throw new Exception("折讓單號:" + dr_Return_Main["DISC_NO"].ToString() + ",資料庫欄位[REPROOF_FLG]資料錯誤"); }
        else
        { this.chb_REPROOF_FLG.Checked = dr_Return_Main["REPROOF_FLG"].ToString() == "0" ? false : true; }//取具進項憑証
        this.txt_REPROOF_NO.Text = dr_Return_Main["REPROOF_NO"].ToString();//發票號碼/收據

        if (dr_Return_Main["RECEIPT_FLG"].ToString() != "0" && dr_Return_Main["RECEIPT_FLG"].ToString() != "1")
        { throw new Exception("折讓單號:" + dr_Return_Main["DISC_NO"].ToString() + ",資料庫欄位[RECEIPT_FLG]資料錯誤"); }
        else
        { this.chb_RECEIPT_FLG.Checked = dr_Return_Main["RECEIPT_FLG"].ToString() == "0" ? false : true; }//憑證收據
        if (dr_Return_Main["CANCEL_FLG"].ToString() != "0" && dr_Return_Main["CANCEL_FLG"].ToString() != "1")
        { throw new Exception("折讓單號:" + dr_Return_Main["DISC_NO"].ToString() + ",資料庫欄位[CANCEL_FLG]資料錯誤"); }
        else
        { this.chb_CANCEL_FLG.Checked = dr_Return_Main["CANCEL_FLG"].ToString() == "0" ? false : true; }//作廢
        this.slp_CANCEL_DATE.Text = dr_Return_Main["CANCEL_DATE"].ToString();//作廢日期
        if (dr_Return_Main["PERIOD_FLG"].ToString() != "0" && dr_Return_Main["PERIOD_FLG"].ToString() != "1")
        { throw new Exception("折讓單號:" + dr_Return_Main["DISC_NO"].ToString() + ",資料庫欄位[PERIOD_FLG]資料錯誤"); }
        else
        { this.chb_PERIOD_FLG.Checked = dr_Return_Main["PERIOD_FLG"].ToString() == "0" ? false : true; }//申報
        this.slp_PERIOD_DATE.Text = dr_Return_Main["PERIOD_DATE"].ToString();//申報日期
        if (dr_Return_Main["TEMPORAL_FLG"].ToString() != "0" && dr_Return_Main["TEMPORAL_FLG"].ToString() != "1")
        { throw new Exception("折讓單號:" + dr_Return_Main["DISC_NO"].ToString() + ",資料庫欄位[TEMPORAL_FLG]資料錯誤"); }
        else
        { this.chb_TEMPORAL_FLG.Checked = dr_Return_Main["TEMPORAL_FLG"].ToString() == "0" ? false : true; }//轉暫收
        this.slp_TEMPORAL_DATE.Text = dr_Return_Main["TEMPORAL_DATE"].ToString();//暫收日期
        this.txt_PAY_RFNO.Text = dr_Return_Main["PAY_RFNO"].ToString();//結帳統編
        this.txt_RFNO.Text = dr_Return_Main["RFNO"].ToString();//統一編號
        this.txt_TITLE.Text = dr_Return_Main["TITLE"].ToString();//發票抬頭
        this.txt_INV_ADDR.Text = dr_Return_Main["INV_ADDR"].ToString();//地址
        this.slp_DISC_UAMT.Text = dr_Return_Main["DISC_UAMT"].ToString();//折讓金額(未稅)
        this.slp_DISC_TAX.Text = dr_Return_Main["DISC_TAX"].ToString();//折讓稅額
        this.slp_DISC_AMT.Text = dr_Return_Main["DISC_AMT"].ToString();//總金額
        this.slp_CLOSE_MONTH.Text = dr_Return_Main["CLOSE_MONTH"].ToString();//結帳年月
        this.txt_MEMO.Text = dr_Return_Main["MEMO"].ToString();//備註
        this.slp_CLOSE_MONTH_ACCT.Text = dr_Return_Main["CLOSE_MONTH_ACCT"].ToString();//結帳年月-財會
        this.hid_Record_Date.Value = dr_Return_Main["CREATEDATE"].ToString();//建立時間

        //20110512 rika insert
        this.slp_PERIOD_MONTH.Text = dr_Return_Main["PERIOD_MONTH"].ToString();//申報期別
        this.slp_DISC_REMAIN_AMT.Text = dr_Return_Main["DISC_REMAIN_AMT"].ToString();//折讓餘額
        this.slp_DISC_WASH_AMT.Text = (Convert.ToInt32(dr_Return_Main["DISC_AMT"])-Convert.ToInt32(dr_Return_Main["DISC_REMAIN_AMT"])).ToString();//累積沖帳金額

        #endregion

        #region 編輯狀態,紀錄CheckBox的勾選狀態

        if (this.hid_PageStatus.Value == "edit")
        {
            if (arl_Chk_Status != null)
            { arl_Chk_Status.Clear(); }
            else
            { arl_Chk_Status = new ArrayList(); }

            //20100715 秀玲新增[取具收據]狀態
            arl_Chk_Status.Add(this.chb_PROOF_FLG.Checked);//憑證已回
            arl_Chk_Status.Add(this.chb_REPROOF_FLG.Checked);//取具進項憑証
            arl_Chk_Status.Add(this.chb_RECEIPT_FLG.Checked);//取具收據
            arl_Chk_Status.Add(this.chb_CANCEL_FLG.Checked);//作廢
            arl_Chk_Status.Add(this.chb_PERIOD_FLG.Checked);//申報
            arl_Chk_Status.Add(this.chb_TEMPORAL_FLG.Checked);//轉暫收

            this.hid_CheckBox_Status.Value = string.Empty;
            for (int i = 0; i < arl_Chk_Status.Count; i++)
            {
                if ((bool)arl_Chk_Status[i] == true)
                { hid_CheckBox_Status.Value += "1,"; }
                else
                { hid_CheckBox_Status.Value += "0,"; }
            }

            //將最後一個"逗號"去除
            hid_CheckBox_Status.Value = hid_CheckBox_Status.Value.Remove(hid_CheckBox_Status.Value.Length - 1, 1);
        }

        #endregion

        #region 編輯狀態,依照CheckBox的勾選狀態來設定GirdView的Enable

        if (this.hid_PageStatus.Value == "edit")
        {
            bool b_IsRight = false;
            string s_ReturnMsg = string.Empty;

            Check_CheckStatus(out b_IsRight, out s_ReturnMsg);

            if (b_IsRight == false)
            {
                if (s_ReturnMsg == "勾選欄位[憑證已回]" ||
                    s_ReturnMsg == "取消勾選欄位[憑證已回]" ||
                    s_ReturnMsg == "勾選欄位[取具進項憑証]" ||
                    s_ReturnMsg == "取消勾選欄位[取具進項憑証]" ||
                    s_ReturnMsg == "勾選欄位[取具收據]" ||
                    s_ReturnMsg == "取消勾選欄位[取具收據]" ||
                    s_ReturnMsg == "都沒有勾")
                { b_GirdView_Enable = true; }
            }
        }

        #endregion

        #region 資料與GridView繫結 DETL

        //抓取本頁初次登記的時間
        string SessionIDName = "CAA182_" + PageTimeStamp.Value;

        Session["SessionID"] = SessionIDName;
        Session[SessionIDName] = ds_Return.Tables["DETL"];

        this.gv_DiscInv.DataSource = ds_Return.Tables["DETL"];
        this.gv_DiscInv.PageSize = 10;
        this.gv_DiscInv.PageIndex = 0;
        this.gv_DiscInv.DataBind();

        #endregion

        #region 如果是編輯模式,則將資料放入TempTable

        if (this.hid_PageStatus.Value == "edit")
        {
            dt_Main = ds_Return.Tables["MAIN"].Copy();
            dt_NewItem = ds_Return.Tables["DETL"].Copy();
        }

        #endregion
    }
Example #8
0
    /// <summary>
    /// 離開[店號]時,帶出相關資料
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void txt_STORE_ID_Onblur()
    {
        try
        {
            #region 新增模式

            BCO.CAACommon CAAComm = new BCO.CAACommon();

            if (this.hid_PageStatus.Value == "insert")
            {
                #region 檢查傳入欄位[店號]的值

                if (this.slp_STORE_ID.Text.Trim() == string.Empty)
                {
                    Set_STORE_ID_Default();

                    #region Focus欄位

                    DropDownList drop_DISC_TYPE = (DropDownList)this.slp_DISC_TYPE.FindControl("D1");
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(drop_DISC_TYPE.ClientID, false);
                    ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);

                    #endregion

                    return;
                }

                #endregion

                #region 傳入參數

                //新增狀態下,必須使用sysdate,去查店號資料
                //資料必須是當時有效的店號
                ParameterList.Clear();
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_STORE_ID.Text, "string", false));//[店號]
                ParameterList.Add(CAAComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));//時間
                ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

                #endregion

                #region 連結資料庫

                BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
                IDataReader dr = bco.QUERY_CAA18_DATA_BY_STORE_ID(ParameterList);

                #endregion

                #region 將資料寫入相關欄位

                //重新將店號再寫入一次
                this.slp_STORE_ID.Text = this.slp_STORE_ID.Text;

                if (dr.Read())
                {
                    this.slp_GROUP_NO.Text = dr.IsDBNull(0) ? string.Empty : dr.GetString(0);//店群
                    this.slp_Z_O.Text = dr.IsDBNull(1) ? string.Empty : dr.GetString(1);//營業所
                    this.slp_SAL_ID.Text = dr.IsDBNull(2) ? string.Empty : dr.GetString(2);//營業人員
                    this.slp_AC_UID.Text = dr.IsDBNull(3) ? string.Empty : dr.GetString(3);//帳務人員
                    this.txt_PAY_RFNO.Text = dr.IsDBNull(4) ? string.Empty : dr.GetString(4);//結帳統編
                    this.txt_RFNO.Text = dr.IsDBNull(5) ? string.Empty : dr.GetString(5);//統一編號
                    this.txt_INV_ADDR.Text = dr.IsDBNull(6) ? string.Empty : dr.GetString(6);//地址
                    this.txt_TITLE.Text = dr.IsDBNull(7) ? string.Empty : dr.GetString(7);//發票抬頭

                    //Rika 20110413 修改 若統編開頭為A 則預設為2聯式折讓
                    if (this.txt_RFNO.Text.Substring(0, 1) == "A")
                    {
                        DropDownList drop_DISC_FORM = (DropDownList)this.slp_DISC_FORM.FindControl("D1");
                        drop_DISC_FORM.SelectedValue = "34";
                    }
                    else
                    {
                        DropDownList drop_DISC_FORM = (DropDownList)this.slp_DISC_FORM.FindControl("D1");
                        drop_DISC_FORM.SelectedValue = "33";
                    }

                    #region Focus欄位

                    DropDownList drop_DISC_TYPE = (DropDownList)this.slp_DISC_TYPE.FindControl("D1");
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(drop_DISC_TYPE.ClientID, false);
                    ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);

                    #endregion
                }

                #endregion

                #region 檢查回傳資料

                else
                {
                    Set_STORE_ID_Default();

                    #region 若發生錯誤則alert訊息(秀玲要alert訊息)

                    string s_ScriptManager_Script = "alert('無符合店號或己關店,請重新輸入')";
                    ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);

                    #endregion
                }
                dr.Close();

                #endregion
            }

            #endregion

            #region 如果不符合以上條件,代表錯誤

            else { throw new Exception("頁面資料錯誤,只有在[新增模式]下,才有欄位[店號]Onblur事件"); }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        { Finally_Function(); }
    }
Example #9
0
        /// <summary>
        /// CAA02報表
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable CAA06_1(ArrayList ParameterList)
        {
            #region 宣告變數

            BCO.CAACommon CAAComm = new BCO.CAACommon();
            ArrayList arl_ReportService = new ArrayList();
            DataTable dt_Return = new DataTable();

            #endregion

            #region 傳入參數

            arl_ReportService.Clear();
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[0].ToString(), "string", false));//[報表](0)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[1].ToString(), "date", false));//[兌換日期]起(1)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[2].ToString(), "date", false));//[兌換日期]迄(2)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[3].ToString(), "date", false));//[到期日]起(3)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[4].ToString(), "date", false));//[到期日]迄(4)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[5].ToString(), "string", false));//[結帳統編](5)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[6].ToString(), "string", false));//[統一編號](6)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[7].ToString(), "string", false));//[營業所]起(3)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[8].ToString(), "string", false));//[營業所]迄(8)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[9].ToString(), "string", false));//[帳務人員](9)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[10].ToString(), "string", false));//[登入人員](10)

            #endregion

            #region 連結資料庫

            BCO.MaintainBondMain bco = new BCO.MaintainBondMain(ConntionDB);
            dt_Return = bco.DUEYETORNOTYET(arl_ReportService);

            #endregion

            #region 檢查回傳資料

            if (dt_Return.Rows.Count == 0)
            { throw new Exception("查無資料"); }
            else
            { return dt_Return; }

            #endregion
        }
Example #10
0
    protected void btn_Query_Click(object sender, EventArgs e)
    {
        try
        {
            #region 參數

            CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_WASH_NO.Text, "string", this.CheckBoxLikeSearch.Checked)); //V_WASH_NO
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_DUE_NO.Text, "string", this.CheckBoxLikeSearch.Checked)); //V_CUBE_NO
            ParameterList.Add(GetValueSetOP(this.slp_WASH_AMT.Operator)); //V_WASH_AMT_OP
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_WASH_AMT.Text, "int", false)); //N_WASH_AMT
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_WASH_DATE.StartDate, "string", false)); //V_WASH_DATE_S
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_WASH_DATE.EndDate, "string", false)); //V_WASH_DATE_E            
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CREATEUID.Text, "string", this.CheckBoxLikeSearch.Checked)); //V_CREATEUID           
            ParameterList.Add(CAAComm.GetValueSetParameter(this.TextBoxRowCountLimit.Text, "int", false)); //N_ROWNUM
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); //V_LOG_UID

            #endregion

            DataTable dt = new DataTable();

            CAAModel.MaintainAccountRecord BCO = new CAAModel.MaintainAccountRecord(ConntionDB);
            dt = BCO.QueryAccountSetByLike(ParameterList);

            //抓取本頁初次登記的時間
            string SessionIDName = "CAA081_" + PageTimeStamp.Value;

            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dt;
            gv_WASH.DataSource = dt;
            gv_WASH.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
            gv_WASH.PageIndex = 0;
            gv_WASH.DataBind();

            #region 將Key值存到Session中

            ArrayList arl_Key = new ArrayList();
            ArrayList arl_Key_C = new ArrayList();
            foreach (DataRow drRow in dt.Rows)
            {
                arl_Key.Add(drRow["WASH_NO"].ToString());
                arl_Key_C.Add(drRow["CUBE_NO"].ToString());
            }

            Session["CAA082_SortKey" + this.PageTimeStamp.Value] = arl_Key;
            Session["CAA082_SortKey_C" + this.PageTimeStamp.Value] = arl_Key_C;

            #endregion

            if (dt.Rows.Count == 0)
            { this.ErrorMsgLabel.Text = "查無資料"; }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #11
0
        /// <summary>
        /// CAA10
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <param name="s_Type"></param>
        /// <returns></returns>
        public DataTable CAA10_1(ArrayList ParameterList, string s_Type)
        {
            #region 宣告變數

            BCO.CAACommon CAAComm = new BCO.CAACommon();
            ArrayList arl_ReportService = new ArrayList();
            DataTable dt_Return = new DataTable();

            #endregion

            #region 取得資料

            switch (s_Type)
            {
                #region 頁籤=通路繳款-專案代收

                case "CAA10_1":

                    #region 傳入參數

                    arl_ReportService.Clear();
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[22].ToString(), "int", false));//[筆數]
                    arl_ReportService.Add(CAAComm.GetValueSetParameter((ParameterList[23].ToString() == "true") ? "1" : "0", "string", false));//[關鍵字查詢],1=勾選關鍵字查詢,0=沒勾選關鍵字查詢
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[0].ToString(), "string", false));//營業日期起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[1].ToString(), "string", false));//營業日期迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[2].ToString(), "string", false));//交易日期起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[3].ToString(), "string", false));//交易日期迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[4].ToString(), "string", false));//交易序號起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[5].ToString(), "string", false));//交易序號迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[6].ToString(), "string", false));//交易金額Operator
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[7].ToString(), "int", false));//交易金額
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[8].ToString(), "string", false));//客戶編號起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[9].ToString(), "string", false));//客戶編號迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[10].ToString(), "string", false));//繳款識別碼起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[11].ToString(), "string", false));//繳款識別碼迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[12].ToString(), "string", false));//店群起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[13].ToString(), "string", false));//店群迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[14].ToString(), "string", false));//收款單號起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[15].ToString(), "string", false));//收款單號迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[16].ToString(), "string", false));//建立日期起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[17].ToString(), "string", false));//建立日期迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[18].ToString(), "string", false));//建立人員
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[19].ToString(), "string", false));//維護日期起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[20].ToString(), "string", false));//維護日期迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[21].ToString(), "string", false));//維護人員
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[24].ToString(), "string", false));//交易金額Operator
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[25].ToString(), "int", false));//交易金額
                    #endregion

                    #region 連結資料庫

                    BCO.MaintainCollRecord bco_1 = new BCO.MaintainCollRecord(ConntionDB);
                    dt_Return = bco_1.QueryCollRecordByByLike(arl_ReportService);

                    #endregion

                    break;

                #endregion

                #region 頁籤=專案代收明細表

                case "CAA10_2":

                    #region 傳入參數

                    arl_ReportService.Clear();
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[0].ToString(), "string", false));//[營業日期]起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[1].ToString(), "string", false));//[營業日期]迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[2].ToString(), "string", false));//[交易日期]起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[3].ToString(), "string", false));//[交易日期]迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[4].ToString(), "date", false));//[收款單號日期]起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[5].ToString(), "date", false));//[收款單號日期]迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[6].ToString(), "string", false));//[繳款型態]
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[7].ToString(), "string", false));//[帳務人員]起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[8].ToString(), "string", false));//[帳務人員]迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[9].ToString(), "string", false));//利潤中心起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[10].ToString(), "string", false));//利潤中心迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[11].ToString(), "string", false));//店號
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[12].ToString(), "string", false));//營業所起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[13].ToString(), "string", false));//營業所迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[14].ToString(), "string", false));//營業人員起
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[15].ToString(), "string", false));//營業人員迄
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[16].ToString(), "string", false));//沖帳餘額OP
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[17].ToString(), "string", false));//沖帳餘額
                    arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[18].ToString(), "string", false));//結案狀態
                    #endregion

                    #region 連結資料庫

                    BCO.ProcessCollReport bco_2 = new BCO.ProcessCollReport(ConntionDB);
                    dt_Return = bco_2.QueryCollReport(arl_ReportService);

                    #endregion

                    break;

                #endregion
            }

            #endregion

            #region 檢查回傳資料

            if (dt_Return.Rows.Count == 0)
            { throw new Exception("查無資料"); }

            #endregion

            return dt_Return;
        }
Example #12
0
        public ArrayList FileToTmp(DataSet ds_Excel, DateTime d_CreateDate, string s_LoginUser, string s_DBConnString, string s_AP_FileName)
        {
            ArrayList arl_Return = new ArrayList();
            int i_FileToTemp_Total_count = 0;
            int ChkCount = 0;
            string strErrMsg = "";
            Int32 iErrCount = 0;
            Double doubleVal;
            ArrayList ParameterList = new ArrayList();
            try
            {
                ParameterList.Clear();

                CAA_32DBO DBO = new CAA_32DBO(ref USEDB);

                #region 先清除前一次,同一使用者執行的匯入暫存資訊與錯誤資訊

                ParameterList.Clear();
                ParameterList.Add(s_LoginUser);
                DBO.DeleteTmp(ParameterList);

                #endregion

                Conn = USEDB.CreateConnection();
                Conn.Open();
                DBT = Conn.BeginTransaction();

                foreach (DataRow dRow in ds_Excel.Tables[0].Rows)
                {
                    iErrCount = 0;
                    string V_ID = dRow["序號"].ToString().Trim();
                    string V_STATUS = "";
                    string V_DATASOURCE = s_AP_FileName;
                    string V_DATATYPE = "1";
                    string V_ERRORMEMO = "";

                    //20110117 Rika改原[沖帳年月]為[沖帳日期]
                    string V_WASH_DATE = dRow["沖帳日期"].ToString().Trim();

                    string V_CLOSE_MONTH = dRow["結帳年月"].ToString().Trim();
                    string V_SOURCE_TYPE = dRow["來源別"].ToString().Trim();
                    string V_SDATE = dRow["日期"].ToString().Trim();
                    string V_SECOND_NO = dRow["單號(次代)"].ToString().Trim();
                    string V_STORE_ID = dRow["店號"].ToString().Trim();
                    string V_WASH_AMT = dRow["繳款金額"].ToString().Trim();
                    string V_WASH_CHAGE = dRow["手續費/郵資"].ToString().Trim();
                    string V_WASH_AMT_TO = dRow["沖帳總額"].ToString().Trim();
                    string V_MEMO = dRow["備註"].ToString().Trim();
                    string V_CREATEUID = s_LoginUser;
                    string V_CREATEDATE = d_CreateDate.AddSeconds(i_FileToTemp_Total_count).ToString("yyyy/MM/dd HH:mm:ss");
                    string V_UPDATEUID = s_LoginUser;
                    string V_UPDATEDATE = d_CreateDate.ToString("yyyy/MM/dd");

                    string s_DIFF_AMT = dRow["尾差"].ToString();
                    string s_OTHER_DIFF = dRow["其他差異"].ToString();
                    string s_REMIT_DIFF = dRow["匯兌損益"].ToString();

                    strErrMsg = "";

                    DateTime dtTEMP;//檢查日期格式用的 不會真正使用此變數

                    #region 20110117異動規格 純萍改原[沖帳年月]為[沖帳日期] 且須判斷該沖帳年月是否已月結

                    if (V_WASH_DATE == string.Empty)
                    {
                        strErrMsg += "沖帳日期欄位為必填,";
                    }
                    //else if (CheckLength(V_WASH_DATE, 8, "沖帳日期", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    //{
                    //    //超過DB欄位
                    //    V_WASH_MONTH = SubStr(V_WASH_DATE, 0, 8);
                    //}
                    else if (DateTime.TryParseExact(V_WASH_DATE, "yyyyMMdd", null, DateTimeStyles.None, out dtTEMP) == false)
                    {
                        strErrMsg += "沖帳日期格式錯誤,";
                        V_WASH_DATE = "";
                    }
                    else
                    {
                        string V_WASH_MONTH = V_WASH_DATE.Substring(0, 6);

                        //檢查該筆資料是否月結,若立沖帳已月結則不可進行次代轉ACCT沖帳處理
                        if (CheckClose(V_WASH_MONTH) == true)
                        {
                            strErrMsg += V_WASH_MONTH + "立沖帳已月結,";
                        }
                    }
                    #endregion


                  //20110117 純萍異動規格 將結帳年月從必填改為選填 且不採用此欄位資料為匯入資料的結帳年月
                  /*  if (V_CLOSE_MONTH == string.Empty)
                    {
                        strErrMsg += "結帳年月欄位為必填,";
                    }
                    else if (CheckLength(V_CLOSE_MONTH, 6, "結帳年月", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    {
                        //超過DB欄位
                        V_CLOSE_MONTH = SubStr(V_CLOSE_MONTH, 0, 6);
                    }
                    else if (DateTime.TryParseExact(V_CLOSE_MONTH + "01", "yyyyMMdd", null, DateTimeStyles.None, out dtTEMP) == false)
                    {
                        strErrMsg += "結帳年月格式錯誤,";
                    }

                    if (strErrMsg == "") //如果結帳年月和沖帳年月格式都沒有錯的話,在做這個檢查
                    {
                        if (int.Parse(V_WASH_MONTH) < int.Parse(V_CLOSE_MONTH))
                        {
                            strErrMsg += "結帳年月不可大於沖帳年月,";
                        }
                    } */

                    if (V_SOURCE_TYPE == string.Empty)
                    {
                        strErrMsg += "來源別欄位為必填,";
                    }
                    else if (CheckLength(V_SOURCE_TYPE, 1, "來源別", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    {
                        //超過DB欄位
                        V_SOURCE_TYPE = SubStr(V_SOURCE_TYPE, 0, 1);
                    }
                    else if (!((V_SOURCE_TYPE == "1") || (V_SOURCE_TYPE == "2") || (V_SOURCE_TYPE == "3") || (V_SOURCE_TYPE == "4") || (V_SOURCE_TYPE == "5")))
                    {
                        strErrMsg += "來源別資料只允許 1 ~ 5,";
                    }

                    //20110301 Rika 改單據日期為由系統抓取
                    //if (V_SDATE == string.Empty)
                    //{
                    //    strErrMsg += "日期欄位為必填,";
                    //}
                    //else 
                    //if (DateTime.TryParseExact(V_SDATE, "yyyyMMdd", null, DateTimeStyles.None, out dtTEMP) == false)
                    //{
                    //    strErrMsg += "日欄位必須為日期型態或日期格式錯誤,";
                    //    V_SDATE = "";
                    //}
                    if (V_SDATE != string.Empty)
                    {
                        if (DateTime.TryParseExact(V_SDATE, "yyyyMMdd", null, DateTimeStyles.None, out dtTEMP) == false)
                        {
                            strErrMsg += "日期欄位必須為日期型態或日期格式錯誤,";
                            V_SDATE = "";
                        }
                    }


                    if (V_SECOND_NO == string.Empty)
                    {
                        strErrMsg += "單號(次代)欄位為必填,";
                    }
                    else 
                    {
                        if (CheckLength(V_SECOND_NO, 14, "單號(次代)", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //超過DB欄位
                            V_SECOND_NO = SubStr(V_SECOND_NO, 0, 14);
                        }

                        //20110303 Rika 新增判斷
                        switch (V_SOURCE_TYPE)
                        {
                            case "1": 
                                if(V_SECOND_NO.Substring(0,2)!="CR")
                                {
                                    strErrMsg += "單據號碼所對應的來源別錯誤,";
                                }
                                break;
                            case "2":
                                if(V_SECOND_NO.Substring(0,2)!="BR")
                                {
                                    strErrMsg += "單據號碼所對應的來源別錯誤,";
                                }
                                break;
                            case "3":
                                if(V_SECOND_NO.Length != 10)
                                {
                                    strErrMsg += "單據號碼所對應的來源別錯誤,";
                                }
                                break;
                            case "4":
                                if(!(SubStr(V_SECOND_NO,0,1)=="W" || SubStr(V_SECOND_NO,0,1)=="Z"))
                                {
                                    strErrMsg += "單據號碼所對應的來源別錯誤,";
                                }
                                break;
                            case "5":
                                if(SubStr(V_SECOND_NO,0,2)!="TR")
                                {
                                    strErrMsg += "單據號碼所對應的來源別錯誤,";
                                }
                                break;
                         
                        }
                    }

                    if (V_STORE_ID == string.Empty)
                    {
                        strErrMsg += "店號欄位為必填,";
                    }
                    else 
                    {
                        if (CheckLength(V_STORE_ID, 10, "店號", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {   //超過DB欄位
                            V_STORE_ID = SubStr(V_STORE_ID, 0, 10);
                        }

                        //若已經有來源別錯誤時可避免進入判斷造成系統錯誤
                        if (strErrMsg == "")
                        {
                            //20110303 Rika 新增判斷單據編號所對應的店號
                            //20110706 Rika 單據號碼錯誤判斷
                            string str_STORE = DBO.Check_Store(V_SECOND_NO, V_SOURCE_TYPE, V_STORE_ID).ToString();

                            if (str_STORE == "0")
                            {
                                strErrMsg += "找不到單據號碼,";
                            }
                            else if (str_STORE != V_STORE_ID)
                            {
                                strErrMsg += "單據號碼所對應之店號錯誤,";
                            }
                        }
                    }

                    if (V_WASH_AMT == string.Empty)
                    {
                        strErrMsg += "繳款金額欄位為必填,";
                        V_WASH_AMT = "0";
                    }
                    else if (CheckLength(V_WASH_AMT, 12, "繳款金額", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    {
                        //超過DB欄位
                        V_WASH_AMT = SubStr(V_WASH_AMT, 0, 12);
                    }
                    else if (double.TryParse(V_WASH_AMT, out doubleVal) == false)
                    {
                        strErrMsg += "繳款金額必須為數值型態,";
                        V_WASH_AMT = "0";
                    }

                    if (V_WASH_CHAGE == string.Empty)
                    {
                        strErrMsg += "手續費/郵資欄位為必填,";
                        V_WASH_CHAGE = "0";
                    }
                    else if (CheckLength(V_WASH_CHAGE, 8, "手續費/郵資", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    {
                        //超過DB欄位
                        V_WASH_CHAGE = SubStr(V_WASH_CHAGE, 0, 8);
                    }
                    else if (double.TryParse(V_WASH_CHAGE, out doubleVal) == false)
                    {
                        strErrMsg += "手續費/郵資必須為數值型態,";
                        V_WASH_CHAGE = "0";
                    }

                    if (V_WASH_AMT_TO == string.Empty)
                    {
                        strErrMsg += "沖帳總額欄位為必填,";
                        V_WASH_AMT_TO = "0";
                    }
                    else if (CheckLength(V_WASH_AMT_TO, 12, "沖帳總額", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    {
                        //超過DB欄位
                        V_WASH_CHAGE = SubStr(V_WASH_AMT_TO, 0, 12);
                    }
                    else if (double.TryParse(V_WASH_AMT_TO, out doubleVal) == false)
                    {
                        strErrMsg += "沖帳總額必須為數值型態,";
                        V_WASH_AMT_TO = "0";
                    }

                    #region 20100609秀玲新增規則

                    #region 尾差

                    if (s_DIFF_AMT == string.Empty)
                    {
                        strErrMsg += "尾差欄位為必填,";
                        s_DIFF_AMT = "0";
                    }
                    else if (CheckLength(s_DIFF_AMT, 3, "尾差", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    {
                        //超過DB欄位
                        s_DIFF_AMT = SubStr(s_DIFF_AMT, 0, 12);
                    }
                    else if (double.TryParse(s_DIFF_AMT, out doubleVal) == false)
                    {
                        strErrMsg += "尾差必須為數值型態,";
                        s_DIFF_AMT = "0";
                    }

                    #endregion

                    #region 其他差異

                    if (s_OTHER_DIFF == string.Empty)
                    {
                        strErrMsg += "其他差異欄位為必填,";
                        s_OTHER_DIFF = "0";
                    }
                    else if (CheckLength(s_OTHER_DIFF, 8, "其他差異", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    {
                        //超過DB欄位
                        s_OTHER_DIFF = SubStr(s_OTHER_DIFF, 0, 12);
                    }
                    else if (double.TryParse(s_OTHER_DIFF, out doubleVal) == false)
                    {
                        strErrMsg += "其他差異必須為數值型態,";
                        s_OTHER_DIFF = "0";
                    }

                    #endregion

                    #region 匯兌損益

                    if (s_REMIT_DIFF == string.Empty)
                    {
                        strErrMsg += "匯兌損益欄位為必填,";
                        s_REMIT_DIFF = "0";
                    }
                    else if (CheckLength(s_REMIT_DIFF, 8, "匯兌損益", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                    {
                        //超過DB欄位
                        s_REMIT_DIFF = SubStr(s_REMIT_DIFF, 0, 12);
                    }
                    else if (double.TryParse(s_REMIT_DIFF, out doubleVal) == false)
                    {
                        strErrMsg += "匯兌損益必須為數值型態,";
                        s_REMIT_DIFF = "0";
                    }

                    #endregion

                    #endregion

                    #region 20100722秀玲新增規則

                    if (V_SOURCE_TYPE == "4")
                    {
                        int i_Check_Flg = 0;

                        CAACommon CAAComm = new CAACommon();

                        ParameterList.Clear();
                        ParameterList.Add(CAAComm.GetValueSetParameter(V_SECOND_NO, "string", false));//[折讓單號]
                        ParameterList.Add(CAAComm.GetValueSetParameter(s_LoginUser, "string", false));//[登入人員]

                        i_Check_Flg = DBO.CHECK_DISC_MAIN_FLG(ParameterList);

                        if (i_Check_Flg != 1)
                        { strErrMsg += "此筆尚未憑證已回,故不允許匯入,"; }
                    }

                    #endregion


                    if ((int.Parse(V_WASH_CHAGE) + int.Parse(V_WASH_AMT) + int.Parse(s_DIFF_AMT) + int.Parse(s_OTHER_DIFF) + int.Parse(s_REMIT_DIFF)) != int.Parse(V_WASH_AMT_TO))
                    {
                        strErrMsg += "繳款金額+手續費/郵資+尾差+其他差異+匯兌損益與沖帳總額不合,";
                    }

                    if (strErrMsg == "")
                    {
                        int iCheckREMAIN_AMT = CheckREMAIN_AMT(V_SECOND_NO, V_SOURCE_TYPE, V_WASH_AMT_TO);
                        if (iCheckREMAIN_AMT == 0)
                            strErrMsg += "找不到符合的單據資料,";
                        else if (iCheckREMAIN_AMT == 1)
                            strErrMsg += "沖帳總額不足,";

                        #region 20110217 RIKA 新增規則

                        if (V_SOURCE_TYPE == "3" || V_SOURCE_TYPE == "4" || V_SOURCE_TYPE == "5")
                        {
                            if (int.Parse(V_WASH_CHAGE) != 0 || int.Parse(s_DIFF_AMT) != 0 || int.Parse(s_OTHER_DIFF) != 0 || int.Parse(s_REMIT_DIFF) != 0)
                                strErrMsg += "手續費/郵資/尾差/差異/匯兌損益沖帳餘額不足,";
                        }
                        else
                        {
                            DataRow ds_Check = DBO.CheckDIFF_AMT(V_SECOND_NO, V_SOURCE_TYPE);

                            if (int.Parse(ds_Check["WASH_AMT"].ToString()) < int.Parse(V_WASH_AMT))
                                strErrMsg += "繳款金額沖帳餘額不足,";

                            if (int.Parse(ds_Check["WASH_CHAGE"].ToString()) < int.Parse(V_WASH_CHAGE))
                                strErrMsg += "手續費/郵資沖帳餘額不足,";

                            if (int.Parse(ds_Check["DIFF_AMT"].ToString()) < int.Parse(s_DIFF_AMT))
                                strErrMsg += "尾差沖帳餘額不足,";

                            if (int.Parse(ds_Check["OTHER_DIFF"].ToString()) < int.Parse(s_OTHER_DIFF))
                                strErrMsg += "其他差異沖帳餘額不足,";

                            if (int.Parse(ds_Check["REMIT_DIFF"].ToString()) < int.Parse(s_REMIT_DIFF))
                                strErrMsg += "匯兌損益沖帳餘額不足,";
                        }

                        #endregion
                    }
                    //20110117 純萍異動規則 因結帳年月改為選填,所以改為判斷單號
                    DataRow[] FindDbls = ds_Excel.Tables[0].Select("[單號(次代)]='" + V_SECOND_NO + "'");
                    if (FindDbls.Length > 1)
                        strErrMsg += "單號(次代)有重覆資料,";
                    if (strErrMsg == "")
                    {
                        V_STATUS = "1";
                    }
                    else
                    {
                        V_STATUS = "2";
                        strErrMsg = strErrMsg.Substring(0, strErrMsg.Length - 1);//去除最後一個逗點
                    }



                    V_ERRORMEMO = strErrMsg;
                    ParameterList.Clear();
                    ParameterList.Add(V_ID); //0.N_ID
                    ParameterList.Add(V_STATUS);        //1.V_STATUS     1:正常資料; 2:錯誤資料				
                    ParameterList.Add(V_DATASOURCE);    //2.V_DATASOURCE 匯入檔名/TMP檔名
                    ParameterList.Add(V_DATATYPE);      //3.V_DATATYPE  
                    ParameterList.Add(V_ERRORMEMO);     //4.V_ERRORMEMO 
                    ParameterList.Add(V_CLOSE_MONTH);   //5.V_CLOSE_MONTH 20110117 純萍異動規格 將結帳年月從必填改為選填
                    ParameterList.Add(V_SOURCE_TYPE);   //6.V_SOURCE_TYPE 必填 1:專案代收 2:支票 3:發票 4:折讓 5:暫收
                    ParameterList.Add(V_SDATE);         //7.V_SDATE 必填(YYYYMMDD)  20110301 Rika 改為由系統抓取				  
                    ParameterList.Add(V_SECOND_NO);     //8.V_SECOND_NO 必填				
                    ParameterList.Add(V_STORE_ID);      //9.V_STORE_ID 必填				
                    ParameterList.Add(V_WASH_AMT);      //10.V_WASH_AMT 必填				
                    ParameterList.Add(V_WASH_CHAGE);    //11.V_WASH_CHAGE 必填				
                    ParameterList.Add(V_WASH_AMT_TO);   //12.V_WASH_AMT_TO 必填(需驗證欄位N + 欄位O = 欄位P)				
                    ParameterList.Add(V_MEMO);          //13.V_MEMO       
                    ParameterList.Add(V_CREATEUID);     //14.V_CREATEUID  
                    ParameterList.Add(V_CREATEDATE);    //15.V_CREATEDATE 
                    ParameterList.Add(V_UPDATEUID);     //16.V_UPDATEUID  
                    ParameterList.Add(V_UPDATEDATE);    //17.V_UPDATEDATE
                    ParameterList.Add(V_WASH_DATE);    //18.V_WASH_DATE  20110117 異動規格 純萍改原[沖帳年月]為[沖帳日期](YYYYMMDD)
                    ParameterList.Add(s_DIFF_AMT);      //19.V_DIFF_AMT
                    ParameterList.Add(s_OTHER_DIFF);    //20.V_OTHER_DIFF
                    ParameterList.Add(s_REMIT_DIFF);    //21.V_REMIT_DIFF
                    DBO.Add_Tmp(ParameterList, DBT);
                    i_FileToTemp_Total_count += 1;
                }
                DBT.Commit();

                //取得匯入TMP 的資料
                int i_FileToTemp_Right_count = 0;
                int i_FileToTemp_Wrong_count = 0;

                ParameterList.Clear();
                ParameterList.Add(s_LoginUser);
                ParameterList.Add("");
                ParameterList.Add("");

                DataTable dtTmp = DBO.QueryTmp(ParameterList);

                DataRow[] FindRows;
                FindRows = dtTmp.Select("STATUS='1'");
                i_FileToTemp_Right_count = FindRows.Length;
                FindRows = dtTmp.Select("STATUS='2'");
                i_FileToTemp_Wrong_count = FindRows.Length;

                arl_Return.Add("TRUE");
                arl_Return.Add(i_FileToTemp_Total_count);
                arl_Return.Add(i_FileToTemp_Right_count);
                arl_Return.Add(i_FileToTemp_Wrong_count);
            }
            catch (Exception ex)
            {

                arl_Return.Add("FALSE");
                arl_Return.Add(ex.Message);
                //獨立呼叫Transcation失敗
                DBT.Rollback();
            }
            finally
            {

                if (Conn.State == ConnectionState.Connecting)
                {
                    Conn.Close();
                }


            }
            return arl_Return;
        }
Example #13
0
    /// <summary>
    /// 頁籤=月結 BUTTON [人工折讓月結解除]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_TAB4_Open_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            BCO.CAACommon CAAComm = new BCO.CAACommon();
            ArrayList arl_Check_Condition = Check_Condition("TAB 月結");

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA181", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            #region 傳入參數

            string s_Now = DateTime.Now.ToString();

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter("CAA18", "string", false));//月結功能代碼
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_4_CLOSE_MONTH.Text, "string", false));//月結年月
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//更新人員
            ParameterList.Add(CAAComm.GetValueSetParameter(s_Now, "datetime", false));//更新日期

            #endregion

            #region 連結資料庫

            BCO.RecordingCloseLockInfo bco = new BCO.RecordingCloseLockInfo(ConntionDB);
            ArrayList ary_Result = bco.RecordingByOpen(ParameterList, null, ConntionDB);

            #endregion

            #region 檢查回傳資料

            this.ErrorMsgLabel.Text = ary_Result[1].ToString();

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { Finally_Function(); }
    }
Example #14
0
    /// <summary>
    /// BUTTON [查詢]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Query_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            BCO.CAACommon CAAComm = new BCO.CAACommon();

            string s_Type = string.Empty;
            if (this.TabContainer1.ActiveTabIndex == 0)
            { s_Type = "BUTTON [查詢]鈕 TAB 銷貨折讓維護"; }
            else if (this.TabContainer1.ActiveTabIndex == 1)
            { s_Type = "BUTTON [查詢]鈕 TAB 發票折抵明細查詢"; }
            else
            { throw new Exception("頁面資訊錯誤,[查詢]鈕,只有在頁籤為[銷貨折讓維護][發票折抵明細查詢]時才可以使用"); }

            ArrayList arl_Check_Condition = Check_Condition(s_Type);

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA181", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            #region 傳入參數

            #region TabContainer 銷貨折讓維護

            if (this.TabContainer1.ActiveTabIndex == 0)
            {
                ParameterList.Clear();
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_DISC_NO.Text, "string", this.chb_LikeSearch.Checked));//[折讓單號]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_FORM.Text, "int", false));//[格式代號]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_SOURCE.Text, "int", false));//[來源]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_GROUP_NO.Text, "string", this.chb_LikeSearch.Checked));//[店群]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_STORE_ID.Text, "string", this.chb_LikeSearch.Checked));//[店號]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_Z_O.Text, "string", false));//[營業所]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_TYPE.Text, "string", false));//[型式]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", this.chb_LikeSearch.Checked));//[商品群分類]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_TAX_TYPE.Text, "string", false));//[稅別]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_SAL_ID.Text, "string", this.chb_LikeSearch.Checked));//[營業人員]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_AC_UID.Text, "string", this.chb_LikeSearch.Checked));//[帳務人員]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_DATE.StartDate, "date", false));//[折讓日期]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_DATE.EndDate, "date", false));//[折讓日期]迄
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_ACT_DISC_NO.Text, "string", this.chb_LikeSearch.Checked));//[財會折讓單號]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CHG_DISC_DATE.StartDate, "date", false));//[異動折讓日期]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CHG_DISC_DATE.EndDate, "date", false));//[異動折讓日期]迄
                ParameterList.Add(CAAComm.GetValueSetParameter((this.radl_PROOF_TYPE.Text == "2") ? string.Empty : this.radl_PROOF_TYPE.Text, "int", false));//[憑證已回]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PROOF_DATE.StartDate, "date", false));//[憑換已回日期]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PROOF_DATE.EndDate, "date", false));//[憑換已回日期]迄
                ParameterList.Add(CAAComm.GetValueSetParameter((this.radl_REPROOF_TYPE.Text == "2") ? string.Empty : this.radl_REPROOF_TYPE.Text, "int", false));//[取具進項憑証]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_REPROOF_NO.Text, "string", this.chb_LikeSearch.Checked));//[發票號碼/收據]
                ParameterList.Add(CAAComm.GetValueSetParameter((this.radl_RECEIPT_TYPE.Text == "2") ? string.Empty : this.radl_RECEIPT_TYPE.Text, "int", false));//[取具收據]
                ParameterList.Add(CAAComm.GetValueSetParameter((this.radl_CANCEL_TYPE.Text == "2") ? string.Empty : this.radl_CANCEL_TYPE.Text, "int", false));//[作廢]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CANCEL_DATE.StartDate, "date", false));//[作廢日期]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CANCEL_DATE.EndDate, "date", false));//[作廢日期]迄
                ParameterList.Add(CAAComm.GetValueSetParameter((this.radl_PERIOD_TYPE.Text == "2") ? string.Empty : this.radl_PERIOD_TYPE.Text, "int", false));//[申報]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PERIOD_DATE.StartDate, "date", false));//[申報日期]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PERIOD_DATE.EndDate, "date", false));//[申報日期]迄
                ParameterList.Add(CAAComm.GetValueSetParameter((this.radl_TEMPORAL_TYPE.Text == "2") ? string.Empty : this.radl_TEMPORAL_TYPE.Text, "int", false));//[轉暫收]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_TEMPORAL_DATE.StartDate, "date", false));//[暫收日期]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_TEMPORAL_DATE.EndDate, "date", false));//[暫收日期]迄
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_PAY_RFNO.Text, "string", this.chb_LikeSearch.Checked));//[結帳統編]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_RFNO.Text, "string", this.chb_LikeSearch.Checked));//[統一編號]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_INV_NO.Text, "string", this.chb_LikeSearch.Checked));//[地址]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_UAMT.Text, "int", false));//[折讓金額(未稅)]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_UAMT.Operator, "int", false));//[折讓金額(未稅)]Operator
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_TAX.Text, "int", false));//[折讓稅額]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_TAX.Operator, "int", false));//[折讓稅額]Operator
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_AMT.Text, "int", false));//[總金額]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_AMT.Operator, "int", false));//[總金額]Operator
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH_B.Text, "string", false));//[結帳年月]起
                
                //20110505 rika insert
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH_E.Text, "string", false));//[結帳年月]迄 
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH_ACCT_B.Text, "string", false));//[結帳年月-財會]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH_ACCT_E.Text, "string", false));//[結帳年月-財會]迄  
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PERIOD_MONTH_B.Text, "string", false));//[申報期別]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PERIOD_MONTH_E.Text, "string", false));//[申報期別]迄  
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_WASH_AMT.Text, "int", false));//[累積沖帳金額]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_WASH_AMT.Operator, "int", false));//[累積沖帳金額]Operator
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_REMAIN_AMT.Text, "int", false));//[折讓餘額]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DISC_REMAIN_AMT.Operator, "int", false));//[折讓餘額]Operator

                ParameterList.Add(CAAComm.GetValueSetParameter((this.txt_RowCountLimit.Text == string.Empty) ? "100" : (int.Parse(this.txt_RowCountLimit.Text) < 0) ? "100" : this.txt_RowCountLimit.Text, "int", false));//[筆數]

                ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID
            }

            #endregion

            #region TabContainer 發票折抵明細查詢

            else if (this.TabContainer1.ActiveTabIndex == 1)
            {
                ParameterList.Clear();
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_2_INV_NO.Text, "string", this.chb_LikeSearch.Checked));//[發票號碼]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_2_INV_DATE.StartDate, "date", false));//[發票日期]起
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_2_INV_DATE.EndDate, "date", false));//[發票日期]迄
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_2_TAX_TYPE.Text, "int", false));//[發票稅別]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_2_ROOT_NO.Text, "string", this.chb_LikeSearch.Checked));//[商品群分類]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_2_ITEM_NAME.Text, "string", this.chb_LikeSearch.Checked));//[品名]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_2_INV_UAMT.Text, "int", false));//[發票金額(未稅)]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_2_INV_UAMT.Operator, "int", false));//[發票金額(未稅)]Operator
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_2_INV_TAX.Text, "int", false));//[發票稅額]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_2_INV_TAX.Operator, "int", false));//[發票稅額]Operator
                ParameterList.Add(CAAComm.GetValueSetParameter((this.txt_RowCountLimit.Text == string.Empty) ? "100" : (int.Parse(this.txt_RowCountLimit.Text) < 0) ? "100" : this.txt_RowCountLimit.Text, "int", false));//[筆數]
                ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID
            }

            #endregion

            #region 其他狀況就是錯誤

            else
            { throw new Exception("頁面資訊錯誤,[查詢]鈕,只有在頁籤為[銷貨折讓維護][發票折抵明細查詢]時才可以使用"); }

            #endregion

            #endregion

            #region 連結資料庫

            DataTable dt_Return = new DataTable();
            BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);

            #region TabContainer 銷貨折讓維護

            if (this.TabContainer1.ActiveTabIndex == 0)
            { dt_Return = bco.QueryDiscRecordByFind(ParameterList); }

            #endregion

            #region TabContainer 發票折抵明細查詢

            else if (this.TabContainer1.ActiveTabIndex == 1)
            { dt_Return = bco.QueryInvDiscByFind(ParameterList); }

            #endregion

            #region 其他狀況就是錯誤

            else
            { throw new Exception("頁面資訊錯誤,[查詢]鈕,只有在頁籤為[銷貨折讓維護][發票折抵明細查詢]時才可以使用"); }

            #endregion

            #endregion

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            string SessionIDName = "CAA181_" + PageTimeStamp.Value;

            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dt_Return;

            this.gv_QueryResult.DataSource = dt_Return;
            this.gv_QueryResult.PageSize = (this.txt_Pagesize.Text == string.Empty) ? 20 : (int.Parse(this.txt_Pagesize.Text) < 0) ? 20 : int.Parse(this.txt_Pagesize.Text);
            this.gv_QueryResult.PageIndex = 0;
            this.gv_QueryResult.DataBind();

            #endregion

            #region 將Key值存到Session中

            ArrayList arl_Key = new ArrayList();
            foreach (DataRow drRow in dt_Return.Rows)
            { arl_Key.Add(drRow["DISC_NO"].ToString()); }

            Session["CAA182_SortKey" + this.PageTimeStamp.Value] = arl_Key;

            #endregion

            #region 檢查回傳資料

            if (dt_Return.Rows.Count == 0)
            { this.ErrorMsgLabel.Text = "查無資料"; }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { Finally_Function(); }
    }
Example #15
0
    /// <summary>
    /// 頁籤=[報表] 欄位[報表類型]=彙總,按下Button[匯出]鈕
    /// </summary>
    private void but_TAB3_Print_Total()
    {
        try
        {
            #region 檢查條件

            BCO.CAACommon CAAComm = new BCO.CAACommon();

            ArrayList arl_Check_Condition = Check_Condition("TAB 報表");

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA181", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_3_CLOSE_MONTH_B.Text, "string", false));//[結帳年月]起 20110520修改為起迄
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_3_CLOSE_MONTH_E.Text, "string", false));//[結帳年月]迄
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_3_CLOSE_MONTH_ACCT_B.Text, "string", false));//[結帳年月-財會]起 20110520修改為起迄
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_3_CLOSE_MONTH_ACCT_E.Text, "string", false));//[結帳年月-財會]迄           
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_3_PROFIT_NO_B.Text, "string", false));//[利潤中心]起
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_3_PROFIT_NO_E.Text, "string", false));//[利潤中心]迄
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UID

            #endregion

            #region 連接資料庫

            DataSet ds_Return = new DataSet();
            BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
            ds_Return = bco.QUERY_CAA18_REPORT_SUMMARY(ParameterList);

            #endregion

            #region 檢查回傳資料

            if (ds_Return.Tables["SUMMARY"].Rows.Count == 0)
            {
                this.ErrorMsgLabel.Text = "查無資料";
                return;
            }

            #endregion

            #region 組合匯出的Excel

            #region 設定變數

            ExcelXmlWorkbook exl_WorkSheet = new ExcelXmlWorkbook();
            Worksheet sheet = exl_WorkSheet[0];
            sheet.Name = "折讓入帳彙總表";

            #region 設定長和寬

            int i_Vertical = 0;//直的有幾個欄位(依據資料庫[利潤中心])
            int i_Horizontal = 0;//橫的有幾個欄位(依據資料庫[型式])

            int i_Vertical_Fix = 3;//直的固定欄位[型式、稅別、合計]
            int i_Horizontal_Fix = 4;//橫的固定欄位[標題抬頭、利潤中心抬頭、合計上方要空一行、合計]

            i_Vertical = ds_Return.Tables["PROFIT"].Rows.Count + i_Vertical_Fix;
            i_Horizontal = (ds_Return.Tables["DISC_TYPE"].Rows.Count * 3) + i_Horizontal_Fix;

            #endregion

            #endregion

            #region 設定格式

            #region 設定欄位寬度

            for (int i_Style = 0; i_Style < i_Vertical; i_Style++)
            { sheet.Columns(i_Style).Width = 100; }

            #endregion

            #region 設定合併儲存格

            Range rang_1 = new Range(sheet[0, 0], sheet[i_Vertical - 1, 0]);
            rang_1.Merge();

            #endregion

            #region 設定Style

            XmlStyle style_1 = new XmlStyle();
            style_1.Alignment.Vertical = VerticalAlignment.Center;
            style_1.Border.LineStyle = Borderline.Continuous;
            style_1.Border.Color = System.Drawing.Color.Black;
            style_1.Border.Sides = BorderSides.All;
            style_1.Border.Weight = 1;
            style_1.Font.Size = 10;
            style_1.Font.Name = "新細明體";

            XmlStyle style_2 = new XmlStyle();
            style_2.Alignment.Vertical = VerticalAlignment.Center;
            style_2.Alignment.Horizontal = HorizontalAlignment.Center;
            style_2.Border.LineStyle = Borderline.Continuous;
            style_2.Border.Color = System.Drawing.Color.Black;
            style_2.Border.Sides = BorderSides.All;
            style_2.Border.Weight = 1;
            style_2.Font.Size = 10;
            style_2.Font.Name = "新細明體";

            for (int x = 0; x < i_Vertical; x++)
            {
                for (int y = 0; y < i_Horizontal; y++)
                {
                    if (y != 0)
                    { sheet[x, y].Style = style_1; }
                }
            }

            #endregion

            #endregion

            #region 組合匯出資料

            for (int i = 0; i < i_Horizontal; i++)
            {
                switch (i)
                {
                    #region 橫的第一行

                    case 0:
                        sheet[0, 0].Value = this.slp_3_CLOSE_MONTH_ACCT_B.Text == string.Empty ? "折讓入帳彙總表" : this.slp_3_CLOSE_MONTH_ACCT_B.Text + "-" + this.slp_3_CLOSE_MONTH_ACCT_E.Text + "月折讓入帳彙總表";
                        sheet[0, 0].Style = style_2;
                        break;

                    #endregion

                    #region 橫的第二行

                    case 1:
                        sheet[0, 1].Value = string.Empty;
                        sheet[1, 1].Value = string.Empty;
                        for (int i_case_1 = 0; i_case_1 < ds_Return.Tables["PROFIT"].Rows.Count; i_case_1++)
                        { sheet[i_case_1 + 2, 1].Value = ds_Return.Tables["PROFIT"].Rows[i_case_1]["PROFIT_NAME"].ToString(); }
                        sheet[i_Vertical - 1, 1].Value = "合計";
                        break;

                    #endregion

                    #region 其它行

                    default:
                        switch (i_Horizontal - i)
                        {
                            #region 橫的倒數第二行(合計上面一行要空白)

                            case 2:
                                sheet[0, i].Value = string.Empty;
                                break;

                            #endregion

                            #region 橫的最後一行(合計那一行)

                            case 1:
                                sheet[0, i].Value = "合計";
                                for (int i_case_last = 0; i_case_last < ds_Return.Tables["PROFIT"].Rows.Count; i_case_last++)
                                { sheet[i_case_last + 2, i_Horizontal - 1].Value = FormulaHelper.Formula("SUM", new Range(sheet[i_case_last + 2, 0], sheet[i_case_last + 2, i_Horizontal - 2])); }
                                sheet[i_Vertical - 1, i_Horizontal - 1].Value = FormulaHelper.Formula("SUM", new Range(sheet[i_Vertical - 1, 0], sheet[i_Vertical - 1, i_Horizontal - 2]));
                                break;

                            #endregion

                            #region 橫的其他行

                            default:

                                #region 設定變數

                                int i_Get_Disc_Type = (i - 2) / 3;
                                int i_Get_Tax_Type = (i - 2) % 3;
                                string s_FilterExpression = string.Empty;//篩選條件
                                string s_DISC_SOURCE = string.Empty;//來源(1=系統、2=人工)
                                string s_DISC_TYPE = string.Empty;//型式
                                string s_TAX_TYPE = string.Empty;//稅別
                                string s_PROFIT_NO = string.Empty;//利潤中心

                                #endregion

                                #region 第1欄(型式)

                                sheet[0, i].Value = ds_Return.Tables["DISC_TYPE"].Rows[i_Get_Disc_Type]["DISC_TYPE_NAME"].ToString();

                                #endregion

                                #region 第2欄(稅別)

                                switch (i_Get_Tax_Type)
                                {
                                    case 0:
                                        sheet[1, i].Value = "應稅";
                                        break;
                                    case 1:
                                        sheet[1, i].Value = "稅額";
                                        break;
                                    case 2:
                                        sheet[1, i].Value = "免稅";
                                        break;
                                }

                                #endregion

                                #region 其他資料欄

                                for (int i_case_default = 0; i_case_default < ds_Return.Tables["PROFIT"].Rows.Count; i_case_default++)
                                {
                                    #region 設定[來源][型式][稅別][利潤中心]參數

                                    //[來源][型式]
                                    switch (i_Get_Disc_Type)
                                    {
                                        case 0://第1個一定是系統-一般
                                            s_DISC_SOURCE = "1";//來源(1=系統、2=人工)
                                            s_DISC_TYPE = "1";//型式=1=一般
                                            break;
                                        case 1://第2個一定是人工-一般
                                            s_DISC_SOURCE = "2";//來源(1=系統、2=人工)
                                            s_DISC_TYPE = "1";//型式=1=一般
                                            break;
                                        default:
                                            s_DISC_SOURCE = "2";//來源(1=系統、2=人工)
                                            s_DISC_TYPE = ds_Return.Tables["DISC_TYPE"].Rows[i_Get_Disc_Type]["DISC_TYPE_NAME"].ToString();
                                            break;
                                    }

                                    //[稅別]
                                    switch (i_Get_Tax_Type)
                                    {
                                        case 0:
                                            s_TAX_TYPE = "0";//稅別=0=應稅,稅別=1=免稅
                                            break;
                                        case 1:
                                            s_TAX_TYPE = "0";//稅別=0=應稅,稅別=1=免稅
                                            break;
                                        case 2:
                                            s_TAX_TYPE = "1";//稅別=0=應稅,稅別=1=免稅
                                            break;
                                    }

                                    //[利潤中心]
                                    s_PROFIT_NO = ds_Return.Tables["PROFIT"].Rows[i_case_default]["CODE"].ToString();

                                    #endregion

                                    #region 組合查詢條件,查詢資料

                                    s_FilterExpression = "DISC_SOURCE='" + s_DISC_SOURCE + "' and DISC_TYPE='" + s_DISC_TYPE + "' and TAX_TYPE='" + s_TAX_TYPE + "' and PROFIT_NO='" + s_PROFIT_NO + "'";
                                    DataRow[] dr = ds_Return.Tables["SUMMARY"].Select(s_FilterExpression);

                                    #endregion

                                    #region 將資料寫入欄位

                                    switch (dr.Length)
                                    {
                                        case 1:
                                            if (i_Get_Tax_Type != 1)
                                            { sheet[i_case_default + 2, i].Value = int.Parse(dr[0]["DISC_UAMT"].ToString()); }
                                            else
                                            { sheet[i_case_default + 2, i].Value = int.Parse(dr[0]["DISC_TAX"].ToString()); }
                                            break;
                                        default:
                                            sheet[i_case_default + 2, i].Value = 0;
                                            break;
                                    }

                                    #endregion
                                }

                                #endregion

                                #region 合計欄(Excel右邊的[合計]欄)

                                sheet[i_Vertical - 1, i].Value = FormulaHelper.Formula("SUM", new Range(sheet[0, i], sheet[i_Vertical - 2, i]));

                                #endregion

                                break;

                            #endregion
                        }
                        break;

                    #endregion
                }
            }

            #endregion

            #region 匯出Excel

            string s_FileName = HttpUtility.UrlEncode("折讓入帳彙總表.XLS", System.Text.Encoding.UTF8);//設定輸出檔名
            Response.Charset = "big5";
            Response.ContentType = "application/x-excel;charset='utf-8'";
            Response.AddHeader("content-disposition", "attachment; filename=" + s_FileName);//excel檔名
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            exl_WorkSheet.Export(stream);
            if (stream == null ||
                stream.Length == 0)
            { return; }
            stream.Flush();
            stream.Position = 0;
            System.IO.StreamReader sr = new System.IO.StreamReader(stream);
            string producedExcel = sr.ReadToEnd();
            stream.Close();
            Response.Write(producedExcel);
            Response.Flush();
            Response.End();

            #endregion

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #16
0
    /// <summary>
    /// 折讓項目,欄位[發票號碼]TextChanged事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void txt_Disc_INV_NO_TextChanged(object sender, EventArgs e)
    {
        try
        {
            #region 新增模式 & 檢視模式

            if (this.hid_PageStatus.Value == "insert" ||
                this.hid_PageStatus.Value == "edit")
            {
                #region 設定變數

                BCO.CAACommon CAAComm = new BCO.CAACommon();

                #endregion

                #region 檢查傳入欄位[發票號碼]的值

                if (this.txt_Disc_INV_NO.Text.Trim() == string.Empty)
                {
                    Set_Disc_NewItem_Default();
                    return;
                }

                #endregion

                #region 若輸入的發票號碼存在於按折讓開立查出的資料

                bool b_IsExist_GetDiscInv = Set_Disc_NewItem_Value(this.txt_Disc_INV_NO.Text, dt_NewItem);

                #endregion

                #region 若輸入的發票號碼不存在於按折讓開立查出的資料

                if (b_IsExist_GetDiscInv == false)
                {
                    #region 傳入參數

                    ParameterList.Clear();
                    ParameterList.Add(CAAComm.GetValueSetParameter("TEXT", "string", false));//[查詢型態]
                    if (this.hid_PageStatus.Value == "insert")
                    { ParameterList.Add(CAAComm.GetValueSetParameter(DateTime.Now.ToString(), "date", false)); }
                    else if (this.hid_PageStatus.Value == "edit")
                    { ParameterList.Add(CAAComm.GetValueSetParameter(this.hid_Record_Date.Value, "date", false)); }//[履歷時間]
                    ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_STORE_ID.Text, "string", false));//[店號]
                    ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_RFNO.Text, "string", false));//[統一編號]
                    ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false));//[商品群分類]
                    ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_TAX_TYPE.Text, "int", false));//[稅別]
                    ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_Disc_INV_NO.Text, "string", false));//[發票號碼]
                    ParameterList.Add(CAAComm.GetValueSetParameter("1", "int", false));//只取第1筆
                    ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

                    #endregion

                    #region 連結資料庫

                    BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
                    DataTable dt_Return = bco.GetDetailRecord(ParameterList);

                    #endregion

                    #region 檢查回傳資料

                    #region 如果沒資料

                    if (dt_Return.Rows.Count == 0)
                    {
                        this.ErrorMsgLabel2.Text = "查無發票號碼:" + this.txt_Disc_INV_NO.Text + "的相關資料";
                        Set_Disc_NewItem_Default();
                    }

                    #endregion

                    #region 如果有資料

                    else
                    {
                        Set_Disc_NewItem_Value(this.txt_Disc_INV_NO.Text, dt_Return);

                        #region 使用XML,將資料放置到前端

                        xml_VDS_CAA_INV_MAIN_Data.InnerHtml = dt_Return.DataSet.GetXml();

                        #endregion

                        #region Focus欄位

                        string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(slp_Disc_DISC_UAMT.TextBox_Code.ClientID, true);
                        ScriptManager.RegisterStartupScript(this.up_DiscItem, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);

                        #endregion
                    }

                    #endregion

                    #endregion
                }
                else
                {
                    #region Focus欄位

                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(slp_Disc_DISC_UAMT.TextBox_Code.ClientID, true);
                    ScriptManager.RegisterStartupScript(this.up_DiscItem, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);

                    #endregion
                }

                #endregion
            }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel2.Text = ex.Message;
        }
        finally { Finally_Function(); }
    }
Example #17
0
    /// <summary>
    /// 檢查條件
    /// </summary>
    /// <param name="s_Type"></param>
    /// <returns></returns>
    private ArrayList Check_Condition(string s_Type)
    {
        #region 宣告

        BCO.CAACommon CAAComm = new BCO.CAACommon();
        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region SLP轉型

        #region 銷或折讓維護區

        TextBox txt_STORE_ID = (TextBox)this.slp_STORE_ID.FindControl("TextBoxCode");//店號
        TextBox txt_ROOT_NO = (TextBox)this.slp_ROOT_NO.FindControl("TextBoxCode");//商品群分類
        TextBox txt_DISC_DATE = (TextBox)this.slp_DISC_DATE.FindControl("TextBoxCode");//折讓日期
        TextBox txt_CHG_DISC_DATE = (TextBox)this.slp_CHG_DISC_DATE.FindControl("TextBoxCode");//異動折讓日期
        TextBox txt_PROOF_DATE = (TextBox)this.slp_PROOF_DATE.FindControl("TextBoxCode");//憑證已回日期
        TextBox txt_CANCEL_DATE = (TextBox)this.slp_CANCEL_DATE.FindControl("TextBoxCode");//作廢日期
        TextBox txt_PERIOD_DATE = (TextBox)this.slp_PERIOD_DATE.FindControl("TextBoxCode");//申報日期
        TextBox txt_TEMPORAL_DATE = (TextBox)this.slp_TEMPORAL_DATE.FindControl("TextBoxCode");//暫收日期
        TextBox txt_DISC_UAMT = (TextBox)this.slp_DISC_UAMT.FindControl("TextBoxCode");//折讓金額(未稅)
        TextBox txt_DISC_TAX = (TextBox)this.slp_DISC_TAX.FindControl("TextBoxCode");//折讓稅額
        TextBox txt_DISC_AMT = (TextBox)this.slp_DISC_AMT.FindControl("TextBoxCode");//總金額
        TextBox txt_CLOSE_MONTH = (TextBox)((ASP.wui_slp_slp_numberupdown_ascx)this.slp_CLOSE_MONTH.FindControl("SLP_NumberUpDown1")).FindControl("TextBoxCode");//結帳年月

        DropDownList drop_DISC_SOURCE = (DropDownList)this.slp_DISC_SOURCE.FindControl("D1");//來源
        DropDownList drop_DISC_TYPE = (DropDownList)this.slp_DISC_TYPE.FindControl("D1");//型式
        DropDownList drop_TAX_TYPE = (DropDownList)this.slp_TAX_TYPE.FindControl("D1");//稅別

        #endregion

        #region 折讓項目區

        TextBox txt_Disc_INV_DATE = (TextBox)this.slp_Disc_INV_DATE.FindControl("TextBoxCode");//發票日期
        TextBox txt_Disc_DISC_UAMT = (TextBox)this.slp_Disc_DISC_UAMT.FindControl("TextBoxCode");//折讓金額(未稅)
        TextBox txt_Disc_DISC_TAX = (TextBox)this.slp_Disc_DISC_TAX.FindControl("TextBoxCode");//折讓稅額
        TextBox txt_Disc_NON_INV_UAMT = (TextBox)this.slp_Disc_NON_INV_UAMT.FindControl("TextBoxCode");//發票餘額(未稅)
        TextBox txt_Disc_NON_INV_TAX = (TextBox)this.slp_Disc_NON_INV_TAX.FindControl("TextBoxCode");//發票稅額

        #endregion

        #endregion

        #region BUTTON [儲存]鈕

        #region 新增狀態

        if (s_Type == "BUTTON [儲存]鈕,新增狀態")
        {
            #region 檢查欄位的Byte長度

            if (CAAComm.Get_Byte_Length(this.txt_ACT_DISC_NO.Text) > 13)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[財會折讓單號]長度不可大於 13 Byte", "1", this.txt_ACT_DISC_NO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_REPROOF_NO.Text) > 12)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[發票號碼/收據]長度不可大於 12 Byte", "1", this.txt_REPROOF_NO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_RFNO.Text) > 10)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[統一編號]長度不可大於 10 Byte", "1", this.txt_RFNO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_MEMO.Text) > 200)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[備註]長度不可大於 200 Byte", "1", this.txt_MEMO.ClientID); }

            #endregion

            #region 檢查SLP日期格式

            arl_Return = CAAComm.Check_Format_Date(this.slp_DISC_DATE.Text, "欄位[折讓日期]日期格式錯誤", "1", txt_DISC_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_CHG_DISC_DATE.Text, "欄位[異動折讓日期]日期格式錯誤", "1", txt_DISC_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_PROOF_DATE.Text, "欄位[憑證已回日期]日期格式錯誤", "1", txt_PROOF_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_CANCEL_DATE.Text, "欄位[作廢日期]日期格式錯誤", "1", txt_CANCEL_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_PERIOD_DATE.Text, "欄位[申報日期]日期格式錯誤", "1", txt_PERIOD_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_TEMPORAL_DATE.Text, "欄位[暫收日期]日期格式錯誤", "1", txt_TEMPORAL_DATE.ClientID, arl_Return);

            #endregion

            #region 檢查SLP數字格式

            arl_Return = CAAComm.Check_Format_Int(this.slp_DISC_UAMT.Text, "欄位[折讓金額(未稅)]數字格式錯誤", "32", "1", txt_DISC_UAMT.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(this.slp_DISC_TAX.Text, "欄位[折讓稅額]數字格式錯誤", "32", "1", txt_DISC_TAX.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(Request[txt_DISC_AMT.UniqueID].ToString(), "欄位[總金額]數字格式錯誤", "32", "1", txt_DISC_AMT.ClientID, arl_Return);

            #endregion

            #region 檢查SLP年月格式

            arl_Return = CAAComm.Check_Format_YearMonth(this.slp_CLOSE_MONTH.Text, "欄位[結帳年月]年月格式錯誤", "1", txt_CLOSE_MONTH.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_YearMonth(this.slp_CLOSE_MONTH_ACCT.Text, "欄位[結帳年月-財會]年月格式錯誤", "1", this.slp_CLOSE_MONTH_ACCT.TextBoxCode_Object.ClientID, arl_Return);

            #endregion

            #region 檢查必填欄位

            arl_Return = CAAComm.Check_MustFillin_Column(drop_DISC_SOURCE.SelectedIndex.ToString(), "drop", "欄位[來源]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_STORE_ID.Text, "text", "欄位[店號]為必填欄位", "1", txt_STORE_ID.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(drop_DISC_TYPE.SelectedIndex.ToString(), "drop", "欄位[型式]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(drop_TAX_TYPE.SelectedIndex.ToString(), "drop", "欄位[稅別]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_ROOT_NO.Text, "text", "欄位[商品群分類]為必填欄位", "1", txt_ROOT_NO.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_CLOSE_MONTH.Text, "text", "欄位[結帳年月]為必填欄位", "1", txt_CLOSE_MONTH.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_DISC_UAMT.Text, "text", "欄位[折讓金額(未稅)]為必填欄位", "1", txt_DISC_UAMT.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_DISC_TAX.Text, "text", "欄位[折讓稅額]為必填欄位", "1", txt_DISC_TAX.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(Request[txt_DISC_AMT.UniqueID].ToString(), "text", "欄位[總金額]為必填欄位", "1", txt_DISC_AMT.ClientID, arl_Return);

            #endregion

            #region 如果基本檢查有誤,則Return

            if (arl_Return[1].ToString() != string.Empty)
            { return arl_Return; }

            #endregion

            #region 自訂檢查

            #region 檢查欄位[折讓金額(未稅)][折讓稅額][總金額]

            int i_DISC_UAMT = int.Parse(this.slp_DISC_UAMT.Text);//折讓金額(未稅)
            int i_DISC_TAX = int.Parse(this.slp_DISC_TAX.Text);//折讓稅額
            int i_DISC_AMT = int.Parse(Request[txt_DISC_AMT.UniqueID].ToString());//總金額

            if (i_DISC_UAMT < 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]不可小於0", "1", txt_DISC_UAMT.ClientID); }
            if (i_DISC_TAX < 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓稅額]不可小於0", "1", txt_DISC_TAX.ClientID); }
            if (i_DISC_AMT <= 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[總金額]不可小於或等於0", "1", txt_DISC_AMT.ClientID); }
            if (i_DISC_UAMT == 0 && i_DISC_TAX != 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]為0時,欄位[折讓稅額]也必須為0", "1", txt_DISC_TAX.ClientID); }
            if (i_DISC_UAMT + i_DISC_TAX != i_DISC_AMT)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]加上欄位[折讓稅額]必須等於欄位[總金額]", "1", txt_DISC_AMT.ClientID); }
            if (this.slp_TAX_TYPE.Text == "1" ||//[稅別]=免稅
                this.slp_TAX_TYPE.Text == "2")//[稅別]=零稅
            {
                if (i_DISC_TAX != 0)
                { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[稅別]是免稅或零稅時,欄位[折讓稅額]必須為0", "1", txt_DISC_TAX.ClientID); }
            }

            #endregion

            #region 新增模式下欄位[來源]必須是選擇人工開立

            if (this.slp_DISC_SOURCE.Text != "2")//2代表是人工開立
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[來源]必須是選擇人工開立", "1", drop_DISC_SOURCE.ClientID); }

            #endregion

            #region 檢查欄位[店號]是否為有效店號

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_STORE_ID.Text, "string", false));//店號
            ParameterList.Add(CAAComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));//系統時間
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//登入人員

            #endregion

            #region 連結資料庫

            BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
            IDataReader dr = bco.QUERY_CAA18_DATA_BY_STORE_ID(ParameterList);

            #endregion

            if (dr.Read() == false)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[店號]查無符合店號或己關店,請重新輸入", "1", this.slp_STORE_ID.TextBox_Code.ClientID); }
            dr.Close();

            #endregion

            #region 新增模式下欄位[作廢]不能勾選

            if (this.chb_CANCEL_FLG.Checked == true)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[作廢]不能勾選", "1", chb_CANCEL_FLG.ClientID); }

            #endregion

            #region 新增模式下欄位[作廢日期]必須為空白

            if (this.slp_CANCEL_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[作廢日期]必須為空白", "1", txt_CANCEL_DATE.ClientID); }

            #endregion

            #region 新增模式下欄位[申報]不能勾選

            if (this.chb_PERIOD_FLG.Checked == true)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[申報]不能勾選", "1", chb_PERIOD_FLG.ClientID); }

            #endregion

            #region 新增模式下欄位[申報日期]必須為空白

            if (this.slp_PERIOD_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[申報日期]必須為空白", "1", txt_PERIOD_DATE.ClientID); }

            #endregion

            #region 新增模式下欄位[轉暫收]不能勾選

            if (this.chb_TEMPORAL_FLG.Checked == true)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[轉暫收]不能勾選", "1", chb_TEMPORAL_FLG.ClientID); }

            #endregion

            #region 新增模式下欄位[暫收日期]必須為空白

            if (this.slp_TEMPORAL_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[暫收日期]必須為空白", "1", txt_TEMPORAL_DATE.ClientID); }

            #endregion

            #region 檢查若己月結則不允許新增

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH.Text, "string", false));//[結帳年月]
            ParameterList.Add(CAAComm.GetValueSetParameter("CAA18", "string", false)); //V_FUNC_NO

            #endregion

            #region 連結資料庫

            BCO.ChanMonthCloseYN bco_Is_Close = new BCO.ChanMonthCloseYN(ConntionDB);

            #endregion

            #region 檢查回傳資料

            //回傳結果=Y,該月份已月結
            //回傳結果=N,該月份尚未月結
            if (((ArrayList)bco_Is_Close.GetChanMonthCloseStatus(ParameterList, null))[0].ToString() == "Y")
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[結帳年月]該月份已月結", "1", txt_CLOSE_MONTH.ClientID); }

            #endregion

            #endregion

            #region 檢查欄位[憑證已回]若已勾選,則欄位[憑證已回日期]為必填欄位

            if (this.chb_PROOF_FLG.Checked == true && this.slp_PROOF_DATE.Text.Trim() == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[憑證已回]若有勾選,則欄位[憑證已回日期]為必填欄位", "1", txt_PROOF_DATE.ClientID); }

            #endregion

            #region 檢查欄位[憑證已回日期]若有值,則欄位[憑證已回]或[取具進項憑証]或[取具收據]必須勾選

            if ((this.chb_PROOF_FLG.Checked == false && this.chb_REPROOF_FLG.Checked == false && this.chb_RECEIPT_FLG.Checked == false) == true &&
                this.slp_PROOF_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[憑證已回日期]若有值,則欄位[憑證已回]或[取具進項憑証]或[取具收據]必須勾選", "1", string.Empty); }

            #endregion

            #region 檢查欄位[取具進項憑証]若已勾選,則欄位[憑證已回日期]為必填欄位

            if (this.chb_REPROOF_FLG.Checked == true && this.slp_PROOF_DATE.Text == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[取具進項憑証]若已勾選,則欄位[憑證已回日期]為必填欄位", "1", txt_PROOF_DATE.ClientID); }

            #endregion

            #region 檢查欄位[取具進項憑証]若已勾選,則欄位[發票號碼/收據]為必填欄位

            if (this.chb_REPROOF_FLG.Checked == true && this.txt_REPROOF_NO.Text == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[取具進項憑証]若已勾選,則欄位[發票號碼/收據]為必填欄位", "1", this.txt_REPROOF_NO.ClientID); }

            #endregion

            #region 檢查欄位[發票號碼/收據]若有值,則欄位[取具進項憑証]必須勾選

            if (this.chb_REPROOF_FLG.Checked == false && this.txt_REPROOF_NO.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[發票號碼/收據]若有值,則欄位[取具進項憑証]必須勾選", "1", string.Empty); }

            #endregion

            #region 檢查欄位[取具收據]若已勾選,則欄位[憑證已回日期]為必填欄位

            if (this.chb_RECEIPT_FLG.Checked == true && this.slp_PROOF_DATE.Text == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[取具收據]若已勾選,則欄位[憑證已回日期]為必填欄位", "1", txt_PROOF_DATE.ClientID); }

            #endregion

            #endregion
        }

        #endregion

        #region 編輯狀態

        else if (s_Type == "BUTTON [儲存]鈕,編輯狀態")
        {
            #region 檢查欄位的Byte長度

            if (CAAComm.Get_Byte_Length(this.txt_ACT_DISC_NO.Text) > 13)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[財會折讓單號]長度不可大於 13 Byte", "1", this.txt_ACT_DISC_NO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_REPROOF_NO.Text) > 12)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[發票號碼/收據]長度不可大於 12 Byte", "1", this.txt_REPROOF_NO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_RFNO.Text) > 10)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[統一編號]長度不可大於 10 Byte", "1", this.txt_RFNO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_MEMO.Text) > 200)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[備註]長度不可大於 200 Byte", "1", this.txt_MEMO.ClientID); }

            #endregion

            #region 檢查SLP日期格式

            arl_Return = CAAComm.Check_Format_Date(this.slp_DISC_DATE.Text, "欄位[折讓日期]日期格式錯誤", "1", txt_DISC_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_CHG_DISC_DATE.Text, "欄位[異動折讓日期]日期格式錯誤", "1", txt_DISC_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_PROOF_DATE.Text, "欄位[憑證已回日期]日期格式錯誤", "1", txt_PROOF_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_CANCEL_DATE.Text, "欄位[作廢日期]日期格式錯誤", "1", txt_CANCEL_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_PERIOD_DATE.Text, "欄位[申報日期]日期格式錯誤", "1", txt_PERIOD_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_TEMPORAL_DATE.Text, "欄位[暫收日期]日期格式錯誤", "1", txt_TEMPORAL_DATE.ClientID, arl_Return);

            #endregion

            #region 檢查SLP數字格式

            arl_Return = CAAComm.Check_Format_Int(this.slp_DISC_UAMT.Text, "欄位[折讓金額(未稅)]數字格式錯誤", "32", "1", txt_DISC_UAMT.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(this.slp_DISC_TAX.Text, "欄位[折讓稅額]數字格式錯誤", "32", "1", txt_DISC_TAX.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(Request[txt_DISC_AMT.UniqueID].ToString(), "欄位[總金額]數字格式錯誤", "32", "1", txt_DISC_AMT.ClientID, arl_Return);

            #endregion

            #region 檢查SLP年月格式

            arl_Return = CAAComm.Check_Format_YearMonth(this.slp_CLOSE_MONTH.Text, "欄位[結帳年月]年月格式錯誤", "1", txt_CLOSE_MONTH.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_YearMonth(this.slp_CLOSE_MONTH_ACCT.Text, "欄位[結帳年月-財會]年月格式錯誤", "1", this.slp_CLOSE_MONTH_ACCT.TextBoxCode_Object.ClientID, arl_Return);

            #endregion

            #region 檢查不可同時進行多個勾選作業

            bool b_IsRight = false;
            string s_ReturnMsg = string.Empty;

            Check_CheckStatus(out b_IsRight, out s_ReturnMsg);

            if (b_IsRight == true)//代表進行1個以上勾選作業
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "不可同時進行多個勾選作業", "1", string.Empty); }

            #endregion

            #region 檢查月結是否與頁面LOAD進來時相同,如有異動,請使用者重新LOAD頁面

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH.Text, "string", false));//[結帳年月]
            ParameterList.Add(CAAComm.GetValueSetParameter("CAA18", "string", false)); //V_FUNC_NO

            #endregion

            #region 連結資料庫

            BCO.ChanMonthCloseYN bco_Is_Close = new BCO.ChanMonthCloseYN(ConntionDB);

            #endregion

            #region 檢查回傳資料

            //回傳結果=Y,該月份已月結
            //回傳結果=N,該月份尚未月結
            bool b_IsClose_Now = false;
            if (((ArrayList)bco_Is_Close.GetChanMonthCloseStatus(ParameterList, null))[0].ToString() == "Y")
            { b_IsClose_Now = true; }
            else
            { b_IsClose_Now = false; }

            if (b_IsClose != b_IsClose_Now)//代表月結已被更動
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "月結已被更動,請重新載入編輯頁面", "1", string.Empty); }

            #endregion

            #endregion

            #region 如果基本檢查有誤,則Return

            if (arl_Return[1].ToString() != string.Empty)
            { return arl_Return; }

            #endregion

            #region 自訂檢查

            #region 檢查欄位[折讓金額(未稅)][折讓稅額][總金額]

            int i_DISC_UAMT = int.Parse(this.slp_DISC_UAMT.Text);//折讓金額(未稅)
            int i_DISC_TAX = int.Parse(this.slp_DISC_TAX.Text);//折讓稅額
            int i_DISC_AMT = int.Parse(Request[txt_DISC_AMT.UniqueID].ToString());//總金額

            if (i_DISC_UAMT < 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]不可小於0", "1", txt_DISC_UAMT.ClientID); }
            if (i_DISC_TAX < 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓稅額]不可小於0", "1", txt_DISC_TAX.ClientID); }
            if (i_DISC_AMT <= 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[總金額]不可小於或等於0", "1", txt_DISC_AMT.ClientID); }
            if (i_DISC_UAMT == 0 && i_DISC_TAX != 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]為0時,欄位[折讓稅額]也必須為0", "1", txt_DISC_TAX.ClientID); }
            if (i_DISC_UAMT + i_DISC_TAX != i_DISC_AMT)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]加上欄位[折讓稅額]必須等於欄位[總金額]", "1", txt_DISC_AMT.ClientID); }
            if (this.slp_TAX_TYPE.Text == "1" ||//[稅別]=免稅
                this.slp_TAX_TYPE.Text == "2")//[稅別]=零稅
            {
                if (i_DISC_TAX != 0)
                { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[稅別]是免稅或零稅時,欄位[折讓稅額]必須為0", "1", txt_DISC_TAX.ClientID); }
            }

            #endregion

            #region 檢查如果己月結則[折讓金額(未稅)][折讓稅額][總金額]要與原始金額相同

            if (b_IsClose == true)//該月份已月結
            {
                if (this.hid_Original_DISC_UAMT.Value.Trim() != this.slp_DISC_UAMT.Text.Trim())
                { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[結帳年月]" + this.slp_CLOSE_MONTH.Text + "該月份己月結,欄位[折讓金額(未稅)]的金額必須等於原始折讓金額(未稅)" + this.hid_Original_DISC_UAMT.Value.Trim() + "元", "1", txt_DISC_UAMT.ClientID); }
                if (this.hid_Original_DISC_TAX.Value.Trim() != this.slp_DISC_TAX.Text.Trim())
                { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[結帳年月]" + this.slp_CLOSE_MONTH.Text + "該月份己月結,欄位[折讓稅額]的金額必須等於原始折讓稅額" + this.hid_Original_DISC_TAX.Value.Trim() + "元", "1", txt_DISC_TAX.ClientID); }
                if (this.hid_Original_DISC_AMT.Value.Trim() != Request[txt_DISC_AMT.UniqueID].ToString().Trim())
                { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[結帳年月]" + this.slp_CLOSE_MONTH.Text + "該月份己月結,欄位[總金額]的金額必須等於原始折讓稅額" + this.hid_Original_DISC_AMT.Value.Trim() + "元", "1", txt_DISC_AMT.ClientID); }
            }

            #endregion

            #region 檢查下列情況如果已月結則修改後的金額必須等於原始金額

            if (b_IsClose == true)//該月份已月結
            {
                if (s_ReturnMsg == "勾選欄位[憑證已回]" ||
                    s_ReturnMsg == "取消勾選欄位[憑證已回]" ||
                    s_ReturnMsg == "取消勾選欄位[取具進項憑証]" ||
                    s_ReturnMsg == "都沒有勾")
                {
                    int i_IsClose_DISC_UAMT = 0;
                    int i_IsClose_DISC_TAX = 0;
                    int i_IsClose_DISC_AMT = 0;

                    foreach (DataRow drRow in dt_NewItem.Rows)
                    {
                        i_IsClose_DISC_UAMT += int.Parse(drRow["DISC_UAMT"].ToString());//折讓金額(未稅)
                        i_IsClose_DISC_TAX += int.Parse(drRow["DISC_TAX"].ToString());//折讓稅額
                        i_IsClose_DISC_AMT += int.Parse(drRow["DISC_AMT"].ToString());//總金額
                    }

                    if (this.hid_Original_DISC_UAMT.Value.Trim() != i_IsClose_DISC_UAMT.ToString())
                    { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[結帳年月]" + this.slp_CLOSE_MONTH.Text + "已月結,折讓項目的折讓金額(未稅):" + i_IsClose_DISC_UAMT.ToString() + "元,不等於原始折讓金額(未稅):" + this.hid_Original_DISC_UAMT.Value + "元", "1", string.Empty); }
                    if (this.hid_Original_DISC_TAX.Value.Trim() != i_IsClose_DISC_TAX.ToString())
                    { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[結帳年月]" + this.slp_CLOSE_MONTH.Text + "已月結,折讓項目的折讓稅額:" + i_IsClose_DISC_TAX.ToString() + "元,不等於原始折讓稅額:" + this.hid_Original_DISC_TAX.Value + "元", "1", string.Empty); }
                    if (this.hid_Original_DISC_AMT.Value.Trim() != i_IsClose_DISC_AMT.ToString())
                    { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[結帳年月]" + this.slp_CLOSE_MONTH.Text + "已月結,折讓項目的總金額:" + i_IsClose_DISC_AMT.ToString() + "元,不等於原始總金額:" + this.hid_Original_DISC_AMT.Value + "元", "1", string.Empty); }
                }
            }

            #endregion

            #region 檢查欄位[憑證已回]若已勾選,則欄位[憑證已回日期]為必填欄位

            if (this.chb_PROOF_FLG.Checked == true && this.slp_PROOF_DATE.Text.Trim() == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[憑證已回]若有勾選,則欄位[憑證已回日期]為必填欄位", "1", txt_PROOF_DATE.ClientID); }

            #endregion

            #region 檢查欄位[憑證已回日期]若有值,則欄位[憑證已回]或[取具進項憑証]或[取具收據]必須勾選

            if ((this.chb_PROOF_FLG.Checked == false && this.chb_REPROOF_FLG.Checked == false && this.chb_RECEIPT_FLG.Checked == false) == true &&
                this.slp_PROOF_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[憑證已回日期]若有值,則欄位[憑證已回]或[取具進項憑証]或[取具收據]必須勾選", "1", string.Empty); }

            #endregion

            #region 檢查欄位[取具進項憑証]若已勾選,則欄位[憑證已回日期]為必填欄位

            if (this.chb_REPROOF_FLG.Checked == true && this.slp_PROOF_DATE.Text == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[取具進項憑証]若已勾選,則欄位[憑證已回日期]為必填欄位", "1", txt_PROOF_DATE.ClientID); }

            #endregion

            #region 檢查欄位[取具進項憑証]若已勾選,則欄位[發票號碼/收據]為必填欄位

            if (this.chb_REPROOF_FLG.Checked == true && this.txt_REPROOF_NO.Text == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[取具進項憑証]若已勾選,則欄位[發票號碼/收據]為必填欄位", "1", this.txt_REPROOF_NO.ClientID); }

            #endregion

            #region 檢查欄位[發票號碼/收據]若有值,則欄位[取具進項憑証]必須勾選

            if (this.chb_REPROOF_FLG.Checked == false && this.txt_REPROOF_NO.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[發票號碼/收據]若有值,則欄位[取具進項憑証]必須勾選", "1", string.Empty); }

            #endregion

            #region 檢查欄位[取具收據]若已勾選,則欄位[憑證已回日期]為必填欄位

            if (this.chb_RECEIPT_FLG.Checked == true && this.slp_PROOF_DATE.Text == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[取具收據]若已勾選,則欄位[憑證已回日期]為必填欄位", "1", txt_PROOF_DATE.ClientID); }

            #endregion

            #region 檢查欄位[作廢]若已勾選,則欄位[作廢日期]為必填欄位

            if (this.chb_CANCEL_FLG.Checked == true && this.slp_CANCEL_DATE.Text.Trim() == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[作廢]若有勾選,則欄位[作廢日期]為必填欄位", "1", txt_CANCEL_DATE.ClientID); }

            #endregion

            #region 檢查[總金額][沖帳餘額],若有沖帳過,則不允許作廢

            #region 規則

            /* 20100325秀玲新增此判斷需求
             * 如果該張折讓單的[DISC_REMAIN_AMT](沖帳金額) & [DISC_AMT](總金額)金額不相符
             * 代表該張折讓單已經沖帳過,不允許作廢。*/

            #endregion

            if (this.chb_CANCEL_FLG.Checked == true || this.slp_CANCEL_DATE.Text.Trim() != string.Empty)
            {
                if (dt_Main.Rows[0]["DISC_REMAIN_AMT"].ToString() != dt_Main.Rows[0]["DISC_AMT"].ToString())
                { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "折讓單已沖帳,不允許作廢", "1", string.Empty); }
            }

            #endregion

            #region 檢查欄位[作廢日期]若有值,則欄位[作廢]必須勾選

            if (this.chb_CANCEL_FLG.Checked == false && this.slp_CANCEL_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[作廢日期]若有值,則欄位[作廢]必須勾選", "1", string.Empty); }

            #endregion

            #region 檢查欄位[轉暫收]若已勾選,則欄位[暫收日期]為必填欄位

            if (this.chb_TEMPORAL_FLG.Checked == true && this.slp_TEMPORAL_DATE.Text.Trim() == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[轉暫收]若有勾選,則欄位[暫收日期]為必填欄位", "1", txt_TEMPORAL_DATE.ClientID); }

            #endregion

            #region 檢查欄位[暫收日期]若有值,則欄位[轉暫收]必須勾選

            if (this.chb_TEMPORAL_FLG.Checked == false && this.slp_TEMPORAL_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[暫收日期]若有值,則欄位[轉暫收]必須勾選", "1", string.Empty); }

            #endregion

            #region 檢查欄位[憑證已回][取具進項憑証][取具收據]三個欄位只能擇一勾選

            int i_Check_Count = 0;

            i_Check_Count += this.chb_PROOF_FLG.Checked == true ? 1 : 0;//憑證已回
            i_Check_Count += this.chb_REPROOF_FLG.Checked == true ? 1 : 0;//取具進項憑証
            i_Check_Count += this.chb_RECEIPT_FLG.Checked == true ? 1 : 0;//取具收據

            if (i_Check_Count > 1)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[憑證已回][取具進項憑証][取具收據]三個欄位只能擇一勾選", "1", string.Empty); }

            #endregion

            #region 檢查欄位[取具收據]如果有勾選,則欄位[折讓稅額]必須為0

            if (this.chb_RECEIPT_FLG.Checked == true &&
                this.slp_DISC_TAX.Text != "0")
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[取具收據]如果有勾選,則欄位[折讓稅額]必須為0", "1", this.slp_DISC_TAX.TextBox_Code.ClientID); }

            #endregion

            #endregion
        }

        #endregion

        #endregion

        #region BUTTON [折讓開立]鈕

        else if (s_Type == "BUTTON [折讓開立]鈕")
        {
            #region 檢查欄位的Byte長度

            if (CAAComm.Get_Byte_Length(this.txt_ACT_DISC_NO.Text) > 13)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[財會折讓單號]長度不可大於 13 Byte", "1", this.txt_ACT_DISC_NO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_REPROOF_NO.Text) > 12)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[發票號碼/收據]長度不可大於 12 Byte", "1", this.txt_REPROOF_NO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_RFNO.Text) > 10)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[統一編號]長度不可大於 10 Byte", "1", this.txt_RFNO.ClientID); }
            if (CAAComm.Get_Byte_Length(this.txt_MEMO.Text) > 200)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[備註]長度不可大於 200 Byte", "1", this.txt_MEMO.ClientID); }

            #endregion

            #region 檢查SLP日期格式

            arl_Return = CAAComm.Check_Format_Date(this.slp_DISC_DATE.Text, "欄位[折讓日期]日期格式錯誤", "1", txt_DISC_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_CHG_DISC_DATE.Text, "欄位[異動折讓日期]日期格式錯誤", "1", txt_DISC_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_PROOF_DATE.Text, "欄位[憑證已回日期]日期格式錯誤", "1", txt_PROOF_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_CANCEL_DATE.Text, "欄位[作廢日期]日期格式錯誤", "1", txt_CANCEL_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_PERIOD_DATE.Text, "欄位[申報日期]日期格式錯誤", "1", txt_PERIOD_DATE.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Date(this.slp_TEMPORAL_DATE.Text, "欄位[暫收日期]日期格式錯誤", "1", txt_TEMPORAL_DATE.ClientID, arl_Return);

            #endregion

            #region 檢查SLP數字格式

            arl_Return = CAAComm.Check_Format_Int(this.slp_DISC_UAMT.Text, "欄位[折讓金額(未稅)]數字格式錯誤", "32", "1", txt_DISC_UAMT.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(this.slp_DISC_TAX.Text, "欄位[折讓稅額]數字格式錯誤", "32", "1", txt_DISC_TAX.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(Request[txt_DISC_AMT.UniqueID].ToString(), "欄位[總金額]數字格式錯誤", "32", "1", txt_DISC_AMT.ClientID, arl_Return);

            #endregion

            #region 檢查SLP年月格式

            arl_Return = CAAComm.Check_Format_YearMonth(this.slp_CLOSE_MONTH.Text, "欄位[結帳年月]年月格式錯誤", "1", txt_CLOSE_MONTH.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_YearMonth(this.slp_CLOSE_MONTH_ACCT.Text, "欄位[結帳年月-財會]年月格式錯誤", "1", this.slp_CLOSE_MONTH_ACCT.TextBoxCode_Object.ClientID, arl_Return);

            #endregion

            #region 檢查必填欄位

            arl_Return = CAAComm.Check_MustFillin_Column(drop_DISC_SOURCE.SelectedIndex.ToString(), "drop", "欄位[來源]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_STORE_ID.Text, "text", "欄位[店號]為必填欄位", "1", txt_STORE_ID.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(drop_DISC_TYPE.SelectedIndex.ToString(), "drop", "欄位[型式]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(drop_TAX_TYPE.SelectedIndex.ToString(), "drop", "欄位[稅別]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_ROOT_NO.Text, "text", "欄位[商品群分類]為必填欄位", "1", txt_ROOT_NO.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_CLOSE_MONTH.Text, "text", "欄位[結帳年月]為必填欄位", "1", txt_CLOSE_MONTH.ClientID, arl_Return);

            #endregion

            #region 如果基本檢查有誤,則Return

            if (arl_Return[1].ToString() != string.Empty)
            { return arl_Return; }

            #endregion

            #region 自訂檢查

            #region 新增模式下欄位[來源]必須是選擇人工開立

            if (this.slp_DISC_SOURCE.Text != "2")//2代表是人工開立
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[來源]必須是選擇人工開立", "1", drop_DISC_SOURCE.ClientID); }

            #endregion

            #region 新增模式下欄位[作廢]不能勾選

            if (this.chb_CANCEL_FLG.Checked == true)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[作廢]不能勾選", "1", chb_CANCEL_FLG.ClientID); }

            #endregion

            #region 新增模式下欄位[作廢日期]必須為空白

            if (this.slp_CANCEL_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[作廢日期]必須為空白", "1", txt_CANCEL_DATE.ClientID); }

            #endregion

            #region 新增模式下欄位[申報]不能勾選

            if (this.chb_PERIOD_FLG.Checked == true)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[申報]不能勾選", "1", chb_PERIOD_FLG.ClientID); }

            #endregion

            #region 新增模式下欄位[申報日期]必須為空白

            if (this.slp_PERIOD_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[申報日期]必須為空白", "1", txt_PERIOD_DATE.ClientID); }

            #endregion

            #region 新增模式下欄位[轉暫收]不能勾選

            if (this.chb_TEMPORAL_FLG.Checked == true)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[轉暫收]不能勾選", "1", chb_TEMPORAL_FLG.ClientID); }

            #endregion

            #region 新增模式下欄位[暫收日期]必須為空白

            if (this.slp_TEMPORAL_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "新增模式下欄位[暫收日期]必須為空白", "1", txt_TEMPORAL_DATE.ClientID); }

            #endregion

            #region 檢查若己月結則不允許新增

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH.Text, "string", false));//[結帳年月]
            ParameterList.Add(CAAComm.GetValueSetParameter("CAA18", "string", false)); //V_FUNC_NO

            #endregion

            #region 連結資料庫

            BCO.ChanMonthCloseYN bco_Is_Close = new BCO.ChanMonthCloseYN(ConntionDB);

            #endregion

            #region 檢查回傳資料

            //回傳結果=Y,該月份已月結
            //回傳結果=N,該月份尚未月結
            if (((ArrayList)bco_Is_Close.GetChanMonthCloseStatus(ParameterList, null))[0].ToString() == "Y")
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[結帳年月]該月份已月結", "1", txt_CLOSE_MONTH.ClientID); }

            #endregion

            #endregion

            #region 檢查欄位[憑證已回]若已勾選,則欄位[憑證已回日期]為必填欄位

            if (this.chb_PROOF_FLG.Checked == true && this.slp_PROOF_DATE.Text.Trim() == string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[憑證已回]若有勾選,則欄位[憑證已回日期]為必填欄位", "1", txt_PROOF_DATE.ClientID); }

            #endregion

            #region 檢查欄位[憑證已回日期]若有值,則欄位[憑證已回]或[取具進項憑証]必須勾選

            if ((this.chb_PROOF_FLG.Checked == false && this.chb_REPROOF_FLG.Checked == false) == true
                && this.slp_PROOF_DATE.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[憑證已回日期]若有值,則欄位[憑證已回]或[取具進項憑証]必須勾選", "1", string.Empty); }

            #endregion

            #region 檢查欄位[取具進項憑証]若已勾選,則不允許按[折讓開立]鈕

            if (this.chb_REPROOF_FLG.Checked == true)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[取具進項憑証]若已勾選,則不允許按[折讓開立]鈕", "1", string.Empty); }

            #endregion

            #region 檢查欄位[發票號碼/收據]若有值,則欄位[取具進項憑証]必須勾選

            if (this.chb_REPROOF_FLG.Checked == false && this.txt_REPROOF_NO.Text.Trim() != string.Empty)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[發票號碼/收據]若有值,則欄位[取具進項憑証]必須勾選", "1", string.Empty); }

            #endregion

            #endregion
        }

        #endregion

        #region 折讓項目 BUTTON [確認]鈕

        else if (s_Type == "折讓項目 BUTTON [確認]鈕")
        {
            #region 檢查SLP日期格式

            arl_Return = CAAComm.Check_Format_Date(this.slp_Disc_INV_DATE.Text, "欄位[發票日期]日期格式錯誤", "1", txt_Disc_INV_DATE.ClientID, arl_Return);

            #endregion

            #region 檢查SLP數字格式

            arl_Return = CAAComm.Check_Format_Int(this.slp_Disc_DISC_UAMT.Text, "欄位[折讓金額(未稅)]數字格式錯誤", "32", "1", txt_Disc_DISC_UAMT.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(Request[txt_Disc_DISC_TAX.UniqueID].ToString(), "欄位[折讓稅額]數字格式錯誤", "32", "1", txt_Disc_DISC_TAX.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(this.slp_Disc_NON_INV_UAMT.Text, "欄位[發票餘額(未稅)]數字格式錯誤", "32", "1", txt_Disc_NON_INV_UAMT.ClientID, arl_Return);
            arl_Return = CAAComm.Check_Format_Int(this.slp_Disc_NON_INV_TAX.Text, "欄位[發票稅額]數字格式錯誤", "32", "1", txt_Disc_NON_INV_TAX.ClientID, arl_Return);

            #endregion

            #region 檢查必填欄位

            arl_Return = CAAComm.Check_MustFillin_Column(this.txt_Disc_INV_NO.Text, "text", "欄位[發票號碼]為必填欄位", "1", this.txt_Disc_INV_NO.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_Disc_DISC_UAMT.Text, "text", "欄位[折讓金額(未稅)]為必填欄位", "1", txt_Disc_DISC_UAMT.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(Request[txt_Disc_DISC_TAX.UniqueID].ToString(), "text", "欄位[折讓稅額]為必填欄位", "1", txt_Disc_DISC_TAX.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_Disc_NON_INV_UAMT.Text, "text", "欄位[發票餘額(未稅)]為必填欄位", "1", txt_Disc_NON_INV_UAMT.ClientID, arl_Return);
            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_Disc_NON_INV_TAX.Text, "text", "欄位[發票稅額]為必填欄位", "1", txt_Disc_NON_INV_TAX.ClientID, arl_Return);

            #endregion

            #region 如果基本檢查有誤,則Return

            if (arl_Return[1].ToString() != string.Empty)
            { return arl_Return; }

            #endregion

            #region 自訂檢查

            int i_Disc_DISC_UAMT = int.Parse(this.slp_Disc_DISC_UAMT.Text);//折讓金額(未稅)
            int i_Disc_DISC_TAX = int.Parse(Request[txt_Disc_DISC_TAX.UniqueID].ToString());//折讓稅額
            int i_Total_NON_INV_UAMT = int.Parse(this.hid_Disc_Total_NON_INV_UAMT.Value);//發票餘額(未稅)+折讓金額(未稅)
            int i_Total_NON_INV_TAX = int.Parse(this.hid_Disc_Total_NON_INV_TAX.Value);//發票稅額+折讓稅額

            if (i_Disc_DISC_UAMT < 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]不可小於0", "1", txt_Disc_DISC_UAMT.ClientID); }
            if (i_Disc_DISC_TAX < 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓稅額]不可小於0", "1", txt_Disc_DISC_TAX.ClientID); }
            if (i_Disc_DISC_UAMT == 0 && i_Disc_DISC_TAX != 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]為0時,欄位[折讓稅額]也必須為0", "1", txt_Disc_DISC_TAX.ClientID); }
            if (i_Disc_DISC_UAMT > i_Total_NON_INV_UAMT)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓金額(未稅)]不得大於[發票餘額(未稅)]", "1", txt_Disc_DISC_UAMT.ClientID); }
            if (i_Disc_DISC_TAX > i_Total_NON_INV_TAX)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折讓稅額]不得大於[發票稅額]", "1", txt_Disc_DISC_TAX.ClientID); }
            if (this.slp_TAX_TYPE.Text == "1" ||//[稅別]=免稅
                this.slp_TAX_TYPE.Text == "2")//[稅別]=零稅
            {
                if (i_Disc_DISC_TAX != 0)
                { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[稅別]是免稅或零稅時,欄位[折讓稅額]必須為0", "1", txt_Disc_DISC_TAX.ClientID); }
            }

            #endregion
        }

        #endregion

        return arl_Return;
    }
Example #18
0
    /// <summary>
    /// 編輯模式下的[儲存]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ButtonModify_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();
            ArrayList arl_Check_Condition = Check_Condition(ViewState["Mode"].ToString());

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAA142", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            DataTable dt;
            CAAModel.MaintainTempRecord BCO = new CAAModel.MaintainTempRecord(ConntionDB);

            ParameterList.Clear();
            ParameterList.Add(txtTEMP_NO.Text.Trim());              /// 0.TEMP_NO = @暫收單號

            if ((ddlSOURCE_TYPE.SelectedValue == "4") && (this.SLP_SUM_TEMP.Text == "0"))
            {
                ParameterList.Add(SLP_STORE_ID.Text.Trim());             /// 1.STORE_ID = @客戶店號      
                ParameterList.Add(SLP_ROOT_NO.Text.Trim());              /// 2.ROOT_NO = @商品群分類                
                ParameterList.Add(ddlTaxType.SelectedValue);             /// 3.TAX_TYPE = @稅別
                ParameterList.Add(SLP_TEMPAMT.Text.Replace(",", ""));    /// 4.TEMP_AMT = @暫收金額      
                SLP_REMAIN_AMT.Text = SLP_TEMPAMT.Text;
                ParameterList.Add(SLP_REMAIN_AMT.Text.Replace(",", "")); /// 5.TEMP_REMAIN_AMT = @暫收餘額        
            }
            else
            {
                ParameterList.Add("");            /// 1.STORE_ID = @客戶店號      
                ParameterList.Add("");            /// 2.ROOT_NO = @商品群分類                
                ParameterList.Add("");            /// 3.TAX_TYPE = @稅別
                ParameterList.Add("");            /// 4.TEMP_AMT = @暫收金額                
                ParameterList.Add("");            /// 5.TEMP_REMAIN_AMT = @暫收餘額        
            }
            ParameterList.Add(txtMEMO.Text.Trim());                 /// 6.MEMO = @備註    
            if (rblCHG_INCOME_TYPE.Enabled == true)
            {
                //與秀玲確認過
                //如果欄位[轉其他收入]選擇[是],則欄位[轉其他收入日期]
                //有輸入就依照輸入的日期,沒輸入就放系統日
                //如果欄位[轉其他收入]選擇[否],則欄位[轉其他收入日期]
                //不管有沒有輸入,都當作null值
                if (rblCHG_INCOME_TYPE.SelectedValue == "1")//是
                {
                    ParameterList.Add(rblCHG_INCOME_TYPE.SelectedValue);    /// 7.CHG_INCOME_TYPE = @轉其它收入選項             
                    if (this.SLP_CHG_INCOME_DATE.Text == string.Empty)
                    { ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd")); }
                    else
                    { ParameterList.Add(this.SLP_CHG_INCOME_DATE.Text); }/// (12) 轉其它收入日期	= CHG_INCOME_DATE
                }
                else
                {
                    ParameterList.Add(string.Empty);    /// 7.CHG_INCOME_TYPE = @轉其它收入選項             
                    ParameterList.Add(string.Empty);    /// 8.CHG_INCOME_DATE = @轉其它收入日期     
                }
            }
            else
            {
                ParameterList.Add("");    /// 7.CHG_INCOME_TYPE = @轉其它收入選項             
                ParameterList.Add("");    /// 8.CHG_INCOME_DATE = @轉其它收入日期     
            }
            ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); /// 8.UPDATEDATE = (系統抓取目前AP機器之時間)
            ParameterList.Add(Session["UID"].ToString());           ///9.UPDATEUID = 登入系統之使用者ID
            ParameterList.Add(hdf_Old_UpdateDate.Value);                   ///10.原始抓資料時的UPDATEDATE
            ParameterList.Add(hdf_Old_UpdateUID.Value);                    ///11.原始抓資料時的UPDATEUID
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_TEMP_DATE.Text, "date", false));//12.欄位[暫收日期]

            string TEMP_NO = "";
            string ID = "";
            int iResult = BCO.UpdateTempRecord(ParameterList, DBT);
            if (iResult == 0)
                ErrorMsgLabel.Text = "資料更新失敗:可能是已不存在或資料已被異動過";
            else
                if (ViewState["TEMP_NO"] != null)
                {
                    if (ViewState["SSID"] != null)
                        Response.Redirect("CAA142.aspx?Code=CAA14&Mode=View&TEMP_NO=" + txtTEMP_NO.Text.Trim() + "&SSID=" + ViewState["SSID"].ToString(), false);
                    else
                        Response.Redirect("CAA142.aspx?Code=CAA14&Mode=View&TEMP_NO=" + txtTEMP_NO.Text.Trim() + "&SSID=", false);
                }

        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #19
0
    /// <summary>
    /// 設定頁面狀態
    /// </summary>
    /// <param name="s_PageStatus"></param>
    private void Set_PageDefault(string s_PageStatus)
    {
        #region 清空變數

        if (dt_NewItem != null)
        { dt_NewItem.Clear(); }

        #endregion

        #region 將AP的時間寫入暫存欄位

        this.hid_Ap_Time.Value = DateTime.Now.ToString("yyyy/MM/dd");

        #endregion

        #region 新增狀態

        if (s_PageStatus == "insert")
        {
            #region 設定AutoPostBack

            this.chb_REPROOF_FLG.AutoPostBack = true;//取具進項憑証
            this.chb_RECEIPT_FLG.AutoPostBack = true;//取具收據

            #endregion

            #region 折讓項目

            this.panel_Disc_NewItem.Visible = false;
            this.but_Disc_NewItem.Enabled = false;

            #endregion

            #region 銷貨折讓維護區控制項

            this.txt_DISC_NO.ReadOnly = true;//折讓單號
            this.txt_DISC_NO.CssClass = "readtxtbox";
            this.slp_DISC_SOURCE.ReadOnly = true;//來源
            this.slp_GROUP_NO.ReadOnly = true;//店群
            this.slp_Z_O.ReadOnly = true;//營業所
            this.slp_SAL_ID.ReadOnly = true;//營業人員
            this.slp_AC_UID.ReadOnly = true;//帳務人員
            this.slp_DISC_DATE.ReadOnly = true;//折讓日期
            this.chb_CANCEL_FLG.Enabled = false;//作廢
            this.slp_CANCEL_DATE.ReadOnly = true;//作廢日期
            this.chb_PERIOD_FLG.Enabled = false;//申報
            this.slp_PERIOD_DATE.ReadOnly = true;//申報日期
            this.chb_TEMPORAL_FLG.Enabled = false;//轉暫收
            this.slp_TEMPORAL_DATE.ReadOnly = true;//暫收日期
            this.txt_PAY_RFNO.ReadOnly = true;//結帳統編
            this.txt_PAY_RFNO.CssClass = "readtxtbox";
            this.txt_RFNO.ReadOnly = true;//統一編號
            this.txt_RFNO.CssClass = "readtxtbox";
            this.txt_TITLE.ReadOnly = true;//發票抬頭
            this.txt_TITLE.CssClass = "readtxtbox";
            this.txt_INV_ADDR.ReadOnly = true;//地址
            this.txt_INV_ADDR.CssClass = "readtxtbox";
            this.slp_DISC_UAMT.ReadOnly = true;//折讓金額(未稅)
            this.slp_DISC_TAX.ReadOnly = true;//折讓稅額
            this.slp_DISC_AMT.ReadOnly = true;//總金額
            this.slp_CLOSE_MONTH_ACCT.ReadOnly = true;//結帳年月-財會

            //20110512 rika insert
            this.slp_DISC_REMAIN_AMT.ReadOnly = true;//折讓餘額
            this.slp_DISC_WASH_AMT.ReadOnly = true;//累積沖帳金額
            this.slp_PERIOD_MONTH.ReadOnly = true;//申報期別

            #endregion

            #region 設定 BUTTON 狀態

            this.but_GetDiscInv.Visible = true;
            this.but_Save.Visible = true;
            this.but_Edit.Visible = false;
            this.but_Cancel.Visible = true;

            #endregion

            #region 設定控制項預設值

            this.txt_DISC_NO.Text = string.Empty;//折讓單號
            this.slp_DISC_FORM.Text = "1";//格式代號
            this.slp_DISC_SOURCE.Text = "2";//來源(預設人工開立)
            this.slp_GROUP_NO.Text = string.Empty;//店群
            this.slp_STORE_ID.Text = string.Empty;//店號
            this.slp_Z_O.Text = string.Empty;//營業所
            this.slp_DISC_TYPE.Text = "01";//型式(預設一般)
            this.slp_ROOT_NO.Text = string.Empty;//商品群分類
            this.slp_TAX_TYPE.Text = string.Empty;//稅別
            this.slp_SAL_ID.Text = string.Empty;//營業人員
            this.slp_AC_UID.Text = string.Empty;//帳務人員
            this.slp_DISC_DATE.Text = DateTime.Now.ToString("yyyy/MM/dd");//折讓日期(預設給AP的時間)
            this.txt_ACT_DISC_NO.Text = string.Empty;//財會折讓單號
            this.slp_CHG_DISC_DATE.Text = string.Empty;//異動折讓日期
            this.chb_PROOF_FLG.Checked = false;//憑證已回
            this.slp_PROOF_DATE.Text = string.Empty;//憑證已回日期
            this.chb_REPROOF_FLG.Checked = false;//取具進項憑証
            this.txt_REPROOF_NO.Text = string.Empty;//發票號碼/收據
            this.chb_RECEIPT_FLG.Checked = false;//取具收據
            this.chb_CANCEL_FLG.Checked = false;//作廢
            this.slp_CANCEL_DATE.Text = string.Empty;//作廢日期
            this.chb_PERIOD_FLG.Checked = false;//申報
            this.slp_PERIOD_DATE.Text = string.Empty;//申報日期
            this.chb_TEMPORAL_FLG.Checked = false;//轉暫收
            this.slp_TEMPORAL_DATE.Text = string.Empty;//暫收日期
            this.txt_PAY_RFNO.Text = string.Empty;//結帳統編
            this.txt_RFNO.Text = string.Empty;//統一編號
            this.txt_TITLE.Text = string.Empty;//發票抬頭
            this.txt_INV_ADDR.Text = string.Empty;//地址
            this.slp_DISC_UAMT.Text = string.Empty;//折讓金額(未稅)
            this.slp_DISC_TAX.Text = string.Empty;//折讓稅額
            this.slp_DISC_AMT.Text = string.Empty;//總金額
            this.slp_CLOSE_MONTH.Text = DateTime.Now.ToString("yyyyMM");//結帳年月,20100315秀玲新增需求預設值設定為系統年月。
            this.txt_MEMO.Text = string.Empty;//備註
            this.slp_CLOSE_MONTH_ACCT.Text = string.Empty;//結帳年月-財會
            this.hid_Record_Date.Value = String.Empty;//履歷時間

            //20110512 rika insert
            this.slp_DISC_REMAIN_AMT.Text = string.Empty;//折讓餘額
            this.slp_DISC_WASH_AMT.Text = string.Empty;//累積沖帳金額
            this.slp_PERIOD_MONTH.Text = string.Empty;//申報期別

            #endregion

            #region 取得折讓稅額

            BCO.CAACommon CAAComm = new BCO.CAACommon();
            BCO.CAAPublic CAAPub = new BCO.CAAPublic(ConntionDB);

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));
            this.hid_TaxRate.Value = CAAPub.GET_TAXRATE(ParameterList).ToString();

            #endregion
        }

        #endregion

        #region 檢視狀態

        else if (s_PageStatus == "view")
        {
            #region 折讓項目

            this.panel_Disc_NewItem.Visible = false;
            this.but_Disc_NewItem.Visible = false;

            #endregion

            #region 銷貨折讓維護區控制項

            this.txt_DISC_NO.ReadOnly = true;//折讓單號
            this.txt_DISC_NO.CssClass = "readtxtbox";
            this.slp_DISC_FORM.ReadOnly = true;//格式代號
            this.slp_DISC_SOURCE.ReadOnly = true;//來源
            this.slp_GROUP_NO.ReadOnly = true;//店群
            this.slp_STORE_ID.ReadOnly = true;//店號
            this.slp_Z_O.ReadOnly = true;//營業所
            this.slp_DISC_TYPE.ReadOnly = true;//型式
            this.slp_ROOT_NO.ReadOnly = true;//商品群分類
            this.slp_TAX_TYPE.ReadOnly = true;//稅別
            this.slp_SAL_ID.ReadOnly = true;//營業人員
            this.slp_AC_UID.ReadOnly = true;//帳務人員
            this.slp_DISC_DATE.ReadOnly = true;//折讓日期
            this.txt_ACT_DISC_NO.ReadOnly = true;//財會折讓單號
            this.txt_ACT_DISC_NO.CssClass = "readtxtbox";
            this.slp_CHG_DISC_DATE.ReadOnly = true;//異動折讓日期
            this.chb_PROOF_FLG.Enabled = false;//憑證已回
            this.slp_PROOF_DATE.ReadOnly = true;//憑證已回日期
            this.chb_REPROOF_FLG.Enabled = false;//取具進項憑証
            this.txt_REPROOF_NO.ReadOnly = true;//發票號碼/收據
            this.txt_REPROOF_NO.CssClass = "readtxtbox";
            this.chb_RECEIPT_FLG.Enabled = false;//取具收據
            this.chb_CANCEL_FLG.Enabled = false;//作廢
            this.slp_CANCEL_DATE.ReadOnly = true;//作廢日期
            this.chb_PERIOD_FLG.Enabled = false;//申報
            this.slp_PERIOD_DATE.ReadOnly = true;//申報日期
            this.chb_TEMPORAL_FLG.Enabled = false;//轉暫收
            this.slp_TEMPORAL_DATE.ReadOnly = true;//暫收日期
            this.txt_PAY_RFNO.ReadOnly = true;//結帳統編
            this.txt_PAY_RFNO.CssClass = "readtxtbox";
            this.txt_RFNO.ReadOnly = true;//統一編號
            this.txt_RFNO.CssClass = "readtxtbox";
            this.txt_TITLE.ReadOnly = true;//發票抬頭
            this.txt_TITLE.CssClass = "readtxtbox";
            this.txt_INV_ADDR.ReadOnly = true;//地址
            this.txt_INV_ADDR.CssClass = "readtxtbox";
            this.slp_DISC_UAMT.ReadOnly = true;//折讓金額(未稅)
            this.slp_DISC_TAX.ReadOnly = true;//折讓稅額
            this.slp_DISC_AMT.ReadOnly = true;//總金額
            this.slp_CLOSE_MONTH.ReadOnly = true;//結帳年月
            this.txt_MEMO.ReadOnly = true;//備註
            this.txt_MEMO.CssClass = "readtxtbox";
            this.slp_CLOSE_MONTH_ACCT.ReadOnly = true;//結帳年月-財會

            //20110512 rika insert
            this.slp_DISC_REMAIN_AMT.ReadOnly = true;//折讓餘額
            this.slp_DISC_WASH_AMT.ReadOnly = true;//累積沖帳金額
            this.slp_PERIOD_MONTH.ReadOnly = true;//申報期別


            #endregion

            #region 設定 BUTTON 狀態

            this.but_GetDiscInv.Visible = false;
            this.but_Save.Visible = false;
            this.but_Edit.Visible = true;
            this.but_Cancel.Visible = true;

            #endregion

            #region 將值寫入控制項

            string s_DISC_NO = Request["CAA182_DISC_NO"].ToString();
            Get_PageDataMainAndDetl(s_DISC_NO);

            #endregion
        }

        #endregion

        #region 編輯狀態

        else if (s_PageStatus == "edit")
        {
            #region 設定AutoPostBack

            this.chb_REPROOF_FLG.AutoPostBack = true;//取具進項憑証
            this.chb_RECEIPT_FLG.AutoPostBack = true;//取具收據
            this.chb_CANCEL_FLG.AutoPostBack = true;//作廢

            #endregion

            #region 折讓項目

            this.panel_Disc_NewItem.Visible = false;
            this.but_Disc_NewItem.Visible = true;

            #endregion

            #region 銷貨折讓維護區控制項

            this.txt_DISC_NO.ReadOnly = true;//折讓單號
            this.txt_DISC_NO.CssClass = "readtxtbox";
            this.slp_DISC_FORM.ReadOnly = true;//格式代號
            this.slp_DISC_SOURCE.ReadOnly = true;//來源
            this.slp_GROUP_NO.ReadOnly = true;//店群
            this.slp_STORE_ID.ReadOnly = true;//店號
            this.slp_Z_O.ReadOnly = true;//營業所
            this.slp_DISC_TYPE.ReadOnly = true;//型式
            this.slp_ROOT_NO.ReadOnly = true;//商品群分類
            this.slp_TAX_TYPE.ReadOnly = true;//稅別
            this.slp_SAL_ID.ReadOnly = true;//營業人員
            this.slp_AC_UID.ReadOnly = true;//帳務人員
            this.slp_DISC_DATE.ReadOnly = true;//折讓日期
            this.txt_ACT_DISC_NO.ReadOnly = true;//財會折讓單號
            this.txt_ACT_DISC_NO.CssClass = "readtxtbox";
            this.slp_CHG_DISC_DATE.ReadOnly = true;//異動折讓日期
            this.chb_PROOF_FLG.Enabled = false;//憑證已回
            this.slp_PROOF_DATE.ReadOnly = true;//憑證已回日期
            this.chb_REPROOF_FLG.Enabled = false;//取具進項憑証
            this.txt_REPROOF_NO.ReadOnly = true;//發票號碼/收據
            this.txt_REPROOF_NO.CssClass = "readtxtbox";
            this.chb_RECEIPT_FLG.Enabled = false;//取具收據
            this.chb_CANCEL_FLG.Enabled = false;//作廢
            this.slp_CANCEL_DATE.ReadOnly = true;//作廢日期
            this.chb_PERIOD_FLG.Enabled = false;//申報
            this.slp_PERIOD_DATE.ReadOnly = true;//申報日期
            this.chb_TEMPORAL_FLG.Enabled = false;//轉暫收
            this.slp_TEMPORAL_DATE.ReadOnly = true;//暫收日期
            this.txt_PAY_RFNO.ReadOnly = true;//結帳統編
            this.txt_PAY_RFNO.CssClass = "readtxtbox";
            this.txt_RFNO.ReadOnly = true;//統一編號
            this.txt_RFNO.CssClass = "readtxtbox";
            this.txt_TITLE.ReadOnly = true;//發票抬頭
            this.txt_TITLE.CssClass = "readtxtbox";
            this.txt_INV_ADDR.ReadOnly = true;//地址
            this.txt_INV_ADDR.CssClass = "readtxtbox";
            this.slp_DISC_UAMT.ReadOnly = true;//折讓金額(未稅)
            this.slp_DISC_TAX.ReadOnly = true;//折讓稅額
            this.slp_DISC_AMT.ReadOnly = true;//總金額
            this.slp_CLOSE_MONTH.ReadOnly = true;//結帳年月
            this.txt_MEMO.ReadOnly = true;//備註
            this.txt_MEMO.CssClass = "readtxtbox";
            this.slp_CLOSE_MONTH_ACCT.ReadOnly = true;//結帳年月-財會

            //20110512 rika insert
            this.slp_DISC_REMAIN_AMT.ReadOnly = true;//折讓餘額
            this.slp_DISC_WASH_AMT.ReadOnly = true;//累積沖帳金額
            this.slp_PERIOD_MONTH.ReadOnly = true;//申報期別


            #endregion

            #region 設定 BUTTON 狀態

            this.but_GetDiscInv.Visible = false;
            this.but_Save.Visible = true;
            this.but_Edit.Visible = false;
            this.but_Cancel.Visible = true;

            #endregion

            #region 將值寫入控制項

            string s_DISC_NO = Request["CAA182_DISC_NO"].ToString();
            Get_PageDataMainAndDetl(s_DISC_NO);

            #endregion

            #region 依照資料,更改控制項狀態

            #region 規則 20100310 秀玲異動需求

            /* (1)CAA18 於檢視模式下至編輯模式時,先檢查[總金額(DISC_AMT)][沖帳餘額(DISC_REMAIN_AMT)]是否相同
             *    (1.1)如果相同,則原本是怎麼做就照舊。
             *    (1.2)如果不相同,判斷是否有[轉暫收]
             *         (1.2.1)欄位[申報][轉暫收][作廢]都沒有勾選([轉暫收]open,[備註]open,[新增項目]鈕close,其他欄位都是唯讀)。
             *         (1.2.2)欄位[申報][轉暫收]都有勾選([備註]open,[新增項目]鈕close,其他欄位都是唯讀)。
             *         (1.2.3)欄位[申報][作廢]都有勾選([備註]open,[新增項目]鈕close,其他欄位都是唯讀)。
             *         (1.2.4)只有欄位[申報]有勾選([轉暫收]open,[備註]open,[新增項目]鈕close,其他欄位都是唯讀)。
             *         (1.2.5)只有欄位[轉暫收]有勾選([備註]open,[新增項目]鈕close,其他欄位都是唯讀)。
             *         (1.2.6)只有欄位[作廢]有勾選([備註]open,[新增項目]鈕close,其他欄位都是唯讀)。
             */

            #endregion

            BCO.CAACommon CAAComm = new BCO.CAACommon();

            #region [總金額(DISC_AMT)][沖帳餘額(DISC_REMAIN_AMT)]相同,代表尚未沖帳

            if (dt_Main.Rows[0]["DISC_REMAIN_AMT"].ToString() == dt_Main.Rows[0]["DISC_AMT"].ToString())
            {
                #region 欄位[申報][轉暫收][作廢]都沒有勾選

                if (this.chb_PERIOD_FLG.Checked == false &&//申報
                    this.chb_TEMPORAL_FLG.Checked == false &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == false)//作廢
                {
                    this.slp_DISC_TYPE.ReadOnly = false;//型式
                    this.txt_ACT_DISC_NO.ReadOnly = false;//財會折讓單號
                    this.txt_ACT_DISC_NO.CssClass = string.Empty;
                    this.slp_CHG_DISC_DATE.ReadOnly = false;//異動折讓日期
                    this.chb_PROOF_FLG.Enabled = true;//憑證已回
                    this.slp_PROOF_DATE.ReadOnly = false;//憑證已回日期
                    this.chb_REPROOF_FLG.Enabled = true;//取具進項憑証
                    this.txt_REPROOF_NO.ReadOnly = false;//發票號碼/收據
                    this.txt_REPROOF_NO.CssClass = string.Empty;
                    this.chb_RECEIPT_FLG.Enabled = true;//取具收據
                    this.chb_CANCEL_FLG.Enabled = true;//作廢
                    this.slp_CANCEL_DATE.ReadOnly = false;//作廢日期
                    this.chb_TEMPORAL_FLG.Enabled = true;//轉暫收
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;

                    //[取具進項憑証]或[取具收據]其中之一有勾選
                    if (this.chb_REPROOF_FLG.Checked == true ||
                        this.chb_RECEIPT_FLG.Checked == true)
                    {
                        this.slp_DISC_UAMT.ReadOnly = false;//折讓金額(未稅)
                        this.slp_DISC_TAX.ReadOnly = false;//折讓稅額
                        this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                    }
                    else
                    { this.but_Disc_NewItem.Enabled = true; }//新增項目鈕
                }

                #endregion

                #region 欄位[申報][轉暫收]都有勾選

                else if (this.chb_PERIOD_FLG.Checked == true &&//申報
                         this.chb_TEMPORAL_FLG.Checked == true &&//轉暫收
                         this.chb_CANCEL_FLG.Checked == false)//作廢
                {
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 欄位[申報][作廢]都有勾選

                else if (this.chb_PERIOD_FLG.Checked == true &&//申報
                    this.chb_TEMPORAL_FLG.Checked == false &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == true)//作廢
                {
                    this.slp_CANCEL_DATE.ReadOnly = false;//作廢日期
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 只有欄位[申報]有勾選

                if (this.chb_PERIOD_FLG.Checked == true &&//申報
                    this.chb_TEMPORAL_FLG.Checked == false &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == false)//作廢
                {
                    this.chb_TEMPORAL_FLG.Enabled = true;//轉暫收
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 只有欄位[轉暫收]有勾選

                if (this.chb_PERIOD_FLG.Checked == false &&//申報
                    this.chb_TEMPORAL_FLG.Checked == true &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == false)//作廢
                {
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 只有欄位[作廢]有勾選

                if (this.chb_PERIOD_FLG.Checked == false &&//申報
                    this.chb_TEMPORAL_FLG.Checked == false &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == true)//作廢
                {
                    this.slp_CANCEL_DATE.ReadOnly = false;//作廢日期
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion
            }

            #endregion

            #region [總金額(DISC_AMT)][沖帳餘額(DISC_REMAIN_AMT)]不相同,代表已沖帳

            else
            {
                #region 欄位[申報][轉暫收][作廢]都沒有勾選

                if (this.chb_PERIOD_FLG.Checked == false &&//申報
                    this.chb_TEMPORAL_FLG.Checked == false &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == false)//作廢
                {
                    this.chb_TEMPORAL_FLG.Enabled = true;//轉暫收
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 欄位[申報][轉暫收]都有勾選

                else if (this.chb_PERIOD_FLG.Checked == true &&//申報
                         this.chb_TEMPORAL_FLG.Checked == true &&//轉暫收
                         this.chb_CANCEL_FLG.Checked == false)//作廢
                {
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 欄位[申報][作廢]都有勾選

                else if (this.chb_PERIOD_FLG.Checked == true &&//申報
                         this.chb_TEMPORAL_FLG.Checked == false &&//轉暫收
                         this.chb_CANCEL_FLG.Checked == true)//作廢
                {
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 只有欄位[申報]有勾選

                if (this.chb_PERIOD_FLG.Checked == true &&//申報
                    this.chb_TEMPORAL_FLG.Checked == false &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == false)//作廢
                {
                    this.chb_TEMPORAL_FLG.Enabled = true;//轉暫收
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 只有欄位[轉暫收]有勾選

                if (this.chb_PERIOD_FLG.Checked == false &&//申報
                    this.chb_TEMPORAL_FLG.Checked == true &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == false)//作廢
                {
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion

                #region 只有欄位[作廢]有勾選

                if (this.chb_PERIOD_FLG.Checked == false &&//申報
                    this.chb_TEMPORAL_FLG.Checked == false &&//轉暫收
                    this.chb_CANCEL_FLG.Checked == true)//作廢
                {
                    this.txt_MEMO.ReadOnly = false;//備註
                    this.txt_MEMO.CssClass = string.Empty;
                    this.but_Disc_NewItem.Enabled = false;//新增項目鈕
                }

                #endregion
            }

            #endregion

            #endregion

            #region 取得折讓稅額

            BCO.CAAPublic CAAPub = new BCO.CAAPublic(ConntionDB);

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));
            this.hid_TaxRate.Value = CAAPub.GET_TAXRATE(ParameterList).ToString();

            #endregion

            #region 紀錄欄位[折讓金額(未稅)][折讓稅額][總金額]的原始金額

            this.hid_Original_DISC_UAMT.Value = this.slp_DISC_UAMT.Text;//折讓金額(未稅)
            this.hid_Original_DISC_TAX.Value = this.slp_DISC_TAX.Text;//折讓稅額
            this.hid_Original_DISC_AMT.Value = this.slp_DISC_AMT.Text;//總金額

            #endregion

            #region 紀錄是否月結

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH.Text, "string", false));//[結帳年月]
            ParameterList.Add(CAAComm.GetValueSetParameter("CAA18", "string", false)); //V_FUNC_NO

            #endregion

            #region 連結資料庫

            BCO.ChanMonthCloseYN bco_Is_Close = new BCO.ChanMonthCloseYN(ConntionDB);

            #endregion

            #region 檢查回傳資料

            //回傳結果=Y,該月份已月結
            //回傳結果=N,該月份尚未月結
            if (((ArrayList)bco_Is_Close.GetChanMonthCloseStatus(ParameterList, null))[0].ToString() == "Y")
            { b_IsClose = true; }
            else
            { b_IsClose = false; }

            #endregion

            #region 如果是月結,欄位[折讓金額(未稅)][折讓稅額]必須ReadOnly

            if (b_IsClose == true)
            {
                this.slp_DISC_UAMT.ReadOnly = true;//折讓金額(未稅)
                this.slp_DISC_TAX.ReadOnly = true;//折讓稅額
            }

            #endregion

            #endregion
        }

        #endregion
    }
Example #20
0
    /// <summary>
    /// 離開[店號]時,帶出相關資料
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void txt_STORE_ID_Onblur()
    {
        #region 規則

        /*
         * 與秀玲確認過
         * 抓取店號帶出相關資料的部份
         * 在[新增]狀態下,要用 sysdate    作為查詢條件
         * 在[編輯]狀態下,要用 createdate 作為查詢條件(編輯畫面load進來時,和使用者修改店號時都要以該筆資料的createdate為主)
         * 來查出 [VDS_STM_STORE][VDS_STM_ACCOUNT_PROPERTY] 這兩個Table當時的資料
         */

        #endregion

        try
        {
            #region 新增 or 編輯 模式

            CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();

            if (ViewState["Mode"].ToString() == "Insert" ||
                ViewState["Mode"].ToString() == "Edit")
            {
                #region 重新將店號再寫入一次

                this.SLP_STORE_ID.Text = this.SLP_STORE_ID.Text;

                #endregion

                if (this.SLP_STORE_ID.Text.Trim() == string.Empty)
                {
                    #region 將欄位清空

                    this.txtGROUP_NO.Text = string.Empty;//店群
                    this.txtZ_O.Text = string.Empty;//營業所
                    this.txtRFNO.Text = string.Empty;//統一編號
                    this.txtSAL_ID.Text = string.Empty;//營業人員
                    this.txtAC_ID.Text = string.Empty;//帳務人員

                    #endregion

                    #region Focus欄位

                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(this.SLP_ROOT_NO.TextBox_Code.ClientID, true);
                    ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA142", s_ScriptManager_Script, true);

                    #endregion
                }
                else
                {
                    #region 傳入參數

                    DateTime d_Date;

                    if (ViewState["Mode"].ToString() == "Insert")//新增狀態
                    { d_Date = DateTime.Now; }
                    else//編輯狀態
                    { d_Date = DateTime.Parse(this.hdf_Old_CreateDate.Value); }

                    ParameterList.Clear();
                    ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_STORE_ID.Text, "string", false));//店號
                    ParameterList.Add(CAAComm.GetValueSetParameter(d_Date.ToString(), "datetime", false));//時間
                    ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

                    #endregion

                    #region 連結資料庫

                    CAAModel.MaintainTempRecord BCO = new CAAModel.MaintainTempRecord(ConntionDB);
                    DataTable dt_Return = BCO.GET_STORE_RELATE_DATA(ParameterList);

                    #endregion

                    #region 檢查回傳資料

                    if (dt_Return.Rows.Count != 1)
                    {
                        #region 將欄位清空

                        this.txtGROUP_NO.Text = string.Empty;//店群
                        this.txtZ_O.Text = string.Empty;//營業所
                        this.txtRFNO.Text = string.Empty;//統一編號
                        this.txtSAL_ID.Text = string.Empty;//營業人員
                        this.txtAC_ID.Text = string.Empty;//帳務人員

                        #endregion

                        #region 若發生錯誤則alert訊息(秀玲要alert訊息)

                        //若發生錯誤,則只要alert錯誤訊息,不要focus到[店號]欄位
                        string s_ScriptManager_Script = "alert('無符合店號或己關店,請重新輸入')";
                        ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA142", s_ScriptManager_Script, true);

                        #endregion

                        return;
                    }

                    #endregion

                    #region 將資料寫入頁面

                    else
                    {
                        this.txtGROUP_NO.Text = dt_Return.Rows[0]["GROUP_NO"].ToString();//店群
                        this.txtZ_O.Text = dt_Return.Rows[0]["Z_O"].ToString();//營業所
                        this.txtRFNO.Text = dt_Return.Rows[0]["RFNO"].ToString();//統一編號
                        this.txtSAL_ID.Text = dt_Return.Rows[0]["SAL_ID"].ToString();//營業人員
                        this.txtAC_ID.Text = dt_Return.Rows[0]["AC_UID"].ToString();//帳務人員

                        #region Focus欄位

                        string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(this.SLP_ROOT_NO.TextBox_Code.ClientID, true);
                        ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA142", s_ScriptManager_Script, true);

                        #endregion
                    }

                    #endregion
                }
            }

            #endregion

            #region 如果不符合以上條件,代表錯誤

            else { throw new Exception("頁面資料錯誤,只有在[新增 or 編輯模式]下,才有欄位[店號]Onblur事件"); }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #21
0
    /// <summary>
    /// 按下BUTTON[儲存]鈕,將更改資料寫入TempTable
    /// </summary>
    /// <param name="dr_NewItem"></param>
    /// <param name="dt_New_Detl"></param>
    /// <param name="s_Now"></param>
    /// <param name="s_Type"></param>
    private void Set_NewItem_To_Temp_For_Modify(DataRow dr_ModifyItem, DataTable dt_Modify_Detl, string s_Now)
    {
        #region 設定變數

        BCO.CAACommon CAAComm = new BCO.CAACommon();
        int i_DISC_UAMT = int.Parse(dr_ModifyItem["DISC_UAMT"].ToString());//折讓金額(未稅)
        int i_DISC_TAX = int.Parse(dr_ModifyItem["DISC_TAX"].ToString());//折讓稅額
        int i_DISC_AMT = int.Parse(dr_ModifyItem["DISC_AMT"].ToString());//含稅金額
        int i_NON_INV_UAMT = int.Parse(dr_ModifyItem["NON_INV_UAMT"].ToString());//發票餘額(未稅)
        int i_NON_INV_TAX = int.Parse(dr_ModifyItem["NON_INV_TAX"].ToString());//發票稅額
        int i_Total_NON_INV_UAMT = int.Parse(dr_ModifyItem["ORIGINAL_NON_INV_UAMT"].ToString()) + int.Parse(dr_ModifyItem["ORIGINAL_DISC_UAMT"].ToString());//發票餘額(未稅)+折讓金額(未稅)
        int i_Total_NON_INV_TAX = int.Parse(dr_ModifyItem["ORIGINAL_NON_INV_TAX"].ToString()) + int.Parse(dr_ModifyItem["ORIGINAL_DISC_TAX"].ToString());//發票稅額+折讓稅額
        bool b_RightData = true;

        #endregion

        #region 檢查條件

        //[折讓金額(未稅)]不可小於0
        if (i_DISC_UAMT < 0)
        { b_RightData = false; }
        //[折讓稅額]不可小於0
        if (i_DISC_TAX < 0)
        { b_RightData = false; }
        //[折讓金額(未稅)]為0時,[折讓稅額]也必須為0
        if (i_DISC_UAMT == 0 && i_DISC_TAX != 0)
        { b_RightData = false; }
        //[折讓金額(未稅)]不得大於[發票餘額(未稅)]
        if (i_DISC_UAMT > i_Total_NON_INV_UAMT)
        { b_RightData = false; }
        //[折讓稅額]不得大於[發票稅額]
        if (i_DISC_TAX > i_Total_NON_INV_TAX)
        { b_RightData = false; }
        //[原始發票餘額(未稅)]-[發票餘額(未稅)]必須等於[折讓金額(未稅)]
        if (i_Total_NON_INV_UAMT - i_NON_INV_UAMT != i_DISC_UAMT)
        { b_RightData = false; }
        //[原始發票稅額]-[發票稅額]必須等於[折讓稅額]
        if (i_Total_NON_INV_TAX - i_NON_INV_TAX != i_DISC_TAX)
        { b_RightData = false; }
        //[折讓金額(未稅)]+[折讓稅額]必須等於[含稅金額]
        if (i_DISC_UAMT + i_DISC_TAX != i_DISC_AMT)
        { b_RightData = false; }

        #endregion

        #region 符合條件,將資料寫入TempTable

        if (b_RightData == true)
        {
            DataRow dr_Modify_Detl = dt_Modify_Detl.NewRow();

            //NEW DATA
            dr_Modify_Detl["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
            dr_Modify_Detl["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
            dr_Modify_Detl["NEW_DISC_UAMT"] = dr_ModifyItem["DISC_UAMT"];
            dr_Modify_Detl["NEW_DISC_TAX"] = dr_ModifyItem["DISC_TAX"];
            dr_Modify_Detl["NEW_DISC_AMT"] = dr_ModifyItem["DISC_AMT"];

            //OLD DATA
            dr_Modify_Detl["INV_NO"] = dr_ModifyItem["INV_NO"];
            dr_Modify_Detl["DISC_UAMT"] = dr_ModifyItem["DISC_UAMT", DataRowVersion.Original];
            dr_Modify_Detl["DISC_TAX"] = dr_ModifyItem["DISC_TAX", DataRowVersion.Original];
            dr_Modify_Detl["DISC_AMT"] = dr_ModifyItem["DISC_AMT", DataRowVersion.Original];
            dr_Modify_Detl["CREATEDATE"] = dr_ModifyItem["CREATEDATE1"];
            dr_Modify_Detl["CREATEUID"] = dr_ModifyItem["CREATEUID1"];
            dr_Modify_Detl["UPDATEDATE"] = dr_ModifyItem["UPDATEDATE1"];
            dr_Modify_Detl["UPDATEUID"] = dr_ModifyItem["UPDATEUID1"];
            dr_Modify_Detl["ENABLE"] = dr_ModifyItem["ENABLE1"];

            dt_Modify_Detl.Rows.Add(dr_Modify_Detl);

        }
        else
        { throw new Exception("按下銷貨折讓維護的[儲存]鈕,新增資料至折讓明細檔,發生頁面資料錯誤"); }

        #endregion
    }
Example #22
0
    /// <summary>
    /// 退票
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Reject_Click(object sender, EventArgs e)
    {
        if (this.slp_REJECT_DATE.Text != string.Empty &&
            this.txt_REJECT_MEMO.Text != string.Empty)
        {
            try
            {
                string strMsg = string.Empty;
                string strNo = dt.Rows[0]["BOND_NO"].ToString();
                string strNowDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

                CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();

                ParameterList.Clear();
                ParameterList.Add(CAAComm.GetValueSetParameter(strNo, "string", false)); //V_BOND_NO
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_REJECT_DATE.Text, "date", false)); //D_REJECT_DATE
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_REJECT_MEMO.Text, "string", false)); //V_REJECT_MEMO
                ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); //V_UPDATEUID
                ParameterList.Add(CAAComm.GetValueSetParameter(strNowDate, "datetime", false)); //D_UPDATEDATE

                CAAModel.MaintainBondRecord BCO = new CAAModel.MaintainBondRecord(ConntionDB);
                ArrayList ary = BCO.BondRejectRecord(ParameterList, null);

                #region 組合跳轉頁面字串

                string s_ADDLocation_Replace_String = string.Empty;

                try
                {
                    int i_Count = int.Parse(Request.QueryString["CAA122_COUNT"]);
                    string s_Request_Key = Request.QueryString["CAA122_PageTimeStamp"];

                    s_ADDLocation_Replace_String = "&CAA122_COUNT=" + i_Count.ToString() + "&CAA122_PageTimeStamp=" + s_Request_Key;
                }
                catch { s_ADDLocation_Replace_String = string.Empty; }

                #endregion

                strMsg = "alert('" + ary[1].ToString() + "');";
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "TO_CAA122.aspx", strMsg, true);
            }
            catch (Exception ex)
            {
                WaringLogProcess(ex.Message);
                this.ErrorMsgLabel.Text = ex.Message;
            }
            finally { Finally_Function(); }
        }
        else
        {
            this.ErrorMsgLabel.Text = "退票日及退票原因不可為空值!";
        }
    }
Example #23
0
    /// <summary>
    /// BUTTON [儲存]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Save_Click(object sender, EventArgs e)
    {
        try
        {
            #region 新增模式

            if (this.hid_PageStatus.Value == "insert")
            {
                #region 檢查條件

                BCO.CAACommon CAAComm = new BCO.CAACommon();
                ArrayList arl_Check_Condition = Check_Condition("BUTTON [儲存]鈕,新增狀態");

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 至資料庫取得Table Schema

                ParameterList.Clear();
                ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

                DataTable dt_Update_Inv = new DataTable();
                DataTable dt_New_Main = new DataTable();
                DataTable dt_New_Detl = new DataTable();

                BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
                dt_Update_Inv = bco.GET_VDS_CAA_INV_MAIN_SCHEMA(ParameterList);
                dt_New_Main = bco.GET_VDS_CAA_DISC_MAIN_SCHEMA(ParameterList);
                dt_New_Detl = bco.GET_VDS_CAA_DISC_DETL_SCHEMA(ParameterList);

                #endregion

                #region 將資料寫入Temp Table

                string s_Now = DateTime.Now.ToString();
                string s_CLOSE_MONTH_ACCT = string.Empty;

                #region SLP轉型

                TextBox txt_DISC_AMT = (TextBox)this.slp_DISC_AMT.FindControl("TextBoxCode");//總金額

                #endregion

                #region VDS_CAA_DISC_MAIN

                DataRow dr_New_Main = dt_New_Main.NewRow();

                #region 設定欄位[結帳年月-財會]

                if (this.slp_DISC_SOURCE.Text == "1")//欄位[來源]=系統開立
                { s_CLOSE_MONTH_ACCT = this.slp_CLOSE_MONTH_ACCT.Text; }
                else if (this.slp_DISC_SOURCE.Text == "2")//欄位[來源]=人工開立
                { s_CLOSE_MONTH_ACCT = (this.slp_PROOF_DATE.Text == string.Empty) ? string.Empty : DateTime.Parse(this.slp_PROOF_DATE.Text).ToString("yyyyMM"); }

                #endregion

                dr_New_Main["DISC_FORM"] = CAAComm.GetValueSetParameter(this.slp_DISC_FORM.Text, "int", false);//格式代號
                dr_New_Main["DISC_SOURCE"] = CAAComm.GetValueSetParameter(this.slp_DISC_SOURCE.Text, "int", false);//來源
                dr_New_Main["STORE_ID"] = CAAComm.GetValueSetParameter(this.slp_STORE_ID.Text, "string", false);//店號
                dr_New_Main["DISC_TYPE"] = CAAComm.GetValueSetParameter(this.slp_DISC_TYPE.Text, "string", false);//形式
                dr_New_Main["ROOT_NO"] = CAAComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false);//商品群分類
                dr_New_Main["TAX_TYPE"] = CAAComm.GetValueSetParameter(this.slp_TAX_TYPE.Text, "string", false);//稅別
                dr_New_Main["DISC_DATE"] = CAAComm.GetValueSetParameter(this.slp_DISC_DATE.Text, "date", false);//折讓日期
                dr_New_Main["CHG_DISC_DATE"] = CAAComm.GetValueSetParameter(this.slp_CHG_DISC_DATE.Text, "date", false);//異動折讓日期
                dr_New_Main["ACT_DISC_NO"] = CAAComm.GetValueSetParameter(this.txt_ACT_DISC_NO.Text, "string", false);//財會折讓單號
                dr_New_Main["PROOF_FLG"] = CAAComm.GetValueSetParameter((this.chb_PROOF_FLG.Checked == true) ? "1" : "0", "int", false);//憑證已回
                dr_New_Main["PROOF_DATE"] = CAAComm.GetValueSetParameter(this.slp_PROOF_DATE.Text, "date", false);//憑證已回日期
                dr_New_Main["REPROOF_FLG"] = CAAComm.GetValueSetParameter((this.chb_REPROOF_FLG.Checked == true) ? "1" : "0", "int", false);//取具進項憑証
                dr_New_Main["REPROOF_NO"] = CAAComm.GetValueSetParameter(this.txt_REPROOF_NO.Text, "string", false);//發票號碼/收據
                dr_New_Main["CANCEL_FLG"] = CAAComm.GetValueSetParameter((this.chb_CANCEL_FLG.Checked == true) ? "1" : "0", "int", false);//作廢
                dr_New_Main["CANCEL_DATE"] = CAAComm.GetValueSetParameter(this.slp_CANCEL_DATE.Text, "date", false);//作廢日期
                dr_New_Main["PERIOD_FLG"] = CAAComm.GetValueSetParameter((this.chb_PERIOD_FLG.Checked == true) ? "1" : "0", "int", false);//申報
                dr_New_Main["PERIOD_DATE"] = CAAComm.GetValueSetParameter(this.slp_PERIOD_DATE.Text, "date", false);//申報日期
                dr_New_Main["TEMPORAL_FLG"] = CAAComm.GetValueSetParameter((this.chb_TEMPORAL_FLG.Checked == true) ? "1" : "0", "int", false);//轉暫收
                dr_New_Main["TEMPORAL_DATE"] = CAAComm.GetValueSetParameter(this.slp_TEMPORAL_DATE.Text, "date", false);//暫收日期
                dr_New_Main["RFNO"] = CAAComm.GetValueSetParameter(this.txt_RFNO.Text, "string", false);//統一編號
                dr_New_Main["DISC_UAMT"] = CAAComm.GetValueSetParameter(this.slp_DISC_UAMT.Text, "int", false);//折讓金額(未稅)
                dr_New_Main["DISC_TAX"] = CAAComm.GetValueSetParameter(this.slp_DISC_TAX.Text, "int", false);//折讓稅額
                dr_New_Main["DISC_AMT"] = CAAComm.GetValueSetParameter(Request[txt_DISC_AMT.UniqueID].ToString(), "int", false);//總金額
                dr_New_Main["CLOSE_MONTH"] = CAAComm.GetValueSetParameter(this.slp_CLOSE_MONTH.Text, "string", false);//結帳年月
                dr_New_Main["MEMO"] = CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false);//備註
                dr_New_Main["CREATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//建立日期
                dr_New_Main["CREATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//建立人員
                dr_New_Main["UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
                dr_New_Main["UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
                dr_New_Main["ENABLE"] = CAAComm.GetValueSetParameter("1", "int", false);//有效
                dr_New_Main["DETL_FLG"] = CAAComm.GetValueSetParameter((this.chb_REPROOF_FLG.Checked == true) ? "0" : "1", "int", false);//明細註記,0代表沒有明細,1代表有明細
                dr_New_Main["REMARK_FLG"] = CAAComm.GetValueSetParameter("0", "int", false);//標記註記(預設為0)
                dr_New_Main["CHECK_FLG"] = CAAComm.GetValueSetParameter("0", "int", false);//勾選註記(預設為0)
                dr_New_Main["DISC_REMAIN_AMT"] = CAAComm.GetValueSetParameter(Request[txt_DISC_AMT.UniqueID].ToString(), "int", false);//沖帳餘額(預設等於總金額[DISC_AMT])
                dr_New_Main["WASH_STATUS"] = CAAComm.GetValueSetParameter("0", "int", false);//沖帳狀態(預設為0)
                dr_New_Main["SOURCE_TYPE"] = CAAComm.GetValueSetParameter("1", "string", false);//區分資料來源(預設為1),1是代表營業系統,2是代表財會系統
                dr_New_Main["IS_SCHEDULE"] = CAAComm.GetValueSetParameter("0", "int", false);//檔期(預設為0),1代表有檔期,0代表沒有檔期
                dr_New_Main["CLOSE_MONTH_ACCT"] = CAAComm.GetValueSetParameter(s_CLOSE_MONTH_ACCT, "int", false);//結帳年月-財會
                dr_New_Main["RECEIPT_FLG"] = CAAComm.GetValueSetParameter((this.chb_RECEIPT_FLG.Checked == true) ? "1" : "0", "int", false);//取具收據

                dt_New_Main.Rows.Add(dr_New_Main);

                #endregion

                #region VDS_CAA_DISC_DETL

                //如果[取具進項憑証]和[取具收據]都沒有被勾選,才必須新增 Detl 資料
                if (this.chb_REPROOF_FLG.Checked == false &&
                    this.chb_RECEIPT_FLG.Checked == false)
                {
                    DataTable dt_NewItem_New = new DataTable();
                    DataTable dt_NewItem_Modify = new DataTable();

                    dt_NewItem_New = dt_NewItem.GetChanges(DataRowState.Added);
                    dt_NewItem_Modify = dt_NewItem.GetChanges(DataRowState.Modified);

                    if (dt_NewItem_New != null || dt_NewItem_Modify != null)
                    {
                        if (dt_NewItem_New != null)
                        {
                            foreach (DataRow dr_NewItem_New in dt_NewItem_New.Rows)
                            {
                                //新增模式,若[折讓金額(未稅)]為0且[折讓稅額]為0,則該筆資料不新增至資料庫
                                if (dr_NewItem_New["DISC_UAMT"].ToString() != "0" ||
                                    dr_NewItem_New["DISC_TAX"].ToString() != "0")
                                { Set_NewItem_To_Temp_For_Add(dr_NewItem_New, dt_New_Detl, s_Now); }
                            }
                        }
                        if (dt_NewItem_Modify != null)
                        {
                            foreach (DataRow dr_NewItem_Modify in dt_NewItem_Modify.Rows)
                            {
                                //新增模式,若[折讓金額(未稅)]為0且[折讓稅額]為0,則該筆資料不新增至資料庫
                                if (dr_NewItem_Modify["DISC_UAMT"].ToString() != "0" ||
                                    dr_NewItem_Modify["DISC_TAX"].ToString() != "0")
                                { Set_NewItem_To_Temp_For_Add(dr_NewItem_Modify, dt_New_Detl, s_Now); }
                            }
                        }
                    }

                    if (dt_New_Detl.Rows.Count == 0)
                    {
                        this.ErrorMsgLabel.Text = "無需要異動的資料";
                        return;
                    }
                }

                #endregion

                #region VDS_CAA_INV_MAIN

                //如果[取具進項憑証]和[取具收據]都沒有被勾選,才要做以下動作
                if (this.chb_REPROOF_FLG.Checked == false &&
                    this.chb_RECEIPT_FLG.Checked == false)
                {
                    foreach (DataRow dr_New_Detl in dt_New_Detl.Rows)
                    {
                        string s_FilterExpression = "INV_NO = '" + dr_New_Detl["INV_NO"].ToString() + "'";
                        DataRow[] dr_NewItem = dt_NewItem.Select(s_FilterExpression);

                        if (dr_NewItem.Length == 1)
                        { Set_NewItem_To_Temp_For_INV_MAIN(dr_NewItem[0], dt_Update_Inv, s_Now); }
                        else
                        { throw new Exception("按下銷貨折讓維護的[儲存]鈕,更改資料至發票主檔,發生頁面資料錯誤"); }
                    }
                }

                #endregion

                #endregion

                #region 連結資料庫

                string s_DISC_NO = bco.CreateDiscRecord(null, dt_New_Main, dt_New_Detl, dt_Update_Inv);

                #endregion

                #region 清空變數,跳轉頁面至檢視模式

                if (dt_NewItem != null)
                { dt_NewItem.Clear(); }
                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA182", "alert('新增完成');location.replace('CAA182.aspx?Code=CAA18&CAA182_Mode=view&CAA182_DISC_NO=" + s_DISC_NO + "');", true);

                #endregion
            }

            #endregion

            #region 編輯模式

            else if (this.hid_PageStatus.Value == "edit")
            {
                #region 檢查條件

                BCO.CAACommon CAAComm = new BCO.CAACommon();
                ArrayList arl_Check_Condition = Check_Condition("BUTTON [儲存]鈕,編輯狀態");

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 判斷是做何種勾選動作

                bool b_IsRight = false;
                string s_ReturnMsg = string.Empty;

                Check_CheckStatus(out b_IsRight, out s_ReturnMsg);

                #endregion

                #region 20100310 秀玲新增規則,已沖帳時,檢查狀態

                #region 規則

                /* 因為在檢視頁進入編輯頁時有做限制,
                 * 所以在[總金額(DISC_AMT)][沖帳餘額(DISC_REMAIN_AMT)]不相同,代表已沖帳時,
                 * 按下[儲存]鈕時,會有6種情況(請看function Check_CheckStatus的邏輯)
                 * (1)都沒有勾
                 * (2)勾選欄位[取具進項憑証]
                 * (3)勾選欄位[取具收據]
                 * (4)勾選欄位[憑證已回]
                 * (5)勾選欄位[轉暫收]
                 * (6)原本就勾選欄位[申報]
                 * 如果不是這5種狀況,則提示錯誤訊息*/

                #endregion

                arl_Check_Condition.Clear();
                arl_Check_Condition = Check_Condition("BUTTON [儲存]鈕,編輯模式,判斷完狀態後的檢查", s_ReturnMsg);

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 依照勾選動作將資料寫入TempTable,並連結資料庫

                #region SLP轉型

                TextBox txt_TEMPORAL_DATE = (TextBox)this.slp_TEMPORAL_DATE.FindControl("TextBoxCode");//暫收日期
                TextBox txt_DISC_AMT = (TextBox)this.slp_DISC_AMT.FindControl("TextBoxCode");//總金額

                #endregion

                #region 宣告變數

                DataTable dt_Update_Inv = new DataTable();
                DataTable dt_Update_Disc_Main = new DataTable();
                DataTable dt_Add_Disc_Detl = new DataTable();
                DataTable dt_Update_Disc_Detl = new DataTable();
                DataTable dt_Delete_Disc_Detl = new DataTable();
                BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
                string s_Now = DateTime.Now.ToString();
                string s_DISC_NO = string.Empty;
                string s_CLOSE_MONTH_ACCT = string.Empty;

                ParameterList.Clear();
                ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

                #endregion

                #region 規則

                //只會有以下10種情況,不是這8種情況就是錯誤的
                //1.勾選欄位[憑證已回]
                //2.勾選欄位[取具進項憑証]
                //3.勾選欄位[取具收據]
                //4.勾選欄位[作廢]
                //5.勾選欄位[轉暫收]
                //6.取消勾選欄位[憑證已回]
                //7.取消勾選欄位[取具進項憑証]
                //8.取消勾選欄位[取具收據]
                //9.都沒有勾
                //10.原本就勾選欄位[申報]

                #endregion

                #region 勾選欄位[憑證已回] or 取消勾選欄位[憑證已回] or 取消勾選欄位[取具進項憑証] or 取消勾選欄位[取具收據] or 都沒有勾

                if (s_ReturnMsg == "勾選欄位[憑證已回]" ||
                    s_ReturnMsg == "取消勾選欄位[憑證已回]" ||
                    s_ReturnMsg == "取消勾選欄位[取具進項憑証]" ||
                    s_ReturnMsg == "取消勾選欄位[取具收據]" ||
                    s_ReturnMsg == "都沒有勾")
                {
                    #region [總金額(DISC_AMT)][沖帳餘額(DISC_REMAIN_AMT)]相同,尚未沖帳

                    if (dt_Main.Rows[0]["DISC_REMAIN_AMT"].ToString() == dt_Main.Rows[0]["DISC_AMT"].ToString())
                    {
                        #region 取得 TempTable 的 SCHEMA

                        dt_Update_Disc_Main = bco.GET_VDS_CAA_DISC_MAIN_SCHEMA(ParameterList);
                        dt_Add_Disc_Detl = bco.GET_VDS_CAA_DISC_DETL_SCHEMA(ParameterList);
                        dt_Update_Disc_Detl = dt_Add_Disc_Detl.Copy();
                        dt_Delete_Disc_Detl = dt_Add_Disc_Detl.Copy();
                        dt_Update_Inv = bco.GET_VDS_CAA_INV_MAIN_SCHEMA(ParameterList);

                        #endregion

                        #region 新增 VDS_CAA_DISC_MAIN 的異動欄位

                        dt_Update_Disc_Main.Columns.Add("NEW_UPDATEDATE", dt_Update_Disc_Main.Columns["UPDATEDATE"].DataType);
                        dt_Update_Disc_Main.Columns.Add("NEW_UPDATEUID", dt_Update_Disc_Main.Columns["UPDATEUID"].DataType);
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_TYPE", dt_Update_Disc_Main.Columns["DISC_TYPE"].DataType);//型式
                        dt_Update_Disc_Main.Columns.Add("NEW_ACT_DISC_NO", dt_Update_Disc_Main.Columns["ACT_DISC_NO"].DataType);//財會折讓單號
                        dt_Update_Disc_Main.Columns.Add("NEW_CHG_DISC_DATE", dt_Update_Disc_Main.Columns["CHG_DISC_DATE"].DataType);//異動折讓日期
                        dt_Update_Disc_Main.Columns.Add("NEW_PROOF_FLG", dt_Update_Disc_Main.Columns["PROOF_FLG"].DataType);//憑證已回
                        dt_Update_Disc_Main.Columns.Add("NEW_PROOF_DATE", dt_Update_Disc_Main.Columns["PROOF_DATE"].DataType);//憑證已回日期
                        dt_Update_Disc_Main.Columns.Add("NEW_REPROOF_FLG", dt_Update_Disc_Main.Columns["REPROOF_FLG"].DataType);//取具進項憑証
                        dt_Update_Disc_Main.Columns.Add("NEW_REPROOF_NO", dt_Update_Disc_Main.Columns["REPROOF_NO"].DataType);//發票號碼/收據
                        dt_Update_Disc_Main.Columns.Add("NEW_RECEIPT_FLG", dt_Update_Disc_Main.Columns["RECEIPT_FLG"].DataType);//取具收據
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_UAMT", dt_Update_Disc_Main.Columns["DISC_UAMT"].DataType);//折讓金額(未稅)
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_TAX", dt_Update_Disc_Main.Columns["DISC_TAX"].DataType);//折讓稅額
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_AMT", dt_Update_Disc_Main.Columns["DISC_AMT"].DataType);//總金額
                        dt_Update_Disc_Main.Columns.Add("NEW_MEMO", dt_Update_Disc_Main.Columns["MEMO"].DataType);//備註
                        dt_Update_Disc_Main.Columns.Add("NEW_CLOSE_MONTH_ACCT", dt_Update_Disc_Main.Columns["CLOSE_MONTH_ACCT"].DataType);//結帳年月-財會
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_REMAIN_AMT", dt_Update_Disc_Main.Columns["DISC_REMAIN_AMT"].DataType);//沖帳餘額
                        dt_Update_Disc_Main.Columns.Add("NEW_DETL_FLG", dt_Update_Disc_Main.Columns["DETL_FLG"].DataType);//明細註記(1是有明細0是沒明細)

                        #endregion

                        #region 新增 VDS_CAA_DISC_DETL 的異動欄位

                        dt_Update_Disc_Detl.Columns.Add("NEW_UPDATEDATE", dt_Update_Disc_Detl.Columns["UPDATEDATE"].DataType);
                        dt_Update_Disc_Detl.Columns.Add("NEW_UPDATEUID", dt_Update_Disc_Detl.Columns["UPDATEUID"].DataType);
                        dt_Update_Disc_Detl.Columns.Add("NEW_DISC_UAMT", dt_Update_Disc_Detl.Columns["DISC_UAMT"].DataType);
                        dt_Update_Disc_Detl.Columns.Add("NEW_DISC_TAX", dt_Update_Disc_Detl.Columns["DISC_TAX"].DataType);
                        dt_Update_Disc_Detl.Columns.Add("NEW_DISC_AMT", dt_Update_Disc_Detl.Columns["DISC_AMT"].DataType);

                        #endregion

                        #region 將資料寫入Temp Table

                        #region VDS_CAA_DISC_MAIN

                        foreach (DataRow dr_MainRow in dt_Main.Rows)
                        {
                            DataRow dr_Update_Disc_Main = dt_Update_Disc_Main.NewRow();

                            #region 設定欄位[結帳年月-財會]

                            if (this.slp_DISC_SOURCE.Text == "1")//欄位[來源]=系統開立
                            { s_CLOSE_MONTH_ACCT = this.slp_CLOSE_MONTH_ACCT.Text; }
                            else if (this.slp_DISC_SOURCE.Text == "2")//欄位[來源]=人工開立
                            { s_CLOSE_MONTH_ACCT = (this.slp_PROOF_DATE.Text == string.Empty) ? string.Empty : DateTime.Parse(this.slp_PROOF_DATE.Text).ToString("yyyyMM"); }

                            #endregion

                            dr_Update_Disc_Main["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
                            dr_Update_Disc_Main["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
                            dr_Update_Disc_Main["NEW_DISC_TYPE"] = CAAComm.GetValueSetParameter(this.slp_DISC_TYPE.Text, "string", false);//型式
                            dr_Update_Disc_Main["NEW_ACT_DISC_NO"] = CAAComm.GetValueSetParameter(this.txt_ACT_DISC_NO.Text, "string", false);//財會折讓單號
                            dr_Update_Disc_Main["NEW_CHG_DISC_DATE"] = CAAComm.GetValueSetParameter(this.slp_CHG_DISC_DATE.Text, "date", false);//異動折讓日期
                            dr_Update_Disc_Main["NEW_PROOF_FLG"] = CAAComm.GetValueSetParameter((this.chb_PROOF_FLG.Checked == true) ? "1" : "0", "int", false);//憑證已回
                            dr_Update_Disc_Main["NEW_PROOF_DATE"] = CAAComm.GetValueSetParameter(this.slp_PROOF_DATE.Text, "date", false);//憑證已回日期
                            dr_Update_Disc_Main["NEW_REPROOF_FLG"] = CAAComm.GetValueSetParameter((this.chb_REPROOF_FLG.Checked == true) ? "1" : "0", "int", false);//取具進項憑証
                            dr_Update_Disc_Main["NEW_REPROOF_NO"] = CAAComm.GetValueSetParameter(this.txt_REPROOF_NO.Text, "string", false);//發票號碼/收據
                            dr_Update_Disc_Main["NEW_RECEIPT_FLG"] = CAAComm.GetValueSetParameter((this.chb_RECEIPT_FLG.Checked == true) ? "1" : "0", "int", false);//取具收據
                            dr_Update_Disc_Main["NEW_DISC_UAMT"] = CAAComm.GetValueSetParameter(this.slp_DISC_UAMT.Text, "int", false);//折讓金額(未稅)
                            dr_Update_Disc_Main["NEW_DISC_TAX"] = CAAComm.GetValueSetParameter(this.slp_DISC_TAX.Text, "int", false);//折讓稅額
                            dr_Update_Disc_Main["NEW_DISC_AMT"] = CAAComm.GetValueSetParameter(Request[txt_DISC_AMT.UniqueID].ToString(), "int", false);//總金額
                            dr_Update_Disc_Main["NEW_MEMO"] = CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false);//備註
                            dr_Update_Disc_Main["NEW_CLOSE_MONTH_ACCT"] = CAAComm.GetValueSetParameter(s_CLOSE_MONTH_ACCT, "string", false);//結帳年月-財會
                            dr_Update_Disc_Main["NEW_DISC_REMAIN_AMT"] = CAAComm.GetValueSetParameter(Request[txt_DISC_AMT.UniqueID].ToString(), "int", false);//沖帳餘額
                            dr_Update_Disc_Main["NEW_DETL_FLG"] = CAAComm.GetValueSetParameter((this.chb_REPROOF_FLG.Checked == true) ? "0" : "1", "int", false);//明細註記(1是有明細0是沒明細)

                            foreach (DataColumn dtcolumn in dt_Update_Disc_Main.Columns)
                            {
                                if (dtcolumn.ColumnName.Length < 4 ||
                                    dtcolumn.ColumnName.Substring(0, 4) != "NEW_")
                                { dr_Update_Disc_Main[dtcolumn.ColumnName] = dr_MainRow[dtcolumn.ColumnName]; }
                            }

                            dt_Update_Disc_Main.Rows.Add(dr_Update_Disc_Main);
                        }

                        #endregion

                        #region VDS_CAA_DISC_DETL

                        //如果[取具進項憑証]和[取具收據]都沒有被勾選,才必須新增 Detl 資料
                        if (this.chb_REPROOF_FLG.Checked == false &&
                            this.chb_RECEIPT_FLG.Checked == false)
                        {
                            DataTable dt_NewItem_New = new DataTable();
                            DataTable dt_NewItem_Modify = new DataTable();

                            dt_NewItem_New = dt_NewItem.GetChanges(DataRowState.Added);
                            dt_NewItem_Modify = dt_NewItem.GetChanges(DataRowState.Modified);

                            if (dt_NewItem_New != null || dt_NewItem_Modify != null)
                            {
                                if (dt_NewItem_New != null)
                                {
                                    foreach (DataRow dr_NewItem_New in dt_NewItem_New.Rows)
                                    {
                                        //新增的資料,若[折讓金額(未稅)]為0且[折讓稅額]為0,則該筆資料不新增至資料庫
                                        if (dr_NewItem_New["DISC_UAMT"].ToString() != "0" ||
                                            dr_NewItem_New["DISC_TAX"].ToString() != "0")
                                        { Set_NewItem_To_Temp_For_Add(dr_NewItem_New, dt_Add_Disc_Detl, s_Now); }
                                    }
                                }
                                if (dt_NewItem_Modify != null)
                                {
                                    foreach (DataRow dr_NewItem_Modify in dt_NewItem_Modify.Rows)
                                    {
                                        //修改的資料,若[折讓金額(未稅)]為0且[折讓稅額]為0,則該筆資料將從資料庫中刪除
                                        if (dr_NewItem_Modify["DISC_UAMT"].ToString() == "0" &&
                                            dr_NewItem_Modify["DISC_TAX"].ToString() == "0")
                                        { Set_NewItem_To_Temp_For_Delete(dr_NewItem_Modify, dt_Delete_Disc_Detl, s_Now); }
                                        else
                                        { Set_NewItem_To_Temp_For_Modify(dr_NewItem_Modify, dt_Update_Disc_Detl, s_Now); }
                                    }
                                }
                            }
                        }

                        #endregion

                        #region VDS_CAA_INV_MAIN

                        //如果[取具進項憑証]和[取具收據]都沒有被勾選,才要做以下動作
                        if (this.chb_REPROOF_FLG.Checked == false &&
                            this.chb_RECEIPT_FLG.Checked == false)
                        {
                            foreach (DataRow dr_Add_Disc_Detl in dt_Add_Disc_Detl.Rows)
                            {
                                string s_FilterExpression = "INV_NO = '" + dr_Add_Disc_Detl["INV_NO"].ToString() + "'";
                                DataRow[] dr_Item = dt_NewItem.Select(s_FilterExpression);

                                if (dr_Item.Length == 1)
                                { Set_NewItem_To_Temp_For_INV_MAIN(dr_Item[0], dt_Update_Inv, s_Now); }
                                else
                                { throw new Exception("按下銷貨折讓維護的[儲存]鈕,更改資料至發票主檔,發生頁面資料錯誤"); }
                            }

                            foreach (DataRow dr_Update_Disc_Detl in dt_Update_Disc_Detl.Rows)
                            {
                                string s_FilterExpression = "INV_NO = '" + dr_Update_Disc_Detl["INV_NO"].ToString() + "'";
                                DataRow[] dr_Item = dt_NewItem.Select(s_FilterExpression);

                                if (dr_Item.Length == 1)
                                { Set_NewItem_To_Temp_For_INV_MAIN(dr_Item[0], dt_Update_Inv, s_Now); }
                                else
                                { throw new Exception("按下銷貨折讓維護的[儲存]鈕,更改資料至發票主檔,發生頁面資料錯誤"); }
                            }

                            foreach (DataRow dr_Delete_Disc_Detl in dt_Delete_Disc_Detl.Rows)
                            {
                                string s_FilterExpression = "INV_NO = '" + dr_Delete_Disc_Detl["INV_NO"].ToString() + "'";
                                DataRow[] dr_Item = dt_NewItem.Select(s_FilterExpression);

                                if (dr_Item.Length == 1)
                                { Set_NewItem_To_Temp_For_INV_MAIN(dr_Item[0], dt_Update_Inv, s_Now); }
                                else
                                { throw new Exception("按下銷貨折讓維護的[儲存]鈕,更改資料至發票主檔,發生頁面資料錯誤"); }
                            }
                        }

                        #endregion

                        #endregion

                        #region 連結資料庫

                        s_DISC_NO = bco.UpdateDiscRecord_OTHER_Checked(null,
                            dt_Update_Disc_Main,
                            dt_Add_Disc_Detl,
                            dt_Update_Disc_Detl,
                            dt_Delete_Disc_Detl,
                            dt_Update_Inv,
                            Session["UID"].ToString());

                        #endregion
                    }

                    #endregion

                    #region [總金額(DISC_AMT)][沖帳餘額(DISC_REMAIN_AMT)]不相同,已沖帳

                    else
                    {
                        if (s_ReturnMsg == "勾選欄位[憑證已回]" ||
                            s_ReturnMsg == "都沒有勾")
                        {
                            #region 取得 TempTable 的 SCHEMA

                            dt_Update_Disc_Main = bco.GET_VDS_CAA_DISC_MAIN_SCHEMA(ParameterList);

                            #endregion

                            #region 新增 VDS_CAA_DISC_MAIN 的異動欄位

                            dt_Update_Disc_Main.Columns.Add("NEW_UPDATEDATE", dt_Update_Disc_Main.Columns["UPDATEDATE"].DataType);
                            dt_Update_Disc_Main.Columns.Add("NEW_UPDATEUID", dt_Update_Disc_Main.Columns["UPDATEUID"].DataType);
                            dt_Update_Disc_Main.Columns.Add("NEW_MEMO", dt_Update_Disc_Main.Columns["MEMO"].DataType);//備註

                            #endregion

                            #region 將異動資料寫入 VDS_CAA_DISC_MAIN 的 TempTable

                            foreach (DataRow dr_MainRow in dt_Main.Rows)
                            {
                                DataRow dr_Update_Disc_Main = dt_Update_Disc_Main.NewRow();

                                dr_Update_Disc_Main["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
                                dr_Update_Disc_Main["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
                                dr_Update_Disc_Main["NEW_MEMO"] = CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false);//備註

                                foreach (DataColumn dtcolumn in dt_Update_Disc_Main.Columns)
                                {
                                    if (dtcolumn.ColumnName.Length < 4 ||
                                        dtcolumn.ColumnName.Substring(0, 4) != "NEW_")
                                    { dr_Update_Disc_Main[dtcolumn.ColumnName] = dr_MainRow[dtcolumn.ColumnName]; }
                                }

                                dt_Update_Disc_Main.Rows.Add(dr_Update_Disc_Main);
                            }

                            #endregion

                            #region 連結資料庫

                            s_DISC_NO = bco.UpdateDiscRecord_PERIOD_Checked(null, dt_Update_Disc_Main);

                            #endregion
                        }
                    }

                    #endregion
                }

                #endregion

                #region 勾選欄位[取具進項憑証] or 勾選欄位[取具收據]

                else if (s_ReturnMsg == "勾選欄位[取具進項憑証]" ||
                         s_ReturnMsg == "勾選欄位[取具收據]")
                {
                    #region [總金額(DISC_AMT)][沖帳餘額(DISC_REMAIN_AMT)]相同,尚未沖帳

                    if (dt_Main.Rows[0]["DISC_REMAIN_AMT"].ToString() == dt_Main.Rows[0]["DISC_AMT"].ToString())
                    {
                        #region 取得 TempTable 的 SCHEMA

                        dt_Update_Disc_Main = bco.GET_VDS_CAA_DISC_MAIN_SCHEMA(ParameterList);

                        #endregion

                        #region 新增 VDS_CAA_DISC_MAIN 的異動欄位

                        dt_Update_Disc_Main.Columns.Add("NEW_UPDATEDATE", dt_Update_Disc_Main.Columns["UPDATEDATE"].DataType);
                        dt_Update_Disc_Main.Columns.Add("NEW_UPDATEUID", dt_Update_Disc_Main.Columns["UPDATEUID"].DataType);
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_TYPE", dt_Update_Disc_Main.Columns["DISC_TYPE"].DataType);//型式
                        dt_Update_Disc_Main.Columns.Add("NEW_ACT_DISC_NO", dt_Update_Disc_Main.Columns["ACT_DISC_NO"].DataType);//財會折讓單號
                        dt_Update_Disc_Main.Columns.Add("NEW_CHG_DISC_DATE", dt_Update_Disc_Main.Columns["CHG_DISC_DATE"].DataType);//異動折讓日期
                        dt_Update_Disc_Main.Columns.Add("NEW_PROOF_DATE", dt_Update_Disc_Main.Columns["PROOF_DATE"].DataType);//憑證已回日期
                        dt_Update_Disc_Main.Columns.Add("NEW_REPROOF_FLG", dt_Update_Disc_Main.Columns["REPROOF_FLG"].DataType);//取具進項憑証
                        dt_Update_Disc_Main.Columns.Add("NEW_REPROOF_NO", dt_Update_Disc_Main.Columns["REPROOF_NO"].DataType);//發票號碼/收據
                        dt_Update_Disc_Main.Columns.Add("NEW_RECEIPT_FLG", dt_Update_Disc_Main.Columns["RECEIPT_FLG"].DataType);//取具收據
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_UAMT", dt_Update_Disc_Main.Columns["DISC_UAMT"].DataType);//折讓金額(未稅)
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_TAX", dt_Update_Disc_Main.Columns["DISC_TAX"].DataType);//折讓稅額
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_AMT", dt_Update_Disc_Main.Columns["DISC_AMT"].DataType);//總金額
                        dt_Update_Disc_Main.Columns.Add("NEW_MEMO", dt_Update_Disc_Main.Columns["MEMO"].DataType);//備註
                        dt_Update_Disc_Main.Columns.Add("NEW_CLOSE_MONTH_ACCT", dt_Update_Disc_Main.Columns["CLOSE_MONTH_ACCT"].DataType);//結帳年月-財會
                        dt_Update_Disc_Main.Columns.Add("NEW_DISC_REMAIN_AMT", dt_Update_Disc_Main.Columns["DISC_REMAIN_AMT"].DataType);//沖帳餘額
                        dt_Update_Disc_Main.Columns.Add("NEW_DETL_FLG", dt_Update_Disc_Main.Columns["DETL_FLG"].DataType);//明細註記(1是有明細0是沒明細)

                        #endregion

                        #region 將異動資料寫入 VDS_CAA_DISC_MAIN 的 TempTable

                        foreach (DataRow dr_MainRow in dt_Main.Rows)
                        {
                            DataRow dr_Update_Disc_Main = dt_Update_Disc_Main.NewRow();

                            #region 設定欄位[結帳年月-財會]

                            if (this.slp_DISC_SOURCE.Text == "1")//欄位[來源]=系統開立
                            { s_CLOSE_MONTH_ACCT = this.slp_CLOSE_MONTH_ACCT.Text; }
                            else if (this.slp_DISC_SOURCE.Text == "2")//欄位[來源]=人工開立
                            { s_CLOSE_MONTH_ACCT = (this.slp_PROOF_DATE.Text == string.Empty) ? string.Empty : DateTime.Parse(this.slp_PROOF_DATE.Text).ToString("yyyyMM"); }

                            #endregion

                            dr_Update_Disc_Main["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
                            dr_Update_Disc_Main["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
                            dr_Update_Disc_Main["NEW_DISC_TYPE"] = CAAComm.GetValueSetParameter(this.slp_DISC_TYPE.Text, "string", false);//型式
                            dr_Update_Disc_Main["NEW_ACT_DISC_NO"] = CAAComm.GetValueSetParameter(this.txt_ACT_DISC_NO.Text, "string", false);//財會折讓單號
                            dr_Update_Disc_Main["NEW_CHG_DISC_DATE"] = CAAComm.GetValueSetParameter(this.slp_CHG_DISC_DATE.Text, "date", false);//異動折讓日期
                            dr_Update_Disc_Main["NEW_PROOF_DATE"] = CAAComm.GetValueSetParameter(this.slp_PROOF_DATE.Text, "date", false);//憑證已回日期
                            dr_Update_Disc_Main["NEW_REPROOF_FLG"] = CAAComm.GetValueSetParameter((this.chb_REPROOF_FLG.Checked == true) ? "1" : "0", "int", false);//取具進項憑証
                            dr_Update_Disc_Main["NEW_REPROOF_NO"] = CAAComm.GetValueSetParameter(this.txt_REPROOF_NO.Text, "string", false);//發票號碼/收據
                            dr_Update_Disc_Main["NEW_RECEIPT_FLG"] = CAAComm.GetValueSetParameter((this.chb_RECEIPT_FLG.Checked == true) ? "1" : "0", "int", false);//取具收據
                            dr_Update_Disc_Main["NEW_DISC_UAMT"] = CAAComm.GetValueSetParameter(this.slp_DISC_UAMT.Text, "int", false);//折讓金額(未稅)
                            dr_Update_Disc_Main["NEW_DISC_TAX"] = CAAComm.GetValueSetParameter(this.slp_DISC_TAX.Text, "int", false);//折讓稅額
                            dr_Update_Disc_Main["NEW_DISC_AMT"] = CAAComm.GetValueSetParameter(Request[txt_DISC_AMT.UniqueID].ToString(), "int", false);//總金額
                            dr_Update_Disc_Main["NEW_MEMO"] = CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false);//備註
                            dr_Update_Disc_Main["NEW_CLOSE_MONTH_ACCT"] = CAAComm.GetValueSetParameter(s_CLOSE_MONTH_ACCT, "string", false);//結帳年月-財會
                            dr_Update_Disc_Main["NEW_DISC_REMAIN_AMT"] = CAAComm.GetValueSetParameter(Request[txt_DISC_AMT.UniqueID].ToString(), "int", false);//沖帳餘額
                            dr_Update_Disc_Main["NEW_DETL_FLG"] = CAAComm.GetValueSetParameter("0", "int", false);//明細註記(1是有明細0是沒明細)

                            foreach (DataColumn dtcolumn in dt_Update_Disc_Main.Columns)
                            {
                                if (dtcolumn.ColumnName.Length < 4 ||
                                    dtcolumn.ColumnName.Substring(0, 4) != "NEW_")
                                { dr_Update_Disc_Main[dtcolumn.ColumnName] = dr_MainRow[dtcolumn.ColumnName]; }
                            }

                            dt_Update_Disc_Main.Rows.Add(dr_Update_Disc_Main);
                        }

                        #endregion

                        #region 連結資料庫

                        ParameterList.Clear();
                        ParameterList.Add(CAAComm.GetValueSetParameter(s_Now, "datetime", false));//更新日期
                        ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//更新人員

                        s_DISC_NO = bco.UpdateDiscRecord_REPROOF_Checked(null, dt_Update_Disc_Main, ParameterList);

                        #endregion
                    }

                    #endregion

                    #region [總金額(DISC_AMT)][沖帳餘額(DISC_REMAIN_AMT)]不相同,已沖帳

                    else
                    {
                        #region 取得 TempTable 的 SCHEMA

                        dt_Update_Disc_Main = bco.GET_VDS_CAA_DISC_MAIN_SCHEMA(ParameterList);

                        #endregion

                        #region 新增 VDS_CAA_DISC_MAIN 的異動欄位

                        dt_Update_Disc_Main.Columns.Add("NEW_UPDATEDATE", dt_Update_Disc_Main.Columns["UPDATEDATE"].DataType);
                        dt_Update_Disc_Main.Columns.Add("NEW_UPDATEUID", dt_Update_Disc_Main.Columns["UPDATEUID"].DataType);
                        dt_Update_Disc_Main.Columns.Add("NEW_MEMO", dt_Update_Disc_Main.Columns["MEMO"].DataType);//備註

                        #endregion

                        #region 將異動資料寫入 VDS_CAA_DISC_MAIN 的 TempTable

                        foreach (DataRow dr_MainRow in dt_Main.Rows)
                        {
                            DataRow dr_Update_Disc_Main = dt_Update_Disc_Main.NewRow();

                            dr_Update_Disc_Main["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
                            dr_Update_Disc_Main["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
                            dr_Update_Disc_Main["NEW_MEMO"] = CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false);//備註

                            foreach (DataColumn dtcolumn in dt_Update_Disc_Main.Columns)
                            {
                                if (dtcolumn.ColumnName.Length < 4 ||
                                    dtcolumn.ColumnName.Substring(0, 4) != "NEW_")
                                { dr_Update_Disc_Main[dtcolumn.ColumnName] = dr_MainRow[dtcolumn.ColumnName]; }
                            }

                            dt_Update_Disc_Main.Rows.Add(dr_Update_Disc_Main);
                        }

                        #endregion

                        #region 連結資料庫

                        s_DISC_NO = bco.UpdateDiscRecord_PERIOD_Checked(null, dt_Update_Disc_Main);

                        #endregion
                    }

                    #endregion
                }

                #endregion

                #region 勾選欄位[作廢]

                else if (s_ReturnMsg == "勾選欄位[作廢]")
                {
                    #region 取得 TempTable 的 SCHEMA

                    dt_Update_Disc_Main = bco.GET_VDS_CAA_DISC_MAIN_SCHEMA(ParameterList);

                    #endregion

                    #region 新增 VDS_CAA_DISC_MAIN 的異動欄位

                    dt_Update_Disc_Main.Columns.Add("NEW_UPDATEDATE", dt_Update_Disc_Main.Columns["UPDATEDATE"].DataType);
                    dt_Update_Disc_Main.Columns.Add("NEW_UPDATEUID", dt_Update_Disc_Main.Columns["UPDATEUID"].DataType);
                    dt_Update_Disc_Main.Columns.Add("NEW_CANCEL_FLG", dt_Update_Disc_Main.Columns["CANCEL_FLG"].DataType);//作廢註記
                    dt_Update_Disc_Main.Columns.Add("NEW_CANCEL_DATE", dt_Update_Disc_Main.Columns["CANCEL_DATE"].DataType);//作廢日期
                    dt_Update_Disc_Main.Columns.Add("NEW_MEMO", dt_Update_Disc_Main.Columns["MEMO"].DataType);//備註

                    #endregion

                    #region 將異動資料寫入 VDS_CAA_DISC_MAIN 的 TempTable

                    foreach (DataRow dr_MainRow in dt_Main.Rows)
                    {
                        DataRow dr_Update_Disc_Main = dt_Update_Disc_Main.NewRow();

                        dr_Update_Disc_Main["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
                        dr_Update_Disc_Main["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
                        dr_Update_Disc_Main["NEW_CANCEL_FLG"] = CAAComm.GetValueSetParameter((this.chb_CANCEL_FLG.Checked == true) ? "1" : "0", "int", false);//作廢註記
                        dr_Update_Disc_Main["NEW_CANCEL_DATE"] = CAAComm.GetValueSetParameter(this.slp_CANCEL_DATE.Text, "date", false);//作廢日期
                        dr_Update_Disc_Main["NEW_MEMO"] = CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false);//備註

                        foreach (DataColumn dtcolumn in dt_Update_Disc_Main.Columns)
                        {
                            if (dtcolumn.ColumnName.Length < 4 ||
                                dtcolumn.ColumnName.Substring(0, 4) != "NEW_")
                            { dr_Update_Disc_Main[dtcolumn.ColumnName] = dr_MainRow[dtcolumn.ColumnName]; }
                        }

                        dt_Update_Disc_Main.Rows.Add(dr_Update_Disc_Main);
                    }

                    #endregion

                    #region 連結資料庫

                    ParameterList.Clear();
                    ParameterList.Add(CAAComm.GetValueSetParameter(s_Now, "datetime", false));//更新日期
                    ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//更新人員

                    s_DISC_NO = bco.UpdateDiscRecord_CANCEL_Checked(null, dt_Update_Disc_Main, ParameterList);

                    #endregion
                }

                #endregion

                #region 勾選欄位[轉暫收]

                else if (s_ReturnMsg == "勾選欄位[轉暫收]")
                {
                    #region 取得 TempTable 的 SCHEMA

                    dt_Update_Disc_Main = bco.GET_VDS_CAA_DISC_MAIN_SCHEMA(ParameterList);

                    #endregion

                    #region 新增 VDS_CAA_DISC_MAIN 的異動欄位

                    dt_Update_Disc_Main.Columns.Add("NEW_UPDATEDATE", dt_Update_Disc_Main.Columns["UPDATEDATE"].DataType);
                    dt_Update_Disc_Main.Columns.Add("NEW_UPDATEUID", dt_Update_Disc_Main.Columns["UPDATEUID"].DataType);
                    dt_Update_Disc_Main.Columns.Add("NEW_TEMPORAL_FLG", dt_Update_Disc_Main.Columns["TEMPORAL_FLG"].DataType);//轉暫收註記
                    dt_Update_Disc_Main.Columns.Add("NEW_TEMPORAL_DATE", dt_Update_Disc_Main.Columns["TEMPORAL_DATE"].DataType);//暫收日期
                    dt_Update_Disc_Main.Columns.Add("NEW_MEMO", dt_Update_Disc_Main.Columns["MEMO"].DataType);//備註
                    dt_Update_Disc_Main.Columns.Add("NEW_TARGET", typeof(string));//判斷資料原本是否為"轉暫收"

                    #endregion

                    #region 將異動資料寫入 VDS_CAA_DISC_MAIN 的 TempTable

                    foreach (DataRow dr_MainRow in dt_Main.Rows)
                    {
                        DataRow dr_Update_Disc_Main = dt_Update_Disc_Main.NewRow();

                        dr_Update_Disc_Main["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
                        dr_Update_Disc_Main["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
                        dr_Update_Disc_Main["NEW_TEMPORAL_FLG"] = CAAComm.GetValueSetParameter((this.chb_TEMPORAL_FLG.Checked == true) ? "1" : "0", "int", false);//轉暫收註記
                        dr_Update_Disc_Main["NEW_TEMPORAL_DATE"] = CAAComm.GetValueSetParameter(Request[txt_TEMPORAL_DATE.UniqueID].ToString(), "date", false);//暫收日期
                        dr_Update_Disc_Main["NEW_MEMO"] = CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false);//備註
                        dr_Update_Disc_Main["NEW_TARGET"] = (dr_MainRow["TEMPORAL_FLG"].ToString() == "1") ? "Original TEMPORAL" : "New TEMPORAL";//判斷資料原本是否為"轉暫收"

                        foreach (DataColumn dtcolumn in dt_Update_Disc_Main.Columns)
                        {
                            if (dtcolumn.ColumnName.Length < 4 ||
                                dtcolumn.ColumnName.Substring(0, 4) != "NEW_")
                            { dr_Update_Disc_Main[dtcolumn.ColumnName] = dr_MainRow[dtcolumn.ColumnName]; }
                        }

                        dt_Update_Disc_Main.Rows.Add(dr_Update_Disc_Main);
                    }

                    #endregion

                    #region 連結資料庫

                    s_DISC_NO = bco.UpdateDiscRecord_TEMPORAL_Checked(null, dt_Update_Disc_Main);

                    #endregion
                }

                #endregion

                #region 原本就勾選欄位[申報]

                else if (s_ReturnMsg == "原本就勾選欄位[申報]")
                {
                    #region 取得 TempTable 的 SCHEMA

                    dt_Update_Disc_Main = bco.GET_VDS_CAA_DISC_MAIN_SCHEMA(ParameterList);

                    #endregion

                    #region 新增 VDS_CAA_DISC_MAIN 的異動欄位

                    dt_Update_Disc_Main.Columns.Add("NEW_UPDATEDATE", dt_Update_Disc_Main.Columns["UPDATEDATE"].DataType);
                    dt_Update_Disc_Main.Columns.Add("NEW_UPDATEUID", dt_Update_Disc_Main.Columns["UPDATEUID"].DataType);
                    dt_Update_Disc_Main.Columns.Add("NEW_MEMO", dt_Update_Disc_Main.Columns["MEMO"].DataType);//備註

                    #endregion

                    #region 將異動資料寫入 VDS_CAA_DISC_MAIN 的 TempTable

                    foreach (DataRow dr_MainRow in dt_Main.Rows)
                    {
                        DataRow dr_Update_Disc_Main = dt_Update_Disc_Main.NewRow();

                        dr_Update_Disc_Main["NEW_UPDATEDATE"] = CAAComm.GetValueSetParameter(s_Now, "datetime", false);//更新日期
                        dr_Update_Disc_Main["NEW_UPDATEUID"] = CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//更新人員
                        dr_Update_Disc_Main["NEW_MEMO"] = CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false);//備註

                        foreach (DataColumn dtcolumn in dt_Update_Disc_Main.Columns)
                        {
                            if (dtcolumn.ColumnName.Length < 4 ||
                                dtcolumn.ColumnName.Substring(0, 4) != "NEW_")
                            { dr_Update_Disc_Main[dtcolumn.ColumnName] = dr_MainRow[dtcolumn.ColumnName]; }
                        }

                        dt_Update_Disc_Main.Rows.Add(dr_Update_Disc_Main);
                    }

                    #endregion

                    #region 連結資料庫

                    s_DISC_NO = bco.UpdateDiscRecord_PERIOD_Checked(null, dt_Update_Disc_Main);

                    #endregion
                }

                #endregion

                #endregion

                #region 清空變數,跳轉頁面至檢視模式

                if (dt_NewItem != null)
                { dt_NewItem.Clear(); }

                #region 組合跳轉頁面字串

                string s_ADDLocation_Replace_String = string.Empty;

                try
                {
                    int i_Count = int.Parse(Request.QueryString["CAA182_COUNT"]);
                    string s_Request_Key = Request.QueryString["CAA182_PageTimeStamp"];

                    s_ADDLocation_Replace_String = "&CAA182_COUNT=" + i_Count.ToString() + "&CAA182_PageTimeStamp=" + s_Request_Key;
                }
                catch { s_ADDLocation_Replace_String = string.Empty; }

                #endregion

                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA182", "alert('更新成功');location.replace('CAA182.aspx?Code=CAA18&CAA182_Mode=view&CAA182_DISC_NO=" + s_DISC_NO + s_ADDLocation_Replace_String + "');", true);

                #endregion
            }

            #endregion

            #region 如果不符合以上條件,代表錯誤

            else { throw new Exception("頁面資料錯誤,只有在[新增模式][編輯模式]下,才可按[儲存]鈕"); }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { Finally_Function(); }
    }
Example #24
0
    /// <summary>
    /// 儲存到期日,票據託收日,票據號碼異動  因為是總帳不用考慮是否沖帳及月結
    /// </summary>
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {

            #region 檢查條件

            CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();
            ArrayList arl_Check_Condition = Check_Condition();

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "TO_CAA122.aspx", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion


            string strMsg = string.Empty;
            string strNo = dt.Rows[0]["BOND_NO"].ToString();
            string strNowDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            DateTime EX_DUE_DATE = new DateTime();

            string txt_BOND_ID = this.txt_BOND_ID.Text.ToString();
            DateTime slp_DUE_DATE = Convert.ToDateTime(this.slp_DUE_DATE.Text.ToString());
            DateTime slp_NB_COLL_DATE = Convert.ToDateTime(this.slp_NB_COLL_DATE.Text.ToString());



            ParameterList.Clear();

            ParameterList.Add(CAAComm.GetValueSetParameter(strNo, "string", false)); //V_BOND_NO
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); //V_UPDATEUID
            ParameterList.Add(CAAComm.GetValueSetParameter(strNowDate, "datetime", false)); //D_UPDATEDATE


            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_BOND_ID.Text.ToUpper(), "string", false)); //V_NEW_BOND_ID
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DUE_DATE.Text, "date", false)); //D_NEW_DUE_DATE
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_NB_COLL_DATE.Text, "date", false)); //D_NEW_NB_COLL_DATE

            //若未兌現,則要更改預計兌現日
            if (this.cb_EX_DUE_FLG.Checked == false)
            {
                /*20100514新增規則
                判斷[票據托收日(DUE_DATE)]及[到期日(NB_COLL_DATE)]何者為大=>
                 * 取大的日期+3天(含假日)置放回[票據預計兌現日(EX_DUE_DATE)]*/
                if (slp_DUE_DATE >= slp_NB_COLL_DATE)
                {
                    EX_DUE_DATE = slp_DUE_DATE.AddDays(3);
                }
                else
                {
                    EX_DUE_DATE = slp_NB_COLL_DATE.AddDays(3);
                }

                ParameterList.Add(CAAComm.GetValueSetParameter(EX_DUE_DATE.ToString(), "date", false)); //D_EX_DUE_DATE
            }
            else
            {
                ParameterList.Add(CAAComm.GetValueSetParameter("", "string", false)); //D_EX_DUE_DATE
            }

            CAAModel.MaintainBondRecord BCO = new CAAModel.MaintainBondRecord(ConntionDB);
            ArrayList ary = BCO.UpdateCAA12BondRecord(ParameterList, null);

            #region 組合跳轉頁面字串

            string s_ADDLocation_Replace_String = string.Empty;

            try
            {
                int i_Count = int.Parse(Request.QueryString["CAA122_COUNT"]);
                string s_Request_Key = Request.QueryString["CAA122_PageTimeStamp"];

                s_ADDLocation_Replace_String = "&CAA122_COUNT=" + i_Count.ToString() + "&CAA122_PageTimeStamp=" + s_Request_Key;
            }
            catch { s_ADDLocation_Replace_String = string.Empty; }

            #endregion

            strMsg = "alert('" + ary[1].ToString() + "');";
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "TO_CAA122.aspx", strMsg, true);
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { Finally_Function(); }
    }
Example #25
0
    /// <summary>
    /// 新增 & 編輯 模式下離開[客戶代號/名稱]帶出相關資料
    /// </summary>
    private void txt_STORE_ID_Onblur()
    {
        #region 規則

        /*
         * 與秀玲確認過
         * 抓取店號帶出相關資料的部份
         * 在[新增]狀態下,要用 sysdate    作為查詢條件
         * 在[編輯]狀態下,要用 createdate 作為查詢條件(編輯畫面load進來時,和使用者修改店號時都要以該筆資料的createdate為主)
         * 來查出 [VDS_STM_STORE][VDS_STM_ACCOUNT_PROPERTY] 這兩個Table當時的資料
         */

        #endregion

        try
        {
            #region 新增 or 編輯 模式

            BCO.CAACommon CAAComm = new BCO.CAACommon();

            if (this.hid_Page_Status.Value == "INSERT" ||
                this.hid_Page_Status.Value == "EDIT")
            {
                #region 重新將店號再寫入一次

                this.slp_STORE_ID.Text = this.slp_STORE_ID.Text;

                #endregion

                if (this.slp_STORE_ID.Text.Trim() == string.Empty)
                {
                    #region 將欄位清空

                    this.txt_Z_O_ID.Text = string.Empty;//營業所
                    this.txt_Z_O.Text = string.Empty;//營業所名稱
                    this.txt_SAL.Text = string.Empty;//營業人員
                    this.txt_SAL_ID.Text = string.Empty;//營業人員名稱
                    this.txt_RFNO.Text = string.Empty;//統一編號
                    this.txt_RFNO_TITLE.Text = string.Empty;//統一編號抬頭




                    #endregion

                    #region Focus欄位

                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(this.txt_BOND_ID.ClientID, true);
                    ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA162", s_ScriptManager_Script, true);

                    #endregion
                }
                else
                {
                    #region 傳入參數

                    DateTime d_Date;

                    d_Date = DateTime.Parse(this.hid_CREATEDATE.Value);

                    ParameterList.Clear();
                    ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_STORE_ID.Text, "string", false));//店號
                    ParameterList.Add(CAAComm.GetValueSetParameter(d_Date.ToString(), "datetime", false));//時間
                    ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

                    #endregion

                    #region 連結資料庫

                    BCO.MaintainBondRecord BCO = new BCO.MaintainBondRecord(ConntionDB);
                    DataTable dt_Return = BCO.GET_STORE_RELATE_DATA(ParameterList);

                    #endregion

                    #region 檢查回傳資料

                    if (dt_Return.Rows.Count != 1)
                    {
                        #region 將欄位清空

                        this.txt_Z_O_ID.Text = string.Empty;//營業所
                        this.txt_Z_O.Text = string.Empty;//營業所名稱
                        this.txt_SAL.Text = string.Empty;//營業人員
                        this.txt_SAL_ID.Text = string.Empty;//營業人員名稱
                        this.txt_RFNO.Text = string.Empty;//統一編號
                        this.txt_RFNO_TITLE.Text = string.Empty;//統一編號抬頭




                        #endregion

                        #region 若發生錯誤則alert訊息(秀玲要alert訊息)

                        //若發生錯誤,則只要alert錯誤訊息,不要focus到[店號]欄位
                        string s_ScriptManager_Script = "alert('無符合店號或己關店,請重新輸入')";
                        ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA162", s_ScriptManager_Script, true);

                        #endregion

                        return;
                    }

                    #endregion

                    #region 將資料寫入頁面

                    else
                    {
                        this.txt_Z_O_ID.Text = dt_Return.Rows[0]["Z_O"].ToString();//營業所
                        this.txt_Z_O.Text = dt_Return.Rows[0]["Z_O_NAME"].ToString();//營業所名稱
                        this.txt_SAL.Text = dt_Return.Rows[0]["SAL_ID"].ToString();//營業人員
                        this.txt_SAL_ID.Text = dt_Return.Rows[0]["SAL_ID_NAME"].ToString();//營業人員名稱
                        this.txt_RFNO.Text = dt_Return.Rows[0]["RFNO"].ToString();//統一編號
                        this.txt_RFNO_TITLE.Text = dt_Return.Rows[0]["TITLE"].ToString();//統一編號抬頭

                        #region Focus欄位

                        string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(this.txt_BOND_ID.ClientID, true);
                        ScriptManager.RegisterStartupScript(this.up_Condition, typeof(UpdatePanel), "CAA162", s_ScriptManager_Script, true);

                        #endregion
                    }

                    #endregion
                }
            }

            #endregion

            #region 如果不符合以上條件,代表錯誤

            else { throw new Exception("頁面資料錯誤,只有在[新增 or 編輯模式]下,才有欄位[店號]Onblur事件"); }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #26
0
    protected void DataBind()
    {
        CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();


        #region 傳入參數

        ParameterList.Clear();
        ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_3_Second_No.Text, "string", false));//[單號]起
        ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_3_WASHDATE_RANGE.StartDate, "date", false));//[沖帳日期]起
        ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_3_WASHDATE_RANGE.EndDate, "date", false));//[沖帳日期]迄
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_SOURCE_TYPE.Text, "string", false));//[來源別]
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_3_STORE_ID.Text, "string", false));//[店號]
        ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_3_RFNO.Text, "string", false));//[結帳統編]
        ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_3_VOUCH_RFNO.Text, "string", false));//[統一編號]
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PROFIT_NO_B.Text, "string", false));//[利潤中心]起
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PROFIT_NO_E.Text, "string", false));//[利潤中心]迄
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_Z_O_B.Text, "string", false));//[營業所]起
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_Z_O_E.Text, "string", false));//[營業所]迄
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_3_SAL_ID.Text, "string", false));//[營業人員]
        ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_3_AC_ID.Text, "string", false));//[帳務人員]
        ParameterList.Add(CAAComm.GetValueSetParameter(this.SLP_3_CREATEUID.Text, "string", false));//[建立人員]
        ParameterList.Add(CAAComm.GetValueSetParameter((this.txt_RowCountLimit.Text == string.Empty) ? "100" : (int.Parse(this.txt_RowCountLimit.Text) < 0) ? "100" : this.txt_RowCountLimit.Text, "int", false));//[筆數]

        #endregion

        #region 連結資料庫

        DataTable dt_Return = new DataTable();
        CAAModel.CAA32_BCO bco = new CAAModel.CAA32_BCO(ConntionDB);
        dt_Return = bco.QueryPreviousData(ParameterList);

        #endregion

        #region 資料與GridView繫結

        //抓取本頁初次登記的時間
        string SessionIDName = "CAA321_" + PageTimeStamp.Value;

        Session["SessionID"] = SessionIDName;
        Session[SessionIDName] = dt_Return;

        this.gv_QueryResult.DataSource = dt_Return;
        this.gv_QueryResult.PageSize = (this.txt_Pagesize.Text == string.Empty) ? 20 : (int.Parse(this.txt_Pagesize.Text) < 0) ? 20 : int.Parse(this.txt_Pagesize.Text);
        this.gv_QueryResult.PageIndex = 0;
        this.gv_QueryResult.DataBind();

        #endregion

        #region 將Key值存到Session中

        //ArrayList arl_Key = new ArrayList();
        //foreach (DataRow drRow in dt_Return.Rows)
        //{ arl_Key.Add(drRow["INV_NO"].ToString()); }

        //Session["CAA322_SortKey" + this.PageTimeStamp.Value] = arl_Key;

        #endregion

        #region 檢查回傳資料

        if (dt_Return.Rows.Count == 0)
        { this.ErrorMsgLabel.Text = "查無資料"; }

        #endregion
    
    }
Example #27
0
    private bool Check_BOND_ID()
    {
        bool bResult = false;

        #region 傳入參數

        BCO.CAACommon CAAComm = new BCO.CAACommon();

        ParameterList.Clear();
        ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_BOND_NO.Text, "string", false));//收款單號
        ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_BOND_ID.Text.ToUpper(), "string", false));//票據號碼
        ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DUE_DATE.Text, "date", false));//到期日
        ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//登入人員

        #endregion

        #region 連結資料庫

        DataTable dt_Return = new DataTable();
        BCO.MaintainBondRecord bco = new BCO.MaintainBondRecord(ConntionDB);
        dt_Return = bco.CHECK_BOND_ID(ParameterList);

        #endregion

        #region 檢查回傳資料

        if (dt_Return.Rows.Count == 0)
        { bResult = true; }

        #endregion

        return bResult;
    }
Example #28
0
    /// <summary>
    /// BUTTON [折讓開立]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_GetDiscInv_Click(object sender, EventArgs e)
    {
        try
        {
            #region 新增狀態

            if (this.hid_PageStatus.Value == "insert")
            {
                #region 檢查條件

                BCO.CAACommon CAAComm = new BCO.CAACommon();
                ArrayList arl_Check_Condition = Check_Condition("BUTTON [折讓開立]鈕");

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 清空變數

                if (dt_NewItem != null)
                { dt_NewItem.Clear(); }

                #endregion

                #region 清空新增項目

                #region 將新增項目的Panel關閉

                this.panel_Disc_NewItem.Visible = false;

                #endregion

                #region 設定新增項目的初始狀態

                Set_Disc_NewItem_Default();

                #endregion

                #endregion

                #region 傳入參數

                ParameterList.Clear();
                ParameterList.Add(CAAComm.GetValueSetParameter("BUTTON", "string", false));//[查詢型態]
                ParameterList.Add(CAAComm.GetValueSetParameter(DateTime.Now.ToString(), "date", false));//[履歷時間]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_STORE_ID.Text, "string", false));//[店號]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_RFNO.Text, "string", false));//[統一編號]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false));//[商品群分類]
                ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_TAX_TYPE.Text, "int", false));//[稅別]
                ParameterList.Add(CAAComm.GetValueSetParameter(string.Empty, "string", false));//[發票號碼]
                ParameterList.Add(CAAComm.GetValueSetParameter("100", "int", false));//只取前100筆
                ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

                #endregion

                #region 連結資料庫

                BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
                dt_NewItem = bco.GetDetailRecord(ParameterList);

                #endregion

                #region 資料與GridView繫結

                this.gv_DiscInv.DataSource = dt_NewItem;
                this.gv_DiscInv.PageSize = 10;//設定一頁10筆資料
                this.gv_DiscInv.PageIndex = 0;
                this.gv_DiscInv.DataBind();

                #endregion

                #region 檢查回傳資料

                #region 不管有沒有資料,[新增項目]鈕都要可以按

                this.but_Disc_NewItem.Enabled = true;

                #endregion

                #region 計算欄位[折讓金額(未稅)][折讓稅額][總金額]

                int i_txt_DISC_UAMT = 0;//折讓金額(未稅)
                int i_txt_DISC_TAX = 0;//折讓稅額
                int i_txt_DISC_AMT = 0;//含稅金額

                foreach (DataRow dr_Count in dt_NewItem.Rows)
                {
                    i_txt_DISC_UAMT += int.Parse(dr_Count["DISC_UAMT"].ToString());//折讓金額(未稅)
                    i_txt_DISC_TAX += int.Parse(dr_Count["DISC_TAX"].ToString());//折讓稅額
                    i_txt_DISC_AMT += int.Parse(dr_Count["DISC_AMT"].ToString());//含稅金額
                }

                this.slp_DISC_UAMT.Text = i_txt_DISC_UAMT.ToString();//折讓金額(未稅)
                this.slp_DISC_TAX.Text = i_txt_DISC_TAX.ToString();//折讓稅額
                this.slp_DISC_AMT.Text = i_txt_DISC_AMT.ToString();//總金額

                #endregion

                #region 將畫面鎖起來

                this.slp_DISC_FORM.ReadOnly = true;//格式代號
                this.slp_STORE_ID.ReadOnly = true;//店號
                this.slp_DISC_TYPE.ReadOnly = true;//型式
                this.slp_ROOT_NO.ReadOnly = true;//商品群分類
                this.slp_TAX_TYPE.ReadOnly = true;//稅別
                this.txt_ACT_DISC_NO.ReadOnly = true;//財會折讓單號
                this.txt_ACT_DISC_NO.CssClass = "readtxtbox";
                this.slp_CHG_DISC_DATE.ReadOnly = true;//異動折讓日期
                this.chb_PROOF_FLG.Enabled = false;//憑證已回
                this.slp_PROOF_DATE.ReadOnly = true;//憑證已回日期
                this.chb_REPROOF_FLG.Enabled = false;//取具進項憑証
                this.txt_REPROOF_NO.ReadOnly = true;//發票號碼/收據
                this.txt_REPROOF_NO.CssClass = "readtxtbox";
                this.chb_RECEIPT_FLG.Enabled = false;//取具收據
                this.slp_CLOSE_MONTH.ReadOnly = true;//結帳年月
                this.txt_MEMO.ReadOnly = true;//備註
                this.txt_MEMO.CssClass = "readtxtbox";

                #endregion

                #endregion
            }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        { Finally_Function(); }
    }
Example #29
0
    /// <summary>
    /// 編輯模式下按下[儲存]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Update_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            BCO.CAACommon CAAComm = new BCO.CAACommon();
            ArrayList arl_Check_Condition = Check_Condition("Edit");

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAA162", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            #region 傳入參數

            string strMsg = string.Empty;
            string strNowDate = DateTime.Now.ToString();
            string strNo = dt.Rows[0]["BOND_NO"].ToString();

            string str_UN_MONTH_CLOSE = "0";
            if (this.cb_UN_MONTH_CLOSE.Checked == true)
            { str_UN_MONTH_CLOSE = "1"; }

            string str_EX_DUE_FLG = "0";
            if (this.cb_EX_DUE_FLG.Checked == true)
            { str_EX_DUE_FLG = "1"; }

            ParameterList.Clear();
            //舊資料
            ParameterList.Add(CAAComm.GetValueSetParameter(dt.Rows[0]["BOND_NO"].ToString(), "string", false)); //V_OLD_BOND_NO
            ParameterList.Add(CAAComm.GetValueSetParameter(dt.Rows[0]["CREATEDATE"].ToString(), "datetime", false)); //D_OLD_CREATEDATE
            ParameterList.Add(CAAComm.GetValueSetParameter(dt.Rows[0]["CREATEUID"].ToString(), "string", false)); //V_OLD_CREATEUID
            ParameterList.Add(CAAComm.GetValueSetParameter(dt.Rows[0]["UPDATEDATE"].ToString(), "datetime", false)); //D_OLD_UPDATEDATE
            ParameterList.Add(CAAComm.GetValueSetParameter(dt.Rows[0]["UPDATEUID"].ToString(), "string", false)); //V_OLD_UPDATEUID
            //新資料
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_BOND_NO.Text, "string", false)); //V_NEW_BOND_NO
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_STORE_ID.Text, "string", false)); //V_NEW_STORE_ID
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_BOND_ID.Text.ToUpper(), "string", false)); //V_NEW_BOND_ID
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_BOND_TYPE.Text, "string", false)); //V_NEW_BOND_TYPE
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_ACCEPT_BOND_DATE.Text, "date", false)); //D_NEW_ACCEPT_BOND_DATE
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_DUE_DATE.Text, "date", false)); //D_NEW_DUE_DATE
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_BOND_AMT.Text, "int", false)); //N_NEW_BOND_AMT
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_POSTAGE.Text, "int", false)); //N_NEW_POSTAGE
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_PAY_BANK.Text, "string", false)); //V_NEW_PAY_BANK
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_PAY_ACCOUNT.Text, "string", false)); //V_NEW_PAY_ACCOUNT
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_COLL_BANK.Text, "string", false)); //V_NEW_COLL_BANK
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_COLL_ID.Text, "string", false)); //V_NEW_COLL_ID
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_NB_COLL_DATE.Text, "date", false)); //D_NEW_NB_COLL_DATE
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_MEMO.Text, "string", false)); //V_NEW_MEMO
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_REJECT_DATE.Text, "date", false)); //D_NEW_REJECT_DATE
            ParameterList.Add(CAAComm.GetValueSetParameter(this.txt_REJECT_MEMO.Text, "string", false)); //V_NEW_REJECT_MEMO
            ParameterList.Add(CAAComm.GetValueSetParameter(str_UN_MONTH_CLOSE, "string", false)); //V_NEW_UN_MONTH_CLOSE
            ParameterList.Add(CAAComm.GetValueSetParameter(str_EX_DUE_FLG, "string", false)); //V_NEW_EX_DUE_FLG
            ParameterList.Add(CAAComm.GetValueSetParameter(strNowDate, "datetime", false)); //D_NEW_UPDATEDATE
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); //V_NEW_UPDATEUID

            #endregion

            #region 組合跳轉頁面字串

            string s_ADDLocation_Replace_String = string.Empty;

            try
            {
                int i_Count = int.Parse(Request.QueryString["CAA162_COUNT"]);
                string s_Request_Key = Request.QueryString["CAA162_PageTimeStamp"];

                s_ADDLocation_Replace_String = "&CAA162_COUNT=" + i_Count.ToString() + "&CAA162_PageTimeStamp=" + s_Request_Key;
            }
            catch { s_ADDLocation_Replace_String = string.Empty; }

            #endregion

            #region 連結資料庫

            BCO.MaintainBondRecord bco = new BCO.MaintainBondRecord(ConntionDB);
            ArrayList aryUpd = bco.UpdateBondRecord(ParameterList, null);

            #endregion

            #region 跳轉頁面至檢視模式

            strMsg = "alert('" + aryUpd[1].ToString() + "');location.replace('CAA162.aspx?V_NO=" + strNo + "&mode=VIEW&Code=CAA16" + s_ADDLocation_Replace_String + "');";
            ScriptManager.RegisterStartupScript(this.btn_Update, this.GetType(), "TO_CAA162.aspx", strMsg, true);

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #30
0
    /// <summary>
    /// 折讓項目 BUTTON [確認]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Disc_Insert_Click(object sender, EventArgs e)
    {
        try
        {
            bool b_ExistTempTable = false;

            #region 新增狀態 & 編輯狀態

            if (this.hid_PageStatus.Value == "insert" ||
                this.hid_PageStatus.Value == "edit")
            {
                #region 檢查條件

                BCO.CAACommon CAAComm = new BCO.CAACommon();
                ArrayList arl_Check_Condition = Check_Condition("折讓項目 BUTTON [確認]鈕");

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel2.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = CAAComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CAA182", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region SLP轉型

                TextBox txt_Disc_DISC_TAX = (TextBox)this.slp_Disc_DISC_TAX.FindControl("TextBoxCode");

                #endregion

                #region 判斷資料是否存在於dt_NewItem

                int i_DISC_UAMT = int.Parse(this.slp_Disc_DISC_UAMT.Text);//折讓金額(未稅)
                int i_DISC_TAX = int.Parse(Request[txt_Disc_DISC_TAX.UniqueID].ToString());//折讓稅額
                int i_Total_NON_INV_UAMT = int.Parse(this.hid_Disc_Total_NON_INV_UAMT.Value);//發票餘額(未稅)+折讓金額(未稅)
                int i_Total_NON_INV_TAX = int.Parse(this.hid_Disc_Total_NON_INV_TAX.Value);//發票稅額+折讓稅額
                bool b_Is_NeedChange = false;

                string s_FilterExpression = "INV_NO = '" + this.txt_Disc_INV_NO.Text + "'";
                DataRow[] dr_Edit = dt_NewItem.Select(s_FilterExpression);

                #region 存在,則更改dt_NewItem的資料

                if (dr_Edit.Length == 1)
                {
                    if (dr_Edit[0].RowState == DataRowState.Added)
                    { b_Is_NeedChange = true; }
                    else
                    {
                        //如果新增項目中的[折讓金額(未稅)][折讓稅額]沒有異動,則不做動作
                        if (
                            (dr_Edit[0]["DISC_UAMT", DataRowVersion.Original].ToString() != i_DISC_UAMT.ToString() || dr_Edit[0]["DISC_TAX", DataRowVersion.Original].ToString() != i_DISC_TAX.ToString()) ||
                            (dr_Edit[0]["DISC_UAMT", DataRowVersion.Current].ToString() != i_DISC_UAMT.ToString() || dr_Edit[0]["DISC_TAX", DataRowVersion.Current].ToString() != i_DISC_TAX.ToString())
                            )
                        { b_Is_NeedChange = true; }
                    }

                    if (b_Is_NeedChange == true)
                    {
                        dr_Edit[0]["INV_NO"] = CAAComm.GetValueSetParameter(this.txt_Disc_INV_NO.Text, "string", false);//發票號碼
                        dr_Edit[0]["INV_DATE"] = CAAComm.GetValueSetParameter(this.slp_Disc_INV_DATE.Text, "date", false);//發票日期
                        dr_Edit[0]["ITEM_NAME"] = CAAComm.GetValueSetParameter(this.txt_Disc_ITEM_NAME.Text, "string", false);//品名
                        dr_Edit[0]["TAX_TYPE"] = CAAComm.GetValueSetParameter(this.slp_Disc_TAX_TYPE.Text, "int", false);//發票稅別
                        dr_Edit[0]["TAX_TYPE_NAME"] = (this.slp_Disc_TAX_TYPE.Text == "0") ? "應稅" : (this.slp_Disc_TAX_TYPE.Text == "1") ? "免稅" : "零稅";
                        dr_Edit[0]["DISC_UAMT"] = CAAComm.GetValueSetParameter(i_DISC_UAMT.ToString(), "int", false);//折讓金額(未稅)
                        dr_Edit[0]["DISC_TAX"] = CAAComm.GetValueSetParameter(i_DISC_TAX.ToString(), "int", false);//折讓稅額
                        dr_Edit[0]["DISC_AMT"] = Convert.ToString(i_DISC_UAMT + i_DISC_TAX);//含稅金額
                        dr_Edit[0]["NON_INV_UAMT"] = CAAComm.GetValueSetParameter(Convert.ToString(i_Total_NON_INV_UAMT - i_DISC_UAMT), "int", false);//發票餘額(未稅)
                        dr_Edit[0]["NON_INV_TAX"] = CAAComm.GetValueSetParameter(Convert.ToString(i_Total_NON_INV_TAX - i_DISC_TAX), "int", false);//發票稅額
                    }

                    b_ExistTempTable = true;
                }

                #endregion

                #region 不存在,則將資料寫入dt_NewItem

                else
                {
                    #region 使用XML轉回DataSet

                    DataSet ds_Main = new DataSet();
                    System.IO.StringReader sr = new System.IO.StringReader(xml_VDS_CAA_INV_MAIN_Data.InnerHtml);
                    ds_Main.ReadXml(sr);

                    #endregion

                    #region 檢查畫面上的發票號碼是否跟XML的資料相符

                    DataRow dr_Main = ds_Main.Tables[0].Rows[0];

                    if (dr_Main["INV_NO"].ToString() != this.txt_Disc_INV_NO.Text)
                    { throw new Exception("按下折讓項目的[確認]鈕,新增資料至TempTable,發生頁面資料錯誤"); }

                    #endregion

                    #region 將資料寫入Temp Table dt_NewItem

                    DataRow dr_New = dt_NewItem.NewRow();

                    foreach (DataColumn dc_NewItem in dt_NewItem.Columns)
                    {
                        if (ds_Main.Tables[0].Columns.Contains(dc_NewItem.ColumnName) == true)
                        { dr_New[dc_NewItem.ColumnName] = dr_Main[dc_NewItem.ColumnName]; }
                    }

                    dr_New["INV_NO"] = CAAComm.GetValueSetParameter(this.txt_Disc_INV_NO.Text, "string", false);//發票號碼
                    dr_New["INV_DATE"] = CAAComm.GetValueSetParameter(this.slp_Disc_INV_DATE.Text, "date", false);//發票日期
                    dr_New["ITEM_NAME"] = CAAComm.GetValueSetParameter(this.txt_Disc_ITEM_NAME.Text, "string", false);//品名
                    dr_New["TAX_TYPE"] = CAAComm.GetValueSetParameter(this.slp_Disc_TAX_TYPE.Text, "int", false);//發票稅別
                    dr_New["TAX_TYPE_NAME"] = (this.slp_Disc_TAX_TYPE.Text == "0") ? "應稅" : (this.slp_Disc_TAX_TYPE.Text == "1") ? "免稅" : "零稅";
                    dr_New["DISC_UAMT"] = CAAComm.GetValueSetParameter(i_DISC_UAMT.ToString(), "int", false);//折讓金額(未稅)
                    dr_New["DISC_TAX"] = CAAComm.GetValueSetParameter(i_DISC_TAX.ToString(), "int", false);//折讓稅額
                    dr_New["DISC_AMT"] = Convert.ToString(i_DISC_UAMT + i_DISC_TAX);//含稅金額
                    dr_New["NON_INV_UAMT"] = CAAComm.GetValueSetParameter(Convert.ToString(i_Total_NON_INV_UAMT - i_DISC_UAMT), "int", false);//發票餘額(未稅)
                    dr_New["NON_INV_TAX"] = CAAComm.GetValueSetParameter(Convert.ToString(i_Total_NON_INV_TAX - i_DISC_TAX), "int", false);//發票稅額
                    dr_New["TABLE_ROWNUM"] = dt_NewItem.Rows.Count + 1;

                    dt_NewItem.Rows.Add(dr_New);

                    #endregion
                }

                #endregion

                #endregion

                #region 計算欄位[折讓金額(未稅)][折讓稅額][總金額]

                int i_txt_DISC_UAMT = 0;//折讓金額(未稅)
                int i_txt_DISC_TAX = 0;//折讓稅額
                int i_txt_DISC_AMT = 0;//含稅金額

                foreach (DataRow dr_Count in dt_NewItem.Rows)
                {
                    i_txt_DISC_UAMT += int.Parse(dr_Count["DISC_UAMT"].ToString());//折讓金額(未稅)
                    i_txt_DISC_TAX += int.Parse(dr_Count["DISC_TAX"].ToString());//折讓稅額
                    i_txt_DISC_AMT += int.Parse(dr_Count["DISC_AMT"].ToString());//含稅金額
                }

                //編輯模式下,如果資料是已月結,則不異動欄位[折讓金額(未稅)][折讓稅額][總金額]
                if ((this.hid_PageStatus.Value == "edit" && b_IsClose == true) == false)
                {
                    this.slp_DISC_UAMT.Text = i_txt_DISC_UAMT.ToString();//折讓金額(未稅)
                    this.slp_DISC_TAX.Text = i_txt_DISC_TAX.ToString();//折讓稅額
                    this.slp_DISC_AMT.Text = i_txt_DISC_AMT.ToString();//總金額

                    //20110512 rika insert
                    this.slp_DISC_REMAIN_AMT.Text = i_txt_DISC_AMT.ToString();//折讓餘額
                }

                #endregion

                #region 資料與GridView繫結

                //如果資料原本就存在於TempTable dt_NewItem,則不重新排序
                if (b_ExistTempTable == true)
                {
                    this.gv_DiscInv.DataSource = dt_NewItem;
                    this.gv_DiscInv.DataBind();
                }
                //如果資料不存在於TempTable dt_NewItem,則重新排序
                else
                {
                    DataView dv_NewItem = dt_NewItem.DefaultView;
                    dv_NewItem.Sort = "TABLE_ROWNUM desc";
                    this.gv_DiscInv.DataSource = dv_NewItem;
                    this.gv_DiscInv.DataBind();
                }

                #endregion

                #region 清空並關閉新增項目

                this.panel_Disc_NewItem.Visible = false;
                Set_Disc_NewItem_Default();

                #endregion
            }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel2.Text = ex.Message;
        }
        finally { Finally_Function(); }
    }