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

            #region 檢查必填欄位
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            if (this.SLP_STORE.Text.Trim() == string.Empty)
            { sb.Append("[店號]欄位不可空白<br/>"); }

            if (this.SLP_EFF_DATE_FROM.Text.Trim() == string.Empty)
            { sb.Append("[舊履歷結束日]欄位不可空白<br/>"); }

            if (this.SLP_EFF_DATE_TO.Text.Trim() == string.Empty)
            { sb.Append("[新履歷結束日]欄位不可空白<br/>"); }

            if (this.SLP_EFF_DATE_TO.Text.Trim() == string.Empty)
            { sb.Append("[新履歷結束日]欄位不可空白<br/>"); }

            if (this.SLP_EFF_DATE_FROM.Text.Trim() != string.Empty && this.SLP_EFF_DATE_TO.Text.Trim() != string.Empty)
            {
                if (DateTime.Parse(this.SLP_EFF_DATE_TO.Text.Trim()) <= DateTime.Parse(this.SLP_OLD_EFF_DATE_TO.Text.Trim()))
                { sb.Append("[新履歷結束日]需大於[舊履歷結束日]<br/>"); }
            }
            
            if (sb.ToString() != string.Empty)
            {
                ErrorMsgLabel.Text = sb.ToString();
                return;
            }
            #endregion

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_TO.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));

            string Msg;

            #region 儲存單筆修改資料
            BCO.MaintainStoreAccount bco = new BCO.MaintainStoreAccount(ConntionDB);
            bco.UpdateEffDateTo(ParameterList, null,out Msg);
            #endregion

            System.Web.UI.ScriptManager.RegisterStartupScript(this.but_Save, this.GetType(), "TO_STM25A.aspx", "alert('"+Msg+"');window.opener.location.reload();window.close();", true);
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        { }
    }
Example #2
0
    private void QueryData(string v_store, string v_eff_date_from)
    {
        try
        {
            #region 將變數資料清空

            ds_Data.Tables.Clear();

            #endregion

            #region 門市帳務主檔
            STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt;
            ParameterList.Clear();

            for (int i = 0; i <= 47; i++)
            {
                if (i == 8)
                    ParameterList.Add(v_store);
                else if (i == 9 || i == 10)
                    ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));
                else
                    ParameterList.Add(DBNull.Value);
            }

            //筆數為1
            ParameterList.Add(1);

            Dt = BCO.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.QueryByLike, ParameterList);

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                ErrorMsgLabel.Text = "查無資料";
                return;
            }

            this.SLP_STORE.Text = Dt.Rows[0]["STORE"].ToString();
            this.SLP_EFF_DATE_FROM.Text = Dt.Rows[0].IsNull("EFF_DATE_FROM") ? "" : Convert.ToDateTime(Dt.Rows[0]["EFF_DATE_FROM"]).ToShortDateString();
            this.SLP_EFF_DATE_TO.Text = Dt.Rows[0].IsNull("EFF_DATE_TO") ? "" : Convert.ToDateTime(Dt.Rows[0]["EFF_DATE_TO"]).ToShortDateString();
            this.txtGROUP_NO.Text = Dt.Rows[0]["GROUP_NO"].ToString();
            this.txtSAL_ID.Text = Dt.Rows[0]["SAL_UID"].ToString();
            this.txtAC_UID.Text = Dt.Rows[0]["AC_UID"].ToString();
            this.txtPAY_RFNO.Text = Dt.Rows[0]["PAY_RFNO"].ToString();
            this.radSTORE_TYPE_HEAD.Checked = false;
            this.radSTORE_TYPE_STORE.Checked = false;
            if (Dt.Rows[0]["STORE_TYPE"].ToString() == "1")
                this.radSTORE_TYPE_HEAD.Checked = true;
            else
                this.radSTORE_TYPE_STORE.Checked = true;
            this.txtRFNO.Text = Dt.Rows[0]["RFNO"].ToString();
            this.txtTITLE.Text = Dt.Rows[0]["TITLE"].ToString();
            this.txtINV_ADDR.Text = Dt.Rows[0]["INV_ADDR"].ToString();
            this.txtPERSON.Text = Dt.Rows[0]["PERSON"].ToString();
            this.SLP_PROFIT_NO.Text = Dt.Rows[0]["PROFIT_NO"].ToString();
            this.SLP_FEET.Text = Dt.Rows[0]["FEET"].ToString();
            this.txtPAY_ACCOUNT.Text = Dt.Rows[0]["PAY_ACCOUNT"].ToString();
            this.radDEPOSIT_NO_HEAD.Checked = false;
            this.radDEPOSIT_NO_STORE.Checked = false;
            if (Dt.Rows[0]["DEPOSIT_NO"].ToString() == "1")
                this.radDEPOSIT_NO_HEAD.Checked = true;
            else
                this.radDEPOSIT_NO_STORE.Checked = true;
            this.ddlDEPOSIT_TYPE.SelectedValue = Dt.Rows[0]["DEPOSIT_TYPE"].ToString();
            this.SLP_DEPOSIT.Text = Dt.Rows[0]["DEPOSIT"].ToString();
            this.SLP_DEPOSIT_DATE_FROM.Text = Dt.Rows[0].IsNull("DEPOSIT_DATE_FROM") ? "" : Convert.ToDateTime(Dt.Rows[0]["DEPOSIT_DATE_FROM"]).ToShortDateString();
            this.SLP_DEPOSIT_DATE_TO.Text = Dt.Rows[0].IsNull("DEPOSIT_DATE_TO") ? "" : Convert.ToDateTime(Dt.Rows[0]["DEPOSIT_DATE_TO"]).ToShortDateString();
            this.SLP_DUIT_UNIT.Text = Dt.Rows[0]["DUTY_UNIT"].ToString();
            this.ddlPAYMENT_STORE.SelectedValue = Dt.Rows[0]["PAYMENT_STORE"].ToString();
            this.txtAC_NAME.Text = Dt.Rows[0]["AC_NAME"].ToString();
            this.txtINVOICE_MAILADD.Text = Dt.Rows[0]["INVOICE_MAIL_ADD"].ToString();
            this.SLP_INVOICE_SEND.Text = Dt.Rows[0]["INVOICE_SEND"].ToString();
            this.SLP_INVOICE_TYPE.Text = Dt.Rows[0]["INVOICE_TYPE"].ToString();
            this.ddlPAY_TYPE.SelectedValue = Dt.Rows[0]["PAY_TYPE"].ToString();
            this.SLP_CLS_DATE.Text = Dt.Rows[0]["CLS_DATE"].ToString();
            if (Dt.Rows[0]["ARMK"].ToString() == "1")
                this.txtARMK.Text = "已審核";
            else
                this.txtARMK.Text = "未審核";

            this.txtPID.Text = Dt.Rows[0]["ID"].ToString();

            if (this.txtARMK.Text == "已審核")
                btnPASS.Enabled = false;
            if (this.txtARMK.Text == "未審核")
                btnNOPASS.Enabled = false;

            #endregion

            #region 設定屬性
            STMModel.MaintainStoreAccount BCO_root = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_root;

            ParameterList.Clear();
            ParameterList.Add(v_store);
            ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));

            Dt_root = BCO_root.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.ROOT, ParameterList);

            GridView1.DataSource = Dt_root;
            string SessionIDName_root = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
            Session[SessionIDName_root] = Dt_root;

            //設定分頁大小
            GridView1.PageIndex = 0;
            GridView1.DataBind();
            this.txtCount_Store.Text = GridView1.Rows.Count.ToString();

            #endregion

            #region 收款天數
            STMModel.MaintainStoreAccount BCO_Charge = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_charge;
            ParameterList.Clear();

            ParameterList.Add(v_store);
            ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));

            Dt_charge = BCO_Charge.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.CHARGE, ParameterList);

            GridView2.DataSource = Dt_charge;
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_02, PageTimeStamp.Value);
            Session[SessionIDName] = Dt_charge;

            //設定分頁大小
            GridView2.PageIndex = 0;
            GridView2.DataBind();
            #endregion

            #region 店群折扣-商品大分類
            STMModel.MaintainStoreAccount BCO_Group1 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Group1;
            ParameterList.Clear();

            ParameterList.Add(this.txtGROUP_NO.Text);

            Dt_Group1 = BCO_Group1.GetQueryGroupDiscountPMA(ParameterList);

            GridView3_1.DataSource = Dt_Group1;
            string SessionIDName3_1 = string.Format("{0}_{1}", PAGE_DT_031, PageTimeStamp.Value);
            Session[SessionIDName3_1] = Dt_Group1;

            //設定分頁大小
            GridView3_1.PageIndex = 0;
            GridView3_1.DataBind();
            #endregion

            #region 店群折扣-商品中分類
            STMModel.MaintainStoreAccount BCO_Group2 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Group2;
            ParameterList.Clear();

            ParameterList.Add(this.txtGROUP_NO.Text);

            Dt_Group2 = BCO_Group2.GetQueryGroupDiscountCategory(ParameterList);

            GridView3_2.DataSource = Dt_Group2;
            string SessionIDName3_2 = string.Format("{0}_{1}", PAGE_DT_032, PageTimeStamp.Value);
            Session[SessionIDName3_2] = Dt_Group2;

            //設定分頁大小
            GridView3_2.PageIndex = 0;
            GridView3_2.DataBind();
            #endregion

            #region 店群折扣-商品
            STMModel.MaintainStoreAccount BCO_Group3 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Group3;
            ParameterList.Clear();

            ParameterList.Add(this.txtGROUP_NO.Text);

            Dt_Group3 = BCO_Group3.GetQueryGroupDiscountItem(ParameterList);

            GridView3_3.DataSource = Dt_Group3;
            string SessionIDName3_3 = string.Format("{0}_{1}", PAGE_DT_033, PageTimeStamp.Value);
            Session[SessionIDName3_3] = Dt_Group3;

            //設定分頁大小
            GridView3_3.PageIndex = 0;
            GridView3_3.DataBind();
            #endregion

            #region 門市折扣-商品大分類
            STMModel.MaintainStoreAccount BCO_Store1 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Store1;
            ParameterList.Clear();

            ParameterList.Add(v_store);

            Dt_Store1 = BCO_Store1.GetQueryStoreDiscountPMA(ParameterList);

            GridView4_1.DataSource = Dt_Store1;
            string SessionIDName4_1 = string.Format("{0}_{1}", PAGE_DT_041, PageTimeStamp.Value);
            Session[SessionIDName4_1] = Dt_Store1;

            //設定分頁大小
            GridView4_1.PageIndex = 0;
            GridView4_1.DataBind();
            #endregion

            #region 門市折扣-商品中分類
            STMModel.MaintainStoreAccount BCO_Store2 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Store2;
            ParameterList.Clear();

            ParameterList.Add(v_store);

            Dt_Store2 = BCO_Store2.GetQueryStoreDiscountCategory(ParameterList);

            GridView4_2.DataSource = Dt_Store2;
            string SessionIDName4_2 = string.Format("{0}_{1}", PAGE_DT_042, PageTimeStamp.Value);
            Session[SessionIDName4_2] = Dt_Store2;

            //設定分頁大小
            GridView4_2.PageIndex = 0;
            GridView4_2.DataBind();
            #endregion

            #region 門市折扣-商品
            STMModel.MaintainStoreAccount BCO_Store3 = new STMModel.MaintainStoreAccount(ConnectionDB);

            DataTable Dt_Store3;
            ParameterList.Clear();

            ParameterList.Add(v_store);

            Dt_Store3 = BCO_Store3.GetQueryStoreDiscountItem(ParameterList);

            GridView4_3.DataSource = Dt_Store3;
            string SessionIDName4_3 = string.Format("{0}_{1}", PAGE_DT_043, PageTimeStamp.Value);
            Session[SessionIDName4_3] = Dt_Store3;

            //設定分頁大小
            GridView4_3.PageIndex = 0;
            GridView4_3.DataBind();
            #endregion

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                return;
            }

            #region 將資料寫入變數

            Dt.TableName = "VDS_STM_ACCOUNT_PROPERTY";
            Dt_root.TableName = "VDS_STM_ACCOUNT_ROOT";
            Dt_charge.TableName = "VDS_STM_ACCOUNT_CHARGE";

            ds_Data.Tables.Add(Dt.Copy());
            ds_Data.Tables.Add(Dt_root.Copy());
            ds_Data.Tables.Add(Dt_charge.Copy());

            //設定屬性
            DataSet ds_root = new DataSet();
            ds_root.Tables.Add(Dt_root.Copy());
            DataColumn[] keys_root = new DataColumn[3];
            keys_root[0] = ds_root.Tables[0].Columns["STORE"];
            keys_root[1] = ds_root.Tables[0].Columns["ROOT_NO"];
            keys_root[2] = ds_root.Tables[0].Columns["EFF_DATE_FROM"];

            ds_root.Tables[0].PrimaryKey = keys_root;
            Session["STM252_root" + PageTimeStamp.Value] = ds_root;

            //收款天數
            DataSet ds = new DataSet();
            ds.Tables.Add(Dt_charge.Copy());
            //DataColumn[] keys = new DataColumn[4];
            //keys[0] = ds.Tables[0].Columns["STORE"];
            //keys[1] = ds.Tables[0].Columns["EFF_DATE_FROM"];
            //keys[2] = ds.Tables[0].Columns["ROOT_NO"];
            // keys[3] = ds.Tables[0].Columns["PMA"];

            DataColumn[] keys = new DataColumn[1];
            keys[0] = ds.Tables[0].Columns["ID"];

            ds.Tables[0].PrimaryKey = keys;
            Session["STM252_" + PageTimeStamp.Value] = ds;

            #endregion

            //UpdatePanel12.Update();

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { }
    }
