예제 #1
0
        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);
            }
        }
예제 #2
0
 private void InitBillDetailInfo(string tabName)
 {
     dvFood.Rows.Clear();
     BillDetailInfoService service = new BillDetailInfoService();
     string billkey = BillInfoService.GetNotCheckOutBillkeyByTabName(tabName);
     List<BillDetailInfo> billDetailInfos = service.GetBillDetailInfoByBillkey(billkey);
     foreach (BillDetailInfo b in billDetailInfos)
     {
         dvFood.Rows.Add(0,b.FoodCnName,b.foodCount,b.FoodPrice);
     }
 }
예제 #3
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;
        }
예제 #4
0
 private void InitBillInfo()
 {
     dvBill.Rows.Clear();
     string billkey = BillInfoService.GetNotCheckOutBillkeyByTabName(tabName);
     BillDetailInfoService service = new BillDetailInfoService();
     List<BillDetailInfo> billDetailInfos = service.GetBillDetailInfoByBillkey(billkey);
     foreach (BillDetailInfo dInfo in billDetailInfos)
     {
         //dvBill.Rows.Add("未确认", lb.Text, 1, food.price, food.unit, "", "否", "否", "否", "");
         dvBill.Rows.Add(dInfo.Stauts,dInfo.FoodCnName,dInfo.foodCount,dInfo.FoodPrice,dInfo.FoodUnit,dInfo.remark,dInfo.jiaocai,dInfo.Mark,dInfo.Handsel,dInfo.Mark,dInfo.ID);
     }
 }
예제 #5
0
        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;
            }
        }
예제 #6
0
        private void FormCheckout_Load(object sender, EventArgs e)
        {
            lbBillkey.Text = billkey;
            lbTabName.Text = tabName;

            float allMoney = 0.0f;
            float canDisMoney = 0.0f;
            float preMoney = 0.0f;
            cbPaymethod.SelectedIndex = 0;
            InitCbDiscount();
            BillDetailInfoService service = new BillDetailInfoService();
            List<BillDetailInfo> billDetailInfos = service.GetBillDetailInfoByBillkey(billkey);
            foreach (BillDetailInfo d in billDetailInfos)
            {
                dvBill.Rows.Add(d.FoodCnName,d.foodCount,d.FoodPrice,d.Handsel);
                allMoney += (d.foodCount * d.FoodPrice);
                if (d.Handsel == "是")
                {
                    preMoney += (d.foodCount * d.FoodPrice);
                }
                else
                {
                    if (FoodService.CanDiscount(d.FoodCnName))
                    {
                        canDisMoney += (d.foodCount * d.FoodPrice);
                    }
                }
            }
            lbBillmoney.Text = allMoney + "";
            lbPreMoney.Text = preMoney + "";
            lbDisMoney.Text = canDisMoney + "";

            lbActMoney.Text = (allMoney - preMoney) + "";
            tbSHMoney.Text = (allMoney - preMoney) + "";
        }