示例#1
0
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        try
        {
            ErrorMsgLabel.Text = "";
            hidCHECK_FLG_ALL.Value = "N";
            txtAC_BALANCE_DATE_U.Text = "";
            #region 呼叫BCO查詢

            CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon();

            ParameterList.Clear();
            if (chkSTAKind1.Checked)
            {
                ParameterList.Add(bco1.GetValueSetParameter("1", "string", false));
            }
            else
            {
                ParameterList.Add(bco1.GetValueSetParameter("", "string", false));
            }

            if (chkSTAKind2.Checked)
            {
                ParameterList.Add(bco1.GetValueSetParameter("2", "string", false));
            }
            else
            {
                ParameterList.Add(bco1.GetValueSetParameter("", "string", false));
            }

            if (chkSTAKind3.Checked)
            {
                ParameterList.Add(bco1.GetValueSetParameter("3", "string", false));
            }
            else
            {
                ParameterList.Add(bco1.GetValueSetParameter("", "string", false));
            }

            if (chkSTAKind4.Checked)
            {
                ParameterList.Add(bco1.GetValueSetParameter("4", "string", false));
            }
            else
            {
                ParameterList.Add(bco1.GetValueSetParameter("", "string", false));
            }

            ParameterList.Add(bco1.GetValueSetParameter(slp_BALANCE_DATE_S.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_BALANCE_DATE.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(txtBUS_NO.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(txtCHAN_SOURCE_NO.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_COST_DIS_SUM.Text, "double", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_GROUP_NO_S.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_GROUP_NO_E.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_SIGN_DATE.StartDate, "date", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_SIGN_DATE.EndDate, "date", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_BUS_DATE.StartDate, "date", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_BUS_DATE.EndDate, "date", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_ROOT_NO.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(slp_TAX_TYPE.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(rdlIS_SCHEDULE.SelectedValue, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false));
            ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_S.Text, "string", false));
            ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_E.Text, "string", false));


            DataTable dt = new DataTable();

            CAMModel.PauseClosing bco = new CAMModel.PauseClosing(ConntionDB);

            dt = bco.QueryDocket(ParameterList);

            txtSUM_CD.Text = "0";
            foreach (DataRow dr in dt.Rows)
            {
                txtSUM_CD.Text = Convert.ToString(Convert.ToDecimal(txtSUM_CD.Text) + ((dr["STAKIND"].ToString().Substring(0, 1) == "2" ? -1 : 1) * Convert.ToDecimal(dr["SUM_CD"])));
            }

            #endregion

            #region 查詢完控制項重置
            //抓取本頁初次登記的時間
            string SessionIDName = "CAM111_GridView1" + PageTimeStamp.Value;

            Session["SessionID"] = SessionIDName;
            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();

            if (dt == null || (dt != null && dt.Rows.Count <= 0))
            {
                btnUpdate.Enabled = false;

                btnAC_BALANCE_DATE_Update.Enabled = false;
                
                btn_UPDATE_BATCH.Enabled = false;
                txtAC_BALANCE_DATE_U.ReadOnly = true;
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, "", btnUpdate, WUI_GMToolbarV.ClickAction.ButtonClick);

                ErrorMsgLabel.Text = "查無資料";
            }
            else
            {
                btnUpdate.Enabled = true;

                btnAC_BALANCE_DATE_Update.Enabled = true;
                
                btn_UPDATE_BATCH.Enabled = true;
                txtAC_BALANCE_DATE_U.ReadOnly = false;
                LockControl();
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, "", btnUpdate, WUI_GMToolbarV.ClickAction.ButtonClick);

            }
            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { Finally_Function(); }
    }
