Exemple #1
0
    protected void btn_Send_Click(object sender, EventArgs e)
    {
        try
        {
            string SessionIDName = "CAA371_" + PageTimeStamp.Value;
            Session[SessionIDName] = null;

            ParameterList.Clear();
            ParameterList.Add(slp_PERIOD_MONTH.Text);
            ParameterList.Add(Session["UID"].ToString());//V_LOG_UPDATEUID

            #region 連結資料庫

            BCO.CAA37_BCO bco = new BCO.CAA37_BCO(ConntionDB);

            bco.Send_Data(null, ParameterList);

            this.ErrorMsgLabel.Text = "[建立傳票]成功";

            btn_Send.Enabled = false;
            btn_Export.Enabled = false;

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Exemple #2
0
    /// <summary>
    /// BUTTON [檢核資料]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Check_Click(object sender, EventArgs e)
    { 
        string SessionIDName = "CAA371_" + PageTimeStamp.Value;
        
        try
        {
            Session[SessionIDName] = null;

            ErrorMsgLabel.Text = "";
            btn_Send.Enabled = false;

            ParameterList.Clear();
            ParameterList.Add(slp_PERIOD_MONTH.Text);
            ParameterList.Add(Session["UID"].ToString());//V_LOG_UPDATEUID

            #region 連結資料庫

            BCO.CAA37_BCO bco = new BCO.CAA37_BCO(ConntionDB);

            DataTable dt =  bco.Check_Data(ParameterList);
           
            string strFilter="";

            for (int i = 0; i < chb_entry.Items.Count; i++)
            {
                if (chb_entry.Items[i].Selected == true)
                {
                    if (strFilter == "")
                    {
                        strFilter = "CATEGORY =" + chb_entry.Items[i].Value;
                    }
                    else
                    {
                        strFilter += " or CATEGORY =" + chb_entry.Items[i].Value;
                    }
                }
            }

            DataView dv = dt.DefaultView;

            dv.RowFilter = strFilter;

            DataTable du = dv.ToTable();

            if (du.Rows.Count == 0)
            {
                this.ErrorMsgLabel.Text = "找不到資料";
            }
            else
            {

                Session[SessionIDName] = du;

                int c_amt = Convert.ToInt32(du.Compute("SUM(AMT)", "T_TYPE = 'C'"));
                int d_amt = Convert.ToInt32(du.Compute("SUM(AMT)", "T_TYPE = 'D'"));

                lbl_Count.Text = du.Rows.Count.ToString() + "筆";
                lbl_C_AMT.Text = c_amt.ToString() + "元";
                lbl_D_AMT.Text = d_amt.ToString() + "元";

                DataRow[] dr = du.Select("AMT <0");

                if (c_amt != d_amt || dr.Length >0)
                {
                    Color C = Color.Red;
                    lbl_C_AMT.ForeColor = C;
                    lbl_D_AMT.ForeColor = C;
                    ErrorMsgLabel.Text = "借貸或金額檢核異常,請匯出檢核報表確認,或請洽系統人員";
                }
                else
                {
                    Color C = ColorTranslator.FromHtml("#405765");

                    lbl_C_AMT.ForeColor = C;
                    lbl_D_AMT.ForeColor = C;

                    btn_Send.Enabled = true;
                }

                btn_Export.Enabled = true;
                
            }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
            Session[SessionIDName] = null;
        }
    }