private void btnCash_Click(object sender, EventArgs e) { Shop_SellList sslback = null; //产生billno 写数据库 库存 要货单 打印 if (!string.IsNullOrEmpty(ssl.BackBillNo)) { sslback = new Shop_SellList(); sslback.BackBillNo = ssl.BackBillNo; sslback.Duty = ssl.Duty; //产生一张完全的退货单 DALShopSellList dalshopselllist = new DALShopSellList(); Shop_SellList selllistback = dalshopselllist.GetByBillNO(ssl.BackBillNo); sslback.BillNO = new DALSys_FormatSerialNo().GetSerialNo(GlobalValue.GShop.ShopNo); ; sslback.Details.Clear(); foreach (Shop_SellDetail ssd in selllistback.Details) { Shop_SellDetail sdnew = new Shop_SellDetail(); sdnew.Amount = -ssd.Amount; sdnew.Price = ssd.Price; sdnew.Pro = ssd.Pro; sdnew.BillNO = sslback.BillNO; sslback.Details.Add(sdnew); } sslback.BillAmount = -selllistback.BillAmount; sslback.ActAmount = -selllistback.ActAmount; sslback.ActCustomAmount = -selllistback.ActCustomAmount; sslback.BackFlag = true; new DALShopSellList().SaveList(sslback); new DALUnity().ExcuteStoredProcedure("usp_Shop_Sell_Cash", new string[] { GlobalValue.GAccount.AccountID.ToString(), GlobalValue.GShop.ShopID.ToString(), sslback.BillNO}); Program.mainfrm.dutyinfo.BackCount++; Program.mainfrm.dutyinfo.BackAmount += sslback.ActAmount; Program.mainfrm.dalduty.Save(Program.mainfrm.dutyinfo); ssl.BackBillNo = null; ssl.Details.Clear(); foreach (Shop_SellDetail sd in Program.mainfrm.ReMoveDetails) { sd.Amount = -sd.Amount; ssl.Details.Add(sd); } } if (ssl.Details.Count > 0) { string billNo = new DALSys_FormatSerialNo().GetSerialNo(GlobalValue.GShop.ShopNo); ssl.BillNO = billNo; ssl.BillAmount = ssl.Details.Sum(x => x.Price * x.Amount); ssl.ActAmount = ssl.BillAmount; ssl.ActCustomAmount = ssl.BillAmount; ssl.BackFlag = false; foreach (Shop_SellDetail detail in ssl.Details) { detail.BillNO = billNo; } new DALShopSellList().SaveList(ssl); Program.mainfrm.dutyinfo.BillCount++; Program.mainfrm.dutyinfo.ActAmount += ssl.ActAmount; Program.mainfrm.dutyinfo.BillAmount += ssl.BillAmount; Program.mainfrm.dalduty.Save(Program.mainfrm.dutyinfo); //执行存储过程,进行库存处理 new DALUnity().ExcuteStoredProcedure("usp_Shop_Sell_Cash", new string[] { GlobalValue.GAccount.AccountID.ToString(), GlobalValue.GShop.ShopID.ToString(), ssl.BillNO}); } if (sslback != null) { new CashPrint(sslback); } if (ssl.Details.Count > 0) { new CashPrint(ssl); } this.DialogResult = System.Windows.Forms.DialogResult.OK; }
void g_OnAddItem(Shop_SellDetail t, Rectangle position, Control gridcontainer) { uc.ucProInfo pi = new uc.ucProInfo(); pi.Left = position.Left; pi.Top = position.Top; pi.Size = position.Size; pi.LeftField = "单价:" + t.Price.ToString("0.00"); pi.RightField = "数量:" + t.Amount.ToString("0.00"); pi.ProInfo = t.Pro; pi.Tag = t; pi.OnSelectPro += new uc.ucProInfo.SelectPro(pi_OnSelectPro); gridcontainer.Controls.Add(pi); }
bool proselect_OnProSelectQty(ProInfo proinfo, decimal qty) { if (selllist.Details.Where(x => x.Pro.ProID == proinfo.ProID).ToList().Count != 0) { return false; } Shop_SellDetail ss = new Shop_SellDetail(); ss.Pro = proinfo; ss.Price = proinfo.ProPrices.Single<ProPrice>(x => x.AreaInfo.AreaID == GlobalValue.GShop.AreaInfo.AreaID).Price; ss.Amount = qty; selllist.Details.Add(ss); //增加了一个产品,需要重新计算金额! lbAmount.Text = GetSumAmount(); pnlselldetail.Tag = 100; //重画界面 ShowSellDetailByPageNo(true); return true; }
private void btnBack_Click(object sender, EventArgs e) { //退货,输入单据号 if (selllist != null) { GlobalFun.MessageBoxError("还有单据未处理,不能进行退货操作"); return; } InputQty iq = new InputQty(); iq.Text = "请输入单据号"; string billno = iq.GetInputValue().ToString(); if (!string.IsNullOrEmpty(billno)) { DALShopSellList dalshopselllist = new DALShopSellList(); //查询这张单据! Shop_SellList ssl = dalshopselllist.GetByBillNO(billno); if (ssl == null) { GlobalFun.MessageBoxError("找不到这张单据"); return; } if (ssl.BackFlag) { GlobalFun.MessageBoxError("退货单,不能退货!"); return; } if (dalshopselllist.GetBackBillByNo(ssl.BillNO) != null) { GlobalFun.MessageBoxError("已经退货的单据,不能重复退货"); return; } if (ssl.Duty.Shop.ShopID != GlobalValue.GShop.ShopID) { GlobalFun.MessageBoxError("不是本门店的单据,不能退货"); return; } CreateBill(); selllist.BackBillNo = ssl.BillNO; foreach (Shop_SellDetail ssd in ssl.Details) { Shop_SellDetail sdnew = new Shop_SellDetail(); sdnew.Amount = -ssd.Amount; sdnew.Price = ssd.Price; sdnew.Pro = ssd.Pro; selllist.Details.Add(sdnew); } ShowSellDetailByPageNo(true); //不允许增加产品!不允许修改数量!!! btnProSelect.Enabled = false; } }