Exemple #1
0
        private void buttonCheckOut_Click(object sender, EventArgs e)
        {
            Table table = lsvBill.Tag as Table;

            int    idBill          = billBUS.GetUncheckBillIDByTableID(table.IdTable);
            int    discount        = (int)nmDisCount.Value;
            double totalPrice      = Convert.ToDouble(txbTotalPrice.Text.Split(',')[0]);
            double finalTotalPrice = totalPrice - (totalPrice / 100) * discount;

            CultureInfo culture = new CultureInfo("vi-VN");

            txbTotalPrice.Text = finalTotalPrice.ToString("c", culture);

            if (idBill != -1)
            {
                if (MessageBox.Show("Bạn có chắc thanh toán hóa đơn cho bàn " + table.TableName + "\n Mã hóa đơn :" + idBill + "\n Tổng tiền: " + totalPrice + "\n giảm giá :" + discount + "%" + "\n Thành tiền :" + finalTotalPrice, "Thông báo", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    billBUS.CheckOut(idBill, table.IdTable, discount, (float)finalTotalPrice);
                    textBoxListFoodName.Text         = string.Empty;
                    numericUpDownListFoodCount.Value = 1;
                    ShowBill(table.IdTable);

                    LoadTable();
                }
            }
        }