private void DanhSachHD_Load(object sender, EventArgs e)
        {
            HoaDonBUS objHD = new HoaDonBUS();

            if (objHD.GetHD() != null)
            {
                dgvHD.DataSource = objHD.GetHD();
            }
            else
            {
                MessageBox.Show("Lỗi dữ liệu không thể tải danh sách");
            }
        }
Beispiel #2
0
 //luu thong tin no,tao hoa don
 private void butTao_Click(object sender, EventArgs e)
 {
     hd.No      = int.Parse(txtTongtien.Text) - int.Parse(txtTientra.Text);
     hd.TienTra = int.Parse(txtTientra.Text);
     if (hd.TongTien < hd.TienTra)
     {
         MessageBox.Show("Tiền trả quá tổng tiền");
         txtTientra.Focus();
     }
     else
     {
         HoaDonBUS objHD = new HoaDonBUS();
         string    sohd  = "HD";
         int       stt   = objHD.GetHD().Rows.Count + 1;
         for (int i = 0; i < 2 - stt.ToString().Length; i++)
         {
             sohd += "0";
         }
         sohd            += stt.ToString();
         hd.SoHD          = sohd;
         labSohd.Text     = sohd;
         labNgaylap.Text  = txtNgaylap.Text;
         labTenkh.Text    = hd.TenKH;
         labTensach.Text  = hd.TenSach;
         labTheloai.Text  = hd.Theloai;
         labSl.Text       = txtSl.Text;
         labTongtien.Text = txtTongtien.Text;
         labTientra.Text  = txtTientra.Text;
         labNo.Text       = hd.No.ToString();
         labDongia.Text   = hd.Gia.ToString();
         butTao.Enabled   = false;
         butLuu.Enabled   = true;
     }
 }