private void buttonThem_Click(object sender, EventArgs e) { buttonHuyBan.Enabled = true; buttonKetThuc.Enabled = true; buttontTachBan.Enabled = true; buttonGopBan.Enabled = true; buttonChuyenBan.Enabled = true; TableCoffee tableCoffee = listView1.Tag as TableCoffee; int idBill = BillDAO.Instance.getIdBillByIdTable(tableCoffee.Id); int idFood = (comboBoxFood.SelectedItem as Food).Id; int countFood = (int)numericUpDown1.Value; if (idBill == -1) { getDateCheckIn_ver2(); BillDAO.Instance.insertBill(tableCoffee.Id); InforBillDAO.Instance.insertInforBill(BillDAO.Instance.getMaxIdBill(), idFood, countFood); } else { InforBillDAO.Instance.insertInforBill(idBill, idFood, countFood); } showDanhSachMon(tableCoffee.Id); loadTableCoffee(); textBoxCheckOut.Clear(); }
private void button7_Click(object sender, EventArgs e) { TableCoffee tableCoffee = listView1.Tag as TableCoffee; int idBill = BillDAO.Instance.getIdBillByIdTable(tableCoffee.Id); int discountCoffee = (int)numericUpDown2.Value; double totalPrice = Convert.ToDouble(textBoxTongTien.Text.Split(',')[0].Replace(".", "")); double finalTotalPrice = totalPrice - ((totalPrice / 100) * discountCoffee); if (idBill != -1) { if (MessageBox.Show("Bạn có chắc muốn thanh toán cho " + tableCoffee.NameTable + "\nTổng tiền = " + finalTotalPrice + " VNĐ", "Thông Báo", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { textBox9.Clear(); buttonThem.Enabled = false; buttonGiam.Enabled = false; buttonXoa.Enabled = false; buttonXuatBill.Enabled = false; buttonBatDau.Enabled = false; buttonHuyBan.Enabled = false; buttonKetThuc.Enabled = false; buttontTachBan.Enabled = false; buttonGopBan.Enabled = false; buttonChuyenBan.Enabled = false; button7.Enabled = false; CultureInfo cultureInfo = new CultureInfo("vi-VN"); label17.Text = finalTotalPrice.ToString("c", cultureInfo); BillDAO.Instance.checkOut(idBill, discountCoffee, (float)finalTotalPrice); //showDanhSachMon1(tableCoffee.Id); loadTableCoffee(); getDateCheckOut_ver2(); } } }
private void buttonGiam_Click(object sender, EventArgs e) { TableCoffee table = listView1.Tag as TableCoffee; int idBill = BillDAO.Instance.getIdBillByIdTable(table.Id); int idFood = (comboBoxFood.SelectedItem as Food).Id; int countFood = (int)numericUpDown1.Value; if (idBill == -1) { buttonGiam.Enabled = true; } else { InforBillDAO.Instance.insertInforBillVer2(idBill, idFood, countFood); showDanhSachMon(table.Id); loadTableCoffee(); textBoxCheckOut.Clear(); } }