Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AuthorityControls(this);
        #region
        try
        {
            ErrorMsgLabel.Text = "";
            this.btnLink.Attributes.Add("onclick", "AddIFrameTab('進項憑證明細表','../VAM/VAM121.aspx?Code=VAM12')");
            if (!IsPostBack)
            {
                ViewState["ToZero"] = "0";
                //寫入首次載入Page TimeStamp
                PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}",
                                                    DateTime.Now.Year.ToString(),
                                                    DateTime.Now.Month.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Day.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Hour.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Minute.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Second.ToString().PadLeft(2, '0')
                                                    );
                //設定GridView預設的狀態

                Initialization_Component();
                //設定ToolBar預設狀態
                ToolBarInit();

                //預設檔案儲存路徑              
                ((TextBox)this.SLP_VendorInvoice2.Controls[1].FindControl("TextBoxCode")).Attributes["onblur"] += "chkInv_no();";

                string V_VANDOR = Request["V_VANDOR"].ToString();
                string V_VANDOR_NAME = Request["V_VANDOR_NAME"].ToString();
                string V_TAX_TYPE = Request["V_TAX_TYPE"].ToString();

                this.TextBox2.Text = V_VANDOR + "/" + V_VANDOR_NAME;
                SLP_VendorBase1.Text = V_VANDOR;
                this.hidVANDOR.Value = V_VANDOR;
                this.TextBox2.ReadOnly = true;
                if (V_TAX_TYPE == "0")
                {
                    this.TextBox1.Text = "應稅";
                }
                else if (V_TAX_TYPE == "1")
                {
                    this.TextBox1.Text = "免稅";
                }
                else if (V_TAX_TYPE == "2")
                {
                    this.TextBox1.Text = "零稅";
                }
                hidTaxType.Value = V_TAX_TYPE;

                //稅率
                if (V_TAX_TYPE == "0")
                {
                    BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
                    decimal iTaxRate;
                    bco.QueryTaxRate(out iTaxRate);
                    this.hidTaxRate.Value = iTaxRate.ToString();
                }
                else
                {
                    this.hidTaxRate.Value = "0";
                }

                Session["V_TAX_TYPE"] = V_TAX_TYPE;
                this.TextBox1.ReadOnly = true;
                this.TextBox2.CssClass = "readtxtbox";
                this.TextBox1.CssClass = "readtxtbox";
                this.TextBox5.CssClass = "readtxtbox";
                ((TextBox)this.SLP_SLPDate2.FindControl("TextBoxCode")).Text = System.DateTime.Now.ToShortDateString();
                this.SetClinetFocus(((TextBox)this.SLP_SLPDate1.FindControl("TextBoxCode")).ClientID);

                DataTable dt = DataLoad(V_VANDOR, V_TAX_TYPE);

                if (dt.Rows.Count == 0)
                {
                    Response.Redirect("VAM171.aspx?Code=VAM17&Msg=查無檔期資料");
                }
                else
                {
                    #region 資料與GridView繫結
                    string SessionIDName = "VAM172_gv_ItemInfo" + PageTimeStamp.Value;
                    this.GridView1.Visible = true;
                    Session["SessionID"] = SessionIDName;
                    Session[SessionIDName] = dt;
                    this.GridView1.DataSource = dt;
                    this.GridView1.DataBind();
                    #endregion
                }

                this.Form.DefaultButton = this.btnSave.UniqueID;
            }
            else
            {
                if (Request.Form["__EVENTTARGET"] == "SaveData")
                {
                    SaveData();
                }
            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        this.panel_parent.Attributes.Add("style", "display:none");
        #endregion
    }//page_load
