private void btncheckout_Click(object sender, EventArgs e) { if (lsvBill.Tag == null) { MessageBox.Show("Hãy chọn bàn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TableDTO table = lsvBill.Tag as TableDTO; int idtable = table.ID; int idbill = BillDAO.GetUncheckedBillIDByTableID(idtable); int giamgia = (int)nmGiamGia.Value; //double TongTien = Convert.ToDouble(txtTongTien.Text.Split(',')[0]); //double TongTienGiamGia = TongTien - (TongTien/100)*giamgia; float TongTienGiamGia = thanhtoan - (thanhtoan / 100) * giamgia; if (idbill != -1) { if (MessageBox.Show(string.Format("Bạn có chắc thanh toán hóa đơn với số tiền là {0}-({1}/100)*{2} = {3}", thanhtoan, thanhtoan, giamgia, TongTienGiamGia), "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { BillDAO.CheckOut(idbill, giamgia, TongTienGiamGia); Showbill(idtable); LoadTable(); } } nmGiamGia.Value = 0; }
private void btnPay_Click(object sender, EventArgs e) { Table table = listViewMenu.Tag as Table; BillDAO billDAO = new BillDAO(); var response = billDAO.GetUnPaidBill(table.id); String idCurrentBill = response.Content; if (idCurrentBill != "0") { if (MessageBox.Show("Bạn có chắc thanh toán cho " + table.title + " không?", "Thanh toán", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { billDAO.CheckOut(idCurrentBill, (float)numericUpDownDiscount.Value); if (numericUpDownDiscount.Value != 0) { double totalPrice = Convert.ToDouble(txbTotalPrice.Text.Split(',')[0]) * 1000; double final_price = totalPrice - (totalPrice / 100) * (float)numericUpDownDiscount.Value; string text = "Số tiền bạn cần thanh toán sau khi giảm giá " + numericUpDownDiscount.Value + "% là:\n" + totalPrice.ToString() + " - " + totalPrice.ToString() + " * " + numericUpDownDiscount.Value + "% =" + final_price.ToString() + " VND"; MessageBox.Show(text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //SẼ PHÁT TRIỂN THÊM IN HÓA ĐƠN FILE EXCEL } loadMenuByIdTable(table.id); CultureInfo culture = new CultureInfo("vi-VN"); int finalPrice = 0; txbTotalPrice.Text = finalPrice.ToString("c", culture); } } loadFinalTotalPrice(table.id); loadTable(table.id); //loadListTable(); numericUpDownDiscount.Value = 0; }