private void btnXoaMon_Click(object sender, EventArgs e) { DTO.Table table = lsvBill.Tag as DTO.Table; int idBill = BillDAO.Instance.GetUncheckBillIDByTableID(table.ID); int foodID = (cbFood.SelectedItem as Food).ID; int count = (int)nmFoodCount.Value; BillInfoDAO.Instance.InsertBillInfo(idBill, foodID, -1); ShowBill(table.ID); LoadTable(); }
private void btnThanhtoan_Click(object sender, EventArgs e) { DTO.Table table = lsvBill.Tag as DTO.Table; int idBill = BillDAO.Instance.GetUncheckBillIDByTableID(table.ID); int discount = (int)nmDiscount.Value; double totalPrice = Convert.ToDouble(tbxTotalPrice.Text.Split(',')[0]) * 1000; double finaltotalprice = totalPrice - (totalPrice / 100) * discount; if (idBill != -1) { if (MessageBox.Show(string.Format("Bạn có chắc thanh toán hoá đơn cho bàn {0}\n Tổng tiền - (Tổng tiền / 100) x Giảm giá = {1} - ({1} / 100 x {2}) = {3}", table.Name, totalPrice, discount, finaltotalprice), "Thông báo", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { BillDAO.Instance.CheckOut(idBill, discount, (float)finaltotalprice); ShowBill(table.ID); } } LoadTable(); }