Example #1
0
 private void InitTabs()
 {
     if (lbEnvs.Items.Count == 0)
         return;
     TabInfoService service = new TabInfoService();
     dvTabs.Rows.Clear();
     dvTabs.Columns[0].Width = 100;
     dvTabs.Columns[1].Width = 150;
     dvTabs.Columns[2].Width = 150;
     dvTabs.Columns[3].Width = 250;
     if (lbEnvs.SelectedIndex <= 0)
     {
         List<TabInfo> tabs = service.GetAllTabs();
         dvTabs.Rows.Clear();
         foreach (TabInfo tab in tabs)
         {
             dvTabs.Rows.Add(tab.id, tab.tabName, tab.envName, tab.createTime);
         }
     }
     else
     {
         List<TabInfo> tabs = service.GetAllTabsByEnvName(lbEnvs.SelectedItem.ToString());
         foreach (TabInfo tab in tabs)
         {
             dvTabs.Rows.Add(tab.id, tab.tabName, tab.envName, tab.createTime);
         }
     }
 }
Example #2
0
 private void tbTabName_TextChanged(object sender, EventArgs e)
 {
     dvTabs.Rows.Clear();
     TabInfoService service = new TabInfoService();
     List<TabInfo> tabs = service.GetAllTabsByNameLike(tbTabName.Text.Trim());
     foreach (TabInfo tab in tabs)
     {
         dvTabs.Rows.Add(tab.id, tab.tabName, tab.envName, tab.createTime);
     }
 }
Example #3
0
 private void InitTabs()
 {
     TabInfoService service = new TabInfoService();
     List<TabInfo> tabs = service.GetAllTabs();
     foreach (TabInfo t in tabs)
     {
         if (t.status.Equals("空闲"))
         {
             cbNewTabName.Items.Add(t.tabName);
         }
     }
 }
Example #4
0
        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;
        }
Example #5
0
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     string envName = lbEnvs.SelectedItem.ToString();
     if (envName != "")
     {
         //MessageBox.Show(envName);
         TabInfoService service = new TabInfoService();
         List<TabInfo> tabs = service.GetAllTabsByEnvName(envName);
         if (tabs.Count > 0)
         {
             DialogResult res = MessageBox.Show(envName + "有未删除的餐桌信息,确定要删除该餐桌环境吗?", "删除确认", MessageBoxButtons.OKCancel);
             if (res == System.Windows.Forms.DialogResult.OK)
             {
                 TabEnvService.DelTabEnv(envName);
                 InitTabEnvs();
             }
         }
         else
         {
             TabEnvService.DelTabEnv(envName);
             InitTabEnvs();
         }
     }
 }
Example #6
0
 private void tcTabs_SelectedIndexChanged(object sender, EventArgs e)
 {
     // 计算开台率
     try
     {
         TabInfoService service = new TabInfoService();
         List<TabInfo> tabs = service.GetAllTabsByEnvName(tcTabs.SelectedTab.Text.Trim());
         if (tabs.Count == 0)
         {
             lbOpenPretage.Text = string.Format("开台率:{0}", "0.00%");
         }
         else
         {
             int count = 0;
             foreach (TabInfo tab in tabs)
             {
                 if (tab.status != "空闲")
                 {
                     count++;
                 }
             }
             lbOpenPretage.Text = string.Format("开台率:{0}", ((double)count/(double)tabs.Count).ToString("P"));
         }
     }
     catch { }
 }