Example #3
0
    private DataTable Check_Root()
    {
        STMModel.MaintainStoreAccount BCO_root = new STMModel.MaintainStoreAccount(ConnectionDB);

        DataTable Dt_root;

        ParameterList.Clear();
        ParameterList.Add(SLP_STORE.Text);
        ParameterList.Add((DateTime.Parse(this.SLP_EFF_DATE_FROM.Text)).ToString("yyyy/MM/dd"));
        ParameterList.Add(txtPAY_RFNO.Text);

        Dt_root = BCO_root.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.HeadROOT, ParameterList);

        return Dt_root;
    }
Example #4
0
    protected void btnClose_Click(object sender, EventArgs e)
    {
        STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);
        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false));
        ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));

        BCO.UpdateDeposit(ParameterList, null);

        ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('結清質押金成功');location.replace('STM252.aspx?mode=view&store=" + SLP_STORE.Text + "&eff_date_from=" + SLP_EFF_DATE_FROM.Text.ToString() + "&Code=STM25');", true);
    }
Example #5
0
    /// <summary>
    /// 元件顯示及使用屬性初始設定
    /// </summary>
    private void Initialization_Component()
    {
        #region 權限設定
        #region STM26功能權限設定
        AuthorityControls(this);
        this.btnNOPASS.Visible = CanUpdate;
        this.btnPASS.Visible = AuthUpdate;
        #endregion

        #endregion

        #region 取得登入使用者名稱
        DataTable dt_name = new DataTable();
        dt_name = (DataTable)Session["UserInfo"];
        Login_Name = dt_name.Rows[0]["Name"].ToString();
        #endregion

        #region 設定屬性新增DataSet
        //新增DataSet
        DataSet ds_root = new DataSet();
        DataTable dt_root = new DataTable();
        DataColumn[] keys_root = new DataColumn[3];

        ds_root.Tables.Add(dt_root);
        dt_root.Columns.Add("STORE", Type.GetType("System.String"));
        dt_root.Columns.Add("ROOT_NO", Type.GetType("System.String"));
        dt_root.Columns.Add("ROOT_NO_EXPLAIN", Type.GetType("System.String"));
        dt_root.Columns.Add("EFF_DATE_FROM", Type.GetType("System.String"));
        dt_root.Columns.Add("HEAD_DOC", Type.GetType("System.String"));
        dt_root.Columns.Add("HEAD_DOC_EXPLAIN", Type.GetType("System.String"));
        dt_root.Columns.Add("SINGLE_DOC", Type.GetType("System.String"));
        dt_root.Columns.Add("SINGLE_DOC_EXPLAIN", Type.GetType("System.String"));
        dt_root.Columns.Add("PAYMENT_TYPE", Type.GetType("System.String"));
        dt_root.Columns.Add("PAYMENT_TYPE_EXPLAIN", Type.GetType("System.String"));
        dt_root.Columns.Add("CREATEDATE");
        dt_root.Columns.Add("CREATEUID");
        dt_root.Columns.Add("UPDATEDATE");
        dt_root.Columns.Add("UPDATEUID");

        dt_root.Columns["STORE"].AllowDBNull = false;
        dt_root.Columns["ROOT_NO"].AllowDBNull = false;
        dt_root.Columns["EFF_DATE_FROM"].AllowDBNull = false;

        keys_root[0] = dt_root.Columns["STORE"];
        keys_root[1] = dt_root.Columns["ROOT_NO"];
        keys_root[2] = dt_root.Columns["EFF_DATE_FROM"];

        dt_root.PrimaryKey = keys_root;

        string SessionIDName_root = "STM252_root" + PageTimeStamp.Value;
        Session[SessionIDName_root] = ds_root;

        #endregion

        #region 收款天數新增DataSet
        //新增DataSet
        DataSet ds = new DataSet();
        DataTable dt = new DataTable();
        DataColumn[] keys = new DataColumn[1];

        ds.Tables.Add(dt);
        dt.Columns.Add("ID", Type.GetType("System.String"));
        dt.Columns.Add("STORE", Type.GetType("System.String"));
        dt.Columns.Add("EFF_DATE_FROM", Type.GetType("System.String"));
        dt.Columns.Add("ROOT_NO", Type.GetType("System.String"));
        dt.Columns.Add("ROOT_NO_EXPLAIN", Type.GetType("System.String"));
        dt.Columns.Add("PMA", Type.GetType("System.String"));
        dt.Columns.Add("PMA_EXPLAIN", Type.GetType("System.String"));
        dt.Columns.Add("COL_DAYS", Type.GetType("System.String"));
        dt.Columns.Add("COL_DAYS_EXPLAIN", Type.GetType("System.String"));
        dt.Columns.Add("CREATEDATE");
        dt.Columns.Add("CREATEUID");
        dt.Columns.Add("UPDATEDATE");
        dt.Columns.Add("UPDATEUID");

        dt.Columns["STORE"].AllowDBNull = false;
        dt.Columns["EFF_DATE_FROM"].AllowDBNull = false;
        //dt.Columns["ROOT_NO"].AllowDBNull = false;
        //dt.Columns["PMA"].AllowDBNull = false;

        keys[0] = dt.Columns["ID"];
        //keys[1] = dt.Columns["EFF_DATE_FROM"];
        //keys[2] = dt.Columns["ROOT_NO"];
        //keys[3] = dt.Columns["PMA"];
        dt.PrimaryKey = keys;

        string SessionIDName = "STM252_" + PageTimeStamp.Value;
        Session[SessionIDName] = ds;

        #endregion

        #region 預設欄位值
        //模式指定
        string mode = "";
        mode = Request.QueryString["mode"].ToString();
        if (mode == "view")
        {
            QueryData(Request.QueryString["store"].ToString(), Request.QueryString["eff_date_from"].ToString());
            ReadOnlyMode(false);
            if (this.txtARMK.Text == "已審核")
            {
                btnEdit_M.Enabled = false; //編輯
                btnPASS.Enabled = false;
                btnNOPASS.Enabled = true;
            }

            if (this.txtARMK.Text == "未審核")
            {
                btnEdit_M.Enabled = true;   //編輯
                btnPASS.Enabled = true;
                btnNOPASS.Enabled = false;
                btnExtend.Visible = false;
            }

            if (SLP_EFF_DATE_TO.Text.Length > 0)
            {
                if (Convert.ToDateTime(this.SLP_EFF_DATE_TO.Text).CompareTo(System.DateTime.Today) == -1)
                {
                    btnEdit_M.Enabled = false;//編輯 
                    btnPASS.Enabled = false;  //審核
                    btnNOPASS.Enabled = false;//審核解除

                    if (CanUpdate && this.txtARMK.Text == "已審核")
                    {
                        STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);
                        ParameterList.Clear();
                        ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false));
                        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false));

                        if (BCO.QueryIsLatest(ParameterList).Rows.Count == 0)
                        {
                            btnExtend.Visible = true;

                            if (SLP_DEPOSIT.Text.Trim()!="")
                            {
                                if (int.Parse(SLP_DEPOSIT.Text.Trim()) > 0)
                                {
                                    btnClose.Visible = true;    
                                }
                            }
                        }
                    }
                }
            }
        }
        if (mode == "insert")
        {
            ReadOnlyMode(true);
            btnCopy.Visible = false;
            btnSave.Visible = true;      //確定新增
            btnAddCancle.Visible = true; //取消(回查詢頁)
            btnEdt.Visible = false;      //確定更新 
            btnUpdateCancel.Visible = false;   //取消(回檢視頁)
            btnPASS.Visible = false;     //審核
            btnNOPASS.Visible = false;   //審核解除
            radSTORE_TYPE_HEAD.Checked = false;
            radSTORE_TYPE_STORE.Checked = true;
            txtPAY_RFNO.ReadOnly = true;
            txtPAY_RFNO.CssClass = "readtxtbox";
            txtARMK.Text = "未審核";
            this.SLP_EFF_DATE_TO.Text = "9999/12/31";
        }
        #endregion

        #region 註冊JavaScript
        TextBox txt_STORE_ID = (TextBox)this.SLP_STORE.FindControl("TextBoxCode");
        txt_STORE_ID.Attributes["onblur"] += "if ( document.getElementById('" + txt_STORE_ID.ClientID + "').readOnly == false && document.getElementById('" + txt_STORE_ID.ClientID + "').value.length!=0){__doPostBack('" + UpdatePanel12.ClientID + "','txt_STORE_Onblur');}";
        txtPAY_RFNO.Attributes["onblur"] += "if ( document.getElementById('" + txtPAY_RFNO.ClientID + "').readOnly == false){__doPostBack('" + UpdatePanel12.ClientID + "','txt_PAY_RFNO_Onblur');}";
        txtRFNO.Attributes["onblur"] += "if ( document.getElementById('" + txtRFNO.ClientID + "').readOnly == false){__doPostBack('" + UpdatePanel12.ClientID + "','txt_RFNO_Onblur');}";
        #endregion
    }
