Beispiel #1
0
        private void btnThanhToan_Click(object sender, EventArgs e)
        {
            BanAn banan = lstvHoaDon.Tag as BanAn;

            int idHoaDon = HoaDonDAO.Instance.GetBillByTableID(banan.IDBanAn1);
            int discount = (int)nmrGG.Value;

            double totalprice = Convert.ToDouble(txtTongTien.Text.Split(',')[0]);

            double totaldiscount = 0;

            if (discount == 0)
            {
                totaldiscount = 0;
            }
            else
            {
                totaldiscount = (totalprice / 100) * discount;
            }
            double finaltotalPrice = totalprice - totaldiscount;

            if (idHoaDon != -1)
            {
                if (MessageBox.Show(string.Format("Bạn chắc chắn muốn thanh toán hóa đơn  cho bàn :{0} \n  \nTiền : {1} \n \n Tiền được giảm giá : {2}  \n \n Tổng Tiền : {3} ", banan.TenBanAn1, totalprice, totaldiscount, finaltotalPrice), "Thông Báo", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    HoaDonDAO.Instance.ThanhToan(idHoaDon, discount, (float)finaltotalPrice);
                    ShowHoaDon(banan.IDBanAn1);
                    LoadBanAn();
                }
            }
        }
Beispiel #2
0
        private void btnThemSP_Click(object sender, EventArgs e)
        {
            BanAn banan = lstvHoaDon.Tag as BanAn;

            if (banan == null)
            {
                MessageBox.Show("Hãy chọn bàn trước khi thêm sản phẩm");
                return;
            }
            int idHD = HoaDonDAO.Instance.GetBillByTableID(banan.IDBanAn1);

            int idSanPham = (cmbSP.SelectedItem as SanPham).IDSanPham1;

            int SoLuong = (int)nmrThemMon.Value;


            if (idHD == -1)
            {
                HoaDonDAO.Instance.InsertHoaDon(banan.IDBanAn1);

                ChiTietHoaDonDAO.Instance.InsertChiTietHoaDon(HoaDonDAO.Instance.GetMaxIDHoaDon(), idSanPham, SoLuong);
            }
            else
            {
                ChiTietHoaDonDAO.Instance.InsertChiTietHoaDon(idHD, idSanPham, SoLuong);
            }
            ShowHoaDon(banan.IDBanAn1);

            LoadBanAn();
        }
 public FormManHinhChinh()
 {
     InitializeComponent();
     banan     = new BanAn();
     chitiethd = new ChiTietHoaDon();
     loaita    = new LoaiThucAn();
     thucan    = new ThucAn();
     hoadon    = new HoaDon();
 }
Beispiel #4
0
 public FormManHinhChinh()
 {
     InitializeComponent();
     banan                = new BanAn();
     chitiethd            = new ChiTietHoaDon();
     loaita               = new LoaiThucAn();
     thucan               = new ThucAn();
     hoadon               = new HoaDon();
     nv                   = new NhanVien();
     thongKeHoaDonBuilder = new ThongKeHoaDonBuilder();
 }