/// <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(); } }
/// <summary> /// CAA18 頁籤=銷貨折讓維護 /// </summary> /// <param name="ParameterList"></param> /// <returns></returns> public DataTable CAA18_1(ArrayList ParameterList) { #region 宣告變數 BCO.CAACommon CAAComm = new BCO.CAACommon(); ArrayList arl_ReportService = new ArrayList(); DataTable dt_Return = new DataTable(); bool b_LikeSearch; #endregion #region 傳入參數 b_LikeSearch = (ParameterList[52].ToString() == "true") ? true : false; arl_ReportService.Clear(); arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[0].ToString(), "string", b_LikeSearch));//[折讓單號](0) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[1].ToString(), "int", false));//[格式代號](1) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[2].ToString(), "int", false));//[來源](2) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[3].ToString(), "string", b_LikeSearch));//[店群](3) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[4].ToString(), "string", b_LikeSearch));//[店號](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", b_LikeSearch));//[商品群分類](7) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[8].ToString(), "string", false));//[稅別](8) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[9].ToString(), "string", b_LikeSearch));//[營業人員](9) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[10].ToString(), "string", b_LikeSearch));//[帳務人員](10) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[11].ToString(), "date", false));//[折讓日期]起(11) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[12].ToString(), "date", false));//[折讓日期]迄(12) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[13].ToString(), "string", b_LikeSearch));//[財會折讓單號](13) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[14].ToString(), "date", false));//[異動折讓日期]起(14) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[15].ToString(), "date", false));//[異動折讓日期]迄(15) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[16].ToString(), "int", false));//[憑證已回](16) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[17].ToString(), "date", false));//[憑換已回日期]起(17) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[18].ToString(), "date", false));//[憑換已回日期]迄(18) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[19].ToString(), "int", false));//[取具進項憑証](19) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[20].ToString(), "string", b_LikeSearch));//[發票號碼/收據](20) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[21].ToString(), "int", false));//[取具收據](21) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[22].ToString(), "int", false));//[作廢](22) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[23].ToString(), "date", false));//[作廢日期]起(23) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[24].ToString(), "date", false));//[作廢日期]迄(24) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[25].ToString(), "int", false));//[申報](25) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[26].ToString(), "date", false));//[申報日期]起(26) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[27].ToString(), "date", false));//[申報日期]迄(27) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[28].ToString(), "int", false));//[轉暫收](28) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[29].ToString(), "date", false));//[暫收日期]起(29) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[30].ToString(), "date", false));//[暫收日期]迄(30) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[31].ToString(), "string", b_LikeSearch));//[結帳統編](31) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[32].ToString(), "string", b_LikeSearch));//[統一編號](32) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[33].ToString(), "string", b_LikeSearch));//[地址](33) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[34].ToString(), "int", false));//[折讓金額(未稅)](34) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[35].ToString(), "int", false));//[折讓金額(未稅)]Operator(35) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[36].ToString(), "int", false));//[折讓稅額](36) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[37].ToString(), "int", false));//[折讓稅額]Operator(37) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[38].ToString(), "int", false));//[總金額](38) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[39].ToString(), "int", false));//[總金額]Operator(39) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[40].ToString(), "string", b_LikeSearch));//[結帳年月]起(40) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[41].ToString(), "string", b_LikeSearch));//[結帳年月]迄(41) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[42].ToString(), "string", b_LikeSearch));//[結帳年月-財會]起(42) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[43].ToString(), "string", b_LikeSearch));//[結帳年月-財會]迄(43) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[44].ToString(), "string", false));//[申報年月]起(44) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[45].ToString(), "string", false));//[申報年月]迄(45) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[46].ToString(), "int", false));//[累積沖帳金額](46) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[47].ToString(), "int", false));//[累積沖帳金額]Operator(47) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[48].ToString(), "int", false));//[折讓餘額](48) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[49].ToString(), "int", false));//[折讓餘額]Operator(49) arl_ReportService.Add(CAAComm.GetValueSetParameter((ParameterList[50].ToString() == string.Empty) ? "100" : (int.Parse(ParameterList[50].ToString()) < 0) ? "100" : ParameterList[50].ToString(), "int", false));//[筆數](50) arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[51].ToString(), "string", false));//V_LOG_UID(51) #endregion #region 連結資料庫 BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB); dt_Return = bco.QueryDiscRecordByFind(arl_ReportService); #endregion #region 檢查回傳資料 if (dt_Return.Rows.Count == 0) { throw new Exception("查無資料"); } #endregion return dt_Return; }