Example #6
0
    protected void btnPASS_Click(object sender, EventArgs e)
    {
        #region 檢查判斷
        //檢核必輸入欄位
        TextBox STORE = ((TextBox)((ASP.stm_slp_slp_store_ascx)SLP_STORE).FindControl("TextBoxCode"));
        TextBox EFF_DATE_FROM = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_EFF_DATE_FROM).FindControl("TextBoxCode"));
        TextBox EFF_DATE_TO = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_EFF_DATE_TO).FindControl("TextBoxCode"));
        TextBox PROFIT_NO = ((TextBox)((ASP.stm_slp_slp_profitcenter_ascx)SLP_PROFIT_NO).FindControl("TextBoxCode"));
        TextBox DUTY_UNIT = ((TextBox)((ASP.sys_slp_slp_role_ascx)SLP_DUIT_UNIT).FindControl("TextBoxCode"));

        TextBox[] FieldIDs ={ STORE, EFF_DATE_FROM, EFF_DATE_TO, txtPAY_RFNO, txtRFNO, txtTITLE, txtINV_ADDR, txtPERSON, PROFIT_NO, DUTY_UNIT };
        string[] FieldNames ={ "店號", "履歷開始日", "履歷結束日", "結帳統編", "單店統編", "發票抬頭", "發票登記地址", "負責人", "利潤中心", "權責單位" };
        int i = 0;
        foreach (TextBox FieldName in FieldIDs)
        {
            if (FieldName.Text.Trim().Length == 0)
            {
                ErrorMsgLabel.Text = "必須輸入「" + FieldNames[i] + "」欄位";
                return;
            }
            i++;
        }
        #endregion

        DateTime processtime = DateTime.Now;

        STMModel.MaintainStoreAccount STM = new STMModel.MaintainStoreAccount(ConntionDB);

        ParameterList.Clear();
        ParameterList.Add(this.SLP_STORE.Text);             //V_STORE
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false));     //D_EFF_DATE_FROM
        ParameterList.Add(processtime);             //D_NEW_UPDATEDATE    
        ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));     //V_NEW_UPDATEUID  

        STM.ConfirmStoreARMK(ParameterList);

        int i_Count = 0;
        string s_Request_Key = "";
        if (Request.QueryString["STM252_COUNT"] == null)
        {
            i_Count = 0;
            s_Request_Key = "";
        }
        else
        {
            i_Count = int.Parse(Request.QueryString["STM252_COUNT"]);
            s_Request_Key = Request.QueryString["STM252_PageTimeStamp"];
        }

        ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('審核成功');", true);

        QueryData(this.SLP_STORE.Text, this.SLP_EFF_DATE_FROM.Text);
        ReadOnlyMode(false);

        if (this.txtARMK.Text == "已審核")
        {
            btnEdit_M.Enabled = false; //編輯
            btnPASS.Enabled = false;
            btnNOPASS.Enabled = true;
        }

        if (this.txtARMK.Text == "未審核")
        {
            btnEdit_M.Enabled = true;   //編輯
            btnPASS.Enabled = true;
            btnNOPASS.Enabled = false;
        }

        if (SLP_EFF_DATE_TO.Text.Length > 0)
        {
            if (Convert.ToDateTime(this.SLP_EFF_DATE_TO.Text).CompareTo(System.DateTime.Today) == -1)
            {
                btnEdit_M.Enabled = false;//編輯 
                btnPASS.Enabled = false;  //審核
                btnNOPASS.Enabled = false;//審核解除
            }
        }
    }
Example #7
0
    protected void btnNOPASS_Click(object sender, EventArgs e)
    {
        try
        {
            string Msg = "";

            DateTime processtime = DateTime.Now;

            STMModel.MaintainStoreAccount STM = new STMModel.MaintainStoreAccount(ConntionDB);

            ParameterList.Clear();
            ParameterList.Add(this.SLP_STORE.Text);             //V_STORE
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false));     //D_EFF_DATE_FROM
            ParameterList.Add(processtime);                    //D_NEW_UPDATEDATE    
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));     //V_NEW_UPDATEUID    

            STM.UnConfirmStoreARMK(ParameterList, out Msg);
            if (Msg != "")
            {
                throw new Exception(Msg);
            }
            else
            {
                int i_Count = 0;
                string s_Request_Key = "";
                if (Request.QueryString["STM252_COUNT"] == null)
                {
                    i_Count = 0;
                    s_Request_Key = "";
                }
                else
                {
                    i_Count = int.Parse(Request.QueryString["STM252_COUNT"]);
                    s_Request_Key = Request.QueryString["STM252_PageTimeStamp"];
                }

                ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('審核解除成功');", true);

                QueryData(this.SLP_STORE.Text, this.SLP_EFF_DATE_FROM.Text);
                ReadOnlyMode(false);
                if (this.txtARMK.Text == "已審核")
                {
                    btnEdit_M.Enabled = false; //編輯
                    btnPASS.Enabled = false;
                    btnNOPASS.Enabled = true;
                }

                if (this.txtARMK.Text == "未審核")
                {
                    btnEdit_M.Enabled = true;   //編輯
                    btnPASS.Enabled = true;
                    btnNOPASS.Enabled = false;
                }

                if (SLP_EFF_DATE_TO.Text.Length > 0)
                {
                    if (Convert.ToDateTime(this.SLP_EFF_DATE_TO.Text).CompareTo(System.DateTime.Today) == -1)
                    {
                        btnEdit_M.Enabled = false;//編輯 
                        btnPASS.Enabled = false;  //審核
                        btnNOPASS.Enabled = false;//審核解除
                    }
                }
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
    }
