Exemplo n.º 1
0
        private void btnAddFood_Click(object sender, EventArgs e)
        {
            Table table = lsvBill.Tag as Table;

            if (table == null)
            {
                MessageBox.Show("Vui lòng chọn bàn");
                return;
            }

            int idBill = billBUS.GetUncheckBillIDByTableID(table.IdTable);
            int foodID = (int)dataGridViewListFood.CurrentRow.Cells["idFood"].Value;
            int count  = (int)nmFoodCount.Value;

            if (idBill == -1)
            {
                billBUS.InsertBill(table.IdTable);
                BillInforBUS.InsertBillInfo(billBUS.GetMaxIDBill(), foodID, count);
            }
            else
            {
                BillInforBUS.InsertBillInfo(idBill, foodID, count);
            }

            ShowBill(table.IdTable);
            LoadTable();
        }
Exemplo n.º 2
0
        private void btnCreateBill_Click(object sender, EventArgs e)
        {
            currentBillId = BillBUS.InsertBill(DateTime.Now, 0, Program.sAccount.ID);
            txtHD.Text    = "HD00" + currentBillId;
            //btnCreateBill.Enabled = false;
            btnLamMoi.Enabled = false;

            LoadListBillNoPayment();
        }
Exemplo n.º 3
0
 private void lstSanPham_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lstSanPham.SelectedItems.Count > 0)
     {
         DrinkDTO drink = lstSanPham.SelectedItems[0].Tag as DrinkDTO;
         // Them qua ListView
         //kiểm tra đã chọn bàn hay chưa
         try
         {
             if (choseTable != null)
             {
                 if ((objTable as Button).Tag != null)
                 {
                     Button btnTable = (objTable as Button);
                     //tag cái bàn đang chọn vào
                     TableDTO table   = (objTable as Button).Tag as TableDTO;
                     int      idTable = table.ID;
                     if (TableBUS.GetStatusByIDTable(idTable) == 0)
                     {
                         DialogResult kq = MessageBox.Show("Bạn đang chọn bàn mới.\n Bạn có muốn tạo hóa đơn mới cho bàn này chứ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                         if (kq == DialogResult.OK)
                         {
                             btnThanhToan.Enabled = true;
                             btnTamTinh.Enabled   = true;
                             lstBill.Tag          = (choseTable as Button).Tag;
                             //ShowBill(idTable);
                             // Cap nhat trang thai bàn
                             TableBUS.UpdateStatusTable(1, idTable);
                             // Tao hóa đơn mới ở đây.
                             BillBUS.InsertBill(DateTime.Now, 0, Program.sAccount.ID, idTable);
                             txtHD.Text    = "HD00" + (string)BillBUS.GetIDBillNoPaymentByIDTable((int)idTable).ToString();
                             btnTable.Text = table.NameTable + Environment.NewLine + "Có";
                         }
                         else
                         {
                             lstBill.Items.Clear();
                             btnThanhToan.Enabled   = false;
                             btnTamTinh.Enabled     = false;
                             cbLoaiThucUong.Enabled = false;
                             txtHD.Text             = "";
                         }
                     }
                     table = CreateAddBillByIDTable(drink);
                     ShowBill(table.ID);
                 }
             }
             else
             {
                 MessageBox.Show("Bạn chưa chọn bàn để thêm thức uống. Vui lòng chọn bàn để tiếp tục!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Question);
             }
         }
         catch
         {
             MessageBox.Show("Hệ thống đang bảo trì, bạn quay lại sau nhé!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Question);
         }
     }
 }
Exemplo n.º 4
0
        public void SaveHD()
        {
            if (dgvListMonAn.Rows.Count == 0)
            {
                MessageBox.Show("Vui Lòng thêm món mới.");
                return;
            }
            string   total    = txtTotal.Text;
            string   pay      = txtPayment.Text;
            string   discount = nbDiscount.Value.ToString();
            string   bal      = txtBalance.Text;
            DateTime time     = DateTime.Now;
            Bill     dtoo     = new Bill
            {
                TimeOfCreate = time,
                SumOfMoney   = Double.Parse(total),
                Discount     = int.Parse(discount),
                Pay          = double.Parse(pay),
                Balance      = double.Parse(bal)
            };
            int    lastid = billBUS.InsertBill(dtoo);
            string MilkteaID;
            int    price = 0;
            int    qty   = 0;
            int    tot   = 0;
            bool   check = false;

            for (int row = 0; row < dgvListMonAn.Rows.Count; row++)
            {
                MilkteaID = dgvListMonAn.Rows[row].Cells[0].Value.ToString();
                //string MilkTeaID =dgvListMonAn.Rows[row].Cells[0].Value.ToString();
                qty   = int.Parse(dgvListMonAn.Rows[row].Cells[2].Value.ToString());
                price = int.Parse(dgvListMonAn.Rows[row].Cells[3].Value.ToString());
                tot   = int.Parse(dgvListMonAn.Rows[row].Cells[4].Value.ToString());

                BillInfo dtoBillInfo = new BillInfo
                {
                    BillID    = lastid,
                    MilkTeaID = MilkteaID,
                    Quantity  = qty,
                    Price     = price,
                    Money     = tot
                };
                check = billInfoBUS.InsertBillInfo(dtoBillInfo);
                check = true;
            }
            if (check)
            {
                MessageBox.Show("Save Successful.");
            }
        }