protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { Session["OrderInHouseSession"] = null; List <Sell_OrderInHouseService> cars = new List <Sell_OrderInHouseService>(); this.gvList.DataSource = cars; this.gvList.DataBind(); var GoodUnitList = new TB_GoodService().GetAllGoodUnits(); ddlGoodUnit.Items.Add("全部"); foreach (var unit in GoodUnitList) { ddlGoodUnit.Items.Add(unit); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["GoodNo"] != null) { var goodList = new TB_GoodService().GetListArray(string.Format(" GoodNo='{0}'", Request["GoodNo"])); if (goodList.Count != 1) { return; } var goodId = goodList[0].GoodId; string sql = "select pro_Id from A_ProInfo where pro_Type='商品档案申请'"; string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='商品档案申请')" , goodId); object eformIdObj = DBHelp.ExeScalar(efromId); object proId = DBHelp.ExeScalar(sql); if ((eformIdObj is DBNull) || eformIdObj == null) { sql = "select ProNo from TB_Good where GoodId=" + goodId; var proNo = DBHelp.ExeScalar(sql); string strProNo = ""; if (proNo is DBNull || proNo == null || proNo.ToString() == "") { strProNo = new tb_EFormService().GetAllE_No("TB_Good"); DBHelp.ExeCommand(string.Format(" update TB_Good set GoodProNo='{0}',GoodStatus='通过' where GoodId={1}", strProNo, goodId)); } else { strProNo = proNo.ToString(); } string insertEform = string.Format("insert into tb_EForm values ({0},1,getdate(),1,getdate(),'通过',{1},0,0,'{2}','',GETDATE())", proId, goodId, strProNo); DBHelp.ExeCommand(insertEform); efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='商品档案申请')", goodId); eformIdObj = DBHelp.ExeScalar(efromId); } string url = "~/BaseInfo/WFGoods.aspx?ProId=" + proId + "&allE_id=" + goodId + "&EForm_Id=" + eformIdObj + "&&ReAudit=true"; Session["backurl1"] = "/BaseInfo/WFGoodsList.aspx"; Response.Redirect(url); } } }
private void Show() { if ((txtInvName.Text == "" && txtGoodNo.Text == "") || ddlHouse.SelectedValue == "0") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('查询条件必选全部填写!');</script>"); txtFrom.Focus(); return; } if (txtFrom.Text == "" && txtTo.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期至少选一个!');</script>"); txtFrom.Focus(); return; } try { if (txtFrom.Text != "") { if (CommHelp.VerifesToDateTime(txtFrom.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期时间 格式错误!');</script>"); return; } Convert.ToDateTime(txtFrom.Text); } if (txtTo.Text != "") { if (CommHelp.VerifesToDateTime(txtTo.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期时间 格式错误!');</script>"); return; } Convert.ToDateTime(txtTo.Text); } } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期格式错误!');</script>"); return; } //if (txtGoodNo.Text != "" && txtInvName.Text != "") //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('查询条件必选全部填写!');</script>"); // txtFrom.Focus(); // return; //} int goodId = 0; if (txtInvName.Text != "") { //string goodName = txtInvName.Text.Replace(@"\", ","); string[] allList = txtInvName.Text.Split('\\'); if (allList.Length != 7) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('商品格式不正确!');</script>"); return; } goodId = goodsSer.GetGoodId(allList[1], allList[3], allList[4], allList[2], allList[5]); if (goodId == 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的商品不存在!');</script>"); return; } } if (txtGoodNo.Text != "") { var allModels = goodsSer.GetListArray(string.Format(" 1=1 and GoodNo='{0}'", txtGoodNo.Text)); if (allModels.Count != 1) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的商品不存在!');</script>"); return; } goodId = allModels[0].GoodId; } var models = goodsSer.GetListArray(" GoodId=" + goodId); var nums = goodsSer.GetGoodNum(goodId); lblGoodNum.Text = nums[0].ToString(); lblCaiKuNum.Text = nums[1].ToString(); List <TB_Good> goodList = new TB_GoodService().GetListArray_New(string.Format(" Temp.GoodId={0}", goodId)); decimal ZhiLiuKuCun = 0; if (goodList.Count > 0) { ZhiLiuKuCun = goodList[0].ZhiLiuKuCun; } lblZhiLiuNum.Text = ZhiLiuKuCun.ToString(); if (models.Count == 1) { lblGoodAreaNumber.Text = models[0].GoodAreaNumber; //名称\小类\规格 lblGoodInfo.Text = models[0].GoodName + @"\" + models[0].GoodTypeSmName + @"\" + models[0].GoodSpec; } //显示当前库存:XX,采库需 出: YY ,滞留库存:XX - YY DateTime fromDate = string.IsNullOrEmpty(txtFrom.Text)?Convert.ToDateTime("2000-1-1"):Convert.ToDateTime(txtFrom.Text); DateTime toDate = string.IsNullOrEmpty(txtTo.Text) ? Convert.ToDateTime("2036-1-1") : Convert.ToDateTime(txtTo.Text); List <Pro_JSXDetailInfo> pOOrderList = this.jxcDetailSer.GetListArray(Convert.ToInt32(ddlHouse.SelectedValue), goodId, fromDate, toDate); pOOrderList.Sort(delegate(Pro_JSXDetailInfo a, Pro_JSXDetailInfo b) { return(a.RuTime.CompareTo(b.RuTime)); }); jxcDetailSer.ReSetPro_JSXDetailInfo(pOOrderList); decimal iniNum = 0; for (int i = 0; i < pOOrderList.Count; i++) { var model = pOOrderList[i]; if (i == 0) { iniNum = model.GoodInNum - model.GoodOutNum; //i++; } else { iniNum = iniNum + model.GoodInNum - model.GoodOutNum; } pOOrderList[i].GoodResultNum = iniNum; } foreach (var m in pOOrderList) { m.KuCunTotal = m.GoodResultNum * m.TempHousePrice; } lblHadInvoice.Text = string.Format("{0:n2}", pOOrderList.Sum(t => t.HadInvoice)); lblNoInvoice.Text = string.Format("{0:n2}", pOOrderList.Sum(t => t.NoInvoice)); lblGoodInNum.Text = string.Format("{0:n2}", pOOrderList.Sum(t => t.GoodInNum)); lbllblGoodInNumTotal.Text = string.Format("{0:n2}", pOOrderList.Sum(t => t.GoodInNum * t.Price)); lblGoodOutNum.Text = string.Format("{0:n2}", pOOrderList.Sum(t => t.GoodOutNum)); lblGoodOutNumTotal.Text = string.Format("{0:n2}", pOOrderList.Sum(t => t.GoodOutTotal)); if (pOOrderList.Count > 0) { var lastModel = pOOrderList[pOOrderList.Count - 1]; lblGoodResultNum.Text = string.Format("{0:n2}", lastModel.GoodResultNum); LBLHouseTotal.Text = string.Format("{0:n2}", lastModel.KuCunTotal); } else { lblGoodResultNum.Text = "0"; } AspNetPager1.RecordCount = pOOrderList.Count; this.gvMain.PageIndex = AspNetPager1.CurrentPageIndex - 1; this.gvMain.DataSource = pOOrderList; this.gvMain.DataBind(); }