Exemple #1
0
        private void btnThanhToan_Click(object sender, EventArgs e)
        {
            if (tbTenNGH.Text != "" && tbDiaChiNGH.Text != "" && tbSdtNGH.Text != "" && tbMaPT.Text != "" && tbChieuKhau.Text != "" && dtpNgayTao.Text != "" && tbTongTien.Text != "" && tbPhaiTra.Text != "" && tbKhachDua.Text != "" && tbTraLai.Text != "")
            {
                if (tbMaGH.Text == "")
                {
                    tbMaGH.Text = busGH.NextMaGH();
                }
                if (!busGH.IsMaGHExists(tbMaGH.Text))
                {
                    busGH.InsertNGH(new DTO_GiamHo(tbMaGH.Text, tbTenNGH.Text, tbDiaChiNGH.Text, tbSdtNGH.Text));
                }

                //Lấy mã Hóa đơn:
                string NextMaHD = busHD.NextMaHD();

                busHD.InsertHD(new DTO_HoaDon(NextMaHD, Convert.ToDouble(tbChieuKhau.Text), dtpNgayTao.DateTime.ToString("yyyy-MM-dd"), Convert.ToInt32(tbTongTien.Text), this.thuNgan.MATHUNGAN, tbMaGH.Text, tbMaPT.Text));

                busGH.AddMaGHtoKH(tbMaGH.Text);
                MessageBoxEx.Show("Thanh toán thành công");

                //Xuất Hóa đơn ra file:
                HoaDonCreator HoaDonCreator = new HoaDonCreator(NextMaHD);
                HoaDonCreator.ShowReportHoaDon();
            }
            else
            {
                MessageBoxEx.Show("Bạn chưa nhập đủ thông tin");
            }
        }
Exemple #2
0
        private void btnXuat_Click(object sender, EventArgs e)
        {
            HoaDonCreator HoaDonCreator = new HoaDonCreator(MaHD);

            HoaDonCreator.ShowReportHoaDon();
        }