Esempio n. 2
0
    public static string GetInvInfo(string V_VANDOR, string V_INV_NO, string V_DISC_AMT, string V_T_DISC_AMT, string V_TAX_TYPE)
    {
        #region 取得資料

        DataTable dt_Return = new DataTable();
        string[] arrVandor = V_VANDOR.Split('/');
        BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
        dt_Return = bco.QueryInvoiceDetl(arrVandor[0].ToString(), V_INV_NO);
        #endregion

        string sReturn = "";
        if (dt_Return.Rows.Count > 0)
        {
            if (V_TAX_TYPE == dt_Return.Rows[0]["TAX_TYPE"].ToString().Trim())
            {
                if (V_DISC_AMT != "" && V_T_DISC_AMT != "")
                {
                    decimal iNonDiscAmt;
                    iNonDiscAmt = Convert.ToDecimal(V_DISC_AMT) - Convert.ToDecimal(V_T_DISC_AMT);
                    if (iNonDiscAmt < 0)
                        iNonDiscAmt = 0;
                    if (Convert.ToDecimal(dt_Return.Rows[0]["NON_DISC_AMT"]) < iNonDiscAmt)
                        sReturn = Convert.ToString(dt_Return.Rows[0]["INV_UAMT"]) + "|" + Convert.ToString(dt_Return.Rows[0]["NON_DISC_AMT"]) + "|" + Convert.ToString(dt_Return.Rows[0]["NON_DISC_AMT"]);
                    else
                        sReturn = Convert.ToString(dt_Return.Rows[0]["INV_UAMT"]) + "|" + Convert.ToString(dt_Return.Rows[0]["NON_DISC_AMT"]) + "|" + Convert.ToString(iNonDiscAmt);
                }
                else
                {
                    sReturn = Convert.ToString(dt_Return.Rows[0]["INV_UAMT"]) + "|" + Convert.ToString(dt_Return.Rows[0]["NON_DISC_AMT"]) + "|" + Convert.ToString(dt_Return.Rows[0]["NON_DISC_AMT"]);
                }
            }
            else
            {
                sReturn = "||";
            }

        }
        else
        {
            sReturn = "||";
        }


        return sReturn;

    }
