protected void txt_STORE_Onblur() { if (OperationMode == OpMode.Add) { txtGroup.Text = ""; txtRoute.Text = ""; txtAcctUID.Text = ""; txtStep.Text = ""; txtProfit.Text = ""; MaintainStoreDiff bco = new MaintainStoreDiff(ConnectionDB); ArrayList parameterList = new ArrayList(); parameterList.Add(txtStore.Text); DataTable dt = bco.GetStoreInfo(parameterList); if (dt.Rows.Count > 0) { txtGroup.Text = dt.Rows[0]["GROUP_NO"].ToString(); txtRoute.Text = dt.Rows[0]["ROUTE"].ToString(); txtStep.Text = dt.Rows[0]["STEP"].ToString(); txtAcctUID.Text = dt.Rows[0]["AC_UID"].ToString(); txtProfit.Text = dt.Rows[0]["PROFIT_NO"].ToString(); txtZ_O.Text = dt.Rows[0]["Z_O"].ToString(); txtSAL_ID.Text = dt.Rows[0]["SAL_ID"].ToString(); } GV_QtyRefresh(); } }
protected void btnAdd_Click(object sender, EventArgs e) { string strCODE; string strDIFF_QTY = ""; try { if (string.IsNullOrEmpty(txtStore.Text) || string.IsNullOrEmpty(txtSignDate.Text) || string.IsNullOrEmpty(txtStBackNo.Text) || string.IsNullOrEmpty(txtBusDate.Text) || string.IsNullOrEmpty(ddlIOType.Text)) { ErrorMsgLabel.Text = "店號、簽收日期、補帳日期、憑證單號、單據類型需有值"; return; } if (DateTime.ParseExact(txtSignDate.Text, "yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture) > DateTime.Now) { ErrorMsgLabel.Text = "簽收日期不可大於系統日期"; return; } if (DateTime.ParseExact(txtBusDate.Text, "yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture) > DateTime.Now) { ErrorMsgLabel.Text = "補帳日期不可大於系統日期"; return; } DataTable dt = DiffData.GetChanges(DataRowState.Deleted); int inCount = (dt == null ? 0 : dt.Rows.Count); if (DiffData.Rows.Count > 0) { if (inCount == DiffData.Rows.Count) { ErrorMsgLabel.Text = "需有明細資料"; return; } } else { ErrorMsgLabel.Text = "需有明細資料"; return; } foreach (DataRow dr in DiffData.Rows) { if (dr.RowState != DataRowState.Deleted) { strDIFF_QTY = dr["DIFF_QTY"].ToString(); break; } } string strCHAN_NO = ""; MaintainStoreDiff bco = new MaintainStoreDiff(ConnectionDB); ArrayList parameterList = new ArrayList(); parameterList.Add(txtStore.Text); DataTable dt1 = bco.GetStoreInfo(parameterList); if (dt1.Rows.Count > 0) { strCHAN_NO = dt1.Rows[0]["CHAN_NO"].ToString(); } ReLoadPrice(); if (ErrorMsgLabel.Text != string.Empty) { return; } parameterList.Clear(); ArrayList masterParameter = new ArrayList(); CAMCommon bco1 = new CAMCommon(); masterParameter.Add(bco1.GetValueSetParameter(ddlACStatus.Text, "int", false)); //0 masterParameter.Add(bco1.GetValueSetParameter(txtBusDate.Text, "string", false)); //1 masterParameter.Add(bco1.GetValueSetParameter(txtSignDate.Text, "string", false)); //2 masterParameter.Add(bco1.GetValueSetParameter(rblTaxType.Text, "int", false)); //3 masterParameter.Add(bco1.GetValueSetParameter(txtRootNo.Text, "string", false)); //4 masterParameter.Add(bco1.GetValueSetParameter(InvoiceDateRange, "string", false)); //5 masterParameter.Add(bco1.GetValueSetParameter(rblIsSchedule.Text, "int", false)); //6 masterParameter.Add(bco1.GetValueSetParameter(ddlIOType.Text, "string", false)); //7 masterParameter.Add(bco1.GetValueSetParameter(ddlCheckSource.Text, "string", false)); //8 masterParameter.Add(bco1.GetValueSetParameter(txtGroup.Text, "string", false)); //9 masterParameter.Add(bco1.GetValueSetParameter(txtStore.Text, "string", false)); //10 masterParameter.Add(bco1.GetValueSetParameter(txtRoute.Text, "string", false)); //11 masterParameter.Add(bco1.GetValueSetParameter(txtStep.Text, "string", false)); //12 masterParameter.Add(bco1.GetValueSetParameter(txtProfit.Text, "string", false)); //13 masterParameter.Add(bco1.GetValueSetParameter(txtChainSourceNo.Text, "string", false)); //14 masterParameter.Add(bco1.GetValueSetParameter(txtStBackNo.Text, "string", false)); //15 masterParameter.Add(bco1.GetValueSetParameter(ddlDesc.Text, "string", false)); //16 masterParameter.Add(bco1.GetValueSetParameter(txtMemo.Text, "string", false)); //17 masterParameter.Add(bco1.GetValueSetParameter(Session["UID"].ToString(), "string", false)); //18 masterParameter.Add(bco1.GetValueSetParameter(strDIFF_QTY, "int", false)); //19 string strITEM = string.Empty; string strPERIOD = string.Empty; for (int i = 0; i < DiffData.Rows.Count; i++) { if (DiffData.Rows[i].RowState != DataRowState.Deleted) { ArrayList detailParameter = new ArrayList(); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["Item"].ToString(), "string", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["Period"].ToString(), "string", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["PSS_ST_ACCEPT_QTY"].ToString(), "int", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["PSS_BACKWARD_QTY"].ToString(), "int", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["DIFF_QTY"].ToString(), "int", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["PDKIND"].ToString(), "int", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["Cost"].ToString(), "double", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["Cost_Dis_Rate"].ToString(), "double", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["Cost_Dis"].ToString(), "double", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["Price"].ToString(), "int", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["CHECK_REASON"].ToString(), "string", false)); detailParameter.Add(bco1.GetValueSetParameter(DiffData.Rows[i]["CHECK_QTY"].ToString(), "int", false)); detailParameter.Add(bco1.GetValueSetParameter(Session["UID"].ToString(), "string", false)); parameterList.Add(detailParameter); if (strITEM == string.Empty) { strITEM = DiffData.Rows[i]["Item"].ToString(); strPERIOD = DiffData.Rows[i]["Period"].ToString(); } } } masterParameter.Add(strITEM); //20 masterParameter.Add(strPERIOD); //21 masterParameter.Add(slpPROMOTE_ID.Text); //22 //因為進貨&正項&金石堂&通路單號空值,需要把上傳打勾 //所以在通路單號為空值時,直接傳上傳已勾選 //之後在PKG_VDS_CAM03B.PATCH_PROC會判斷 進貨&正項&金石堂 這邊就不需要都一次判斷 if (txtChainSourceNo.Text.Trim() == "") masterParameter.Add(bco1.GetValueSetParameter("1", "string", false));//23 else masterParameter.Add(bco1.GetValueSetParameter(chkUpload.Checked ? "1" : "0", "string", false));//23 string[] strReturn = bco.CreateStoreDiff(masterParameter, parameterList); if (strReturn[2] == "") { strCODE = strReturn[1]; ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('新增成功');location.replace('CAM032.aspx?Code=" + Request["Code"].ToString() + "&Mode=View&ID=" + strCODE + "');"), true); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('新增失敗:" + strReturn[2] + "');"), true); } } catch (Exception ex) { WaringLogProcess(ex.Message); if (ex.Message.IndexOf("此入帳日年月己月結,請確認入帳日期是否正確?") > 0) { this.ErrorMsgLabel.Text = "此入帳日年月己月結,請確認入帳日期是否正確?"; } else { this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } } finally { Finally_Function(); } }