private string SaleDefToExcel(string BeginDate, string EndDate) { DataSet ds = new ZhangWei.BLL.Sale_Detail().GetSaleDefinite(BeginDate, EndDate); string ToExcel = new LTP.Common.DataToExcel().OutputExcel(ds.Tables[0], "销售明细 " + BeginDate + "—" + EndDate, HttpContext.Current.Server.MapPath("/ExcelFiles/"), "销售明细"); return(ToExcel); }
protected void EnterAgain()//重新入库 { //Model.Sale ml_sale = bll_sale.GetModel(Convert.ToInt32(Request.Params["Sale_ID"])); Model.EnterStock ml_es = bl_es.GetModel(EnterStock_ID); ml_es.StoreHouse_ID = Convert.ToInt32(DropDownList1.SelectedValue); bl_es.Update(ml_es); //ml_sale.GatheringWay = this.DropDownList6.SelectedItem.Text; //ml_sale.Account = this.DropDownList4.SelectedItem.Text; //ml_sale.Address = this.TextBox1.Text; //ml_sale.Customer = Convert.ToInt32(DropDownList5.SelectedValue); //bll_sale.Update(ml_sale); string Ids = this.newId.Value.Replace(" ", "").Replace("\r\n", ""); string Qtys = this.newQty.Value.Replace(" ", "").Replace("\r\n", ""); string Prices = this.newPrice.Value.Replace(" ", "").Replace("\r\n", ""); string[] ArrIds = Ids.Split(new char[] { '|' }); string[] ArrQty = Qtys.Split(new char[] { '|' }); string[] ArrPri = Prices.Split(new char[] { '|' }); for (int i = 0; i < ArrIds.Length - 1; i++) { Model.EnterStock_Detail ml_esd = new ZhangWei.Model.EnterStock_Detail(); ml_esd.EnterStock_ID = EnterStock_ID; ml_esd.Product_ID = Convert.ToInt32(ArrIds[i]); ml_esd.Quantity = Convert.ToDecimal(ArrQty[i]); ml_esd.Price = Convert.ToDecimal(ArrPri[i]); BLL.Sale_Detail bl_sd = new ZhangWei.BLL.Sale_Detail(); //ml_sa.Sale_ID = Convert.ToInt32(Request.Params["Sale_ID"]); //ml_sa.Product_ID = Convert.ToInt32(ArrIds[i]); //ml_sa.SaleOrder_ID = 0; //ml_sa.Quantity = Convert.ToDecimal(ArrQty[i]); //ml_sa.Price = Convert.ToDecimal(ArrPri[i]); Model.StockPile ml_sp = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList1.SelectedValue)); BLL.StockPile bl_sp = new ZhangWei.BLL.StockPile(); if (ml_sp == null) { Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i])); ml_sp = new ZhangWei.Model.StockPile(); ml_sp.Product_ID = Convert.ToInt32(ArrIds[i]); ml_sp.Dept_ID = 1; ml_sp.FirstEnterDate = DateTime.Now; ml_sp.LastLeaveDate = DateTime.Now; ml_sp.Price = Convert.ToDecimal(ArrPri[i]); ml_sp.Quantity = 0; ml_sp.StoreHouse_ID = Convert.ToInt32(DropDownList1.SelectedValue); ml_sp.Quantity += Convert.ToDecimal(ArrQty[i]); bl_sp.Add(ml_sp); } else { ml_sp.Quantity += Convert.ToDecimal(ArrQty[i]); //ml_sp.LastLeaveDate = DateTime.Now; bl_sp.Update(ml_sp); } bl_esd.Add(ml_esd); } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtSale_ID.Text)) { strErr += "Sale_ID格式错误!\\n"; } if (!PageValidate.IsNumber(txtProduct_ID.Text)) { strErr += "Product_ID格式错误!\\n"; } if (!PageValidate.IsNumber(txtSaleOrder_ID.Text)) { strErr += "SaleOrder_ID格式错误!\\n"; } if (!PageValidate.IsNumber(txtQuantity.Text)) { strErr += "Quantity格式错误!\\n"; } if (!PageValidate.IsDecimal(txtPrice.Text)) { strErr += "Price格式错误!\\n"; } if (!PageValidate.IsNumber(txtDiscount.Text)) { strErr += "Discount格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Sale_ID = int.Parse(this.txtSale_ID.Text); int Product_ID = int.Parse(this.txtProduct_ID.Text); int SaleOrder_ID = int.Parse(this.txtSaleOrder_ID.Text); int Quantity = int.Parse(this.txtQuantity.Text); decimal Price = decimal.Parse(this.txtPrice.Text); int Discount = int.Parse(this.txtDiscount.Text); ZhangWei.Model.Sale_Detail model = new ZhangWei.Model.Sale_Detail(); model.Sale_ID = Sale_ID; model.Product_ID = Product_ID; model.SaleOrder_ID = SaleOrder_ID; model.Quantity = Quantity; model.Price = Price; model.Discount = Discount; ZhangWei.BLL.Sale_Detail bll = new ZhangWei.BLL.Sale_Detail(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void ShowInfo() { ZhangWei.BLL.Sale_Detail bll = new ZhangWei.BLL.Sale_Detail(); ZhangWei.Model.Sale_Detail model = bll.GetModel(); this.txtSale_ID.Text = model.Sale_ID.ToString(); this.txtProduct_ID.Text = model.Product_ID.ToString(); this.txtSaleOrder_ID.Text = model.SaleOrder_ID.ToString(); this.txtQuantity.Text = model.Quantity.ToString(); this.txtPrice.Text = model.Price.ToString(); this.txtDiscount.Text = model.Discount.ToString(); }
protected void Button5_Click(object sender, EventArgs e) { BackSaleOld();//先退货,库存数恢复 BLL.Sale_Detail bl_sd = new ZhangWei.BLL.Sale_Detail(); bl_sd.DeleteSaleDtl(Convert.ToInt32(Request.QueryString["Sale_ID"])); //把修改前的详单数据删了 SaleAgain(); //在重卖 Maticsoft.Common.MessageBox.Show(this, "更改成功!"); BindData(); //在重新绑定一下数据 }
private string SaleGatToExcel(string BeginDate, string EndDate, string according) { if (according == "1") { DataSet ds = new ZhangWei.BLL.Sale_Detail().GetSaleGather(BeginDate, EndDate); string ToExcel = new LTP.Common.DataToExcel().OutputExcel(ds.Tables[0], "销售汇总(按品种) " + BeginDate + "—" + EndDate, HttpContext.Current.Server.MapPath("/ExcelFiles/"), "销售汇总(按品种)"); return(ToExcel); } else { DataSet ds = new ZhangWei.BLL.Sale_Detail().GetGatherByList(BeginDate, EndDate); string ToExcel = new LTP.Common.DataToExcel().OutputExcel(ds.Tables[0], "销售汇总(按单号) " + BeginDate + "—" + EndDate, HttpContext.Current.Server.MapPath("/ExcelFiles/"), "销售汇总(按单号)"); return(ToExcel); } }
protected void Button2_Click(object sender, EventArgs e) { if (HiddenField1.Value == "") { Maticsoft.Common.MessageBox.Show(this, "请添加商品"); return; } else { Model.Sale ml_sale = new ZhangWei.Model.Sale(); ml_sale.SaleDate = Convert.ToDateTime(TextBox1.Text); ml_sale.Dept_ID = Convert.ToInt32(DropDownList1.SelectedValue); ml_sale.Customer = Convert.ToInt32(DropDownList5.SelectedValue);//客户 ml_sale.Employee_ID = Convert.ToInt32(DropDownList2.SelectedValue); ml_sale.Account = DropDownList4.SelectedValue; ml_sale.Address = TextBox2.Text; ml_sale.GatheringWay = DropDownList6.SelectedValue; ml_sale.StoreHouse_ID = Convert.ToInt32(DropDownList3.SelectedValue); ml_sale.TradeNo = GetTradeNo(); Int32 sale_id = new BLL.Sale().Add(ml_sale); string Ids = HiddenField1.Value.Replace(" ", "").Replace("\r\n", ""); string Qtys = HiddenField2.Value.Replace(" ", "").Replace("\r\n", ""); string Prices = HiddenField3.Value.Replace(" ", "").Replace("\r\n", ""); string[] ArrIds = Ids.Split(new char[] { '|' }); string[] ArrQty = Qtys.Split(new char[] { '|' }); string[] ArrPri = Prices.Split(new char[] { '|' }); for (int i = 0; i < ArrIds.Length - 1; i++) { Model.Sale_Detail ml_sa = new ZhangWei.Model.Sale_Detail(); BLL.Sale_Detail bl_sd = new ZhangWei.BLL.Sale_Detail(); ml_sa.Sale_ID = sale_id; ml_sa.Product_ID = Convert.ToInt32(ArrIds[i]); //ml_sa.SaleOrder_ID = 0; ml_sa.Quantity = Convert.ToDecimal(ArrQty[i]); ml_sa.Price = Convert.ToDecimal(ArrPri[i]); Model.StockPile ml_sp = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList3.SelectedValue)); BLL.StockPile bl_sp = new ZhangWei.BLL.StockPile(); if (ml_sp == null) { Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i])); ml_sp = new ZhangWei.Model.StockPile(); ml_sp.Product_ID = Convert.ToInt32(ArrIds[i]); ml_sp.Dept_ID = Convert.ToInt32(DropDownList1.SelectedValue); ml_sp.FirstEnterDate = DateTime.Now; ml_sp.LastLeaveDate = DateTime.Now; ml_sp.Price = Convert.ToDecimal(ArrPri[i]); ml_sp.Quantity = 0; ml_sp.StoreHouse_ID = Convert.ToInt32(DropDownList3.SelectedValue); ml_sp.Quantity -= Convert.ToDecimal(ArrQty[i]); bl_sp.Add(ml_sp); } else { ml_sp.Quantity -= Convert.ToDecimal(ArrQty[i]); ml_sp.LastLeaveDate = DateTime.Now; bl_sp.Update(ml_sp); } bl_sd.Add(ml_sa); } Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功,单号为:" + ml_sale.TradeNo, "/Sales/SaleReport.aspx"); } }