Esempio n. 3
0
    private void SaveData()
    {
        try
        {
            #region 傳入參數

            ParameterList.Clear();
            //0.D_DISC_DATE
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate1.Text.Trim(), "date", false));
            //1.V_TAX_TYPE
            ParameterList.Add(GetValueSetParameter(Session["V_TAX_TYPE"].ToString(), "string", false));
            //2.V_VENDOR
            ParameterList.Add(GetValueSetParameter(this.hidVANDOR.Value, "string", false));
            //3.N_DISC_UAMT
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber1.Text.Trim(), "Decimal", false));
            //4.N_DISC_TAX
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber2.Text.Trim(), "Decimal", false));
            //5.D_KEYIN_DATE
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate2.Text.Trim(), "date", false));
            //6.D_UPDATEDATE
            ParameterList.Add(System.DateTime.Now);
            //7.V_UPDATEUID
            ParameterList.Add(Session["UID"].ToString());
            //8.D_CREATEDATE
            ParameterList.Add(System.DateTime.Now);
            //9.V_CREATEUID
            ParameterList.Add(Session["UID"].ToString());
            //10.V_TRANS_TAX
            if (chkTRANS_TAX.Checked == true)
                ParameterList.Add("1");
            else
                ParameterList.Add("0");


            string SessionIDName = "VAM172_gv_ItemInfo" + PageTimeStamp.Value;
            DataTable dtA = (DataTable)Session[SessionIDName];

            for (int i = 0; i < dtA.Rows.Count; i++)
            {
                dtA.Rows[i]["AMT"] = Convert.ToDecimal(((TextBox)this.GridView1.Rows[i].FindControl("txtAMT")).Text.Trim());
            }

            SessionIDName = "VAM172_gvA" + PageTimeStamp.Value;
            DataTable dtB = (DataTable)Session[SessionIDName];

            for (int i = 0; i < dtB.Rows.Count; i++)
            {
                dtB.Rows[i]["DISC_AMT"] = Convert.ToDecimal(((Label)this.GridView2.Rows[i].FindControl("Label5")).Text.Trim());
            }


            #endregion

            #region 新增資料
            string V_DISC_NO = "";
            BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
            bco.CreateDiscountInvoice(ParameterList, dtA, dtB, out V_DISC_NO);
            this.btnSave.Enabled = false;
            this.TextBox5.Text = V_DISC_NO;

            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('新增成功');location.replace('VAM171.aspx?Code=VAM17&DISC_NO=" + V_DISC_NO + "');", Session["UID"].ToString().Trim()), true);

            this.UpdatePanel1.Update();

            #endregion

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Esempio n. 4
0
    protected void btnAdd_Detl_Click(object sender, EventArgs e)
    {

        try
        {
            this.TextBox3.Text = Page.Request.Form[TextBox3.UniqueID];
            Label8.Text = "";
            string SessionIDName = "VAM172_gvA" + PageTimeStamp.Value;
            DataTable dtA = new DataTable();
            if (Session[SessionIDName] == null)
            {
                dtA = this.MakeDTForInvDis();
            }
            else
            {
                dtA = (DataTable)Session[SessionIDName];
            }

            #region 檢核發票號碼

            string V_VANDOR = this.hidVANDOR.Value;
            string V_INV_NO = this.SLP_VendorInvoice2.Text.Trim();

            #region 取得資料

            DataTable dt_Return = new DataTable();

            BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
            dt_Return = bco.QueryInvoiceDetl(V_VANDOR, V_INV_NO);
            #endregion

            if (dt_Return.Rows.Count == 0)
            {
                this.Label8.Text = "此發票號碼非該廠商開立的發票,請重新輸入!";
                this.SetClinetFocus(((TextBox)this.SLP_VendorInvoice2.FindControl("TextBoxCode")).ClientID);
                return;
            }
            else
            {
                for (int i = 0; i < dtA.Rows.Count; i++)
                {
                    if (V_INV_NO == dtA.Rows[i]["INV_NO"].ToString())
                    {
                        Label8.Text = "此發票號碼已輸入發票折減資料";
                        this.SetClinetFocus(((TextBox)this.SLP_VendorInvoice2.FindControl("TextBoxCode")).ClientID);
                        return;
                    }
                }
                if (this.TextBox4.Text.Trim() == "")
                {
                    Label8.Text = "[折減金額]欄位不可為空值!";
                    this.SetClinetFocus(this.TextBox4.ClientID);
                    return;
                }
                else
                {
                    if (Convert.ToDecimal(this.TextBox4.Text.Trim()) > Convert.ToDecimal(this.TextBox3.Text.Trim()))
                    {
                        Label8.Text = "[折減金額]欄位不可大於[未折減金額]欄位!";
                        this.SetClinetFocus(this.TextBox4.ClientID);
                        return;
                    }
                }
            }

            #endregion


            DataRow drA = dtA.NewRow();
            drA["INV_NO"] = this.SLP_VendorInvoice2.Text.Trim();
            drA["INV_UAMT"] = Convert.ToDecimal(dt_Return.Rows[0]["INV_UAMT"].ToString());
            drA["NON_DISC_AMT"] = Convert.ToDecimal(this.TextBox3.Text.Trim());
            drA["DISC_AMT"] = Convert.ToDecimal(this.TextBox4.Text.Trim());

            dtA.Rows.Add(drA);




            this.GridView2.Visible = true;
            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dtA;
            this.GridView2.DataSource = dtA;
            this.GridView2.DataBind();
        }
        catch (Exception ex)
        {
            Label8.Text = ex.Message;
        }

    }
