Esempio n. 1
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (_canUpdate)
     {
         int id = comboBox1.SelectedIndex;
         if (id >= 0)
         {
             comboBox1.SelectedIndex = -1;
             if (chooseTable != null && chooseTable.Table.TableStatus == true)
             {
                 InputNumber form = new InputNumber();
                 //chooseTable.ListFood.Add(listFood[id]);
                 int num = 1;
                 if (form.ShowDialog(this) == DialogResult.OK)
                 {
                     num = form.getNum();
                 }
                 chooseTable.addFood(listFood[id], num);
                 updateListChoose();
             }
             else
             {
                 MessageBox.Show("Chưa chọn hoặc bàn còn trống!");
             }
         }
     }
     else
     {
         _canUpdate = true;
     }
 }
Esempio n. 2
0
        //打印优惠券
        private void btnCoupon_Click(object sender, EventArgs e)
        {
            InputNumber inputNumber = new InputNumber("输入账单号", false);

            if (inputNumber.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var act_id = inputNumber.number;
            var act    = db.Account.FirstOrDefault(x => x.id == act_id);

            if (act == null)
            {
                return;
            }

            //if (BathClass.ToBool(act.couponPrinted))
            //{
            //    InformationDlg dlg = new InformationDlg("该账单号已经打印");
            //    dlg.ShowDialog();
            //    return;
            //}

            var act_money = BathClass.get_account_money(act);

            if (db.Coupon.Any(x => x.minAmount != null && act_money >= x.minAmount))
            {
                var coupons = db.Coupon.Where(x => x.minAmount != null && act_money >= x.minAmount);
                var coupon  = coupons.OrderByDescending(x => x.money).FirstOrDefault();

                PrintCoupon.Print_Coupon((byte[])coupon.img.ToArray());

                //act.couponPrinted = true;
                db.SubmitChanges();
            }
            else
            {
                InformationDlg dlg = new InformationDlg("未达到最低赠送消费金额");
                dlg.ShowDialog();
            }
        }
Esempio n. 3
0
 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         int id = listView1.Items.IndexOf(listView1.SelectedItems[0]);
         if (chooseTable != null && chooseTable.Table.TableStatus == true)
         {
             InputNumber form = new InputNumber();
             //chooseTable.ListFood.Add(listFood[id]);
             int num = 1;
             if (form.ShowDialog(this) == DialogResult.OK)
             {
                 num = form.getNum();
                 chooseTable.addFood(listFoodCategory[id], num);
                 updateListChoose();
             }
         }
         else
         {
             MessageBox.Show("Chưa chọn hoặc bàn còn trống!");
         }
     }
 }
Esempio n. 4
0
        //手工打折
        private void discountTool_Click(object sender, EventArgs e)
        {
            var      dc   = new BathDBDataContext(LogIn.connectionString);
            Employee oper = null;

            if (BathClass.getAuthority(dc, LogIn.m_User, "手工打折"))
            {
                oper = LogIn.m_User;
            }

            if (oper == null)
            {
                InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
                if (inputEmployee.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (BathClass.getAuthority(dc, inputEmployee.employee, "手工打折"))
                {
                    oper = inputEmployee.employee;
                }
                else
                {
                    BathClass.printErrorMsg("没有手工打折权限");
                    return;
                }
            }
            if (oper == null)
            {
                return;
            }


            InputNumber inputNumberForm = new InputNumber("输入折扣率(<10)");

            if (inputNumberForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            double number       = inputNumberForm.number;
            double discountRate = 0;

            if (number < 1)
            {
                discountRate = number;
            }
            else
            {
                discountRate = number / 10.0;
            }
            var os = dc.Orders.Where(x => m_Seats.Select(y => y.systemId).Contains(x.systemId) && x.deleteEmployee == null);

            foreach (Orders o in os)
            {
                o.money = Math.Round(o.money * discountRate);
            }

            foreach (HotelRoom seat in m_Seats)
            {
                seat.discount         = inputNumberForm.number;
                seat.discountEmployee = oper.id;
            }

            Operation op = new Operation();

            op.employee     = oper.name;
            op.seat         = string.Join("|", m_Seats.Select(y => y.text).ToArray());
            op.openEmployee = string.Join("|", m_Seats.Select(y => y.openEmployee).ToArray());
            //op.openTime = seat.openTime;
            op.explain = "手工打折";
            op.note1   = number.ToString();
            op.note2   = string.Join("|", m_Seats.Select(y => y.systemId).ToArray());
            op.opTime  = BathClass.Now(LogIn.connectionString);
            dc.Operation.InsertOnSubmit(op);

            dc.SubmitChanges();
            dgvExpense_show(dc);
            setStatus(dc);
        }