protected void Page_Load(object sender, EventArgs e) { if (Session["Usermanager"] == null) { Response.Redirect("~/Login.aspx"); } else { if (!IsPostBack) { //判断是否为编辑 if (Request.QueryString["Cusid"] != null) { //接受前页面传过来的Cusid值 int Cusid = Convert.ToInt32(Request.QueryString["Cusid"]); //获取客户信息,传输到当前页面的文本框中 CustomersTB customer = cus.GetCusmoerByid(Cusid); txtCusName.Text = customer.CusName.ToString(); txtTel.Text = customer.CusTel.ToString(); if (customer.IsCounterman == "是") { rdoYes.Checked = true; } else { rdoNo.Checked = true; } txtRemark.Text = customer.Remark.ToString(); } } } }
protected void ddlName_SelectedIndexChanged(object sender, EventArgs e) { int cusid = Convert.ToInt32(ddlName.SelectedValue); CustomersTB cs = new CustomersTB(); cs = cm.GetCusmoerByid(cusid); //如果该员工不是业务员,则不能有价格模板 if (cs.IsCounterman == "False") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('该客户不是业务员!')</script>"); } }
protected void imgbtnsel_Click(object sender, ImageClickEventArgs e) { CustomerPianTB cp = new CustomerPianTB(); int cusid = Convert.ToInt32(ddlcus.SelectedValue); DateTime qtime = Convert.ToDateTime(txtstime.Text); DateTime ttime = Convert.ToDateTime(txtttime.Text); try { if (customerpianmanager.GetCustomerPianTBById(cusid, qtime, ttime) != null) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('该用户信息已存在,请确认业务员及时间。')</script>"); return; } } catch (Exception ex) { try { CustomersTB cus = customersmanager.GetCusmoerByid(cusid); string name = cus.CusName; //获取客户名 DisNoteTB dis = disnotemanager.GetDisNoteTBById(cusid, qtime, ttime); double oddmon = dis.Sum; //获取面单费用 string issrt = dis.IsSet; //获取面单费用是否已结算 if (issrt == "是") { cp.Remark = "面单费已结!"; } else { cp.Remark = "面单费未结!"; } CustomerSentTB cs = customersentmanager.GetCustomerSentTBById(cusid, qtime, ttime); double sendmon = cs.Price;//获取发件费 CustomerSendTB cf = customersendmanager.GetCustomerSendTBById(cusid, qtime, ttime); double givemon = cf.EAllPrice;//获取送件费 SentTB st = sentmanager.GetSentTBById(cusid, qtime, ttime); double backmon = st.Price;//获取收到付件返利 AcceptTB at = acceptmanager.GetAcceptTBById(cusid, qtime, ttime); double accmon = at.Price;//获取派收到付件款 IAEManagerTB ia = iaemanagermanager.GetIAEManagerTBById(cusid, qtime, ttime); double othermon = ia.Price; //获取其他费用 double allmon = oddmon + sendmon + backmon - givemon - accmon + othermon; //总计 string ISsettle = "false"; cp.CusID = Convert.ToInt32(cusid); cp.DateMon = ttime; cp.OddMon = oddmon; cp.SendMon = sendmon; cp.GiveMon = givemon; cp.BackMon = backmon; cp.AccMon = accmon; cp.OtherMon = othermon; cp.AllMon = allmon; cp.ISsettle = ISsettle; int cou = customerpianmanager.AddCustomerPianTBInfo(cp); if (cou == 1) { allInfo = customerpianmanager.GetAllCustomerPianTBInfo(cusid); anpInfo.RecordCount = allInfo.Count(); BindData(); anpInfo.CurrentPageIndex = 1; } } catch (Exception) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('无该用户信息,请确认业务员及时间。')</script>"); return; } } }