Esempio n. 5
0
    protected void btnUpdate_Detl_Click(object sender, EventArgs e)
    {
        try
        {
            Label8.Text = "";
            string SessionIDName = "VAM173_gvB_ItemInfo" + PageTimeStamp.Value;
            DataTable dtA = new DataTable();
            if (Session[SessionIDName] == null)
            {
                dtA = this.MakeDTForInvDis();
            }
            else
            {
                dtA = (DataTable)Session[SessionIDName];
            }

            #region 檢核發票號碼

            string V_VANDOR = this.SLP_VendorBase1.Text;
            string[] arrVandor = V_VANDOR.Split('/');
            string V_INV_NO = this.SLP_VendorInvoice2.Text.Trim();

            #region 取得資料

            DataTable dt_Return = new DataTable();

            BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
            dt_Return = bco.QueryInvoiceDetl(arrVandor[0], V_INV_NO);
            #endregion

            if (dt_Return.Rows.Count == 0)
            {
                this.Label8.Text = "此發票號碼非該廠商開立的發票,請重新輸入!";
                this.SetClinetFocus(((TextBox)this.SLP_VendorInvoice2.FindControl("TextBoxCode")).ClientID);
                return;
            }
            else
            {

                if (this.TextBox4.Text.Trim() == "")
                {
                    Label8.Text = "[折減金額]欄位不可為空值!";
                    this.SetClinetFocus(this.TextBox4.ClientID);
                    return;
                }
                else
                {
                    if (Convert.ToDecimal(this.TextBox4.Text.Trim()) > Convert.ToDecimal(this.TextBox3.Text.Trim()))
                    {
                        Label8.Text = "[折減金額]欄位不可大於[未折減金額]欄位!";
                        this.TextBox3.Text = dt_Return.Rows[0]["NON_DISC_AMT"].ToString();
                        this.SetClinetFocus(this.TextBox4.ClientID);
                        return;
                    }
                }
            }

            #endregion


            DataRow drA = dtA.Select("INV_NO='" + V_INV_NO + "'")[0];
            if (drA != null)
            {
                drA["NON_DISC_AMT"] = Convert.ToDecimal(this.TextBox3.Text.Trim()) - Convert.ToDecimal(this.TextBox4.Text.Trim());
                drA["DISC_AMT"] = Convert.ToDecimal(this.TextBox4.Text.Trim());
            }

            this.GridView2.Visible = true;
            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dtA;
            this.GridView2.DataSource = dtA;
            this.GridView2.DataBind();
            ((TextBox)this.SLP_VendorInvoice2.FindControl("TextBoxCode")).Text = "";
            this.TextBox3.Text = "";
            this.TextBox4.Text = "";
            this.btnAdd_Detl.Visible = true;
            this.btnCancel_Detl.Visible = false;
            this.btnUpdate_Detl.Visible = false;
        }
        catch (Exception ex)
        {
            Label8.Text = ex.Message;
        }
    }
Esempio n. 6
0
    private DataTable DataLoad(string V_VANDOR, string V_TAX_TYPE)
    {
        #region 傳入參數

        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter(V_VANDOR, "string", false));
        ParameterList.Add(GetValueSetParameter(V_TAX_TYPE, "string", false));

        #endregion

        #region 取得資料

        DataTable dt_Return = new DataTable();

        BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
        dt_Return = bco.QueryDiscountSource(ParameterList);
        return dt_Return;
        #endregion
    }