示例#2
0
    protected void btnAC_BALANCE_DATE_Update_Click(object sender, EventArgs e)
    {
        try
        {
            ErrorMsgLabel.Text = "";
            string strErrorBUS_NO1 = "";
            string strErrorBUS_NO2 = "";

            string SessionIDName = "CAM111_GridView1" + PageTimeStamp.Value;

            //同步GRIDVIEW至DT
            DoUPD_DT();

            #region UPDATE
            bool bResult;
            Decimal dSUM_CD = 0;

            this.btnQuery.Enabled = false;
            this.btnUpdate.Enabled = false;
            this.btnAC_BALANCE_DATE_Update.Enabled = false;

            DataTable dt = ((DataTable)Session[SessionIDName]);
            GridView1.DataSource = dt;
            GridView1.DataBind();

            DataTable dt_new = dt.GetChanges();
            if (dt_new != null)
            {
                DataRow[] row1 = (DataRow[])dt_new.Select("CHECK_FLG='Y' and AC_BALANCE_DATE<>AC_BALANCE_DATE_OLD and UPD_YN='Y'");
                if (row1.Length > 0)
                {
                    foreach (DataRow dr in row1)
                    {
                        if (dr["AC_BALANCE_DATE_S"].ToString().CompareTo(dr["AC_BALANCE_DATE_OLD"].ToString()) != 0)
                        {
                            strErrorBUS_NO1 += dr["BUS_NO"].ToString() + "、";
                        }
                        
                        if (dr["AC_BALANCE_DATE_S"].ToString().CompareTo(dr["AC_BALANCE_DATE"].ToString()) == 1)
                        {
                            strErrorBUS_NO2 += dr["BUS_NO"].ToString() + "、";
                        }
                    }

                    if (strErrorBUS_NO1 != "")
                    {
                        strErrorBUS_NO1 = strErrorBUS_NO1.Substring(0, strErrorBUS_NO1.Length - 1);
                        ErrorMsgLabel.Text += "原本的「原結帳年月」和原本的「結帳年月」不相等的話,就不能修改【單號:" + strErrorBUS_NO1 + "】" + "<br/>";
                    }

                    if (strErrorBUS_NO2 != "")
                    {
                        strErrorBUS_NO2 = strErrorBUS_NO2.Substring(0, strErrorBUS_NO2.Length - 1);
                        ErrorMsgLabel.Text += "異動結帳年月不得小於原結帳年月【單號:" + strErrorBUS_NO2 + "】";
                    }

                    if (ErrorMsgLabel.Text != "")
                    {
                        this.btnAC_BALANCE_DATE_Update.Enabled = true;
                    }
                    else
                    {
                        CAMModel.PauseClosing BCO = new CAMModel.PauseClosing(ConntionDB);
                        bResult = BCO.SavePause_S(Session["UID"].ToString(), dt_new, null);

                        if (bResult)
                        {
                            foreach (DataRow dr in row1)
                            {
                                dSUM_CD += Convert.ToDecimal(dr["SUM_CD"]);
                            }

                            slp_COST_DIS_SUM.Text = dSUM_CD.ToString();

                            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('資料更新完成');"), true);
                        }
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('沒有需更新的資料');"), true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('沒有需更新的資料');"), true);
            }
            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { Finally_Function(); }
    }
示例#3
0
    /// <summary>
    /// page載入
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel.Text = "";

            //結算Timeout設定
            Session.Timeout = 5; //分為單位
            ((ScriptManager)Page.Controls[0].Controls[3].FindControl("ScriptManager1")).AsyncPostBackTimeout = Session.Timeout * 60; //秒為單位


            if (!IsPostBack)
            {
                //寫入首次載入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();

                //註冊JS
                JS_Process();

                CAMModel.PauseClosing bco = new CAMModel.PauseClosing(ConntionDB);
                hidCLOSE_YM.Value = bco.GetCloseYM();

                #region 預設系統功能鍵及Focus欄位

                this.Form.Attributes["onkeypress"] += "return CAMCommon_WebForm_FireDefaultButton(event,'" + this.btnQuery.ClientID + "');";

                CAMModel.CAMCommon CAMComm = new CAMModel.CAMCommon();
                string s_ScriptManager_Script = CAMComm.ToMakeUp_SetFocus_Script(slp_BALANCE_DATE_S.TextBoxCode_Object.ClientID, false);
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAM111", s_ScriptManager_Script, true);

                #endregion

                string strClientS = ((TextBox)slpPROMOTE_ID_S.FindControl("TextBoxCode")).ClientID;
                string strClientE = ((TextBox)slpPROMOTE_ID_E.FindControl("TextBoxCode")).ClientID;
                string strScript = "document.getElementById('" + strClientE + "').value = document.getElementById('" + strClientS + "').value;";
                strScript += "document.getElementById('" + strClientE + "')['onkeyup']();";
                ((TextBox)slpPROMOTE_ID_S.FindControl("TextBoxCode")).Attributes.Add("onblur", strScript);
            }
            else
            {
                if (Request.Form["__EVENTTARGET"] == "Update")
                {
                    DoUpdate();
                }
            }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { Finally_Function(); }
        #endregion
    }