Example #8
0
    protected void btnEdit_M_Click(object sender, EventArgs e)
    {
        //預設欄位Focus
        SetClinetFocus(SLP_STORE.ClientID);
        ReadOnlyMode(true);
        btnSave.Visible = false;
        btnPASS.Visible = false;
        btnNOPASS.Visible = false;
        btnCopy.Visible = false;

        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "STM251.aspx?Code=STM25", null, WUI_GMToolbarV.ClickAction.LinkURL);
        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", this.btnEdit_M, WUI_GMToolbarV.ClickAction.ButtonClick);
        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.New, false, string.Empty, this.btnEdit_M, WUI_GMToolbarV.ClickAction.ButtonClick);
        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, string.Empty, this.btnEdt, WUI_GMToolbarV.ClickAction.ButtonClick);
        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, false, string.Empty, this.btnEdit_M, WUI_GMToolbarV.ClickAction.ButtonClick);
        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, false, string.Empty, this.btnEdit_M, WUI_GMToolbarV.ClickAction.ButtonClick);
        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Copy, false, string.Empty, this.btnCopy, WUI_GMToolbarV.ClickAction.ButtonClick);



        if (txtPAY_RFNO.Text == txtRFNO.Text && radSTORE_TYPE_STORE.Checked)
        {
            #region 總部門市資料唯讀
            STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);
            DataTable Dt_rtn;
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.txtRFNO.Text, "string", false));
            Dt_rtn = BCO.QueryAccountHead(ParameterList);

            if (Dt_rtn != null && Dt_rtn.Rows.Count > 0)
            {
                #region 總部資料唯讀
                SLP_STORE.ReadOnly = true;
                txtPAY_RFNO.ReadOnly = true;
                txtPAY_RFNO.CssClass = "readtxtbox";
                txtRFNO.ReadOnly = true;
                txtRFNO.CssClass = "readtxtbox";
                this.radSTORE_TYPE_HEAD.Enabled = false;
                this.radSTORE_TYPE_STORE.Enabled = false;
                this.SLP_EFF_DATE_FROM.ReadOnly = true;
                this.radSTORE_TYPE_HEAD.Enabled = false;
                this.radSTORE_TYPE_STORE.Enabled = false;
                this.txtTITLE.ReadOnly = true;
                txtTITLE.CssClass = "readtxtbox";
                this.txtINV_ADDR.ReadOnly = true;
                txtINV_ADDR.CssClass = "readtxtbox";
                this.txtPERSON.ReadOnly = true;
                txtPERSON.CssClass = "readtxtbox";
                this.SLP_PROFIT_NO.ReadOnly = true;
                this.txtPAY_ACCOUNT.ReadOnly = true;
                txtPAY_ACCOUNT.CssClass = "readtxtbox";
                this.SLP_DUIT_UNIT.ReadOnly = true;
                this.ddlPAYMENT_STORE.Enabled = false;
                this.txtAC_NAME.ReadOnly = true;
                txtAC_NAME.CssClass = "readtxtbox";
                this.txtINVOICE_MAILADD.ReadOnly = true;
                txtINVOICE_MAILADD.CssClass = "readtxtbox";
                this.SLP_INVOICE_SEND.ReadOnly = true;
                this.SLP_INVOICE_TYPE.ReadOnly = true;
                this.ddlPAY_TYPE.Enabled = false;
                this.SLP_CLS_DATE.ReadOnly = true;

                if (GridView1.Rows.Count > 0)
                {
                    foreach (GridViewRow dr in GridView1.Rows)
                    {
                        ((Button)dr.FindControl("btnDel")).Enabled = false;   //GRID刪除
                        ((Button)dr.FindControl("btnEdit")).Enabled = false;  //GRID編輯
                    }
                }
                btnAdd.Enabled = false;//新增
                #endregion
            }
            #endregion
        }
        else if (radSTORE_TYPE_HEAD.Checked)
        {
            txtPAY_RFNO.ReadOnly = true;
            txtPAY_RFNO.CssClass = "readtxtbox";
            txtRFNO.ReadOnly = true;
            txtRFNO.CssClass = "readtxtbox";
        }
    }
