Esempio n. 1
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;
    }
Esempio n. 2
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
    }
Esempio n. 3
0
        private bool CheckClose(string strWashDate)
        {
            //檢查該筆資料是否月結
            CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();
            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(strWashDate, "string", false)); //V_MONTH_CLOSE
            ParameterList.Add(GetValueSetParameter("CAA11", "string", false)); //V_FUNC_NO

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

            ArrayList arySet = new ArrayList();
            arySet = BCO.GetChanMonthCloseStatus(ParameterList, null);

            if (arySet[0].ToString() == "Y") // "此筆資料已月結,故不允許修改!"
                return true;

            return false;
        }
Esempio n. 4
0
    private bool CheckClose()
    {
        //檢查該筆資料是否月結
        CAAModel.CAACommon CAAComm = new CAAModel.CAACommon();
        ArrayList arySet = new ArrayList();
        string strSalDate = string.Empty;
        strSalDate = slp_SAL_DATE.Text.Replace("/", "").Substring(0, 6);

        ParameterList.Clear();
        ParameterList.Add(CAAComm.GetValueSetParameter(strSalDate, "string", false)); //V_MONTH_CLOSE
        ParameterList.Add(CAAComm.GetValueSetParameter("CAA10", "string", false)); //V_FUNC_NO

        CAAModel.ChanMonthCloseYN BCO = new CAAModel.ChanMonthCloseYN(ConntionDB);
        arySet = BCO.GetChanMonthCloseStatus(ParameterList, null);

        if (arySet[0].ToString() == "Y") // "此筆資料已月結,故不允許修改!"
            return true;

        return false;
    }
        /// <summary>
        /// 傳入參數 : @月結月份, @月結功能代號
        /// 
        /// 呼叫:ChanMonthCloseYN.ChanMonthCloseYN
        /// 
        /// IF FLAG=N THEN
        ///       回傳訊息:「此月份尚未月結,不允許執行解除月結作業」
        /// ELSE
        ///      (1)依條件FUNC_NO=@月結功能代號 AND
        /// MONTH_CLOSE=@月結月份,將資料異動回資料庫VDS_CAA_MON_SETTING(月結設定檔)
        ///         ENABLE = 0
        ///         UPDATEUID =  登入系統之使用者ID
        ///         UPDATEDATE = 取AP系統日期
        ///      (2)依INVOICE_MONTH=@月結月份,異動資料庫VDS_CAA_INVOICE_TRACK
        ///       異動欄位:
        ///       (2.1) CLOSEUID = ""
        ///       (2.2) CLOSEDATE = ""
        ///       (2.3) UPDATEUID =  登入系統之使用者ID
        ///       (2.4) UPDATEDATE = 取AP系統日期
        /// End IF
        /// </summary>
        public ArrayList RecordingByOpen(ArrayList ParameterList,
                                         DbTransaction RootDBT,
                                         string ConntionDB
                                        )
        {
            try
            {
                string strResult = string.Empty;
                string strMsg = string.Empty;
                ArrayList ary = new ArrayList();

                ParameterList1.Clear();
                ParameterList1.Add(GetValueSetParameter(ParameterList[0].ToString(), "string", false)); //V_MONTH_CLOSE
                ParameterList1.Add(GetValueSetParameter(ParameterList[1].ToString(), "string", false)); //V_FUNC_NO

                CAAModel.ChanMonthCloseYN BCO = new CAAModel.ChanMonthCloseYN(ConntionDB);
                ArrayList aryResult = BCO.GetChanMonthCloseStatus(ParameterList, null);

                //設定檔 Y:已月結 N:未月結
                if (aryResult[0].ToString() == "Y")
                {
                    strMsg = "此月份尚未月結,不允許執行解除月結作業!";
                    ary.Add(aryResult[0].ToString());
                    ary.Add(strMsg);
                    return ary;
                }
                else
                {
                    bool IsRootTranscation = false;

                    try
                    {
                        CAA_InvTrackDBO DBO = new CAA_InvTrackDBO(ref USEDB);

                        //判斷是否有傳入Root Transcation 
                        IsRootTranscation = (RootDBT == null) ? true : false;

                        #region 啟動交易或指定RootTranscation

                        if (IsRootTranscation)
                        {
                            //獨立呼叫啟動Transcation
                            Conn = USEDB.CreateConnection();
                            Conn.Open();
                            DBT = Conn.BeginTransaction();
                        }
                        else
                        {
                            DBT = RootDBT;
                        }

                        #endregion

                        ArrayList arrRec = DBO.RecordingByOpen(ParameterList, DBT);

                        #region 交易成功

                        if (IsRootTranscation)
                        {
                            //獨立呼叫Transcation成立
                            DBT.Commit();
                        }

                        #endregion

                        return arrRec;

                    }
                    catch (Exception ex)
                    {
                        #region 交易失敗

                        if (IsRootTranscation)
                        {
                            //獨立呼叫Transcation失敗
                            DBT.Rollback();
                        }

                        #endregion

                        throw ex;
                    }
                    finally
                    {
                        #region 判斷是否關閉交易連線

                        if (IsRootTranscation)
                        {
                            //獨立呼叫Transcation,關閉連線
                            if (Conn.State == ConnectionState.Connecting)
                            {
                                Conn.Close();
                            }
                        }

                        #endregion
                    }

                }

            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
Esempio n. 6
0
    /// <summary>
    /// 檢查條件
    /// </summary>
    /// <param name="s_Type"></param>
    /// <returns></returns>
    private ArrayList Check_Condition(string s_Type, DataRow[] dr_Checked)
    {
        #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 頁籤=整批兌現

        #region BUTTON [整批兌換]鈕

        if (s_Type == "頁籤=整批兌現 BUTTON [整批兌換]鈕")
        {
            #region 檢查SLP日期格式

            arl_Return = CAAComm.Check_Format_Date(this.slp_tab2_NB_COLL_DATE.Text, "欄位[兌現日期]日期格式錯誤", "1", this.slp_tab2_NB_COLL_DATE.DateTextBox.ClientID, arl_Return);

            #endregion

            #region 檢查必填欄位

            arl_Return = CAAComm.Check_MustFillin_Column(this.slp_tab2_NB_COLL_DATE.Text, "text", "欄位[兌現日期]為必填欄位", "1", this.slp_tab2_NB_COLL_DATE.DateTextBox.ClientID, arl_Return);

            #endregion

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

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

            #endregion

            #region 自訂檢查

            #region 檢查是否有勾選整批兌換的資料

            if (dr_Checked == null ||
                dr_Checked.Length == 0)
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, "查無[整批兌換]的資料", "1", string.Empty); }

            #endregion

            #region 檢查欄位[兌現日期]是否月結

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(CAAComm.GetValueSetParameter("CAA12", "string", false)); //V_FUNC_NO
            ParameterList.Add(CAAComm.GetValueSetParameter(this.slp_tab2_NB_COLL_DATE.Text.Replace("/", string.Empty).Substring(0, 6), "string", false)); //V_MONTH_CLOSE
            ParameterList.Add(CAAComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); //V_CREATEUID

            #endregion

            #region 連結資料庫

            BCO.ChanMonthCloseYN bco = new BCO.ChanMonthCloseYN(ConntionDB);
            ArrayList ary_Result = bco.GetChanMonthCloseStatus(ParameterList, null);

            #endregion

            #region 檢查資料

            //Y:已月結 N:未月結
            if (ary_Result[0].ToString() == "Y")
            { arl_Return = CAAComm.ToMakeUp_Err_ArrayList(arl_Return, ary_Result[0].ToString(), "1", this.slp_tab2_NB_COLL_DATE.DateTextBox.ClientID); }

            #endregion

            #endregion

            #endregion
        }

        #endregion

        #endregion

        return arl_Return;
    }
Esempio n. 7
0
    private bool CheckChanMonthClose(string strYM)
    {
        //判斷是否字軌月結
        CAAModel.ChanMonthCloseYN BCO = new CAAModel.ChanMonthCloseYN(ConntionDB);
        ParameterList.Clear();
        ParameterList.Add(strYM);
        ParameterList.Add("CAA15");
        ArrayList arlResult = BCO.GetChanMonthCloseStatus(ParameterList, null);

        bool bResult = false;

        if (arlResult[0].ToString() == "Y")
            bResult = true;

        return bResult;
    }