Esempio n. 7
0
    private void databind(string V_DISC_NO, string V_SESSIONNAME)
    {
        BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
        #region 取得發票主檔資料
        DataTable dtMain = (DataTable)Session[V_SESSIONNAME];
        DataRow drA = dtMain.Select("DISC_NO='" + V_DISC_NO + "'")[0];
        //取得原始折讓資料(for delete)
        ArrayList ParameterDel = new ArrayList();

        if (drA != null)
        {
            this.hidID.Value = drA["ID"].ToString();
            this.TextBox2.Text = drA["VENDOR"].ToString() + "/" + drA["VENDOR_NAME"].ToString();
            this.TextBox2.CssClass = "readtxtbox";
            this.SLP_VendorBase1.Text = drA["VENDOR"].ToString();
            this.TextBox2.ReadOnly = true;

            if (drA["TAX_TYPE"].ToString() == "0")
            {
                this.TextBox1.Text = "應稅";
            }
            else if (drA["TAX_TYPE"].ToString() == "1")
            {
                this.TextBox1.Text = "免稅";
            }
            else if (drA["TAX_TYPE"].ToString() == "2")
            {
                this.TextBox1.Text = "零稅";
            }
            hidTaxType.Value = drA["TAX_TYPE"].ToString();
            this.TextBox1.ReadOnly = true;

            if (drA["TRANS_TAX"].ToString() == "0")
            {
                chkTRANS_TAX.Checked = false;
            }
            else if (drA["TRANS_TAX"].ToString() == "1")
            {
                chkTRANS_TAX.Checked = true;
            }


            //稅率
            if (drA["TAX_TYPE"].ToString() == "0")
            {
                decimal iTaxRate;
                bco.QueryTaxRate(out iTaxRate);
                this.hidTaxRate.Value = iTaxRate.ToString();
            }
            else
            {
                this.hidTaxRate.Value = "0";
            }
            Session["V_TAX_TYPE"] = drA["TAX_TYPE"].ToString();
            this.TextBox5.Text = V_DISC_NO;

            this.TextBox1.CssClass = "readtxtbox";
            this.TextBox5.CssClass = "readtxtbox";

            ((TextBox)this.SLP_SLPDate1.FindControl("TextBoxCode")).Text = drA["DISC_DATE"].ToString();
            ((TextBox)this.SLP_SLPDate2.FindControl("TextBoxCode")).Text = drA["KEYIN_DATE"].ToString();

            ((TextBox)this.SLP_SLPNumber1.FindControl("TextBoxCode")).Text = drA["DISC_UAMT"].ToString();
            ((TextBox)this.SLP_SLPNumber4.FindControl("TextBoxCode")).Text = drA["DISC_UAMT"].ToString();
            ((TextBox)this.SLP_SLPNumber2.FindControl("TextBoxCode")).Text = drA["DISC_TAX"].ToString();
            ((TextBox)this.SLP_SLPNumber3.FindControl("TextBoxCode")).Text = drA["DISC_AMT"].ToString();

            ParameterDel.Add(GetValueSetParameter(V_DISC_NO, "string", false));
            ParameterDel.Add(GetValueSetParameter(drA["UPDATEDATE"].ToString(), "datetime", false));
            ParameterDel.Add(GetValueSetParameter(drA["UPDATEUID"].ToString(), "string", false));
            ParameterDel.Add(GetValueSetParameter(drA["CREATEUID"].ToString(), "string", false));
            ParameterDel.Add(GetValueSetParameter(drA["CREATEDATE"].ToString(), "datetime", false));
            string seName = "VAM173_Par" + PageTimeStamp.Value;
            Session[seName] = ParameterDel;
        }

        #endregion


        #region 取得資料

        DataTable dtA = new DataTable();
        DataTable dtB = new DataTable();


        dtA = bco.ViewDiscountDetl(V_DISC_NO);
        dtB = bco.QueryDiscountInv(V_DISC_NO);

        string SessionIDNameA = "VAM173_gvA_ItemInfo" + PageTimeStamp.Value;
        string SessionIDNameB = "VAM173_gvB_ItemInfo" + PageTimeStamp.Value;

        this.GridView1.Visible = true;
        Session[SessionIDNameA] = dtA;
        this.GridView1.DataSource = dtA;
        this.GridView1.DataBind();

        this.GridView2.Visible = true;
        Session[SessionIDNameB] = dtB;
        this.GridView2.DataSource = dtB;
        this.GridView2.DataBind();
        if (dtA.Rows.Count == 0 && dtB.Rows.Count == 0)
        {
            ErrorMsgLabel.Text = "此筆資料已被其他使用者刪除,請點選上一筆/下一筆鈕繼續查詢";
            this.btnSave.Enabled = false;
        }
        else
        {
            this.btnSave.Enabled = true;
        }
        #endregion
    }