Example #9
0
    protected void btnEdt_Click(object sender, EventArgs e)
    {
        //檢核必輸入欄位
        TextBox STORE = ((TextBox)((ASP.stm_slp_slp_store_ascx)SLP_STORE).FindControl("TextBoxCode"));
        TextBox EFF_DATE_FROM = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_EFF_DATE_FROM).FindControl("TextBoxCode"));
        TextBox EFF_DATE_TO = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_EFF_DATE_TO).FindControl("TextBoxCode"));
        TextBox PROFIT_NO = ((TextBox)((ASP.stm_slp_slp_profitcenter_ascx)SLP_PROFIT_NO).FindControl("TextBoxCode"));
        TextBox DUTY_UNIT = ((TextBox)((ASP.sys_slp_slp_role_ascx)SLP_DUIT_UNIT).FindControl("TextBoxCode"));

        TextBox[] FieldIDs ={ STORE, EFF_DATE_FROM, EFF_DATE_TO, txtPAY_RFNO, txtRFNO, txtTITLE, txtINV_ADDR, txtPERSON, PROFIT_NO, DUTY_UNIT };
        string[] FieldNames ={ "店號", "履歷開始日", "履歷結束日", "結帳統編", "單店統編", "發票抬頭", "發票登記地址", "負責人", "利潤中心", "權責單位" };
        int i = 0;
        foreach (TextBox FieldName in FieldIDs)
        {
            if (FieldName.Text.Trim().Length == 0)
            {
                ErrorMsgLabel.Text = "必須輸入「" + FieldNames[i] + "」欄位";
                return;
            }
            i++;
        }

        //履歷開始日須小於履歷結束日
        if ((SLP_EFF_DATE_FROM.Text != "") || (SLP_EFF_DATE_TO.Text != ""))
        {
            if (DateTime.Parse(SLP_EFF_DATE_FROM.Text) > DateTime.Parse(SLP_EFF_DATE_TO.Text))
            {
                ErrorMsgLabel.Text = "履歷開始日須小於履歷結束日 !!";
                return;
            }
        }

        if (ddlDEPOSIT_TYPE.SelectedValue == "2" || ddlDEPOSIT_TYPE.SelectedValue == "3")
        {
            if (SLP_DEPOSIT_DATE_FROM.Text == "")
            {
                ErrorMsgLabel.Text = "必須輸入「質押金起日」欄位";
                return;
            }

            if (SLP_DEPOSIT_DATE_TO.Text == "")
            {
                ErrorMsgLabel.Text = "必須輸入「質押金迄日」欄位";
                return;
            }

            if (ddlDEPOSIT_TYPE.SelectedValue == "3" && SLP_DEPOSIT.Text == "")
            {
                ErrorMsgLabel.Text = "必須輸入「質押金額」欄位";
                return;
            }
        }
        else if (ddlDEPOSIT_TYPE.SelectedValue == "1" )
        {
            if (SLP_DEPOSIT.Text == "")
            {
                ErrorMsgLabel.Text = "必須輸入「質押金額」欄位";
                return;
            }
        }

        if (radSTORE_TYPE_HEAD.Checked && ddlPAYMENT_STORE.SelectedValue != "1")
        {
            ErrorMsgLabel.Text = "門市類型等於總店時,付款對象限只能選總部";
            return;
        }

        DataSet ds_root1 = (DataSet)Session["STM252_root" + PageTimeStamp.Value];

        DataTable DtHeadRoot = Check_Root();
        if (DtHeadRoot.Rows.Count > 0)
        {
            foreach (DataRow dr in ds_root1.Tables[0].Rows)
            {
                if (dr.RowState != DataRowState.Deleted)
                {
                    DataRow[] dr2 = DtHeadRoot.Select(string.Format("ROOT_NO = '{0}' and (HEAD_DOC='{1}' or SINGLE_DOC ='{2}')", dr["ROOT_NO"].ToString(), dr["HEAD_DOC"].ToString(), dr["SINGLE_DOC"].ToString()));
                    if (dr2.Length == 0)
                    {
                        ErrorMsgLabel.Text = "總部下的門市:群分類設定的內容(憑証開立、付款方式)需和總部相同!! ";
                        return;
                    }
                }
            }
        }

        //儲存作業
        int v_ID = 0;

        #region
        try
        {
            #region 取得畫面元件的值

            DateTime processtime = DateTime.Now;

            #endregion

            #region 門市帳務主檔
            ParameterList.Clear();

            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_ACCOUNT_PROPERTY"].Rows[0]["CREATEDATE"].ToString(), "datetime", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_ACCOUNT_PROPERTY"].Rows[0]["CREATEUID"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_ACCOUNT_PROPERTY"].Rows[0]["UPDATEDATE"].ToString(), "datetime", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_ACCOUNT_PROPERTY"].Rows[0]["UPDATEUID"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_ACCOUNT_PROPERTY"].Rows[0]["STORE"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_ACCOUNT_PROPERTY"].Rows[0]["EFF_DATE_FROM"].ToString(), "string", false));
            ParameterList.Add(string.Format("{0}{1}", this.SLP_STORE.Text.Trim(), this.SLP_EFF_DATE_FROM.Text)); //V_CODE
            ParameterList.Add(processtime);
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false)); //V_STORE
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false)); //D_EFF_DATE_FROM
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_TO.Text, "date", false)); //D_EFF_DATE_TO
            ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", false)); //V_PAY_RFNO
            if (this.radSTORE_TYPE_HEAD.Checked == true)
                ParameterList.Add("1"); //V_STORE_TYPE
            else
                ParameterList.Add("2"); //V_STORE_TYPE
            ParameterList.Add(GetValueSetParameter(this.txtRFNO.Text, "string", false)); //V_RFNO
            ParameterList.Add(GetValueSetParameter(this.txtTITLE.Text, "string", false)); //V_TITLE
            ParameterList.Add(GetValueSetParameter(this.txtINV_ADDR.Text, "string", false)); //V_INV_ADDR
            ParameterList.Add(GetValueSetParameter(this.txtPERSON.Text, "string", false)); //V_PERSON
            ParameterList.Add(GetValueSetParameter(this.SLP_PROFIT_NO.Text, "string", false)); //V_PROFIT_NO
            ParameterList.Add(GetValueSetParameter(this.SLP_FEET.Text, "int", false)); //N_FEET
            ParameterList.Add(GetValueSetParameter(this.txtPAY_ACCOUNT.Text, "string", false)); //PAY_ACCOUNT
            if (this.radDEPOSIT_NO_HEAD.Checked == true)
                ParameterList.Add("1"); //V_DEPOSIT_NO
            else
                ParameterList.Add("2"); //V_DEPOSIT_NO
            ParameterList.Add(GetValueSetParameter(this.ddlDEPOSIT_TYPE.SelectedValue, "string", false)); //N_DEPOSIT
            ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT.Text, "int", false)); //N_DEPOSIT
            ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_FROM.Text, "date", false)); //D_DEPOSIT_DATE_FROM
            ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_TO.Text, "date", false)); //D_DEPOSIT_DATE_TO
            ParameterList.Add(GetValueSetParameter(this.SLP_DUIT_UNIT.Text, "string", false)); //V_DUTY_UNIT
            ParameterList.Add(GetValueSetParameter(this.ddlPAYMENT_STORE.SelectedValue, "string", false)); //V_PAYMENT_STORE
            ParameterList.Add(GetValueSetParameter(this.txtAC_NAME.Text, "string", false)); //V_AC_NAME
            ParameterList.Add(GetValueSetParameter(this.txtINVOICE_MAILADD.Text, "string", false)); //V_INVOICE_MAIL_ADD
            ParameterList.Add(GetValueSetParameter(this.SLP_INVOICE_SEND.Text, "string", false)); //V_INVOICE_SEND
            ParameterList.Add(GetValueSetParameter(this.SLP_INVOICE_TYPE.Text, "string", false)); //V_INVOICE_TYPE
            ParameterList.Add(GetValueSetParameter(this.ddlPAY_TYPE.SelectedValue, "string", false)); //V_PAY_TYPE
            ParameterList.Add(GetValueSetParameter(this.SLP_CLS_DATE.Text, "string", false)); //V_CLS_DATE
            if (this.txtARMK.Text == "已審核")
                ParameterList.Add(1); //N_ARMK
            else
                ParameterList.Add(0); //N_ARMK

            #endregion

            #region 設定屬性

            DataSet ds_root = (DataSet)Session["STM252_root" + PageTimeStamp.Value];

            #endregion

            #region 收款天數

            DataSet ds = (DataSet)Session["STM252_" + PageTimeStamp.Value];

            #endregion

            STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);

            string Msg = "";

            BCO.UpdateStoreBase(ParameterList, null, ds_root.Tables[0], ds.Tables[0], txtPID.Text, out Msg);

            if (Msg != "")
            {
                throw new Exception(Msg);
            }
            else
            {
                int i_Count = 0;
                string s_Request_Key = "";
                if (Request.QueryString["STM252_COUNT"] == null)
                {
                    i_Count = 0;
                    s_Request_Key = "";
                }
                else
                {
                    i_Count = int.Parse(Request.QueryString["STM252_COUNT"]);
                    s_Request_Key = Request.QueryString["STM252_PageTimeStamp"];
                }

                ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('更新完成');", true);

                QueryData(SLP_STORE.Text, SLP_EFF_DATE_FROM.Text);
                ReadOnlyMode(false);
                if (this.txtARMK.Text == "已審核")
                {
                    btnEdit_M.Enabled = false; //編輯
                    btnPASS.Enabled = false;
                    btnNOPASS.Enabled = true;
                }

                if (this.txtARMK.Text == "未審核")
                {
                    btnEdit_M.Enabled = true;   //編輯
                    btnPASS.Enabled = true;
                    btnNOPASS.Enabled = false;
                }

                if (SLP_EFF_DATE_TO.Text.Length > 0)
                {
                    if (Convert.ToDateTime(this.SLP_EFF_DATE_TO.Text).CompareTo(System.DateTime.Today) == -1)
                    {
                        btnEdit_M.Enabled = false;//編輯 
                        btnPASS.Enabled = false;  //審核
                        btnNOPASS.Enabled = false;//審核解除
                    }
                }

                btnPASS.Visible = true && AuthUpdate;
                btnNOPASS.Visible = true && CanUpdate;

                this.Panel2.Visible = false;
                this.Panel4.Visible = false;

                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, string.Empty, this.btnEdt, WUI_GMToolbarV.ClickAction.ButtonClick);
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, true, string.Empty, this.btnEdit_M, WUI_GMToolbarV.ClickAction.ButtonClick);
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Copy, true, string.Empty, this.btnCopy, WUI_GMToolbarV.ClickAction.ButtonClick);
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }
Example #10
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        STMModel.MaintainStoreAccount STM = new STMModel.MaintainStoreAccount(ConntionDB);

        //檢核必輸入欄位
        TextBox STORE = ((TextBox)((ASP.stm_slp_slp_store_ascx)SLP_STORE).FindControl("TextBoxCode"));
        TextBox EFF_DATE_FROM = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_EFF_DATE_FROM).FindControl("TextBoxCode"));
        TextBox EFF_DATE_TO = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_EFF_DATE_TO).FindControl("TextBoxCode"));
        TextBox PROFIT_NO = ((TextBox)((ASP.stm_slp_slp_profitcenter_ascx)SLP_PROFIT_NO).FindControl("TextBoxCode"));
        TextBox DUTY_UNIT = ((TextBox)((ASP.sys_slp_slp_role_ascx)SLP_DUIT_UNIT).FindControl("TextBoxCode"));

        TextBox[] FieldIDs ={ STORE, EFF_DATE_FROM, EFF_DATE_TO, txtPAY_RFNO, txtRFNO, txtTITLE, txtINV_ADDR, txtPERSON, PROFIT_NO, DUTY_UNIT };
        string[] FieldNames ={ "店號", "履歷開始日", "履歷結束日", "結帳統編", "單店統編", "發票抬頭", "發票登記地址", "負責人", "利潤中心", "權責單位" };
        int i = 0;
        foreach (TextBox FieldName in FieldIDs)
        {
            if (FieldName.Text.Trim().Length == 0)
            {
                ErrorMsgLabel.Text = "必須輸入「" + FieldNames[i] + "」欄位";
                return;
            }
            i++;
        }

        if (txtGROUP_NO.Text.Length == 0)
        {
            ErrorMsgLabel.Text = "無門市唯一檔,無法建立門市帳務主檔";
            return;
        }

        if (ddlDEPOSIT_TYPE.SelectedValue == "2" || ddlDEPOSIT_TYPE.SelectedValue == "3")
        {
            if (SLP_DEPOSIT_DATE_FROM.Text == "")
            {
                ErrorMsgLabel.Text = "必須輸入「質押金起日」欄位";
                return;
            }

            if (SLP_DEPOSIT_DATE_TO.Text == "")
            {
                ErrorMsgLabel.Text = "必須輸入「質押金迄日」欄位";
                return;
            }

            if (ddlDEPOSIT_TYPE.SelectedValue == "3" && SLP_DEPOSIT.Text == "")
            {
                ErrorMsgLabel.Text = "必須輸入「質押金額」欄位";
                return;
            }
        }
        else if (ddlDEPOSIT_TYPE.SelectedValue == "1")
        {
            if (SLP_DEPOSIT.Text == "")
            {
                ErrorMsgLabel.Text = "必須輸入「質押金額」欄位";
                return;
            }
        }

        //履歷開始日須小於履歷結束日
        if ((SLP_EFF_DATE_FROM.Text != "") || (SLP_EFF_DATE_TO.Text != ""))
        {
            if (DateTime.Parse(SLP_EFF_DATE_FROM.Text) > DateTime.Parse(SLP_EFF_DATE_TO.Text))
            {
                ErrorMsgLabel.Text = "履歷開始日須小於履歷結束日 !!";
                return;
            }
        }

        if (radSTORE_TYPE_HEAD.Checked && ddlPAYMENT_STORE.SelectedValue != "1")
        {
            ErrorMsgLabel.Text = "門市類型等於總店時,付款對象限只能選總部";
            return;
        }

        DataSet ds_root1 = (DataSet)Session["STM252_root" + PageTimeStamp.Value];

        DataTable DtHeadRoot = Check_Root();
        if (DtHeadRoot.Rows.Count > 0)
        {
            foreach (DataRow dr in ds_root1.Tables[0].Rows)
            {
                if (dr.RowState != DataRowState.Deleted)
                {
                    DataRow[] dr2 = DtHeadRoot.Select(string.Format("ROOT_NO = '{0}' and (HEAD_DOC='{1}' or SINGLE_DOC ='{2}')", dr["ROOT_NO"].ToString(), dr["HEAD_DOC"].ToString(), dr["SINGLE_DOC"].ToString()));
                    if (dr2.Length == 0)
                    {
                        ErrorMsgLabel.Text = "總部下的門市:群分類設定的內容(憑証開立、付款方式)需和總部相同!! ";
                        return;
                    }
                }
            }
        }

        //儲存作業
        string v_ID = "";

        #region
        try
        {
            #region 取得畫面元件的值

            DateTime processtime = DateTime.Now;

            #endregion

            #region 門市帳務
            ParameterList.Clear();
            ParameterList.Add(string.Format("{0}{1}", this.SLP_STORE.Text.Trim(), this.SLP_EFF_DATE_FROM.Text)); //V_CODE
            ParameterList.Add(processtime);
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));
            ParameterList.Add(processtime);
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false)); //V_STORE
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false)); //D_EFF_DATE_FROM
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_TO.Text, "date", false)); //D_EFF_DATE_TO
            ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", false)); //V_PAY_RFNO
            if (this.radSTORE_TYPE_HEAD.Checked == true)
                ParameterList.Add("1"); //V_STORE_TYPE
            else
                ParameterList.Add("2"); //V_STORE_TYPE
            ParameterList.Add(GetValueSetParameter(this.txtRFNO.Text, "string", false)); //V_RFNO
            ParameterList.Add(GetValueSetParameter(this.txtTITLE.Text, "string", false)); //V_TITLE
            ParameterList.Add(GetValueSetParameter(this.txtINV_ADDR.Text, "string", false)); //V_INV_ADDR
            ParameterList.Add(GetValueSetParameter(this.txtPERSON.Text, "string", false)); //V_PERSON
            ParameterList.Add(GetValueSetParameter(this.SLP_PROFIT_NO.Text, "string", false)); //V_PROFIT_NO
            ParameterList.Add(GetValueSetParameter(this.SLP_FEET.Text, "int", false)); //N_FEET
            if (this.radDEPOSIT_NO_HEAD.Checked == true)
                ParameterList.Add("1"); //V_DEPOSIT_NO
            else
                ParameterList.Add("2"); //V_DEPOSIT_NO
            ParameterList.Add(GetValueSetParameter(this.ddlDEPOSIT_TYPE.SelectedValue, "string", false)); //N_DEPOSIT
            ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT.Text, "int", false)); //N_DEPOSIT
            ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_FROM.Text, "date", false)); //D_DEPOSIT_DATE_FROM
            ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_TO.Text, "date", false)); //D_DEPOSIT_DATE_TO
            ParameterList.Add(GetValueSetParameter(this.SLP_DUIT_UNIT.Text, "string", false)); //V_DUTY_UNIT
            ParameterList.Add(GetValueSetParameter(this.ddlPAYMENT_STORE.SelectedValue, "string", false)); //V_PAYMENT_STORE
            ParameterList.Add(GetValueSetParameter(this.txtAC_NAME.Text, "string", false)); //V_AC_NAME
            ParameterList.Add(GetValueSetParameter(this.txtINVOICE_MAILADD.Text, "string", false)); //V_INVOICE_MAIL_ADD
            ParameterList.Add(GetValueSetParameter(this.SLP_INVOICE_SEND.Text, "string", false)); //V_INVOICE_SEND
            ParameterList.Add(GetValueSetParameter(this.SLP_INVOICE_TYPE.Text, "string", false)); //V_INVOICE_TYPE
            ParameterList.Add(GetValueSetParameter(this.ddlPAY_TYPE.SelectedValue, "string", false)); //V_PAY_TYPE
            ParameterList.Add(GetValueSetParameter(this.SLP_CLS_DATE.Text, "string", false)); //V_CLS_DATE
            if (this.txtARMK.Text == "已審核")
                ParameterList.Add(1); //N_ARMK
            else
                ParameterList.Add(0); //N_ARMK

            #endregion

            #region 設定屬性

            DataSet ds_root = (DataSet)Session["STM252_root" + PageTimeStamp.Value];

            #endregion

            #region 收款天數

            DataSet ds = (DataSet)Session["STM252_" + PageTimeStamp.Value];

            #endregion

            STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);

            string Msg = "";

            v_ID = BCO.CreateStoreBase(ParameterList, null, ds_root.Tables[0], ds.Tables[0], out Msg);

            if (Msg != "")
            {
                throw new Exception(Msg);
            }
            else
            {
                if ((v_ID == "") || (v_ID == null))
                {
                    throw new Exception("新增0筆資料!");
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('新增完成');location.replace('STM252.aspx?mode=view&store=" + SLP_STORE.Text + "&eff_date_from=" + SLP_EFF_DATE_FROM.Text.ToString() + "&Code=STM25');", true);
                }
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }
Example #11
0
    protected void txt_RFNO_Onblur()
    {
        if (txtPAY_RFNO.Text == txtRFNO.Text)
        {
            string mode = "";
            string v_STORE = "";
            string v_eff_date_from = "";

            #region 帶出總部資料
            STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);
            DataTable Dt_rtn;
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.txtRFNO.Text, "string", false));
            Dt_rtn = BCO.QueryAccountHead(ParameterList);

            if (Dt_rtn == null || (Dt_rtn != null && Dt_rtn.Rows.Count <= 0))
            {
                //無資料
            }
            else
            {
                #region 帶出總部資料

                v_STORE = Dt_rtn.Rows[0]["STORE"].ToString();
                v_eff_date_from = Dt_rtn.Rows[0]["EFF_DATE_FROM"].ToString();
                this.SLP_EFF_DATE_TO.Text = Dt_rtn.Rows[0]["EFF_DATE_TO"].ToString();
                this.radSTORE_TYPE_HEAD.Checked = false;
                this.radSTORE_TYPE_STORE.Checked = true;
                this.txtTITLE.Text = Dt_rtn.Rows[0]["TITLE"].ToString();
                this.txtINV_ADDR.Text = Dt_rtn.Rows[0]["INV_ADDR"].ToString();
                this.txtPERSON.Text = Dt_rtn.Rows[0]["PERSON"].ToString();
                this.SLP_PROFIT_NO.Text = Dt_rtn.Rows[0]["PROFIT_NO"].ToString();
                this.txtPAY_ACCOUNT.Text = Dt_rtn.Rows[0]["PAY_ACCOUNT"].ToString();
                this.SLP_DUIT_UNIT.Text = Dt_rtn.Rows[0]["DUTY_UNIT"].ToString();
                this.ddlPAYMENT_STORE.SelectedValue = Dt_rtn.Rows[0]["PAYMENT_STORE"].ToString();
                this.txtAC_NAME.Text = Dt_rtn.Rows[0]["AC_NAME"].ToString();
                this.txtINVOICE_MAILADD.Text = Dt_rtn.Rows[0]["INVOICE_MAIL_ADD"].ToString();
                this.SLP_INVOICE_SEND.Text = Dt_rtn.Rows[0]["INVOICE_SEND"].ToString();
                this.SLP_INVOICE_TYPE.Text = Dt_rtn.Rows[0]["INVOICE_TYPE"].ToString();
                this.ddlPAY_TYPE.SelectedValue = Dt_rtn.Rows[0]["PAY_TYPE"].ToString();
                this.SLP_CLS_DATE.Text = Dt_rtn.Rows[0]["CLS_DATE"].ToString();
                #endregion

                #region 帶出總部資料唯讀
                SLP_STORE.ReadOnly = true;
                txtPAY_RFNO.ReadOnly = true;
                txtPAY_RFNO.CssClass = "readtxtbox";
                txtRFNO.ReadOnly = true;
                txtRFNO.CssClass = "readtxtbox";
                this.radSTORE_TYPE_HEAD.Enabled = false;
                this.radSTORE_TYPE_STORE.Enabled = false;
                this.SLP_EFF_DATE_FROM.ReadOnly = true;
                this.radSTORE_TYPE_HEAD.Enabled = false;
                this.radSTORE_TYPE_STORE.Enabled = false;
                this.txtTITLE.ReadOnly = true;
                txtTITLE.CssClass = "readtxtbox";
                this.txtINV_ADDR.ReadOnly = true;
                txtINV_ADDR.CssClass = "readtxtbox";
                this.txtPERSON.ReadOnly = true;
                txtPERSON.CssClass = "readtxtbox";
                this.SLP_PROFIT_NO.ReadOnly = true;
                this.txtPAY_ACCOUNT.ReadOnly = true;
                txtPAY_ACCOUNT.CssClass = "readtxtbox";
                this.SLP_DUIT_UNIT.ReadOnly = true;
                this.ddlPAYMENT_STORE.Enabled = false;
                this.txtAC_NAME.ReadOnly = true;
                txtAC_NAME.CssClass = "readtxtbox";
                this.txtINVOICE_MAILADD.ReadOnly = true;
                txtINVOICE_MAILADD.CssClass = "readtxtbox";
                this.SLP_INVOICE_SEND.ReadOnly = true;
                this.SLP_INVOICE_TYPE.ReadOnly = true;
                this.ddlPAY_TYPE.Enabled = false;
                this.SLP_CLS_DATE.ReadOnly = true;
                #endregion
            }
            #endregion

            #region 帶出設定屬性
            if (v_STORE.Length != 0 && v_eff_date_from.Length != 0)
            {
                STMModel.MaintainStoreAccount BCO_root = new STMModel.MaintainStoreAccount(ConnectionDB);

                DataTable Dt_root;

                ParameterList.Clear();
                ParameterList.Add(v_STORE);
                ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));

                Dt_root = BCO_root.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.ROOT, ParameterList);

                if (Dt_root == null || (Dt_root != null && Dt_root.Rows.Count <= 0))
                {
                    //無資料
                }
                else
                {
                    DataSet ds_root = (DataSet)Session["STM252_root" + PageTimeStamp.Value];

                    ds_root.Clear();

                    for (int i = 0; i < Dt_root.Rows.Count; i++)
                    {
                        DataRow dr = ds_root.Tables[0].NewRow();

                        dr["STORE"] = this.SLP_STORE.Text;
                        dr["EFF_DATE_FROM"] = this.SLP_EFF_DATE_FROM.Text;
                        dr["ROOT_NO"] = Dt_root.Rows[i]["ROOT_NO"].ToString();
                        dr["ROOT_NO_EXPLAIN"] = Dt_root.Rows[i]["ROOT_NO_EXPLAIN"].ToString();
                        dr["HEAD_DOC"] = Dt_root.Rows[i]["HEAD_DOC"].ToString();
                        dr["HEAD_DOC_EXPLAIN"] = Dt_root.Rows[i]["HEAD_DOC_EXPLAIN"].ToString();
                        dr["SINGLE_DOC"] = Dt_root.Rows[i]["SINGLE_DOC"].ToString();
                        dr["SINGLE_DOC_EXPLAIN"] = Dt_root.Rows[i]["SINGLE_DOC_EXPLAIN"].ToString();
                        dr["PAYMENT_TYPE"] = Dt_root.Rows[i]["PAYMENT_TYPE"].ToString();
                        dr["PAYMENT_TYPE_EXPLAIN"] = Dt_root.Rows[i]["PAYMENT_TYPE_EXPLAIN"].ToString();

                        ds_root.Tables[0].Rows.Add(dr);
                    }

                    GridView1.DataSource = ds_root;
                    string SessionIDName_root = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
                    Session[SessionIDName_root] = ds_root;
                    GridView1.DataBind();
                    Session["STM252_root" + PageTimeStamp.Value] = ds_root;

                    if (GridView1.Rows.Count > 0)
                    {
                        foreach (GridViewRow dr in GridView1.Rows)
                        {
                            ((Button)dr.FindControl("btnDel")).Enabled = false;   //GRID刪除
                            ((Button)dr.FindControl("btnEdit")).Enabled = false;  //GRID編輯
                        }
                    }

                    btnAdd.Enabled = false;//新增
                }
            }
            #endregion

            #region 帶出收款天數
            if (v_STORE.Length != 0 && v_eff_date_from.Length != 0)
            {
                STMModel.MaintainStoreAccount BCO_Charge = new STMModel.MaintainStoreAccount(ConnectionDB);

                DataTable Dt_charge;
                ParameterList.Clear();

                ParameterList.Add(v_STORE);
                ParameterList.Add((DateTime.Parse(v_eff_date_from)).ToString("yyyy/MM/dd"));

                Dt_charge = BCO_Charge.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.CHARGE, ParameterList);

                if (Dt_charge == null || (Dt_charge != null && Dt_charge.Rows.Count <= 0))
                {
                    //無資料
                }
                else
                {
                    DataSet ds = (DataSet)Session["STM252_" + PageTimeStamp.Value];

                    ds.Clear();

                    for (int i = 0; i < Dt_charge.Rows.Count; i++)
                    {
                        DataRow dr = ds.Tables[0].NewRow();

                        dr["ID"] = DateTime.Now.ToFileTime().ToString() + i.ToString();
                        dr["STORE"] = this.SLP_STORE.Text;
                        dr["EFF_DATE_FROM"] = this.SLP_EFF_DATE_FROM.Text;
                        dr["ROOT_NO"] = Dt_charge.Rows[i]["ROOT_NO"].ToString();
                        dr["ROOT_NO_EXPLAIN"] = Dt_charge.Rows[i]["ROOT_NO_EXPLAIN"].ToString();
                        dr["PMA"] = Dt_charge.Rows[i]["PMA"].ToString();
                        dr["PMA_EXPLAIN"] = Dt_charge.Rows[i]["PMA_EXPLAIN"].ToString();
                        dr["COL_DAYS"] = Dt_charge.Rows[i]["COL_DAYS"].ToString();
                        dr["COL_DAYS_EXPLAIN"] = Dt_charge.Rows[i]["COL_DAYS_EXPLAIN"].ToString();

                        ds.Tables[0].Rows.Add(dr);
                    }
                    Session["STM252_" + PageTimeStamp.Value] = ds;

                    GridView2.DataSource = ds;
                    string SessionIDName2 = string.Format("{0}_{1}", PAGE_DT_02, PageTimeStamp.Value);
                    Session[SessionIDName2] = ds;
                    GridView2.DataBind();
                }
            }
            #endregion

            UpdatePanelLineItem.Update();
            UpdatePanel3.Update();
            UpdatePanel4.Update();
            UpdatePanel7.Update();
        }
    }
