Exemple #1
0
        private void frmHoaDonXuat_Load(object sender, EventArgs e)
        {
            dgvDSHDXuat.AutoGenerateColumns = dgvDSCTHDXuat.AutoGenerateColumns = false;
            gboTTCTHDXuat.Enabled           = false;
            txtDonGia.Enabled      = false;
            btnXoaHD.Enabled       = false;
            txtMaHD.Enabled        = false;
            txtTenTaiKhoan.Enabled = false;
            txtTongTien.Enabled    = false;
            radTTChoXuLy.Enabled   = radTTDaXuLy.Enabled = false;
            radTTChoXuLy.Checked   = true;

            DataGridViewComboBoxColumn dgvcolNL = (DataGridViewComboBoxColumn)dgvDSCTHDXuat.Columns["colMaNL_CTHD"];
            DataTable dtNguyenLieu = NguyenLieuBUS.LoadDSNguyenLieu();

            // Đỗ dữ liệu cho cbo trong dgv
            dgvcolNL.DataSource    = dtNguyenLieu;
            dgvcolNL.DisplayMember = "TenNL";
            dgvcolNL.ValueMember   = "MaNL";
            // Đỗ dữ liệu cho cbo MaNguyenLieu
            cboMaNL.DataSource    = dtNguyenLieu;
            cboMaNL.DisplayMember = "TenNL";
            cboMaNL.ValueMember   = "MaNL";

            cboMaNL.SelectedValue = -1;
            txtDonGia.Text        = "";

            LoadDSHDXuat();
            LamMoi();
            AddStatus(-1);
        }
 private void btnCapNhat_Click(object sender, EventArgs e)
 {
     if (!RegexForm())
     {
         return;
     }
     else
     {
         GetInfoResultNguyenLieu();
         if (nl != null)
         {
             if (NguyenLieuBUS.CapNhatNguyenLieu(nl))
             {
                 //MessageBox.Show("Cập nhật nguyên liệu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);
                 LoadDSNguyenLieu();
                 LamMoi();
             }
             else
             {
                 MessageBox.Show("Cập nhật nguyên liệu thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Dữ liệu nguyên liệu không tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
 private void QuanLyNguyenLieu_Load(object sender, EventArgs e)
 {
     nlBUS = new NguyenLieuBUS();
     this.loadData_Vao_GridView();
     Kiemtrahsd();
     clear();
 }
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (!RegexForm())
     {
         return;
     }
     else
     {
         GetInfoResultNguyenLieu();
         if (nl != null)
         {
             if (DialogResult.Yes == MessageBox.Show("Bạn có chắc chắn muốn xóa nguyên liệu này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
             {
                 RegexForm();
                 if (NguyenLieuBUS.XoaNguyenLieu(nl.MaNL))
                 {
                     //MessageBox.Show("Xóa nguyên liệu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);
                     LoadDSNguyenLieu();
                     LamMoi();
                     AddStatus(1);
                 }
                 else
                 {
                     MessageBox.Show("Xóa nguyên liệu thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);
                     LoadDSNguyenLieu();
                 }
             }
         }
         else
         {
             MessageBox.Show("Dữ liệu nguyên liệu không tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             LoadDSNguyenLieu();
         }
     }
 }
Exemple #5
0
        private void btnSuaNguyenLieu_Click(object sender, EventArgs e)
        {
            NguyenLieuDTO nguyenLieu = new NguyenLieuDTO();

            nguyenLieu.MaNguyenLieu  = Convert.ToInt32(txtMaNguyenLieu.Text);
            nguyenLieu.TenNguyenLieu = txtTenNguyenLieu.Text;
            if (txtSoLuong.Text != "")
            {
                nguyenLieu.SoLuong = Convert.ToInt32(txtSoLuong.Text);
            }
            else
            {
                nguyenLieu.SoLuong = 0;
            }
            nguyenLieu.DonViTinh = txtDonViTinh.Text;
            nguyenLieu.TrangThai = true;
            if (NguyenLieuBUS.SuaNguyenLieu(nguyenLieu))
            {
                MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LamMoiNguyenLieu();
                NL_LoadDanhSachNguyenLieu(GetTimKiemNguyenLieu());
                dgvNguyenLieu.ClearSelection();
            }
            else
            {
                MessageBox.Show("Sửa thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                nguyenLieu = null;
            }
        }
 private void btnThem_Click(object sender, EventArgs e)
 {
     if (nl == null)
     {
         if (!RegexForm())
         {
             return;
         }
         else
         {
             GetInfoResultNguyenLieu();
             if (NguyenLieuBUS.ThemNguyenLieu(nl))
             {
                 //MessageBox.Show("Thêm nguyên liệu mới thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);
                 LoadDSNguyenLieu();
                 LamMoi();
                 AddStatus(1);
             }
             else
             {
                 MessageBox.Show("Mã nguyên liệu không được phép trùng nhau", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 nl = null;
             }
         }
     }
 }
Exemple #7
0
        public void HienTatCaNguyenLieu()
        {
            List <NguyenLieuDTO> lsNguyenLieu = NguyenLieuBUS.LayDanhSachNguyenLieu();

            rpvBaoCao.LocalReport.ReportEmbeddedResource = path + "rptTatCaNguyenLieu.rdlc";
            rpvBaoCao.LocalReport.DataSources.Add(new ReportDataSource("DSNGUYENLIEU", lsNguyenLieu));
            rpvBaoCao.RefreshReport();
        }
Exemple #8
0
 private void LamMoiNguyenLieu(bool state = true)
 {
     txtMaNguyenLieu.Text          = NguyenLieuBUS.LayMaNguyenLieuMoiNhat() + 1 + "";
     txtTenNguyenLieu.Text         = txtSoLuong.Text = txtDonViTinh.Text = string.Empty;
     btnThemNguyenLieu.Enabled     = state;
     btnXoaNguyenLieu.Enabled      = !state;
     btnSuaNguyenLieu.Enabled      = !state;
     btnKhoiPhucNguyenLieu.Enabled = !state;
 }
Exemple #9
0
 private void cboMaNL_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboMaNL.SelectedIndex == 0)
     {
         txtDonGia.Text = NguyenLieuBUS.LayDonGiaTuMaNL("NL001").ToString();
         if (dgvDSCTHDXuat.Rows.Count > 0)
         {
             bool result = false;
             for (int i = 0; i < dgvDSCTHDXuat.Rows.Count; i++)
             {
                 if (dgvDSCTHDXuat.Rows[i].Cells["colMaNL_CTHD"].Value.ToString() == "NL001")
                 {
                     result = true;
                     break;
                 }
             }
             if (result)
             {
                 lblSLTK.Text = (NguyenLieuBUS.LaySoLuongTKNL("NL001") - CTHDXuatBUS.LaySoLuongHienTai(hd.MaHDXuat, "NL001")).ToString();
             }
         }
         else
         {
             lblSLTK.Text = NguyenLieuBUS.LaySoLuongTKNL("NL001").ToString();
         }
         lblDonViTinh.Text = NguyenLieuBUS.LayDonViTinhTuMaNL("NL001").ToString() + ")";
     }
     else if (cboMaNL.SelectedIndex > 0)
     {
         string maNL = cboMaNL.SelectedValue.ToString();
         txtDonGia.Text = NguyenLieuBUS.LayDonGiaTuMaNL(maNL).ToString();
         lblSLTK.Text   = NguyenLieuBUS.LaySoLuongTKNL(maNL).ToString();
         if (dgvDSCTHDXuat.Rows.Count > 0)
         {
             bool result = false;
             for (int i = 0; i < dgvDSCTHDXuat.Rows.Count; i++)
             {
                 if (dgvDSCTHDXuat.Rows[i].Cells["colMaNL_CTHD"].Value.ToString() == maNL)
                 {
                     result = true;
                     break;
                 }
             }
             if (result)
             {
                 lblSLTK.Text = (NguyenLieuBUS.LaySoLuongTKNL(maNL) - CTHDXuatBUS.LaySoLuongHienTai(hd.MaHDXuat, maNL)).ToString();
             }
         }
         else
         {
             lblSLTK.Text = NguyenLieuBUS.LaySoLuongTKNL(maNL).ToString();
         }
         lblDonViTinh.Text = NguyenLieuBUS.LayDonViTinhTuMaNL(maNL).ToString() + ")";
     }
 }
 void RefeshForm()
 {
     txtMaNL.Text = NguyenLieuBUS.LayMaNLLonNhat();
     txtTenNL.Clear();
     txtDonGia.Clear();
     txtSLTonKho.Clear();
     cboDonViTinh.SelectedValue = -1;
     cboLoaiNL.SelectedValue    = -1;
     cboNhaCC.SelectedValue     = -1;
     chkTrangThai.Checked       = true;
 }
Exemple #11
0
 private void cboMaNL_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboMaNL.SelectedIndex == 0)
     {
         txtDonGia.Text = NguyenLieuBUS.LayDonGiaTuMaNL("NL001").ToString();
     }
     else if (cboMaNL.SelectedIndex > 0)
     {
         string maNL = cboMaNL.SelectedValue.ToString();
         txtDonGia.Text = NguyenLieuBUS.LayDonGiaTuMaNL(maNL).ToString();
     }
 }
Exemple #12
0
        private void btnHoanTat_Click(object sender, EventArgs e)
        {
            if (dgvDSCTHDNhap.Rows.Count == 0)
            {
                MessageBox.Show("Bạn chưa thêm thông CTHD nhập!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (hd != null)
                {
                    hd.MaNCC    = cboNhaCC.SelectedValue.ToString();
                    hd.NgayNhap = dtpNgayNhap.Value;
                    if (HDNhapBUS.CapNhatTrangThaiHD(hd.MaHDNhap, 1) && HDNhapBUS.HoanTatHD(hd))
                    {
                        LoadDSHDNhap();
                        //MessageBox.Show("Tạo hóa đơn thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);


                        // Cập nhật nguyên liệu số lượng tồn kho - tăng
                        for (int i = 0; i < dgvDSCTHDNhap.Rows.Count; i++)
                        {
                            DataTable dt = NguyenLieuBUS.LayDSMaNL();
                            foreach (DataRow dr in dt.Rows)
                            {
                                NguyenLieuDTO nl = new NguyenLieuDTO();
                                nl.MaNL = dr["MaNL"].ToString();
                                if (dgvDSCTHDNhap.Rows[i].Cells["colMaNL_CTHD"].Value.ToString() == nl.MaNL)
                                {
                                    cthd          = new CTHDNhapDTO();
                                    cthd.MaHDNhap = Convert.ToInt32(dgvDSCTHDNhap.Rows[i].Cells["colMaHDNhap_CTHD"].Value);
                                    cthd.MaNL     = dgvDSCTHDNhap.Rows[i].Cells["colMaNL_CTHD"].Value.ToString();
                                    int sltk = NguyenLieuBUS.LaySoLuongTKNL(cthd.MaNL) + CTHDNhapBUS.LaySoLuongHienTai(cthd.MaHDNhap, cthd.MaNL);
                                    if (NguyenLieuBUS.CapNhatSoLuongTonKhoTang(cthd.MaHDNhap, cthd.MaNL, sltk))
                                    {
                                        //MessageBox.Show("Cập nhật số lượng tồn kho thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);
                                    }
                                    else
                                    {
                                        MessageBox.Show("Cập nhật số lượng tồn kho thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Tạo hóa đơn thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
 void TimKiem()
 {
     if (txtTimKiemNL.Text != "")
     {
         dgvDSNguyenLieu.DataSource = NguyenLieuBUS.TimKiemTheoTenNguyenLieu(txtTimKiemNL.Text);
         AddStatus(1);
     }
     else
     {
         LoadDSNguyenLieu();
         AddStatus(1);
     }
 }
 public ChiTietMonAn(MonAnDTO ma)
 {
     maBUS      = new MonAnBUS();
     nlBUS      = new NguyenLieuBUS();
     dsnlBUS    = new DSNguyenLieuBUS();
     qdBUS      = new QuyDinhBUS();
     quydinh    = qdBUS.Laydulieu();
     this.maDTO = ma;
     GiaTien    = ma.dongia;
     InitializeComponent();
     loadDataVaoComboBox();
     loadData_Vao_GridView();
 }
Exemple #15
0
 private void btnKhoiPhucNguyenLieu_Click(object sender, EventArgs e)
 {
     if (NguyenLieuBUS.KhoiPhucNguyenLieu(Convert.ToInt32(txtMaNguyenLieu.Text)))
     {
         MessageBox.Show("Khôi phục thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         NL_LoadDanhSachNguyenLieuDaXoa(GetTimKiemNguyenLieu());
         LamMoiNguyenLieu();
         dgvNguyenLieu.ClearSelection();
     }
     else
     {
         MessageBox.Show("Khôi phục thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public ChiTietHoaDon(hoaDonDTO hoadon)
 {
     maBUS       = new MonAnBUS();
     nlBUS       = new NguyenLieuBUS();
     dsmaBUS     = new DSMonAnBUS();
     hdBUS       = new hoaDonBUS();
     qdBUS       = new QuyDinhBUS();
     dsnlBUS     = new DSNguyenLieuBUS();
     quydinh     = qdBUS.Laydulieu();
     this.hoadon = hoadon;
     InitializeComponent();
     loadDataVaoComboBox();
     loadData_Vao_GridView();
 }
Exemple #17
0
 private void btnXoaNguyenLieu_Click(object sender, EventArgs e)
 {
     if (DialogResult.Yes == MessageBox.Show("Bạn có chắc chắn muốn xoá nguyên liệu này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
     {
         if (NguyenLieuBUS.XoaNguyenLieu(Convert.ToInt32(txtMaNguyenLieu.Text)))
         {
             MessageBox.Show("Xoá thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             LamMoiNguyenLieu();
             NL_LoadDanhSachNguyenLieu(GetTimKiemNguyenLieu());
             dgvNguyenLieu.ClearSelection();
         }
         else
         {
             MessageBox.Show("Xoá thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
        private void FrmQuanLyKho_FormClosed(object sender, FormClosedEventArgs e)
        {
            ((FrmMain)this.ParentForm).TopMost = FrmMain.topMost;
            List <NguyenLieuDTO> lsNguyenLieu = NguyenLieuBUS.LayDanhSachNguyenLieu();

            LoadBangChonNhanh(lsNguyenLieu);
            LoadDanhSachNguyenLieu(lsNguyenLieu);

            if (cmbNguyenLieu.Items.Count > 0)
            {
                btnThem.Enabled = true;
            }
            else
            {
                btnThem.Enabled = false;
            }
        }
Exemple #19
0
 private void dgvDSCTHDXuat_SelectionChanged(object sender, EventArgs e)
 {
     if (dgvDSCTHDXuat.SelectedRows.Count > 0)
     {
         DataGridViewRow dgvRow = dgvDSCTHDXuat.CurrentRow;
         cthd          = new CTHDXuatDTO();
         cthd.MaHDXuat = Convert.ToInt32(dgvRow.Cells["colMaHDXuat_CTHD"].Value.ToString());
         cthd.MaNL     = dgvRow.Cells["colMaNL_CTHD"].Value.ToString();
         cthd.SoLuong  = Convert.ToInt32(dgvRow.Cells["colSoLuong"].Value.ToString());
         cthd.DonGia   = Convert.ToInt32(dgvRow.Cells["colDonGia"].Value.ToString());
         SetInfoCTHD();
         SettingText();
         lblSLTK.Text = NguyenLieuBUS.LaySoLuongTKNL(cthd.MaNL).ToString();
     }
     else
     {
         SetInfoCTHD();
     }
     AddStatus(2);
 }
 void LoadDSNguyenLieu()
 {
     if (chkNLConSuDung.Checked == false)
     {
         dgvDSNguyenLieu.DataSource = NguyenLieuBUS.LoadDSNguyenLieu();
         AddStatus(1);
         btnXoa.Show();
         btnLamMoi.Show();
     }
     else
     {
         dgvDSNguyenLieu.DataSource = NguyenLieuBUS.LoadDSNguyenLieuKhongConSuDung();
         AddStatus(0);
         RefeshForm();
         txtMaNL.Clear();
         chkTrangThai.Checked       = false;
         cboDonViTinh.SelectedIndex = -1;
     }
     dgvDSNguyenLieu.CurrentCell = null;
 }
 private void btnKhoiPhuc_Click(object sender, EventArgs e)
 {
     if (chkNLConSuDung.Checked == true)
     {
         try
         {
             GetInfoResultNguyenLieu();
             if (nl != null)
             {
                 if (NguyenLieuBUS.KhoiPhucTrangThaiNguyenLieu(nl))
                 {
                     //MessageBox.Show("Khôi phục trạng thái nguyên liệu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);
                     LoadDSNguyenLieu();
                 }
             }
         }
         catch
         {
             MessageBox.Show("Khôi phục trạng thái nguyên liệu thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
        private void FrmNhapHang_Load(object sender, EventArgs e)
        {
            grvBangChonNhanh.AutoGenerateColumns = false;

            List <NguyenLieuDTO> lsNguyenLieu = NguyenLieuBUS.LayDanhSachNguyenLieu();

            LoadBangChonNhanh(lsNguyenLieu);
            LoadDanhSachNguyenLieu(lsNguyenLieu);
            LoadNhaCungCap();

            lblMaPhieu.Text  = PhieuNhapBUS.LayMaPhieuNhapMoiNhat() + 1 + "";
            dtpNgayLap.Value = DateTime.Now;

            LamMoi();

            if (cmbNguyenLieu.Items.Count > 0)
            {
                btnThem.Enabled = true;
            }
            else
            {
                btnThem.Enabled = false;
            }
        }
        private void dgvCTPhieuNhap_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            ((DataGridViewComboBoxCell)dgvCTPhieuNhap.Rows[e.RowIndex].Cells["colMaNguyenLieu"]).DataSource    = NguyenLieuBUS.LayDanhSachNguyenLieu();
            ((DataGridViewComboBoxCell)dgvCTPhieuNhap.Rows[e.RowIndex].Cells["colMaNguyenLieu"]).DisplayMember = "TenNguyenLieu";
            ((DataGridViewComboBoxCell)dgvCTPhieuNhap.Rows[e.RowIndex].Cells["colMaNguyenLieu"]).ValueMember   = "MaNguyenLieu";

            lblTongTien.Text    = TinhTongTien().ToString("#,##0đ");
            btnNhapHang.Enabled = true;
        }
Exemple #24
0
        // Bắt đầu khu vực chức năng Quản lý nguyên liệu

        private void NL_LoadDanhSachNguyenLieu(string timKiem = "")
        {
            List <NguyenLieuDTO> lsNguyenLieu = NguyenLieuBUS.LayDanhSachNguyenLieu(timKiem);

            dgvNguyenLieu.DataSource = lsNguyenLieu;
        }
Exemple #25
0
 private void dgvCTPhieuNhap_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
 {
     ((DataGridViewComboBoxCell)dgvCTPhieuNhap.Rows[e.RowIndex].Cells["colCTPN_MaNguyenLieu"]).DataSource    = NguyenLieuBUS.LayDanhSachTatCaNguyenLieu();
     ((DataGridViewComboBoxCell)dgvCTPhieuNhap.Rows[e.RowIndex].Cells["colCTPN_MaNguyenLieu"]).DisplayMember = "TenNguyenLieu";
     ((DataGridViewComboBoxCell)dgvCTPhieuNhap.Rows[e.RowIndex].Cells["colCTPN_MaNguyenLieu"]).ValueMember   = "MaNguyenLieu";
 }
Exemple #26
0
 public SuaNguyenLieu(NguyenLieuDTO nl)
 {
     nlBUS      = new NguyenLieuBUS();
     this.nlDTO = nl;
     InitializeComponent();
 }
Exemple #27
0
        private void btnThemCTHD_Click(object sender, EventArgs e)
        {
            if (txtMaHD_CTHD.Text == "" || txtSoLuongConLai.Text == "" || txtDonGia.Text == "")
            {
                MessageBox.Show("Mời bạn nhập đầy đủ thông tin CTHD xuất!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (Convert.ToInt32(txtSoLuongConLai.Text) >= NguyenLieuBUS.LaySoLuongTKNL(cboMaNL.SelectedValue.ToString()) || Convert.ToInt32(txtSoLuongConLai.Text) >= Convert.ToInt32(lblSLTK.Text))
            {
                MessageBox.Show("Số lượng còn lại không được bằng hoặc vượt quá số lượng tồn kho!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (cthd == null)
                {
                    GetInfoResultCTHDXuat();
                    cthd.SoLuong = NguyenLieuBUS.LaySoLuongTKNL(cthd.MaNL) - Convert.ToInt32(txtSoLuongConLai.Text);
                    if (!CTHDXuatBUS.KiemTraMaNLTonTai(cthd.MaHDXuat, cthd.MaNL))
                    {
                        if (CTHDXuatBUS.ThemCTHDHDXuat(cthd))
                        {
                            if (hd != null)
                            {
                                hd.MaHDXuat = Convert.ToInt32(txtMaHD_CTHD.Text);
                                //Tổng tiền = tổng tiền HD + vs Tiền mới của 1 món ăn mói thêm vào
                                hd.TongTien = HDXuatBUS.LayTongTienHDXuat(hd.MaHDXuat) + (Convert.ToInt32(Convert.ToInt32(txtDonGia.Text) * cthd.SoLuong));
                                if (HDXuatBUS.CapNhatHDXuat(hd.MaHDXuat, hd.TongTien))
                                {
                                    //MessageBox.Show("Thêm thông tin CTHD xuất thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);
                                    LoadDSCTHDXuat(hd.MaHDXuat);
                                    txtTongTien.Text = HDXuatBUS.LayTongTienHDXuat(cthd.MaHDXuat).ToString();
                                }
                            }
                            cthd = null;
                        }
                        else
                        {
                            MessageBox.Show("Thêm thông tin CTHD xuất thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        int sltk = NguyenLieuBUS.LaySoLuongTKNL(cthd.MaNL) - CTHDXuatBUS.LaySoLuongHienTai(cthd.MaHDXuat, cthd.MaNL);
                        cthd.SoLuong = (CTHDXuatBUS.LaySoLuongHienTai(cthd.MaHDXuat, cthd.MaNL) + (sltk - Convert.ToInt32(txtSoLuongConLai.Text)));
                        if (CTHDXuatBUS.CapNhatSoLuong(cthd.SoLuong, cthd.MaHDXuat, cthd.MaNL))
                        {
                            hd.TongTien = HDXuatBUS.LayTongTienHDXuat(hd.MaHDXuat) + (Convert.ToInt32(Convert.ToInt32(txtDonGia.Text) * (sltk - Convert.ToInt32(txtSoLuongConLai.Text))));
                            if (HDXuatBUS.CapNhatHDXuat(hd.MaHDXuat, hd.TongTien))
                            {
                                LoadDSCTHDXuat(hd.MaHDXuat);
                                txtTongTien.Text = HDXuatBUS.LayTongTienHDXuat(cthd.MaHDXuat).ToString();

                                //MessageBox.Show("Thêm số lượng thông tin CTHD xuất thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.None);
                            }
                        }
                        cthd = null;
                    }
                    AddStatus(-2);
                }
            }
        }