Esempio n. 8
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        try
        {

            string SessionIDName = "VAM171_gv_ItemInfo" + PageTimeStamp.Value;
            DataTable dtA = new DataTable();
            dtA = (DataTable)Session[SessionIDName];
            LinkButton btn = sender as LinkButton;
            GridViewRow gr = (btn.BindingContainer as GridViewRow);
            int i = gr.RowIndex;
            DataRow drA = dtA.Select("DISC_NO='" + dtA.Rows[i]["DISC_NO"].ToString() + "'")[0];

            ArrayList ParameterDel = new ArrayList();
            ParameterDel.Add(GetValueSetParameter(drA["DISC_NO"].ToString(), "string", false));
            ParameterDel.Add(GetValueSetParameter(drA["UPDATEDATE"].ToString(), "datetime", false));
            ParameterDel.Add(GetValueSetParameter(drA["UPDATEUID"].ToString(), "string", false));
            ParameterDel.Add(GetValueSetParameter(drA["CREATEUID"].ToString(), "string", false));
            ParameterDel.Add(GetValueSetParameter(drA["CREATEDATE"].ToString(), "datetime", false));
            ParameterDel.Add(Session["UID"].ToString());
            ParameterDel.Add(System.DateTime.Now);
            BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
            bco.DeleteDiscountInvoice(ParameterDel, null);
            drA.Delete();
            dtA.AcceptChanges();
            Session[SessionIDName] = dtA;
            this.GridView1.DataSource = dtA;
            this.GridView1.DataBind();

            ArrayList NOList = new ArrayList();
            for (int j = 0; j < dtA.Rows.Count; j++)
            {
                string[] strNO = new string[2];
                strNO[0] = dtA.Rows[j]["DISC_NO"].ToString();
                strNO[1] = SessionIDName;
                NOList.Add(strNO);
            }

            Session["VAM171Query" + SessionIDName] = NOList;
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", "alert('刪除成功');", true);
        }
        catch (Exception ex)
        {
            if (ex.Message.IndexOf("位置0") == -1)
                ErrorMsgLabel.Text = "刪除失敗,此資料已被其他使用者異動,請重新查詢再進行編輯。";
            else
                ErrorMsgLabel.Text = ex.Message;
        }
        //finally { }
    }
Esempio n. 9
0
    }//ButtonNew_Click

    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender);

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            #endregion

            #region 傳入參數
            string Number1_OP, Number2_OP, Number3_OP;
            if (this.SLP_SLPNumber1.Operator == "0")
                Number1_OP = "<";
            else if (this.SLP_SLPNumber1.Operator == "1")
                Number1_OP = "=";
            else
                Number1_OP = ">";

            if (this.SLP_SLPNumber2.Operator == "0")
                Number2_OP = "<";
            else if (this.SLP_SLPNumber2.Operator == "1")
                Number2_OP = "=";
            else
                Number2_OP = ">";

            if (this.SLP_SLPNumber3.Operator == "0")
                Number3_OP = "<";
            else if (this.SLP_SLPNumber3.Operator == "1")
                Number3_OP = "=";
            else
                Number3_OP = ">";

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_PROMOTE.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_VendorBase1.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EnumBase1.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDateRange2.StartDate.ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDateRange2.EndDate.ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_VendorDisc1.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDateRange3.StartDate.ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDateRange3.EndDate.ToString(), "string", false));
            ParameterList.Add(Number1_OP);
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber1.Text.Trim(), "Decimal", false));
            ParameterList.Add(GetValueSetParameter(this.ddlTRANS_TAX.Text, "string", false));
            ParameterList.Add(Number2_OP);
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber2.Text.Trim(), "Decimal", false));
            ParameterList.Add(Number3_OP);
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber3.Text.Trim(), "Decimal", false));
            ParameterList.Add(GetValueSetParameter(this.TextBoxRowCountLimit.Text.Trim(), "int", false));


            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();

            BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
            dt_Return = bco.QueryDiscountMain(ParameterList);

            #endregion

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            if (dt_Return.Rows.Count == 0)
            {
                this.GridView1.Visible = false;
                ErrorMsgLabel.Text = "查無資料!";
            }
            else
            {
                string SessionIDName = "VAM171_gv_ItemInfo" + PageTimeStamp.Value;

                this.GridView1.Visible = true;
                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dt_Return;
                this.GridView1.DataSource = dt_Return;
                if (this.TextBoxPagesize.Text == "")
                    this.GridView1.PageSize = 10;
                else
                    this.GridView1.PageSize = Convert.ToInt32(this.TextBoxPagesize.Text);
                this.GridView1.PageIndex = 0;
                this.GridView1.DataBind();

                ArrayList NOList = new ArrayList();
                for (int i = 0; i < dt_Return.Rows.Count; i++)
                {
                    string[] strNO = new string[2];
                    strNO[0] = dt_Return.Rows[i]["DISC_NO"].ToString();
                    strNO[1] = SessionIDName;
                    NOList.Add(strNO);
                }

                Session["VAM171Query" + SessionIDName] = NOList;
            }

            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }//ButtonQuery_Click	