Example #12
0
    }//GridView4_3_PageIndexChanging

    #endregion

    #endregion ------------------------------------------------------------------------------------------------------------------

    #region ------------------------TextBox動作區----------------------------------------------------------------------------
    /// <summary>
    /// 欄位[店號]TextChanged事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void txt_STORE_Onblur()
    {
        try
        {
            #region 門市資料
            string[] strResult = new string[4];

            this.SLP_EFF_DATE_FROM.Text = "";
            this.txtGROUP_NO.Text = "";
            this.txtAC_UID.Text = "";
            this.txtSAL_ID.Text = "";

            if (this.SLP_STORE.Text.Length > 0)
            {
                STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);

                ParameterList.Clear();
                ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false)); //V_CODE

                strResult = BCO.GetStoreAcctEndDate(ParameterList);
                if (strResult[0] == "0")
                {
                    txtPAY_RFNO.ReadOnly = true;
                    txtPAY_RFNO.CssClass = "readtxtbox";
                    txtRFNO.ReadOnly = true;
                    txtRFNO.CssClass = "readtxtbox";
                    ErrorMsgLabel.Text = "此店號前履歷生效迄日未定";
                    return;
                }
                else
                {
                    this.SLP_EFF_DATE_FROM.Text = Convert.ToDateTime(strResult[0]).ToShortDateString();
                    this.txtGROUP_NO.Text = strResult[1];
                    this.txtAC_UID.Text = strResult[2];
                    this.txtSAL_ID.Text = strResult[3];

                    if (txtGROUP_NO.Text.Length == 0)
                    {
                        txtPAY_RFNO.ReadOnly = true;
                        txtPAY_RFNO.CssClass = "readtxtbox";
                        txtRFNO.ReadOnly = true;
                        txtRFNO.CssClass = "readtxtbox";
                        ErrorMsgLabel.Text = "門市檔無資料";
                        return;
                    }
                    else
                    {
                        txtPAY_RFNO.ReadOnly = false;
                        txtPAY_RFNO.CssClass = "";
                        txtRFNO.ReadOnly = false;
                        txtRFNO.CssClass = "";
                    }
                }
            }
            else
            {
                txtPAY_RFNO.ReadOnly = true;
                txtPAY_RFNO.CssClass = "readtxtbox";
                txtRFNO.ReadOnly = true;
                txtRFNO.CssClass = "readtxtbox";
            }
            #endregion

            #region 設定屬性

            DataSet ds_root = (DataSet)Session["STM252_root" + PageTimeStamp.Value];

            foreach (DataRow dr1 in ds_root.Tables[0].Rows)
            {
                object[] findPKs = new object[3];
                findPKs[0] = dr1["STORE"].ToString();
                findPKs[1] = dr1["ROOT_NO"].ToString();
                findPKs[2] = dr1["EFF_DATE_FROM"].ToString();
                DataRow dr = ds_root.Tables[0].Rows.Find(findPKs);
                if (dr != null)
                {
                    dr["STORE"] = this.SLP_STORE.Text;
                    dr["EFF_DATE_FROM"] = this.SLP_EFF_DATE_FROM.Text;
                }

                GridView1.DataSource = ds_root;
                GridView1.DataBind();
                Session["STM252_root" + PageTimeStamp.Value] = ds_root;
            }
            #endregion

            #region 收款天數

            DataSet ds = (DataSet)Session["STM252_" + PageTimeStamp.Value];

            foreach (DataRow dr2 in ds.Tables[0].Rows)
            {
                object[] findPKs_1 = new object[1];
                findPKs_1[0] = dr2["ID"].ToString();

                DataRow dr3 = ds.Tables[0].Rows.Find(findPKs_1);
                if (dr3 != null)
                {
                    dr3["STORE"] = this.SLP_STORE.Text;
                    dr3["EFF_DATE_FROM"] = this.SLP_EFF_DATE_FROM.Text;
                }
                GridView2.DataSource = ds;
                GridView2.DataBind();
                Session["STM252_" + PageTimeStamp.Value] = ds;
            }
            #endregion

            ScriptManager.RegisterClientScriptBlock(this.UpdatePanel12, typeof(UpdatePanel), "", @"
                 document.getElementById('" + txtPAY_RFNO.ClientID + @"').select();
                 document.getElementById('" + txtPAY_RFNO.ClientID + @"').focus();", true);
        }

        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { }
    }
