private void CheckOut(int type) { BillInfoService bService = new BillInfoService(); BillInfo billInfo = bService.GetBillInfoByBillkey(billkey); billInfo.billMoney = float.Parse(lbBillmoney.Text); //billInfo.billtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); billInfo.checktime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); billInfo.checkUsername = App.userName; billInfo.discount = cbDiscount.Text; billInfo.mark = tbMark.Text.Trim(); billInfo.paymethod = cbPaymethod.Text; if (cbPaymethod.Text.Equals("现金")) { billInfo.SHcash = float.Parse(tbSHMoney.Text); } else { billInfo.SHvesa = float.Parse(tbSHMoney.Text); } billInfo.SHmoney = float.Parse(tbSHMoney.Text); billInfo.status = 1; billInfo.tabName = tabName; billInfo.zl = float.Parse(tbZL.Text); billInfo.preMoney = float.Parse(tbPre.Text); float canDisMoney = float.Parse(lbDisMoney.Text); float dicValue = float.Parse(cbDiscount.SelectedValue.ToString()); float disMoney = canDisMoney * (1 - dicValue); billInfo.disMoney = disMoney; BillInfoService service = new BillInfoService(); service.UpdateBillInfo(billInfo); // 打印账单 BillDetailInfoService dService = new BillDetailInfoService(); List<BillDetailInfo> billDetailInfos = dService.GetBillDetailInfoByBillkey(billkey); CheckoutPrinter printer = new CheckoutPrinter(billInfo, type, billDetailInfos); printer.pdDocument.Print(); if (type == 1) { TabInfoService tService = new TabInfoService(); tService.UpdateTabInfoStatus(tabName, "结账"); this.DialogResult = System.Windows.Forms.DialogResult.OK; } }
private void lbOK_Click(object sender, EventArgs e) { tbOrTabName.Text = orTabName; string billkey = BillInfoService.GetNotCheckOutBillkeyByTabName(orTabName); BillInfoService service = new BillInfoService(); BillInfo billInfo = service.GetBillInfoByBillkey(billkey); string newTabName = cbNewTabName.Text; TabInfoService tService = new TabInfoService(); string tabStatus = TabInfoService.GetTabStatusByTabName(orTabName); // 原餐桌号状态改为空闲 tService.UpdateTabInfoStatus(orTabName, "空闲"); // 新餐桌号状态改为原餐桌状态 tService.UpdateTabInfoStatus(newTabName, tabStatus); // 账单对应的餐桌号改为新餐桌号 billInfo.tabName = newTabName; service.UpdateBillInfo(billInfo); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void billTimer_Tick(object sender, EventArgs e) { try { billTimer.Stop(); Padorder order = CommService.GetLastNotPrintPadorder(); if (order != null) { BillInfoService bService = new BillInfoService(); BillInfo billinfo = bService.GetBillInfoByBillkey(order.billkey); BillDetailInfoService dService = new BillDetailInfoService(); List<BillDetailInfo> bills = dService.GetBillDetailInfoByBillkey(order.billkey); //List<BillDetailInfo> AllDetailInfos = new List<BillDetailInfo>(); List<BillDetailInfo> KitchenDetailInfos = new List<BillDetailInfo>(); List<BillDetailInfo> BarDetailInfos = new List<BillDetailInfo>(); foreach (BillDetailInfo bd in bills) { if (bd.isPrint == 1) break; if (FoodService.IsPlanFood(bd.FoodCnName)) { PlanFoodService pService = new PlanFoodService(); List<PlanFood> planFoods = pService.GetPlanFood(bd.FoodCnName); foreach (PlanFood f in planFoods) { BillDetailInfo pdInfo = new BillDetailInfo(); pdInfo.BillKey = order.billkey; pdInfo.FoodCnName = f.planFoodname; pdInfo.foodCount = f.planFoodCount; pdInfo.FoodID = 0; pdInfo.FoodPrice = f.planFoodPrice; pdInfo.FoodUnit = f.planFoodUnit; pdInfo.Handsel = "否"; pdInfo.isPrint = 0; pdInfo.jiaocai = order.jiaocai; pdInfo.remark = ""; pdInfo.Mark = ""; pdInfo.Stauts = "已点菜"; pdInfo.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); pdInfo.UserName = App.userName; if (FoodService.IsKitchenFood(f.planFoodname)) { KitchenDetailInfos.Add(pdInfo); } else { BarDetailInfos.Add(pdInfo); } } } else { if (FoodService.IsKitchenFood(bd.FoodCnName)) { KitchenDetailInfos.Add(bd); } else { BarDetailInfos.Add(bd); } } } // 打印 TabInfoService tabService = new TabInfoService(); TabInfo tabInfo = tabService.GetTabInfoByTabName(order.tabname); // 打印账单 if (bills.Count <= 0) return; string tabStatus = tabInfo.status; if (tabStatus.Equals("开台")) { ConsumeBillPrinter conPrinter = new ConsumeBillPrinter(billinfo, "点餐单", bills); conPrinter.pdDocument.Print(); if (KitchenDetailInfos.Count > 0) { KitchenBillPrinter kitPrinter = new KitchenBillPrinter(billinfo, "点餐单", KitchenDetailInfos); kitPrinter.pdDocument.Print(); foreach (BillDetailInfo d in KitchenDetailInfos) { KitchenBillDetailPrinter kitDetailPrinter = new KitchenBillDetailPrinter(d, tabName, "后厨点菜单"); kitDetailPrinter.pdDocument.Print(); BillDetailInfoService.UpdatePrintByID(d.ID); } } if (BarDetailInfos.Count > 0) { BarBillPrinter barPrinter = new BarBillPrinter(billinfo, "点餐单", BarDetailInfos); barPrinter.pdDocument.Print(); foreach (BillDetailInfo d in BarDetailInfos) { BarBillDetailPrinter barDetailPrinter = new BarBillDetailPrinter(d, tabName, "酒吧点菜单"); barDetailPrinter.pdDocument.Print(); BillDetailInfoService.UpdatePrintByID(d.ID); } } } else { ConsumeBillPrinter conPrinter = new ConsumeBillPrinter(billinfo, "加菜单", bills); conPrinter.pdDocument.Print(); if (KitchenDetailInfos.Count > 0) { KitchenBillPrinter kitPrinter = new KitchenBillPrinter(billinfo, "加餐单", KitchenDetailInfos); kitPrinter.pdDocument.Print(); foreach (BillDetailInfo d in KitchenDetailInfos) { KitchenBillDetailPrinter kitDetailPrinter = new KitchenBillDetailPrinter(d, tabName, "后厨加菜单"); kitDetailPrinter.pdDocument.Print(); BillDetailInfoService.UpdatePrintByID(d.ID); } } if (BarDetailInfos.Count > 0) { BarBillPrinter barPrinter = new BarBillPrinter(billinfo, "加餐单", BarDetailInfos); barPrinter.pdDocument.Print(); foreach (BillDetailInfo d in BarDetailInfos) { BarBillDetailPrinter barDetailPrinter = new BarBillDetailPrinter(d, tabName, "酒吧加菜单"); barDetailPrinter.pdDocument.Print(); BillDetailInfoService.UpdatePrintByID(d.ID); } } } // 1 收银打印 总单 (点餐单或者加餐单) // 2 后厨打印总单+分单 (点餐单或者加餐单) // 3 酒吧打印总单+分单 (点餐单或者加餐单) if (tabInfo.status.Equals("开台")) { tabService.UpdateTabInfoStatus(tabName, "点餐"); } else { tabService.UpdateTabInfoStatus(tabName, "加餐"); } BillInfoService.UpdateBillIsPrintByBillkey(order.billkey); CommService.SetPadorderPrinted(order.id); } // 设置次order 已经打印 billTimer.Start(); } catch (Exception ex) { billTimer.Start(); MessageBox.Show(ex.Message); } }
private void InitBaseInfo(string tabName) { lbName.Text = string.Format("{0} 餐桌:{1}",tcTabs.SelectedTab.Text,tabName); string billkey = BillInfoService.GetNotCheckOutBillkeyByTabName(tabName); if (billkey != "") { BillInfoService service = new BillInfoService(); BillInfo bill = service.GetBillInfoByBillkey(BillInfoService.GetNotCheckOutBillkeyByTabName(tabName)); lbOpenTime.Text = string.Format("开台时间:{0}", bill.billtime.Substring(11)); //lbOpenPretage.Text = string.Format("开台率:{0}","10%"); lbCustCount.Text = string.Format("用餐人数:{0}", bill.custCount + "人"); //lbMoney.Text = string.Format("总消费额:{0}", bill.billMoney + "元"); } else { lbOpenTime.Text = string.Format("开台时间:{0}", "00:00:00"); //lbOpenPretage.Text = string.Format("开台率:{0}","10%"); lbCustCount.Text = string.Format("用餐人数:{0}", "0人"); //lbMoney.Text = string.Format("总消费额:{0}", "0元"); } }
private void lbOrder_Click(object sender, EventArgs e) { string billkey = BillInfoService.GetNotCheckOutBillkeyByTabName(tabName); BillInfoService bService = new BillInfoService(); BillInfo billInfo = bService.GetBillInfoByBillkey(billkey); BillDetailInfoService service = new BillDetailInfoService(); List<BillDetailInfo> AllDetailInfos = new List<BillDetailInfo>(); List<BillDetailInfo> KitchenDetailInfos = new List<BillDetailInfo>(); List<BillDetailInfo> BarDetailInfos = new List<BillDetailInfo>(); foreach (DataGridViewRow row in dvBill.Rows) { if (row.Cells["status"].Value.ToString() == "未确认") { BillDetailInfo dinfo = new BillDetailInfo(); dinfo.BillKey = billkey; dinfo.FoodCnName = row.Cells["foodname"].Value.ToString(); dinfo.foodCount = Convert.ToInt32(row.Cells["foodcount"].Value); dinfo.FoodID = 0; dinfo.FoodPrice = float.Parse(row.Cells["foodprice"].Value.ToString()); dinfo.FoodUnit = row.Cells["foodunit"].Value.ToString(); dinfo.Handsel = row.Cells["give"].Value.ToString(); dinfo.isPrint = 0; dinfo.jiaocai = row.Cells["hold"].Value.ToString(); dinfo.remark = row.Cells["cook"].Value.ToString(); dinfo.Mark = ""; dinfo.Stauts = "已点菜"; dinfo.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); dinfo.UserName = App.userName; int id = service.AddBillDetailInfo(dinfo); dinfo.ID = id; if (FoodService.IsPlanFood(dinfo.FoodCnName)) { PlanFoodService pService = new PlanFoodService(); List<PlanFood> planFoods = pService.GetPlanFood(dinfo.FoodCnName); AllDetailInfos.Add(dinfo); foreach (PlanFood f in planFoods) { BillDetailInfo pdInfo = new BillDetailInfo(); pdInfo.BillKey = billkey; pdInfo.FoodCnName = f.planFoodname; pdInfo.foodCount = f.planFoodCount; pdInfo.FoodID = 0; pdInfo.FoodPrice = f.planFoodPrice; pdInfo.FoodUnit = f.planFoodUnit; pdInfo.Handsel = row.Cells["give"].Value.ToString(); pdInfo.isPrint = 0; pdInfo.jiaocai = row.Cells["hold"].Value.ToString(); pdInfo.remark = row.Cells["cook"].Value.ToString(); pdInfo.Mark = ""; pdInfo.Stauts = "已点菜"; pdInfo.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); pdInfo.UserName = App.userName; if (FoodService.IsKitchenFood(f.planFoodname)) { KitchenDetailInfos.Add(pdInfo); } else { BarDetailInfos.Add(pdInfo); } } } else { AllDetailInfos.Add(dinfo); if (FoodService.IsKitchenFood(dinfo.FoodCnName)) { KitchenDetailInfos.Add(dinfo); } else { BarDetailInfos.Add(dinfo); } } } } TabInfoService tabService = new TabInfoService(); TabInfo tabInfo = tabService.GetTabInfoByTabName(tabName); // 打印账单 if (AllDetailInfos.Count <= 0) return; string tabStatus = tabInfo.status; if (tabStatus.Equals("开台")) { ConsumeBillPrinter conPrinter = new ConsumeBillPrinter(billInfo, "点餐单",AllDetailInfos); conPrinter.pdDocument.Print(); if (KitchenDetailInfos.Count > 0) { KitchenBillPrinter kitPrinter = new KitchenBillPrinter(billInfo, "点餐单", KitchenDetailInfos); kitPrinter.pdDocument.Print(); foreach (BillDetailInfo d in KitchenDetailInfos) { KitchenBillDetailPrinter kitDetailPrinter = new KitchenBillDetailPrinter(d, tabName, "后厨点菜单"); kitDetailPrinter.pdDocument.Print(); } } if (BarDetailInfos.Count > 0) { BarBillPrinter barPrinter = new BarBillPrinter(billInfo, "点餐单", BarDetailInfos); barPrinter.pdDocument.Print(); foreach (BillDetailInfo d in BarDetailInfos) { BarBillDetailPrinter barDetailPrinter = new BarBillDetailPrinter(d, tabName, "酒吧点菜单"); barDetailPrinter.pdDocument.Print(); } } } else { ConsumeBillPrinter conPrinter = new ConsumeBillPrinter(billInfo, "加菜单", AllDetailInfos); conPrinter.pdDocument.Print(); if (KitchenDetailInfos.Count > 0) { KitchenBillPrinter kitPrinter = new KitchenBillPrinter(billInfo, "加餐单", KitchenDetailInfos); kitPrinter.pdDocument.Print(); foreach (BillDetailInfo d in KitchenDetailInfos) { KitchenBillDetailPrinter kitDetailPrinter = new KitchenBillDetailPrinter(d, tabName, "后厨加菜单"); kitDetailPrinter.pdDocument.Print(); } } if (BarDetailInfos.Count > 0) { BarBillPrinter barPrinter = new BarBillPrinter(billInfo, "加餐单", BarDetailInfos); barPrinter.pdDocument.Print(); foreach (BillDetailInfo d in BarDetailInfos) { BarBillDetailPrinter barDetailPrinter = new BarBillDetailPrinter(d, tabName, "酒吧加菜单"); barDetailPrinter.pdDocument.Print(); } } } // 1 收银打印 总单 (点餐单或者加餐单) // 2 后厨打印总单+分单 (点餐单或者加餐单) // 3 酒吧打印总单+分单 (点餐单或者加餐单) if (tabInfo.status.Equals("开台")) { tabService.UpdateTabInfoStatus(tabName, "点餐"); } else { tabService.UpdateTabInfoStatus(tabName, "加餐"); } BillInfoService.UpdateBillIsPrintByBillkey(billkey); //this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void lbRunBill_Click(object sender, EventArgs e) { BillInfoService bService = new BillInfoService(); BillInfo billInfo = bService.GetBillInfoByBillkey(billkey); billInfo.billMoney = float.Parse(lbBillmoney.Text); billInfo.status = 2; billInfo.checktime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); billInfo.checkUsername = App.userName; billInfo.discount = "无"; billInfo.paymethod = "挂账"; bService.UpdateBillInfo(billInfo); TabInfoService tService = new TabInfoService(); tService.UpdateTabInfoStatus(tabName, "结账"); this.DialogResult = System.Windows.Forms.DialogResult.OK; }