Esempio n. 10
0
    protected void ButtonNew_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region 檢查條件

            this.ErrorMsgLabel.Text = "";
            this.GridView1.Visible = false;
            if (this.SLP_EnumBase1.Text == "")
            {
                this.ErrorMsgLabel.Text = "請選擇單一稅別";
                SetDDLFocus(((DropDownList)this.SLP_EnumBase1.FindControl("D1")).ClientID);
                return;
            }

            string s_CheckPage = CheckPageNew(sender);

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }


            //檢查檔期資料是否存在
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_VendorBase1.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EnumBase1.Text.ToString(), "string", false));            
            BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
            DataTable dt_Return = bco.QueryDiscountSource(ParameterList);
            if (dt_Return.Rows.Count == 0)
            {
                this.ErrorMsgLabel.Text = "查無檔期資料";
                return;
            }

            #endregion

            Response.Redirect("VAM172.aspx?Code=VAM17&V_VANDOR=" + this.SLP_VendorBase1.Text.Trim() + "&V_VANDOR_NAME=" + this.SLP_VendorBase1.Name + "&V_TAX_TYPE=" + this.SLP_EnumBase1.Text.ToString());
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
        #endregion
    }//ButtonNew_Click
Esempio n. 11
0
    private void LoadData(string sDISC_NO)
    {
        #region 傳入參數

        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter(sDISC_NO, "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add("<");
        ParameterList.Add(GetValueSetParameter("", "Decimal", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add("<");
        ParameterList.Add(GetValueSetParameter("", "Decimal", false));
        ParameterList.Add("<");
        ParameterList.Add(GetValueSetParameter("", "Decimal", false));
        ParameterList.Add(GetValueSetParameter("1", "int", false));

        #endregion

        #region 取得資料

        DataTable dt_Return = new DataTable();

        BCO.VAM17_BCO bco = new BCO.VAM17_BCO(ConnectionDB);
        dt_Return = bco.QueryByFind(ParameterList);

        #endregion

        #region 資料與GridView繫結

        //抓取本頁初次登記的時間
        if (dt_Return.Rows.Count == 0)
        {
            this.GridView1.Visible = false;
            ErrorMsgLabel.Text = "查無資料!";
        }
        else
        {
            string SessionIDName = "VAM171_gv_ItemInfo" + PageTimeStamp.Value;

            this.GridView1.Visible = true;
            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dt_Return;
            this.GridView1.DataSource = dt_Return;
            if (this.TextBoxPagesize.Text == "")
                this.GridView1.PageSize = 10;
            else
                this.GridView1.PageSize = Convert.ToInt32(this.TextBoxPagesize.Text);
            this.GridView1.PageIndex = 0;
            this.GridView1.DataBind();

            ArrayList NOList = new ArrayList();
            for (int i = 0; i < dt_Return.Rows.Count; i++)
            {
                string[] strNO = new string[2];
                strNO[0] = dt_Return.Rows[i]["DISC_NO"].ToString();
                strNO[1] = SessionIDName;
                NOList.Add(strNO);
            }

            Session["VAM171Query" + SessionIDName] = NOList;
        }

        #endregion
    }