Exemple #1
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(); }
    }
Exemple #2
0
        /// <summary>
        /// CAA18 頁籤=發票資料查詢
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <returns></returns>
        public DataTable CAA18_2(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[12].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(), "date", false));//[發票日期]起(1)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[2].ToString(), "date", false));//[發票日期]迄(2)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[3].ToString(), "int", false));//[發票稅別](3)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[4].ToString(), "string", b_LikeSearch));//[商品群分類](4)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[5].ToString(), "string", b_LikeSearch));//[品名](5)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[6].ToString(), "int", false));//[發票金額(未稅)](6)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[7].ToString(), "int", false));//[發票金額(未稅)]Operator(7)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[8].ToString(), "int", false));//[發票稅額](8)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[9].ToString(), "int", false));//[發票稅額]Operator(9)
            arl_ReportService.Add(CAAComm.GetValueSetParameter((ParameterList[10].ToString() == string.Empty) ? "100" : (int.Parse(ParameterList[10].ToString()) < 0) ? "100" : ParameterList[10].ToString(), "int", false));//[筆數](10)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[11].ToString(), "string", false));//V_LOG_UPDATEUID(11)

            #endregion

            #region 連結資料庫

            BCO.MaintainDiscRecord bco = new BCO.MaintainDiscRecord(ConntionDB);
            dt_Return = bco.QueryInvDiscByFind(arl_ReportService);

            #endregion

            #region 檢查回傳資料

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

            #endregion

            return dt_Return;
        }