/// <summary> /// CAM35報表 /// </summary> /// <param name="ParameterList">變數清單</param> /// <returns>回傳查詢結果</returns> public DataTable CAM35_1(ArrayList ParameterList) { #region 宣告變數 BCO.CAMCommon CAMCommonBCO = new BCO.CAMCommon(); ArrayList arl_ReportService = new ArrayList(); DataTable dt_Return = new DataTable(); #endregion #region 傳入參數 arl_ReportService.Clear(); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[0].ToString(), "date", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[1].ToString(), "date", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[2].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[3].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[4].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[5].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[6].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[7].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[8].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[9].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[10].ToString(), "int", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[11].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[12].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[13].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[14].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[15].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[16].ToString(), "int", false)); #endregion #region 連結資料庫 BCO.CAM35_BCO bco = new BCO.CAM35_BCO(ConntionDB); dt_Return = bco.QueryStoreTransfer(arl_ReportService); #endregion #region 檢查回傳資料 if (dt_Return.Rows.Count == 0) { throw new Exception("查無資料"); } else { return dt_Return; } #endregion }
/// <summary> /// VAM25彙總報表 /// </summary> /// <param name="ParameterList">變數清單</param> /// <returns>回傳查詢結果</returns> public DataTable VAM25_1(ArrayList ParameterList) { #region 宣告變數 BCO.CAMCommon CAMCommonBCO = new BCO.CAMCommon(); ArrayList arl_ReportService = new ArrayList(); DataTable dt_Return = new DataTable(); #endregion #region 傳入參數 arl_ReportService.Clear(); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[0].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[1].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[2].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[3].ToString(), "string", false)); arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[4].ToString(), "string", false)); #endregion #region 連結資料庫 VAM25_BCO bco = new VAM25_BCO(ConntionDB); dt_Return = bco.QueryTRANSHIP_PAY_R1(arl_ReportService); #endregion #region 檢查回傳資料 if (dt_Return.Rows.Count == 0) { throw new Exception("查無資料"); } else { return dt_Return; } #endregion }
/// <summary> /// page載入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { #region try { ErrorMsgLabel.Text = ""; 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(); #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_ACCT_MONTH.TextBoxCode_Object.ClientID, false); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAM221", s_ScriptManager_Script, true); #endregion } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } #endregion }
protected void btnUpdate_Click(object sender, EventArgs e) { string[] bResult = null; string dtSIGN_DATE = txtSIGN_DATE.Text == "" ? "0001/01/01" : txtSIGN_DATE.Text; string dtSIGN_DATE_OLD = hidSIGN_DATE_OLD.Value == "" ? "0001/01/01" : hidSIGN_DATE_OLD.Value; try { #region 檢核作業 if (Convert.ToDateTime(dtSIGN_DATE).CompareTo(Convert.ToDateTime(dtSIGN_DATE_OLD)) == 0 && txtCHAN_SOURCE_NO.Text == hidCHAN_SOURCE_NO_OLD.Value) { ScriptManager.RegisterStartupScript(UpdatePanel4, this.GetType(), "ClientScript", string.Format("alert('資料無更改');"), true); return; } #endregion #region 呼叫BCO CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(txtSB_NO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtSTORE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(hidSIGN_DATE_OLD.Value, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(hidCHAN_SOURCE_NO_OLD.Value, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtSIGN_DATE.Text, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(txtCHAN_SOURCE_NO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtBUS_DATE.Text, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(Session["UID"].ToString(), "string", false)); CAMModel.MaintainStoreAcceptAndBackwardTick bco = new CAMModel.MaintainStoreAcceptAndBackwardTick(ConntionDB); if (txtSTAKind.Text == "進貨單") { bResult = bco.UpdateStAccept(ParameterList); } else if (txtSTAKind.Text == "退貨單") { bResult = bco.UpdateBackward(ParameterList); } else if (txtSTAKind.Text == "補帳單") { bResult = bco.UpdateCamPatch(ParameterList); } else if (txtSTAKind.Text == "調撥單") { bResult = bco.UpdateCamTran(ParameterList); } if (bResult[0] == "0")//成功 { databind(hidSTAKind.Value, hidSB_NO.Value); ScriptManager.RegisterStartupScript(UpdatePanel4, this.GetType(), "ClientScript", string.Format("alert('更新成功');"), true); } else//失敗 { string strErrMsg = bResult[1]; if (bResult[1].IndexOf("此入帳日年月己月結,請確認入帳日期是否正確?") > 0) { strErrMsg = "此入帳日年月己月結,請確認入帳日期是否正確?"; } ScriptManager.RegisterStartupScript(UpdatePanel4, this.GetType(), "ClientScript", string.Format("alert('更新失敗:" + strErrMsg + "');"), true); } #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }
/// <summary> /// 繫結資料到控制項 /// </summary> /// <param name="vdb"></param> private void databind(string strSTAKind, string strOUT_NO) { #region 呼叫BCO查詢1 string strAC_STATUS = ""; CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(strSTAKind, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(strOUT_NO, "string", false)); DataTable dt1 = new DataTable(); CAMModel.MaintainStoreAcceptAndBackwardTick bco = new CAMModel.MaintainStoreAcceptAndBackwardTick(ConntionDB); dt1 = bco.QueryTick_D1(ParameterList); if (dt1.Rows.Count > 0) { //txtSTAKind.Text = strSTAKind == "1" ? "進貨單" : "退貨單"; if (strSTAKind == "1") { txtSTAKind.Text = "進貨單"; } else if (strSTAKind == "2") { txtSTAKind.Text = "退貨單"; } else if (strSTAKind == "3") { txtSTAKind.Text = "補帳單"; } else if (strSTAKind == "4") { txtSTAKind.Text = "調撥單"; } txtGROUP_NO.Text = dt1.Rows[0]["GROUP_NO"].ToString(); txtGROUP_NAME.Text = dt1.Rows[0]["GROUP_NAME"].ToString(); txtSTORE.Text = dt1.Rows[0]["STORE"].ToString(); txtSTORE_NAME.Text = dt1.Rows[0]["STORE_NAME"].ToString(); txtPROFIT_NO.Text = dt1.Rows[0]["PROFIT_NO"].ToString(); txtPROFIT_NAME.Text = dt1.Rows[0]["PROFIT_NAME"].ToString(); txtROUTE.Text = dt1.Rows[0]["ROUTE"].ToString(); txtROUTE_NAME.Text = dt1.Rows[0]["ROUTE_NAME"].ToString(); txtSTEP.Text = dt1.Rows[0]["STEP"].ToString(); txtTAX_TYPE.Text = dt1.Rows[0]["TAX_TYPE"].ToString(); txtTYPE_NO.Text = dt1.Rows[0]["TYPE_NO"].ToString(); txtBUS_DATE.Text = dt1.Rows[0]["BUS_DATE"].ToString(); txtSIGN_DATE.Text = dt1.Rows[0]["SIGN_DATE"].ToString(); hidSIGN_DATE_OLD.Value = dt1.Rows[0]["SIGN_DATE"].ToString(); txtT_DATE.Text = dt1.Rows[0]["T_DATE"].ToString(); txtSB_NO.Text = dt1.Rows[0]["SB_NO"].ToString(); txtCHAN_SOURCE_NO.Text = dt1.Rows[0]["CHAN_SOURCE_NO"].ToString(); hidCHAN_SOURCE_NO_OLD.Value = dt1.Rows[0]["CHAN_SOURCE_NO"].ToString(); txtINOUT_NO.Text = dt1.Rows[0]["INOUT_NO"].ToString(); txtROOT_NO.Text = dt1.Rows[0]["ROOT_NO"].ToString(); txtIS_SCHEDULE.Text = dt1.Rows[0]["IS_SCHEDULE"].ToString(); txtAC_STATUS.Text = dt1.Rows[0]["AC_STATUS_NAME"].ToString(); strAC_STATUS = dt1.Rows[0]["AC_STATUS"].ToString(); txtBALANCE_DATE_S.Text = dt1.Rows[0]["AC_BALANCE_DATE_S"].ToString(); txtBALANCE_DATE.Text = dt1.Rows[0]["AC_BALANCE_DATE"].ToString(); slpPROMOTE_ID.Text = dt1.Rows[0]["PROMOTE_ID"].ToString(); } else { txtSTAKind.Text = ""; txtGROUP_NO.Text = ""; txtGROUP_NAME.Text = ""; txtSTORE.Text = ""; txtSTORE_NAME.Text = ""; txtPROFIT_NO.Text = ""; txtPROFIT_NAME.Text = ""; txtROUTE.Text = ""; txtROUTE_NAME.Text = ""; txtSTEP.Text = ""; txtTAX_TYPE.Text = ""; txtTYPE_NO.Text = ""; txtBUS_DATE.Text = ""; txtSIGN_DATE.Text = ""; hidSIGN_DATE_OLD.Value = ""; txtT_DATE.Text = ""; txtSB_NO.Text = ""; txtCHAN_SOURCE_NO.Text = ""; hidCHAN_SOURCE_NO_OLD.Value = ""; txtINOUT_NO.Text = ""; txtROOT_NO.Text = ""; txtIS_SCHEDULE.Text = ""; txtAC_STATUS.Text = ""; strAC_STATUS = ""; txtBALANCE_DATE_S.Text = ""; txtBALANCE_DATE.Text = ""; slpPROMOTE_ID.Text = ""; ErrorMsgLabel.Text = "查無資料"; } #endregion #region 呼叫BCO查詢2 ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(strSTAKind, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(strOUT_NO, "string", false)); DataTable dt = new DataTable(); bco = new CAMModel.MaintainStoreAcceptAndBackwardTick(ConntionDB); dt = bco.QueryTick_D2(ParameterList); #endregion #region 查詢完控制項重置 //抓取本頁初次登記的時間 string SessionIDName = "CAM232_GridView1" + PageTimeStamp.Value; Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt; GridView1.DataSource = dt; //設定分頁大小 GridView1.PageSize = 20; GridView1.PageIndex = 0; GridView1.DataBind(); //簽收日結帳後不可改 if (strAC_STATUS != "1") { txtSIGN_DATE.ReadOnly = true; } else { txtSIGN_DATE.ReadOnly = false; } btnUpdate.Enabled = true; txtCHAN_SOURCE_NO.ReadOnly = false; txtCHAN_SOURCE_NO.CssClass = ""; #endregion }
/// <summary> /// 查詢 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnQuery_Click(object sender, EventArgs e) { try { #region JS註冊 // 限制只能 key 入負號+數字 string strJS = "function OnlyNegNumber(obj,len)"; strJS += " {"; strJS += " var tmpCount = 0; "; strJS += " if(obj.value.substr(0,1) == '-')"; strJS += " {"; strJS += " len++; "; strJS += " }"; strJS += " if(obj.value.length>len)"; strJS += " {"; strJS += " obj.value = obj.value.substr(0, obj.value.length-1);"; strJS += " }"; strJS += " for (var tmpI = 0; tmpI < obj.value.length; tmpI++) "; strJS += " {"; strJS += " tmpCount = obj.value.charCodeAt(tmpI);"; strJS += " if (tmpI == 0)"; strJS += " {"; strJS += " if(obj.value.substr(tmpI,1) != '-')"; strJS += " {"; strJS += " if((tmpCount < 48) || (tmpCount > 57))"; strJS += " {"; strJS += " obj.value = obj.value.substr(0, tmpI);"; strJS += " }"; strJS += " }"; strJS += " }"; strJS += " else"; strJS += " {"; strJS += " if((tmpCount < 48) || (tmpCount > 57))"; strJS += " {"; strJS += " obj.value = obj.value.substr(0, tmpI);"; strJS += " }"; strJS += " }"; strJS += " }"; strJS += " }"; // 限制只能 key 入數字 string strJS1 = "function OnlyNegNumber(obj,len)"; strJS1 += " {"; strJS1 += " var tmpCount = 0;"; strJS1 += " if(obj.value.length>len)"; strJS1 += " {"; strJS1 += " obj.value = obj.value.substr(0, obj.value.length-1);"; strJS1 += " }"; strJS1 += " for (var tmpI = 0; tmpI < obj.value.length; tmpI++) "; strJS1 += " {"; strJS1 += " tmpCount = obj.value.charCodeAt(tmpI);"; strJS1 += " if((tmpCount < 48) || (tmpCount > 57))"; strJS1 += " {"; strJS1 += " obj.value = obj.value.substr(0, tmpI);"; strJS1 += " }"; strJS1 += " }"; strJS1 += " }"; //限制只能 key 入數字+小數點 string strJS2 = "function OnlyNegNumber(obj,len)"; strJS2 += " {"; strJS2 += " var tmpCount = 0;"; strJS2 += " var v_cnt=0; "; strJS2 += " var v_cnt1=0; "; strJS2 += " for (var tmpI = 0; tmpI < obj.value.length; tmpI++) "; strJS2 += " {"; strJS2 += " tmpCount = obj.value.charCodeAt(tmpI);"; strJS2 += " if(tmpCount == 46)"; strJS2 += " {"; strJS2 += " if(tmpI>len)"; strJS2 += " {"; strJS2 += " obj.value = obj.value.substr(0, tmpI);"; strJS2 += " }"; strJS2 += " break;"; strJS2 += " }"; strJS2 += " else if(tmpI == obj.value.length-1)"; strJS2 += " {"; strJS2 += " if(tmpI>len-1)"; strJS2 += " {"; strJS2 += " obj.value = obj.value.substr(0, tmpI);"; strJS2 += " }"; strJS2 += " break;"; strJS2 += " }"; strJS2 += " }"; strJS2 += " for (var tmpI = 0; tmpI < obj.value.length; tmpI++) "; strJS2 += " {"; strJS2 += " tmpCount = obj.value.charCodeAt(tmpI);"; strJS2 += " if (tmpI == 0)"; strJS2 += " {"; strJS2 += " if((tmpCount < 48) || (tmpCount > 57))"; strJS2 += " {"; strJS2 += " obj.value = obj.value.substr(0, tmpI);"; strJS2 += " }"; strJS2 += " }"; strJS2 += " else"; strJS2 += " {"; strJS2 += " if(((tmpCount < 48) || (tmpCount > 57)) && tmpCount != 46)"; strJS2 += " {"; strJS2 += " obj.value = obj.value.substr(0, tmpI);"; strJS2 += " }"; strJS2 += " }"; strJS2 += " if (tmpCount == 46)"; strJS2 += " {"; strJS2 += " v_cnt++;"; strJS2 += " v_cnt1++;"; strJS2 += " }"; strJS2 += " else"; strJS2 += " {"; strJS2 += " if (v_cnt1 > 0)"; strJS2 += " {"; strJS2 += " v_cnt1++;"; strJS2 += " }"; strJS2 += " }"; strJS2 += " if (v_cnt > 1)"; strJS2 += " {"; strJS2 += " obj.value = obj.value.substr(0, tmpI);"; strJS2 += " }"; strJS2 += " if (v_cnt1 > 3)"; strJS2 += " {"; strJS2 += " obj.value = obj.value.substr(0, tmpI);"; strJS2 += " }"; strJS2 += " }"; strJS2 += " }"; if (ddlSTAKind.SelectedValue == "3" || ddlSTAKind.SelectedValue == "4" || ddlSTAKind.SelectedValue == "0") { txtOUT_QTY_G.Attributes.Add("onkeyup", strJS + " OnlyNegNumber(this,6)"); } else { txtOUT_QTY_G.Attributes.Add("onkeyup", strJS1 + " OnlyNegNumber(this,6)"); } txtCOST_G.Attributes.Add("onkeyup", strJS2 + " OnlyNegNumber(this,6)"); txtOUT_COST_DIS_G.Attributes.Add("onkeyup", strJS2 + " OnlyNegNumber(this,6)"); txtOUT_PRICE_G.Attributes.Add("onkeyup", strJS1 + " OnlyNegNumber(this,5)"); #endregion #region 呼叫BCO查詢 DataTable dt = GetData(); CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); CAMModel.AdjustDocketByStoreGroup bco = new CAMModel.AdjustDocketByStoreGroup(ConntionDB); string strBUS_YM = ""; string s_RESULT = string.Empty; string s_ERR_MSG = string.Empty; DataView dv = dt.DefaultView; dv.Sort = "BUS_YM"; DataTable dt1 = dv.ToTable(); foreach (DataRow dr in dt1.Rows) { if (dr["BUS_YM"].ToString() != strBUS_YM) { ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(dr["BUS_YM"].ToString(), "string", false));//[結帳年月] s_RESULT = string.Empty; s_ERR_MSG = string.Empty; PIC.VDS2G.ACM.PSS.MaintainCheckPSSCloseYN pss_bco = new PIC.VDS2G.ACM.PSS.MaintainCheckPSSCloseYN(ConntionDB); pss_bco.CheckPSSCloseYN(ParameterList, out s_RESULT, out s_ERR_MSG); //s_RESULT=0,該月份已月結 //s_RESULT=1,該月份尚未月結 if (s_RESULT == "0")//該月份已月結 { DataRow[] dr1 = (DataRow[])dt.Select("BUS_YM='" + dr["BUS_YM"].ToString() + "'"); foreach (DataRow dr2 in dr1) { dr2.Delete(); } } } strBUS_YM = dr["BUS_YM"].ToString(); } dt.AcceptChanges(); #endregion #region 查詢完控制項重置 //抓取本頁初次登記的時間 string SessionIDName = "CAM01_GridView1" + PageTimeStamp.Value; double dblOUT_QTY_OLD = 0; double dblCOST_OLD = 0; double dblOUT_COST_DIS_OLD = 0; double dblOUT_PRICE_OLD = 0; Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt; GridView1.DataSource = dt; GridView1.PageIndex = 0; GridView1.DataBind(); txtOUT_QTY_G.Text = ""; txtCOST_G.Text = ""; txtOUT_COST_DIS_G.Text = ""; txtOUT_PRICE_G.Text = ""; hidFlag.Value = ""; if (dt.Rows.Count == 0) { panUPDATE_SUMMARY.Visible = false; ErrorMsgLabel.Text = "查無資料"; panSTORE_GROUP.Visible = false; btnUpdate.Enabled = false; } else { panUPDATE_SUMMARY.Visible = true; panSTORE_GROUP.Visible = true; if (RdlKIND1.Checked) { btnUpdate.Enabled = CanUpdate; } else { btnUpdate.Enabled = AuthUpdate; } LockControl(true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "$get('ctl00_CPH_PanelQuery').style.display='none';", true); if (RdlKIND1.Checked) { txtOUT_QTY_G.ReadOnly = false; txtOUT_QTY_G.CssClass = ""; txtCOST_G.ReadOnly = false; txtCOST_G.CssClass = ""; txtOUT_COST_DIS_G.ReadOnly = false; txtOUT_COST_DIS_G.CssClass = ""; txtOUT_PRICE_G.ReadOnly = false; txtOUT_PRICE_G.CssClass = ""; for (int k = 0; k <= GridView1.Rows.Count - 1; k++) { ((TextBox)GridView1.Rows[k].FindControl("txtOUT_QTY")).ReadOnly = true; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_QTY")).CssClass = "readtxtbox"; ((TextBox)GridView1.Rows[k].FindControl("txtCOST")).ReadOnly = true; ((TextBox)GridView1.Rows[k].FindControl("txtCOST")).CssClass = "readtxtbox"; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_COST_DIS")).ReadOnly = true; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_COST_DIS")).CssClass = "readtxtbox"; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_PRICE")).ReadOnly = true; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_PRICE")).CssClass = "readtxtbox"; } } else { txtOUT_QTY_G.ReadOnly = true; txtOUT_QTY_G.CssClass = "readtxtbox"; txtCOST_G.ReadOnly = true; txtCOST_G.CssClass = "readtxtbox"; txtOUT_COST_DIS_G.ReadOnly = true; txtOUT_COST_DIS_G.CssClass = "readtxtbox"; txtOUT_PRICE_G.ReadOnly = true; txtOUT_PRICE_G.CssClass = "readtxtbox"; txtOUT_QTY_G.Text = ""; txtCOST_G.Text = ""; txtOUT_COST_DIS_G.Text = ""; txtOUT_PRICE_G.Text = ""; for (int k = 0; k <= GridView1.Rows.Count - 1; k++) { ((TextBox)GridView1.Rows[k].FindControl("txtOUT_QTY")).ReadOnly = false; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_QTY")).CssClass = ""; ((TextBox)GridView1.Rows[k].FindControl("txtCOST")).ReadOnly = false; ((TextBox)GridView1.Rows[k].FindControl("txtCOST")).CssClass = ""; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_COST_DIS")).ReadOnly = false; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_COST_DIS")).CssClass = ""; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_PRICE")).ReadOnly = false; ((TextBox)GridView1.Rows[k].FindControl("txtOUT_PRICE")).CssClass = ""; } } #region 原價格合計 for (int k = 0; k <= dt.Rows.Count - 1; k++) { dblOUT_QTY_OLD += double.Parse(dt.Rows[k]["OUT_QTY"].ToString() == "" ? "0" : dt.Rows[k]["OUT_QTY"].ToString()); dblCOST_OLD += double.Parse(dt.Rows[k]["COST"].ToString() == "" ? "0" : dt.Rows[k]["COST"].ToString()); dblOUT_COST_DIS_OLD += double.Parse(dt.Rows[k]["OUT_COST_DIS"].ToString() == "" ? "0" : dt.Rows[k]["OUT_COST_DIS"].ToString()); dblOUT_PRICE_OLD += double.Parse(dt.Rows[k]["OUT_PRICE"].ToString() == "" ? "0" : dt.Rows[k]["OUT_PRICE"].ToString()); } txtOUT_QTY_B.Text = dblOUT_QTY_OLD.ToString(); txtCOST_B.Text = dblCOST_OLD.ToString(); txtOUT_COST_DIS_B.Text = dblOUT_COST_DIS_OLD.ToString(); txtOUT_PRICE_B.Text = dblOUT_PRICE_OLD.ToString(); txtOUT_QTY_A.Text = ""; txtCOST_A.Text = ""; txtOUT_COST_DIS_A.Text = ""; txtOUT_PRICE_A.Text = ""; #endregion } #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }
/// <summary> /// page載入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { try { ErrorMsgLabel.Text = ""; //結算Timeout設定 Session.Timeout = 30; //分為單位 ((ScriptManager)Page.Controls[0].Controls[3].FindControl("ScriptManager1")).AsyncPostBackTimeout = Session.Timeout * 60; //秒為單位 #region CAM02功能權限設定 SetAuthority(); #endregion 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') ); //設定控制項預設的狀態 Initialization_Component(); //設定ToolBar預設狀態 ToolBarInit(); //註冊JS JS_Process(); #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(this.RdlKIND1.Enabled ? this.RdlKIND1.ClientID : this.RdlKIND2.ClientID, false); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAM011", s_ScriptManager_Script, true); #endregion RdlKIND2_CheckedChanged(null, null); } 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(); } }
protected void btnOVER_Click(object sender, EventArgs e) { try { string strCHECK = Check_PageCondition(false); if (strCHECK != "") { ErrorMsgLabel.Text = strCHECK; return; } else { #region 呼叫BCO CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); 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(txtPAY_RFNO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtRFNO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_RootNo.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtBUS_NO.Text, "string", false)); DataTable dt = new DataTable(); CAMModel.ProcessStoresMonthCounting bco = new CAMModel.ProcessStoresMonthCounting(ConntionDB); dt = bco.GetCAM14R01Data(ParameterList); if (dt.Rows.Count == 0) { this.ErrorMsgLabel.Text = "查無資料"; return; } else { ShowReport(dt, ((Button)sender).CommandName); } #endregion } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }
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(); } }
protected void Page_Load(object sender, EventArgs e) { try { this.ErrorMsgLabel.Text = string.Empty; this.RightMsgLabel.Text = string.Empty; 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') ); UserID.Value = Session["UID"].ToString(); DataTable dt1 = new DataTable(); dt1 = (DataTable)Session["UserInfo"]; UserName.Value = dt1.Rows[0]["Name"].ToString(); //設定ToolBar預設狀態 ToolBarInit(); //註冊JS JS_Process(); #region 預設系統功能鍵及Focus欄位 this.Form.Attributes["onkeypress"] += "return CAMCommon_WebForm_FireDefaultButton(event,'" + this.but_Print1.ClientID + "');"; BCO.CAMCommon CAMComm = new BCO.CAMCommon(); string s_ScriptManager_Script = CAMComm.ToMakeUp_SetFocus_Script(((TextBox)((ASP.wui_slp_slp_slpdate_ascx)this.slp_BUS_DATE.FindControl("SLP_SLPDate1")).FindControl("TextBoxCode")).ClientID, false); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAM081", s_ScriptManager_Script, true); #endregion } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }
protected void Page_Load(object sender, EventArgs e) { try { #region 清空Message this.ErrorMsgLabel.Text = string.Empty; #endregion if (!IsPostBack) { #region 寫入首次載入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') ); #endregion #region 設定ToolBar預設狀態 ToolBarInit(); #endregion //註冊JS JS_Process(); #region 預設系統功能鍵 this.Form.DefaultButton = this.btnExport.UniqueID; #endregion } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { #region Focus欄位 if (!IsPostBack) { BCO.CAMCommon CAMCommon = new BCO.CAMCommon(); string s_ScriptManager_Script = CAMCommon.ToMakeUp_SetFocus_Script(this.btnExport.ClientID, false); ScriptManager.RegisterStartupScript(this.up_ErrorMsg, typeof(UpdatePanel), "CAM361", s_ScriptManager_Script, true); } #endregion } }
protected void btnExport_Click(object sender, EventArgs e) { try { ErrorMsgLabel.Text = ""; #region 傳入參數 BCO.CAMCommon bco1 = new BCO.CAMCommon(); ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(slp_CHECK_MONTH_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_CHECK_MONTH_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_ACCT_MONTH_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_ACCT_MONTH_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtPROMOTE_ID_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtPROMOTE_ID_E.Text, "string", 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_Z_O_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_Z_O_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_AC_UID.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_SAL_ID.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(rdoDISCOUNT_TYPE.SelectedValue, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(rdb_Diff.SelectedValue, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(rdoREPORT_KIND.SelectedValue, "string", false)); ParameterList.Add(HttpContext.Current.Session["UID"].ToString()); #endregion #region 連結資料庫 DataTable dt = new DataTable(); BCO.CAM36_BCO BCO = new BCO.CAM36_BCO(ConntionDB); dt = BCO.QueryData(ParameterList); #endregion #region 檢查回傳資料 if (dt.Rows.Count == 0) { this.ErrorMsgLabel.Text = "查無資料"; } #endregion else { Export_Excel(dt, rdoREPORT_KIND.SelectedValue); } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } }
/// <summary> /// 繫結資料到控制項 /// </summary> /// <param name="vdb"></param> private void databind() { #region 呼叫BCO查詢 CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); //ParameterList.Add(bco1.GetValueSetParameter(chkSTAKind1.Checked && chkSTAKind2.Checked ? "0" : (chkSTAKind1.Checked ? "1" : "2"), "string", false)); string strSTAKind = ""; if (chkSTAKind1.Checked) { strSTAKind += "1,"; } if (chkSTAKind2.Checked) { strSTAKind += "2,"; } if (chkSTAKind3.Checked) { strSTAKind += "3,"; } if (chkSTAKind4.Checked) { strSTAKind += "4,"; } if (strSTAKind=="") { strSTAKind = "1,2,3,4"; } else { strSTAKind = strSTAKind.Substring(0, strSTAKind.Length - 1); } ParameterList.Add(bco1.GetValueSetParameter(strSTAKind, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_GROUP_NO.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(bco1.GetValueSetParameter(slp_PROFIT_NO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_ROUTE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtSTEP.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_TAX_TYPE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_TYPE_NO.Text, "string", 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_SIGN_DATE.StartDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_SIGN_DATE.EndDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_T_DATE.StartDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_T_DATE.EndDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(txtSB_NO.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(bco1.GetValueSetParameter(txtCHAN_SOURCE_NO.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(bco1.GetValueSetParameter(txtINOUT_NO.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(bco1.GetValueSetParameter(slp_ROOT_NO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(rdlIS_SCHEDULE.SelectedValue, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_AC_STATUS.Text, "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(slp_BALANCE_DATE_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(TextBoxRowCountLimit.Text, "string", 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.MaintainStoreAcceptAndBackwardTick bco = new CAMModel.MaintainStoreAcceptAndBackwardTick(ConntionDB); dt = bco.QueryTick_M(ParameterList); #endregion #region 查詢完控制項重置 //抓取本頁初次登記的時間 string SessionIDName = "CAM231_GridView1" + PageTimeStamp.Value; ArrayList NOList = new ArrayList(); 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(); for (int i = 0; i < dt.Rows.Count; i++) { string[] strNO = new string[2]; strNO[0] = dt.Rows[i]["STAKind"].ToString(); strNO[1] = dt.Rows[i]["OUT_NO"].ToString(); NOList.Add(strNO); } Session["CAM23Query"] = NOList; LabelQueryRecordCount.Text = string.Format(" {0} Rows ", dt.Rows.Count.ToString()); if (dt == null || (dt != null && dt.Rows.Count <= 0)) { ErrorMsgLabel.Text = "查無資料"; } #endregion }
/// <summary> /// page載入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { #region try { ErrorMsgLabel.Text = ""; //按鈕權限控制 AuthorityControls(this); 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') ); //設定預設的狀態 Initialization_Component(); //設定ToolBar預設狀態 ToolBarInit(); if (Request.QueryString["Store"] != null) { slp_STORE.Text = Request.QueryString["Store"].ToString(); } #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_GROUP_NO.TextBox_Code.ClientID, false); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "CAM231", 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); } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } #endregion }
protected void btnSETTLE_CANCLE_Click(object sender, EventArgs e) { try { string[] bResult; string strCHECK = Check_PageCondition(true); if (strCHECK != "") { ErrorMsgLabel.Text = strCHECK; return; } else { #region 呼叫BCO CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_YM.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_DATE.StartDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_DATE.EndDate, "date", 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(txtPAY_RFNO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtRFNO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_RootNo.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(rdoPAY_TYPE1.Checked ? "1" : (rdoPAY_TYPE2.Checked ? "2" : "3"), "string", false)); ParameterList.Add(bco1.GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtBUS_NO.Text, "string", false)); CAMModel.ProcessStoresMonthCounting bco = new CAMModel.ProcessStoresMonthCounting(ConntionDB); bResult = bco.CancelStoreCloseCounting(ParameterList); //20121121 曾怡婷確認取消帳差計算 //ParameterList.Clear(); //ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_YM.Text, "string", false)); //ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_DATE.StartDate, "date", false)); //ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_DATE.EndDate, "date", false)); //ParameterList.Add(bco1.GetValueSetParameter(Session["UID"].ToString(), "string", false)); //bco.ProcessAcctDiff(ParameterList); if (bResult[2] == "0")//成功 { ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", string.Format("alert('解除結算成功:成功復原筆數" + bResult[0] + "筆,無法復原筆數" + bResult[1] + "筆 [執行時間:" + System.DateTime.Now.ToString("yyyy/MM/dd hh:mm") + "]');"), true); } else//失敗 { ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", string.Format("alert('解除結算失敗:" + bResult[3] + " [執行時間:" + System.DateTime.Now.ToString("yyyy/MM/dd hh:mm") + "]');"), true); } #endregion } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }
protected void btnQuery_Click(object sender, EventArgs e) { try { ErrorMsgLabel.Text = ""; #region 呼叫BCO查詢 CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(slp_ACCT_MONTH.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtBUS_NO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(ddlGROUP_NO.SelectedValue, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", 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_SIGN_DATE.StartDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_SIGN_DATE.EndDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(chkSTA1.Checked?"1":"0", "int", false)); ParameterList.Add(bco1.GetValueSetParameter(chkSTA2.Checked?"2":"0", "int", false)); ParameterList.Add(bco1.GetValueSetParameter(chkDiff1.Checked?"1":"0", "int", false)); ParameterList.Add(bco1.GetValueSetParameter(chkDiff2.Checked?"1":"0", "int", false)); ParameterList.Add(bco1.GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false)); DataTable dt = new DataTable(); CAMModel.MaintainPAYCompareResure bco = new CAMModel.MaintainPAYCompareResure(ConntionDB); dt = bco.QueryPAYCompareResure(ParameterList); #endregion #region 查詢完控制項重置 //抓取本頁初次登記的時間 string SessionIDName = "CAM221_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; GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, "", btnUpdate, WUI_GMToolbarV.ClickAction.ButtonClick); ErrorMsgLabel.Text = "查無資料"; } else { btnUpdate.Enabled = true; LockControl(); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, "", btnUpdate, WUI_GMToolbarV.ClickAction.ButtonClick); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "$get('ctl00_CPH_PanelQuery').style.display='none';", true); } #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }
/// <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 }
///按鈕事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Print_Click(object sender, EventArgs e) { try { #region 呼叫BCO CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(txtPROMOTE_ID_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtPROMOTE_ID_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_AC_BALANCE_DATE_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_AC_BALANCE_DATE_E.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_MANUFACTURE.Text, "string", 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_AC_UID.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(rdoDISCOUNT_TYPE.SelectedValue, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_Z_O_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_Z_O_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_SAL_ID.Text, "string", false)); DataTable dt = new DataTable(); if (rdoVer.SelectedValue == "1")//舊版 { CAMModel.ReportPromotionItemSaleSummay bco = new CAMModel.ReportPromotionItemSaleSummay(ConntionDB); if (rdoREPORT_KIND1.SelectedIndex == 0)//供應商 { if (rdoREPORT_KIND2.SelectedIndex == 0)//彙總 { dt = bco.GetCAM29R01Data(ParameterList); } else//明細 { dt = bco.GetCAM29R03Data(ParameterList); } } else if (rdoREPORT_KIND1.SelectedIndex == 1)//門市 { dt = bco.GetCAM29R02Data(ParameterList); } else if (rdoREPORT_KIND1.SelectedIndex == 2)//成本 { dt = bco.GetCAM29R04Data(ParameterList); } } else if (rdoVer.SelectedValue == "0")//新版 { CAMModel.ReportPromotionItemSaleSummayNew bco = new CAMModel.ReportPromotionItemSaleSummayNew(ConntionDB); if (rdoREPORT_KIND1.SelectedIndex == 0)//供應商 { if (rdoREPORT_KIND2.SelectedIndex == 0)//彙總 { dt = bco.GetCAM29R01Data(ParameterList); } else//明細 { dt = bco.GetCAM29R03Data(ParameterList); } } else if (rdoREPORT_KIND1.SelectedIndex == 1)//門市 { dt = bco.GetCAM29R02Data(ParameterList); } else if (rdoREPORT_KIND1.SelectedIndex == 2)//成本 { dt = bco.GetCAM29R04Data(ParameterList); } else if (rdoREPORT_KIND1.SelectedIndex == 3)//特殊書展 { dt = bco.GetCAM29R05Data(ParameterList); } } if (dt.Rows.Count == 0) { this.ErrorMsgLabel.Text = "查無資料"; return; } else { ShowReport(dt, ((Button)sender).CommandName); } #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }
private DataTable GetData() { CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); CAMModel.AdjustDocketByStoreGroup bco = new CAMModel.AdjustDocketByStoreGroup(ConntionDB); DataTable dtResult = new DataTable(); if (ddlSTAKind.SelectedIndex == 0) { for (int i = 1; i <= 4; i++) { ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(SLP_BUS_DATE.StartDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_BUS_DATE.EndDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(i.ToString(), "string", 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_ROUTE_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_ROUTE_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtOUT_NO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_ITEM.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtPERIOD.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(Session["UID"].ToString(), "string", false)); DataTable dt = bco.QueryByStoreGroup(ParameterList); if (i == 1) dtResult = dt; else dtResult.Merge(dt); } } else { ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(SLP_BUS_DATE.StartDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_BUS_DATE.EndDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(ddlSTAKind.SelectedValue, "string", 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_ROUTE_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_ROUTE_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtOUT_NO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_ITEM.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtPERIOD.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(Session["UID"].ToString(), "string", false)); dtResult = bco.QueryByStoreGroup(ParameterList); } dtResult.DefaultView.Sort = "STORE ASC,STAKIND ASC,OUT_NO ASC,ITEM ASC,PERIOD ASC"; dtResult = dtResult.DefaultView.ToTable(); return dtResult; }
protected void btnTRAN_CNT_Click(object sender, EventArgs e) { try { double dblSETTLED = 0; double dblUNSETTLE = 0; double dblTOTALSETTLE = 0; string strCHECK = Check_PageCondition(true); if (strCHECK != "") { ErrorMsgLabel.Text = strCHECK; return; } else { #region 呼叫BCO CAMModel.CAMCommon bco1 = new CAMModel.CAMCommon(); ParameterList.Clear(); ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_YM.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_DATE.StartDate, "date", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_SETTLE_DATE.EndDate, "date", 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(txtPAY_RFNO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtRFNO.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slp_STORE.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(SLP_RootNo.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(rdoPAY_TYPE1.Checked ? "1" : (rdoPAY_TYPE2.Checked ? "2" : "3"), "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_S.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(slpPROMOTE_ID_E.Text, "string", false)); ParameterList.Add(bco1.GetValueSetParameter(txtBUS_NO.Text, "string", false)); DataTable dt = new DataTable(); CAMModel.ProcessStoresMonthCounting bco = new CAMModel.ProcessStoresMonthCounting(ConntionDB); dt = bco.CheckNotCountingTransactionQuality(ParameterList); for (int k = 0; k <= dt.Rows.Count - 1; k++) { if (dt.Rows[k]["AC_STATUS"].ToString() == "1" || dt.Rows[k]["AC_STATUS"].ToString() == "2")//1.未彙總結算,2.進行彙總結算中 { dblUNSETTLE += double.Parse(dt.Rows[k]["AC_STATUS_QTY"].ToString()); } else if ( dt.Rows[k]["AC_STATUS"].ToString() == "4" || dt.Rows[k]["AC_STATUS"].ToString() == "5" || dt.Rows[k]["AC_STATUS"].ToString() == "6" || dt.Rows[k]["AC_STATUS"].ToString() == "7" )//4.已彙總結算,5.人為註記已結算,6.已開立銷項發票,7.已開立銷項折讓 { dblSETTLED += double.Parse(dt.Rows[k]["AC_STATUS_QTY"].ToString()); } else { //其它非規範狀態都不計算 //CASE:進貨單未確定出入庫0 } dblTOTALSETTLE += double.Parse(dt.Rows[k]["AC_STATUS_QTY"].ToString()); } RightMsgLabel.Text = "總數" + dblTOTALSETTLE.ToString() + "筆,已結" + dblSETTLED.ToString() + "筆,未結" + dblUNSETTLE.ToString() + "筆 [執行時間:" + System.DateTime.Now.ToString("yyyy/MM/dd hh:mm") + "]"; #endregion } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } }