Example #1
0
    protected void btnExportDel_Click(object sender, EventArgs e)
    {
        try
        {

            #region 傳入參數

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

            ParameterList.Clear();
            ParameterList.Add(this.slp_Date_TAB1.StartDate);
            ParameterList.Add(this.slp_Date_TAB1.EndDate);

            #endregion

            #region 連結資料庫

            DataTable dt = new DataTable();

            BCO.ProcessAccountRecord BCO = new BCO.ProcessAccountRecord(ConntionDB);
            dt = BCO.QueryDetail(ParameterList);

            #endregion

            #region 檢查回傳資料

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

            #endregion
            else
            {
                Export_Excel_D(dt);
            }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }

    }
Example #2
0
        /// <summary>
        /// CAA13 立沖帳彙總表
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <returns></returns>
        public DataTable CAA13_1(ArrayList ParameterList)
        {
            #region 宣告變數

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

            #endregion

            #region 傳入參數

            #region 設定列印類別

            if (ParameterList[2].ToString() == string.Empty &&
                ParameterList[3].ToString() == string.Empty)
            { s_Type = "Summary"; }
            else
            { s_Type = "Detail"; }

            #endregion

            arl_ReportService.Clear();
            arl_ReportService.Add(CAAComm.GetValueSetParameter(s_Type, "string", false));//[列印類別]
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[0].ToString(), "date", false));//[結帳年月]起(0)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[1].ToString(), "date", false));//[結帳年月]迄(1)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[2].ToString(), "string", false));//[利潤中心]起(2)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[3].ToString(), "string", false));//[利潤中心]迄(3)
            arl_ReportService.Add(CAAComm.GetValueSetParameter(ParameterList[4].ToString(), "string", false));//登入人員(4)

            #endregion

            #region 連結資料庫

            BCO.ProcessAccountRecord BCO = new BCO.ProcessAccountRecord(ConntionDB);
            dt_Return = BCO.QueryAccountSumReport(arl_ReportService);

            #endregion

            #region 檢查回傳資料

            #region 檢查每一筆資料是否每一個欄位都為0,若是,則刪除該筆資料。

            foreach (DataRow dr in dt_Return.Rows)
            {
                bool b_Is_All_Zero = true;
                for (int i = 0; i < dr.Table.Columns.Count; i++)
                {
                    if (dr.Table.Columns[i].ToString() != "NAME")
                    {
                        if (dr[i].ToString() != "0")
                        { b_Is_All_Zero = false; }
                    }
                }

                //這一筆資料全部欄位都為0,則該筆資料要刪除
                if (b_Is_All_Zero == true)
                { dr.Delete(); }
            }

            dt_Return.AcceptChanges();

            #endregion

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

            #endregion

            return dt_Return;
        }
Example #3
0
    protected void btnExport1_Click(object sender, EventArgs e)
    {
        try
        {

            #region 傳入參數

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

            ParameterList.Clear();
            ParameterList.Add(this.slp_Date_TAB1.StartDate);
            ParameterList.Add(this.slp_Date_TAB1.EndDate);
            ParameterList.Add(this.slp_ProfitCenter1.Text);
            ParameterList.Add(this.slp_ProfitCenter2.Text);
            ParameterList.Add(HttpContext.Current.Session["UID"].ToString());

            #endregion

            #region 連結資料庫

            DataTable dt = new DataTable();

            BCO.ProcessAccountRecord BCO = new BCO.ProcessAccountRecord(ConntionDB);
            dt = BCO.QueryData(ParameterList);

            #endregion

            #region 檢查回傳資料

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

            #endregion
            else
            {
                DataRow dr = dt.NewRow();

                dr["PROFIT_NO"] = "合計";
                dr["INV_AMT"] = dt.Compute("Sum(INV_AMT)", string.Empty);
                dr["CAN_INV_AMT"] = dt.Compute("Sum(CAN_INV_AMT)", string.Empty);
                dr["DISC_AMT_W"] = dt.Compute("Sum(DISC_AMT_W)", string.Empty);
                dr["DISC_AMT_Z"] = dt.Compute("Sum(DISC_AMT_Z)", string.Empty);
                dr["CAN_DISC_AMT"] = dt.Compute("Sum(CAN_DISC_AMT)", string.Empty);

                dt.Rows.Add(dr);

                Export_Excel(dt);
            }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }

    }