Example #7
0
        void lb_Click(object sender, EventArgs e)
        {
            Label lb = (Label)sender;
            string tabName = lb.Text;
            this.tabName = tabName;
            InitBaseInfo(tabName);
            InitBillDetailInfo(tabName);

            TabInfoService service = new TabInfoService();
            string tabStatus = TabInfoService.GetTabStatusByTabName(tabName);
            switch (tabStatus)
            {
                case "空闲":
                    if (App.userGights.Contains("点餐"))
                    {
                        lbUserTab.BackColor = Color.LightGreen;
                        lbOrder.BackColor = Color.Gray;
                        lbCheckout.BackColor = Color.Gray;
                        lbChangeTab.BackColor = Color.Gray;
                        lbReset.BackColor = Color.Gray;
                    }
                    else
                    {
                        lbUserTab.BackColor = Color.Gray;
                        lbOrder.BackColor = Color.Gray;
                        lbCheckout.BackColor = Color.Gray;
                        lbChangeTab.BackColor = Color.Gray;
                        lbReset.BackColor = Color.Gray;
                    }
                    break;
                case "开台":
                case "点餐":
                case "加餐":
                    if (App.userGights.Contains("点餐"))
                    {
                        lbUserTab.BackColor = Color.Gray;
                        lbOrder.BackColor = Color.LightGreen;
                        lbCheckout.BackColor = Color.LightGreen;
                        lbChangeTab.BackColor = Color.LightGreen;
                        lbReset.BackColor = Color.Gray;
                    }
                    else
                    {
                        lbUserTab.BackColor = Color.Gray;
                        lbOrder.BackColor = Color.Gray;
                        lbCheckout.BackColor = Color.Gray;
                        lbChangeTab.BackColor = Color.Gray;
                        lbReset.BackColor = Color.Gray;
                    }
                    break;

                case "结账":
                    if (App.userGights.Contains("收银"))
                    {
                        lbUserTab.BackColor = Color.Gray;
                        lbOrder.BackColor = Color.Gray;
                        lbCheckout.BackColor = Color.Gray;
                        lbChangeTab.BackColor = Color.Gray;
                        lbReset.BackColor = Color.LightGreen;
                    }
                    else
                    {
                        lbUserTab.BackColor = Color.Gray;
                        lbOrder.BackColor = Color.Gray;
                        lbCheckout.BackColor = Color.Gray;
                        lbChangeTab.BackColor = Color.Gray;
                        lbReset.BackColor = Color.Gray;
                    }
                    break;
                default:
                    break;
            }
        }
Example #8
0
 private void lbReset_Click(object sender, EventArgs e)
 {
     if (tabName != "")
     {
         if (ValidLB((Label)sender))
         {
             TabInfoService service = new TabInfoService();
             service.UpdateTabInfoStatus(tabName, "空闲");
             UpdateTabs();
         }
     }
     else
     {
         MessageBox.Show("请选择需要换桌的餐桌");
     }
 }
Example #9
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);
            }
        }
Example #10
0
        private void InitTabs()
        {
            foreach (TabPage page in tcTabs.TabPages)
            {
                int width = page.Width;
                int height = page.Height;
                int lbWidth = width / 12;
                int lbHeight = height / 8;
                String envName = page.Text.Trim();
                TabInfoService service = new TabInfoService();
                List<TabInfo> tabs = service.GetAllTabsByEnvName(envName);
                for (int i = 0; i < 6; i++)
                {
                    for (int j = 0; j < 10; j++)
                    {
                        int cco = i * 6 + j;

                        if (cco < tabs.Count)
                        {
                            TabInfo tab = tabs[cco];
                            if (tab == null)
                                return;
                            Label lb = new Label();
                            lb.Text = tab.tabName;
                            lb.ForeColor = Color.White;

                            lb.TextAlign = ContentAlignment.MiddleCenter;
                            lb.BorderStyle = BorderStyle.FixedSingle;
                            //lb.AutoSize = false;
                            lb.Size = new Size(lbWidth, lbHeight);
                            lb.ContextMenuStrip = ops;
                            lb.Click += new EventHandler(lb_Click);
                            //lb.MouseEnter += new EventHandler(lb_MouseEnter);
                            //lb.MouseLeave += new EventHandler(lb_MouseLeave);
                            lb.Location = new Point(10 + j * width / 10, 15 + i * height / 6);
                            page.Controls.Add(lb);
                            switch (tab.status)
                            {
                                case "空闲":
                                    lb.BackColor = Color.LightGreen;
                                    break;
                                case "开台":
                                case "点餐":
                                case "加餐":
                                    lb.BackColor = Color.Red;
                                    break;
                                case "结账":
                                    lb.BackColor = Color.Blue;
                                    break;
                                default:
                                    lb.BackColor = Color.LightGreen;
                                    break;
                            }
                        }
                    }
                }
            }
        }
Example #11
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;
        }
Example #12
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;
            }
        }
Example #13
0
        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;
        }