Example #1
0
 private void loadCTHDNH()
 {
     balChiTietHD = new BALChiTietHDBanHang();
     try
     {
         if (balChiTietHD.LayChiTietHDBanHangTheoMaHD(txtMaHD.Text).Tables[0].Rows.Count != 0)
         {
             this.gridDSKH.DataSource = balChiTietHD.LayChiTietHDBanHangTheoMaHD(txtMaHD.Text).Tables[0];
             //int rowSelected2 = gridView2.FocusedRowHandle;
             //txtSP.Text = gridView2.GetRowCellValue(rowSelected2, "MaSP").ToString();
             //txtSL.Text = gridView2.GetRowCellValue(rowSelected2, "DonGia").ToString();
             //txtSL.Text = gridView2.GetRowCellValue(rowSelected2, "SoLuong").ToString();
             //txtTT.Text = gridView2.GetRowCellValue(rowSelected2, "ThanhTien").ToString();
         }
     }
     catch (SqlException error)
     {
         MessageBox.Show("Không truy cập dữ liệu hóa đơn nhập hàng được!\rLỗi: " + error.Message, "Lỗi SQL", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception er)
     {
         MessageBox.Show("Không truy cập dữ liệu hóa đơn nhập hàng được!\rLỗi: " + er.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     //HienThiChucNangCTHD(true);
     //HienThiHanhDongCTHD(false);
 }
 private void loadHoaDonBan()
 {
     balChiTietBanHang = new BALChiTietHDBanHang();
     balHoaDonBanHang  = new BAHoaDonBanHang();
     try
     {
         if (balHoaDonBanHang.LayListHoaDonBanHang().Tables[0].Rows.Count != 0)
         {
             this.gridHdBanHang.DataSource = balHoaDonBanHang.LayListHoaDonBanHang().Tables[0];
             int rowSelected2 = gridView1.FocusedRowHandle;
             txtMaHDBan.Text       = gridView1.GetRowCellValue(rowSelected2, "MaHD").ToString();
             dtNgayLapHD.EditValue = (DateTime)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NgayLapHD");
             txtMaNV.Text          = gridView1.GetRowCellValue(rowSelected2, "MaNV").ToString();
             txtMaKH.Text          = gridView1.GetRowCellValue(rowSelected2, "MaKH").ToString();
             txtThanhTienBAn.Text  = gridView1.GetRowCellValue(rowSelected2, "ThanhTien").ToString();
             this.gridChiTietHDBanHang.DataSource = balChiTietBanHang.LayChiTietHDBanHangTheoMaHD(txtMaHDBan.Text).Tables[0];
         }
     }
     catch (SqlException error)
     {
         MessageBox.Show("Không truy cập dữ liệu chi tiết hóa đơn bán hàng được!\rLỗi: " + error.Message, "Lỗi SQL", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception er)
     {
         MessageBox.Show("Không truy cập dữ liệu chi tiết hóa đơn bán hàng được!\rLỗi: " + er.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     //HienThiChucNangCTHD(true);
     //HienThiHanhDongCTHD(false);
 }
Example #3
0
 private void FormBanHang_Load(object sender, EventArgs e)
 {
     balHoaDon    = new BAHoaDonBanHang();
     balChiTietHD = new BALChiTietHDBanHang();
     LoadLoaiSP();
     gbThongTin.Enabled = false;
     txtNhanVien.Text   = "1";
 }