Example #13
0
    // 刪除作業
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            #region 檢查判斷

            #endregion

            DateTime processtime = DateTime.Now;

            #region 門市帳務主檔
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblCREATEDATE")).Text, "datetime", false)); //D_OLD_CREATEDATE
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblCREATEUID")).Text, "string", false)); //V_OLD_CREATEUID
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblUPDATEDATE")).Text, "datetime", false)); //D_OLD_UPDATEDATE
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblUPDATEUID")).Text, "string", false)); //V_OLD_UPDATEUID
            ParameterList.Add(GetValueSetParameter(GridView1.Rows[e.RowIndex].Cells[0].Text, "string", false)); //V_OLD_STORE
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblEFF_DATE_FROM")).Text, "datetime", false)); //D_OLD_EFF_DATE_FROM
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));
            ParameterList.Add(processtime);
            #endregion

            STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);

            BCO.DeleteStoreBase(ParameterList, null);

            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('刪除完成');", true);

            databind();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
    }
Example #14
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void databind()
    {
        #region

        //抓取本頁初次登記的時間

        string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

        STMModel.MaintainStoreAccount BCO = new STMModel.MaintainStoreAccount(ConnectionDB);

        //門市帳務主檔
        ParameterList.Clear();
        ParameterList.Add(DBNull.Value); //N_ID
        ParameterList.Add(DBNull.Value); //V_CODE
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATEDATE.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_CREATEDATE_S
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATEDATE.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_CREATEDATE_E
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATEUI.Text, "string", CheckBoxLikeSearch.Checked)); //V_CREATEUID
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATEDATE.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_UPDATEDATE_S
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATEDATE.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_UPDATEDATE_E
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATEUI.Text, "string", CheckBoxLikeSearch.Checked)); //V_UPDATEUID
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", CheckBoxLikeSearch.Checked)); //V_STORE
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_EFF_DATE_FROM_S
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_FROM.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_EFF_DATE_FROM_E
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_TO.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_EFF_DATE_TO_S
        ParameterList.Add(GetValueSetParameter(this.SLP_EFF_DATE_TO.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_EFF_DATE_TO_E
        ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", CheckBoxLikeSearch.Checked)); //V_PAY_RFNO
        if (radSTORE_TYPE_ALL.Checked)
            ParameterList.Add(DBNull.Value); //V_STORE_TYPE
        if (radSTORE_TYPE_HEAD.Checked)
            ParameterList.Add("1"); //V_STORE_TYPE
        if (radSTORE_TYPE_STORE.Checked)
            ParameterList.Add("2"); //V_STORE_TYPE
        ParameterList.Add(GetValueSetParameter(this.txtRFNO.Text, "string", CheckBoxLikeSearch.Checked)); //V_RFNO
        ParameterList.Add(GetValueSetParameter(this.txtTITLE.Text, "string", CheckBoxLikeSearch.Checked)); //V_TITLE
        ParameterList.Add(GetValueSetParameter(this.txtINV_ADDR.Text, "string", CheckBoxLikeSearch.Checked)); //V_INV_ADDR
        ParameterList.Add(GetValueSetParameter(this.txtPERSON.Text, "string", CheckBoxLikeSearch.Checked)); //V_PERSON
        ParameterList.Add(GetValueSetParameter(this.SLP_PROFIT_NO.Text, "string", CheckBoxLikeSearch.Checked)); //V_PROFIT_NO
        ParameterList.Add(GetValueSetParameter(this.SLP_FEET.Text, "int", CheckBoxLikeSearch.Checked)); //N_FEET
        ParameterList.Add(GetValueSetParameter(this.txtPAY_ACCOUNT.Text, "string", CheckBoxLikeSearch.Checked)); //V_PAY_ACCOUNT
        if (this.radDEPOSIT_NO_ALL.Checked)
            ParameterList.Add(DBNull.Value);  //V_DEPOSIT_NO
        if (this.radDEPOSIT_NO_HEAD.Checked)
            ParameterList.Add("1");  //V_DEPOSIT_NO
        if (this.radDEPOSIT_NO_STORE.Checked)
            ParameterList.Add("2");  //V_DEPOSIT_NO
        ParameterList.Add(GetValueSetParameter(this.ddlDEPOSIT_TYPE.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //N_DEPOSIT
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT.Text, "int", CheckBoxLikeSearch.Checked)); //N_DEPOSIT
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_FROM.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_DEPOSIT_DATE_FROM_S
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_FROM.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_DEPOSIT_DATE_FROM_E
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_TO.StartDate, "string", CheckBoxLikeSearch.Checked)); //V_DEPOSIT_DATE_TO_S
        ParameterList.Add(GetValueSetParameter(this.SLP_DEPOSIT_DATE_TO.EndDate, "string", CheckBoxLikeSearch.Checked)); //V_DEPOSIT_DATE_TO_E
        ParameterList.Add(GetValueSetParameter(this.SLP_DUTY_UNIT.Text, "string", CheckBoxLikeSearch.Checked)); //V_DUTY_UNIT
        if (this.ddlPAYMENT_STORE.SelectedValue == "0")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlPAYMENT_STORE.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_PAYMENT_STORE
        ParameterList.Add(GetValueSetParameter(this.txtAC_NAME.Text, "string", CheckBoxLikeSearch.Checked)); //V_AC_NAME
        ParameterList.Add(GetValueSetParameter(this.txtINVOICE_MAILADD.Text, "string", CheckBoxLikeSearch.Checked)); //V_INVOICE_MAIL_ADD
        ParameterList.Add(GetValueSetParameter(this.SLP_INVOICE_SEND.Text, "string", CheckBoxLikeSearch.Checked)); //V_INVOICE_SEND
        ParameterList.Add(GetValueSetParameter(this.SLP_INVOICE_TYPE.Text, "string", CheckBoxLikeSearch.Checked)); //V_INVOICE_TYPE

        if (this.ddlPAY_TYPE.SelectedValue == "0") //modify by jsy 2011.02.21 修正欄位對應
            ParameterList.Add(DBNull.Value);
        else
            //modify by jsy 2011.02.21 修正欄位對應
            ParameterList.Add(GetValueSetParameter(this.ddlPAY_TYPE.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_PAY_TYPE
        ParameterList.Add(GetValueSetParameter(this.SLP_CLS_DATE.Text, "string", CheckBoxLikeSearch.Checked)); //V_CLS_DATE
        if (this.ddlARMK.SelectedValue == "2")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlARMK.SelectedValue, "int", CheckBoxLikeSearch.Checked)); //N_ARMK

        //設定屬性
        ParameterList.Add(GetValueSetParameter(this.SLP_ROOT_NO1.Text, "string", CheckBoxLikeSearch.Checked)); //V_ROOT_NO
        if (this.ddlHEAD_DOC.SelectedValue == "000")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlHEAD_DOC.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_HEAD_DOC
        if (this.ddlSINGLE_DOC.SelectedValue == "000")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlSINGLE_DOC.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_SINGLE_DOC
        if (this.ddlPAYMENT_TYPE.SelectedValue == "0")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.ddlPAYMENT_TYPE.SelectedValue, "string", CheckBoxLikeSearch.Checked)); //V_PAYMENT_TYPE

        //收款天數
        ParameterList.Add(GetValueSetParameter(this.SLP_ROOT_NO2.Text, "string", CheckBoxLikeSearch.Checked)); //V_CHARGE_ROOT_NO
        ParameterList.Add(GetValueSetParameter(this.SLP_PMA.Text, "string", CheckBoxLikeSearch.Checked)); //V_CHARGE_PMA
        if (this.SLP_COL_DAYS.Text == "")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(GetValueSetParameter(this.SLP_COL_DAYS.Text, "string", CheckBoxLikeSearch.Checked)); //V_CHARGE_COL_DAYS

        ParameterList.Add(GetValueSetParameter(this.SLP_GROUP_NO.Text, "string", CheckBoxLikeSearch.Checked)); //V_GROUP_NO
        ParameterList.Add(GetValueSetParameter(this.SLP_AC_UID.Text, "string", CheckBoxLikeSearch.Checked)); //V_AC_UID
        ParameterList.Add(GetValueSetParameter(this.SLP_SAL_ID.Text, "string", CheckBoxLikeSearch.Checked)); //V_SAL_ID
        ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text,"int",false));


        DataTable Dt = BCO.QuerySwitch(STMModel.MaintainStoreAccount.QueryType.QueryByLike, ParameterList);
        Session[SessionIDName] = Dt;
        GridView1.DataSource = Dt;

        //設定分頁大小
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();

        LabelQueryRecordCount.Text = string.Format(" {0} Rows ", Dt.Rows.Count.ToString());

        if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
        {
            ErrorMsgLabel.Text = "查無資料";
        }

        #region 將Key值存到Session中

        ArrayList arl_Key = new ArrayList();

        foreach (DataRow drRow in Dt.Rows)
        { arl_Key.Add("store=" + drRow["STORE"].ToString() + "&eff_date_from=" + drRow["EFF_DATE_FROM"].ToString()); }

        Session["STM252_SortKey" + this.PageTimeStamp.Value] = arl_Key;

        #endregion

        #endregion
    }//databind