示例#1
0
        public BarBillDetailPrinter(BillDetailInfo dinfo, string tabName, string type)
        {
            this.dinfo = dinfo;
            this.tabName = tabName;
            this.type = type;

            PrintUtils.SetDefaultPrint(PrintUtils.GetBarPrintName());

            pdDocument = new PrintDocument();
            pdDocument.PrintController = new StandardPrintController();
            pdDocument.PrintPage += new PrintPageEventHandler(pdDocument_PrintPage);
        }
示例#2
0
 public BillDetailInfo ToBillDetailInfo(DataRow row)
 {
     BillDetailInfo dInfo = new BillDetailInfo();
     dInfo.BillKey = (string)row["billkey"];
     dInfo.FoodCnName = (string)row["foodCnName"];
     dInfo.foodCount = (int)row["foodCount"];
     dInfo.FoodID = (int)row["foodID"];
     dInfo.FoodPrice = (float)row["foodPrice"];
     dInfo.FoodUnit = (string)row["foodUnit"];
     dInfo.Handsel = (string)row["handsel"];
     dInfo.ID = (int)row["id"];
     dInfo.isPrint = (int)row["isPrint"];
     dInfo.jiaocai = (string)row["jiaocai"];
     dInfo.Mark = (string)row["mark"];
     dInfo.remark = (string)row["remark"];
     dInfo.Stauts = (string)row["status"];
     dInfo.Time = (string)row["bTime"];
     dInfo.UserName = (string)row["userName"];
     return dInfo;
 }
示例#3
0
        public int AddBillDetailInfo(BillDetailInfo dInfo)
        {
            string sql = "INSERT INTO `billDetailInfo`(`billkey`,`foodID`,`foodCnName`,`foodUnit`,`foodCount`,`foodPrice`,`userName`,`status`,`mark`,`handsel`,`bTime`,`isPrint`,`remark`,`jiaocai`)VALUES (@billkey,@foodID,@foodCnName,@foodUnit,@foodCount,@foodPrice,@userName,@status,@mark,@handsel,@bTime,@isPrint,@remark,@jiaocai)";
            DbUtil.ExecuteScalar(sql,
                new MySqlParameter("@billkey", dInfo.BillKey),
                new MySqlParameter("@foodID", dInfo.FoodID),
                new MySqlParameter("@foodCnName", dInfo.FoodCnName),

                new MySqlParameter("@foodUnit", dInfo.FoodUnit),
                new MySqlParameter("@foodCount", dInfo.foodCount),
                new MySqlParameter("@foodPrice", dInfo.FoodPrice),
                new MySqlParameter("@userName", dInfo.UserName),
                new MySqlParameter("@status", dInfo.Stauts),
                new MySqlParameter("@mark", dInfo.Mark),
                new MySqlParameter("@handsel", dInfo.Handsel),
                new MySqlParameter("@bTime", dInfo.Time),
                new MySqlParameter("@isPrint", dInfo.isPrint),
                new MySqlParameter("@remark", dInfo.remark),
                new MySqlParameter("@jiaocai", dInfo.jiaocai));

            sql = "select max(id) from billDetailInfo";

            return Convert.ToInt32(DbUtil.ExecuteScalar(sql));
        }
示例#4
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);
            }
        }
示例#5
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;
        }