Exemple #1
0
        private void btnTimnhacungcap_Click(object sender, EventArgs e)
        {
            frmTraCuu fr = new frmTraCuu("DonDatHang_NhaCungCap", "NhaCungCap");

            fr.ShowDialog();
            BindHangHoa();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (hanhdong == "Insert")
     {
         frmTraCuu fr = new frmTraCuu("HoaDonNhap_MaDonDatHang", "MaDonDatHang");
         fr.ShowDialog();
         BindHangHoa();
     }
 }
 private void txtManhacungcap_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F4)
     {
         if (hanhdong == "Insert")
         {
             frmTraCuu fr = new frmTraCuu("HoaDonNhap_NhaCungCap", "HoaDonNhap");
             fr.ShowDialog();
             BindHangHoa();
         }
     }
 }
Exemple #4
0
 private void txtManhacungcap_KeyDown(object sender, KeyEventArgs e)
 {
     if (this.HanhDong == "Insert")
     {
         if (e.KeyCode == Keys.F4)
         {
             frmTraCuu fr = new frmTraCuu("DonDatHang_NhaCungCap", "NhaCungCap");
             fr.ShowDialog();
             BindHangHoa();
             ResetTool();
         }
     }
 }
 private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
 {
     if (chekChonLoai.Checked == true)
     {
         if (e.KeyCode == Keys.F4)
         {
             frmTraCuu fr = new frmTraCuu("HoaDonDat_HangHoa", "HoaDonHangHoa");
             fr.ShowDialog();
             BindHangHoa();
         }
     }
     else
     {
     }
 }
 private void txtMadondathang_KeyDown(object sender, KeyEventArgs e)
 {
     if (chekChonLoai.Checked == true)
     {
         if (e.KeyCode == Keys.F4)
         {
             if (hanhdong == "Insert")
             {
                 frmTraCuu fr = new frmTraCuu("HoaDonNhap_MaDonDatHang", "MaDonDatHang");
                 fr.ShowDialog();
                 BindHangHoa();
             }
         }
     }
 }
Exemple #7
0
 private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F4)
     {
         if (cbxKhoban.Text != "")
         {
             frmTraCuu fr = new frmTraCuu("KiemKeKho_HangHoa", "HangHoa");
             fr.ShowDialog();
             BindHangHoa();
         }
         else
         {
             MessageBox.Show("Chọn kho hàng");
         }
     }
 }
Exemple #8
0
 private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F4)
     {
         if (txtManhacungcap.Text.Length > 0)
         {
             frmTraCuu fr = new frmTraCuu("DonDatHang_HangHoa", "HangHoa");
             fr.ShowDialog();
             BindHangHoa();
         }
         else
         {
             MessageBox.Show("Nhập mã nhà cung cấp");
         }
     }
 }
 private void btnTimnhacungcap_Click(object sender, EventArgs e)
 {
     try
     {
         GiaTriCanLuu.Ma = null;
         GiaTriCanLuu.Ten = null;
         GiaTriCanLuu.Giatri2 = null;
         if (check_loaidathang.Checked == true)
         {
             frmTraCuu fr = new frmTraCuu("DonDatHang_NhaCungCap", "NhaCungCap");
             fr.ShowDialog();
         }
         if (check_loaidathang.Checked == false)
         {
             frmTraCuu fr = new frmTraCuu("DonDatHang_KhachHang", "KhachHang");
             fr.ShowDialog();
         }
         BindHangHoa();
         if (GiaTriCanLuu.Ma == null)
         { txtManhacungcap.Text = "<F4-Tra cứu>"; }
         if (dgvInsertOrder.RowCount > 0)
         { TinhToan(); }
         else
         { reset(); }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
        private void KeyDown_Chung(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F4)
                {
                    switch (this.tenForm)
                    {
                        case "KhachHangTraLai":
                            if (txtChungtugoc.Text != "" && txtChungtugoc.Text != "<F4 - Tra cứu>")
                            {
                                frmTraCuu fr = new frmTraCuu("ChiTietKhachHangTraLaiHang_HangHoa", "HangHoaTraLai", txtChungtugoc.Text, loaihoadon(rdoBanbuon, rdoBanle));
                                fr.ShowDialog();
                                BindHangHoa();

                            }
                            else
                            {
                                MessageBox.Show("Nhập mã hóa đơn bán hàng");
                                txtChungtugoc.Text = "";
                                txtChungtugoc.Focus();
                            }
                            break;
                        case "TraLaiNhaCungCap":
                            if (txtChungtugoc.Text != "" && txtChungtugoc.Text != "<F4 - Tra cứu>")
                            {
                                frmTraCuu fr = new frmTraCuu("ChiTietTraLaiNhaCungCap_MaHangHoa", "ThongTinTraLaiNhaCungCap", txtChungtugoc.Text);
                                fr.ShowDialog();
                                BindHangHoa();
                            }
                            else
                            {
                                MessageBox.Show("Nhập mã hóa đơn mua hàng");
                                txtChungtugoc.Focus();
                                txtChungtugoc.Text = "";
                            }
                            break;
                        default:
                            break;
                    }
                    if (toolStrip_txtTracuu.Text.Length <= 0)
                    {
                        ResetTool();
                    }
                }
                if (e.KeyCode == Keys.F5)
                {
                    txtThanhtoanngay_Click(sender, e);
                    txtThanhtoanngay.Focus();
                }
                if (e.KeyCode == Keys.F6)
                {
                    dgvXemthongtin.Focus();
                }
            }
            catch
            {
            }
        }
 private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
 {
     if (chekChonLoai.Checked == true)
     {
         if (e.KeyCode == Keys.F4)
         {
             frmTraCuu fr = new frmTraCuu("HoaDonDat_HangHoa", "HoaDonHangHoa");
             fr.ShowDialog();
             BindHangHoa();
         }
     }
     else
     { }
 }
 private void txtMadondathang_KeyDown(object sender, KeyEventArgs e)
 {
     if (chekChonLoai.Checked == true)
     {
         if (e.KeyCode == Keys.F4)
         {
             if (hanhdong == "Insert")
             {
                 frmTraCuu fr = new frmTraCuu("HoaDonNhap_MaDonDatHang", "MaDonDatHang");
                 fr.ShowDialog();
                 BindHangHoa();
             }
         }
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (chekChonLoai.Checked == true)
         {
             ngaythangnam = "KhongCo";
             if (hanhdong == "Insert")
             {
                 if (txtManhacungcap.Text != "<F4 -Tra cứu>" && txtManhacungcap.Text != "")
                 {
                     GiaTriCanLuu.Ma = null;
                     GiaTriCanLuu.Ten = null;
                     GiaTriCanLuu.Giatri = null;
                     dgvInsertOrder.DataSource = null;
                     Entities.HienThi_ChiTiet_DonDatHang[] lay = new Entities.HienThi_ChiTiet_DonDatHang[0];
                     dgvInsertOrder.DataSource = lay;
                     DoiTen(dgvInsertOrder);
                     reset();
                     frmTraCuu fr = new frmTraCuu("HoaDonNhap_MaDonDatHang", "MaDonDatHang", txtManhacungcap.Text);
                     fr.ShowDialog();
                     BindHangHoa();
                     if (GiaTriCanLuu.Ma.Length <= 0)
                     { txtMadondathang.Text = "<F4 -Tra cứu>"; }
                     if (dgvInsertOrder.RowCount > 0)
                     { TinhToan(); txtTienTraLai.Text = "0"; }
                     else
                     { reset(); }
                     ngaythangnam = "";
                 }
                 else
                 { MessageBox.Show("Nhập mã nhà cung cấp"); }
             }
         }
     }
     catch { }
 }
        private void btnTimchungtu_Click(object sender, EventArgs e)
        {
            frmTraCuu fr = new frmTraCuu();

            fr.ShowDialog();
        }
        private void txtmahanghoa_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F4)
                {
                    frmTraCuu fr = new frmTraCuu("XuLyKhachHang", "HangHoa");
                    fr.ShowDialog();
                    BindHangHoa();

                }
            }
            catch
            {
            }
        }
 private void TraCuuMa()
 {
     try
     {
         GiaTriCanLuu.Ma = null;
         GiaTriCanLuu.Ten = null;
         GiaTriCanLuu.Giatri2 = null;
         if (tenForm == "KhachHangTraLai")
         {
             if (hanhDong == "Them_KhachHangTraLai")
             {
                 frmTraCuu fr = new frmTraCuu("HangTraLai_KhachHangTraLai_KhachHang", "KhachHangTralaiHang", loaihoadon(rdoBanbuon, rdoBanle));
                 fr.ShowDialog();
             }
             Binding();
         }
         if (tenForm == "TraLaiNhaCungCap")
         {
             if (hanhDong == "Them_TraLaiNhaCungCap")
             {
                 frmTraCuu fr = new frmTraCuu("HangTraLai_TraLaiNhaCungCap", "NhaCungCap");
                 fr.ShowDialog();
             }
             Binding();
         }
         if (txtMakhachhang.Text.Length <= 0)
         { txtMakhachhang.Text = "<F4 - Tra cứu>"; }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
 private void TraCuuMa(KeyEventArgs e)
 {
     if (tenForm == "KhachHangTraLai")
     {
         if (e.KeyCode == Keys.F4 && hanhDong == "Them_KhachHangTraLai")
         {
             frmTraCuu fr = new frmTraCuu("HangTraLai_KhachHangTraLai_KhachHang", "KhachHang");
             fr.ShowDialog();
         }
         Binding();
     }
     if (tenForm == "TraLaiNhaCungCap")
     {
         if (e.KeyCode == Keys.F4 && hanhDong == "Them_TraLaiNhaCungCap")
         {
             frmTraCuu fr = new frmTraCuu("HangTraLai_TraLaiNhaCungCap", "NhaCungCap");
             fr.ShowDialog();
         }
         Binding();
     }
 }
 private void btnChungtugoc_Click(object sender, EventArgs e)
 {
     if (tenForm == "KhachHangTraLai")
     {
         if (txtMakhachhang.Text != "<F4 - Tra cứu>" && txtMakhachhang.Text.Length > 0)
         {
             //hoa don nhap mua
             frmTraCuu fr = new frmTraCuu("HangTraLai_KhachHangTraLai_MaDonHang", "HoaDonBanHang");
             fr.ShowDialog();
             Binding();
         }
         else
         { MessageBox.Show("Nhập khách hàng"); txtMakhachhang.Focus(); }
     }
     if (tenForm == "TraLaiNhaCungCap")
     {
         if (txtMakhachhang.Text != "<F4 - Tra cứu>" && txtMakhachhang.Text.Length > 0)
         {
             //hoa don nhap mua
             frmTraCuu fr = new frmTraCuu("HangTraLai_DonDatHangNhaCungCap", "DonDatHangNhaCungCap");
             fr.ShowDialog();
             Binding();
         }
         else
         { MessageBox.Show("Nhập nhà cung cấp"); txtMakhachhang.Focus(); }
     }
 }
 private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F4)
     {
         if (cbxKhoban.Text != "")
         {
             frmTraCuu fr = new frmTraCuu("KiemKeKho_HangHoa", "HangHoa");
             fr.ShowDialog();
             BindHangHoa();
         }
         else
         { MessageBox.Show("Chọn kho hàng"); }
     }
 }
 private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (hanhdong == "Insert")
         {
             if (chekChonLoai.Checked == false)
             {
                 GiaTriCanLuu.Ma = null;
                 GiaTriCanLuu.Ten = null;
                 GiaTriCanLuu.TonKho = null;
                 GiaTriCanLuu.Giatri = null;
                 GiaTriCanLuu.giatrigiatang = null;
                 if (txtManhacungcap.Text != "" && txtManhacungcap.Text != "<F4 -Tra cứu>")
                 {
                     if (cbxKhoHang.SelectedValue.ToString().Length > 0)
                     {
                         if (e.KeyCode == Keys.F4)
                         {
                             frmTraCuu fr = new frmTraCuu("HoaDonDat_HangHoa", "HoaDonHangHoa");
                             fr.ShowDialog();
                             BindHangHoa();
                         }
                     }
                     else
                     { MessageBox.Show("Nhập mã kho hàng"); }
                 }
                 else
                 { MessageBox.Show("Nhập mã nhà cung cấp"); }
             }
         }
     }
     catch { }
 }
 private void btnTimnhacungcap_Click(object sender, EventArgs e)
 {
     try
     {
         if (hanhdong == "Insert")
         {
             GiaTriCanLuu.Ma = null;
             GiaTriCanLuu.Ten = null;
             GiaTriCanLuu.TonKho = null;
             dgvInsertOrder.DataSource = null;
             Entities.HienThi_ChiTiet_DonDatHang[] lay = new Entities.HienThi_ChiTiet_DonDatHang[0];
             dgvInsertOrder.DataSource = lay;
             DoiTen(dgvInsertOrder);
             reset();
             frmTraCuu frm = new frmTraCuu("HoaDonNhap_NhaCungCap", "HoaDonNhap");
             frm.ShowDialog();
             BindHangHoa();
             if (GiaTriCanLuu.Ma == null)
             { txtManhacungcap.Text = "<F4 -Tra cứu>"; }
             if (txtNohienthoi.Text.Length <= 0)
             { txtNohienthoi.Text = "0"; }
         }
     }
     catch { }
 }
 private void TimChungTuKhachHang()
 {
     GiaTriCanLuu.Giatri = loaihoadon(rdoBanbuon, rdoBanle);
     if (GiaTriCanLuu.Giatri == "BanBuon")
     {
         if (txtMakhachhang.Text != "<F4 - Tra cứu>" && txtMakhachhang.Text.Length > 0)
         {
             Entities.LayHangHoaTheoMaKhachHangTraLai[] lay = new Entities.LayHangHoaTheoMaKhachHangTraLai[0];
             dgvXemthongtin.DataSource = lay;
             fixDatagridview();
             ResetTool();
             string makho = cbxKhoHang.SelectedValue.ToString();
             frmTraCuu fr = new frmTraCuu("HangTraLai_KhachHangTraLai_MaDonHang", "HoaDonBanHang", txtMakhachhang.Text, makho, "");
             fr.ShowDialog();
             Binding();
         }
         else
         { MessageBox.Show("Nhập khách hàng"); txtMakhachhang.Focus(); }
     }
     else
     {
         string makh = "";
         if (txtMakhachhang.Text == "<F4 - Tra cứu>" || txtMakhachhang.Text.Length <= 0)
             makh = "";
         else
             makh = txtMakhachhang.Text;
         Entities.LayHangHoaTheoMaKhachHangTraLai[] lay = new Entities.LayHangHoaTheoMaKhachHangTraLai[0];
         dgvXemthongtin.DataSource = lay;
         fixDatagridview();
         ResetTool();
         string makho = cbxKhoHang.SelectedValue.ToString();
         frmTraCuu fr = new frmTraCuu("HangTraLai_KhachHangTraLai_MaDonHang", "HoaDonBanHang", makh, makho, "");
         fr.ShowDialog();
         Binding();
     }
 }
        private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (cbxKhoban.SelectedValue.ToString() != null)
                {
                    if (testCharacter(toolStrip_txtTracuu.Text) == false)
                    {
                        return;
                    }
                    // F4
                    if (e.KeyCode == Keys.F4)
                    {
                        if (cbxKhoban.Text != "")
                        {
                            GiaTriCanLuu.Loaitrave = null;
                            GiaTriCanLuu.Ma = null;
                            GiaTriCanLuu.Ten = null;
                            GiaTriCanLuu.TonKho = null;
                            frmTraCuu fr = new frmTraCuu("KiemKeKho_HangHoa", "KiemKeHangHoa", cbxKhoban.SelectedValue.ToString());
                            fr.ShowDialog();
                            BindHangHoa();
                        }
                        else
                        { MessageBox.Show("Chọn kho hàng"); }
                    }
                    // Enter
                    if (e.KeyCode == Keys.Enter)
                    {
                        GiaTriCanLuu.Loaitrave = null;
                        GiaTriCanLuu.Ma = null;
                        GiaTriCanLuu.Ten = null;
                        GiaTriCanLuu.TonKho = null;
                        // lay thong tin san pham
                        string maHangHoa = toolStrip_txtTracuu.Text;
                        // Check quy doi
                        bool isQuyDoi = false;
                        foreach (Entities.QuyDoiDonViTinh item in quidoidvt)
                        {
                            if (item.MaHangQuyDoi.Trim().ToUpper().Equals(maHangHoa.Trim().ToUpper()))
                            {
                                GiaTriCanLuu.Ma = item.MaHangDuocQuyDoi.Trim().ToUpper();
                                isQuyDoi = true;
                                break;
                            }
                        }
                        //
                        if (!isQuyDoi)
                            GiaTriCanLuu.Ma = toolStrip_txtTracuu.Text.Trim().ToUpper();

                        foreach (Entities.ThongTinDatHang item in hangHoaTrongKho)
                        {
                            if (GiaTriCanLuu.Ma.Trim().ToUpper().Equals(item.MaHangHoa.Trim().ToUpper()))
                            {
                                GiaTriCanLuu.Ten = item.TenHangHoa;
                                GiaTriCanLuu.Giatri2 = item.Tonkho;
                                GiaTriCanLuu.Giatri = item.GiaNhap;
                                break;
                            }
                        }

                        GiaTriCanLuu.Loaitrave = "KiemKeKho_HangHoa";
                        BindHangHoa();
                    }
                }
                else
                {
                    MessageBox.Show("Phải nhập kho hàng");
                }
            }
            catch
            {
            }
        }
 private void TimChungTuNhaCungCap()
 {
     if (txtMakhachhang.Text != "<F4 - Tra cứu>" && txtMakhachhang.Text.Length > 0)
     {
         Entities.LayHangHoaTheoMaKhachHangTraLai[] lay = new Entities.LayHangHoaTheoMaKhachHangTraLai[0];
         dgvXemthongtin.DataSource = lay;
         fixDatagridview();
         ResetTool();
         string makho = cbxKhoHang.SelectedValue.ToString();
         frmTraCuu fr = new frmTraCuu("HangTraLai_DonDatHangNhaCungCap", "TimHoaDonNhapTheoMa", txtMakhachhang.Text, makho, "");
         fr.ShowDialog();
         Binding();
     }
     else
     { MessageBox.Show("Nhập nhà cung cấp"); txtMakhachhang.Focus(); }
 }
 private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F4)
     {
         if (txtManhacungcap.Text.Length > 0)
         {
             frmTraCuu fr = new frmTraCuu("DonDatHang_HangHoa", "HangHoa");
             fr.ShowDialog();
             BindHangHoa();
         }
         else
         {
             MessageBox.Show("Nhập mã nhà cung cấp");
         }
     }
 }
 private void toolStrip_txtTracuu_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F4)
     {
         if (tenForm == "KhachHangTraLai")
         {
             if (txtMakhachhang.Text.Length > 0 && txtMakhachhang.Text != "<F2 Tra cứu>")
             {
                 frmTraCuu fr = new frmTraCuu("ChiTietKhachHangTraLaiHang_HangHoa", "HangHoa");
                 fr.ShowDialog();
                 BindHangHoa();
             }
             else
             {
                 txtMakhachhang.Focus();
                 MessageBox.Show("Nhập mã khách hàng");
             }
         }
         //dang lam
         if (tenForm == "TraLaiNhaCungCap")
         {
             if (txtMakhachhang.Text.Length > 0 && txtMakhachhang.Text != "<F2 Tra cứu>")
             {
                 frmTraCuu fr = new frmTraCuu("ChiTietTraLaiNhaCungCap_MaHangHoa", "LayChiTietTraLaiNhaCungCap", txtMakhachhang.Text.ToUpper());
                 fr.ShowDialog();
                 BindHangHoa();
             }
             else
             {
                 txtMakhachhang.Focus();
                 MessageBox.Show("Nhập mã nhà cung cấp");
             }
         }
     }
 }
Exemple #27
0
        /// <summary>
        /// hungvv ==================================================
        /// </summary>
        private void DieuKienForm()
        {
            try
            {
                frmTraCuu fr = new frmTraCuu();
                if (hanhdong == "LayHangHoaGoiHang")
                {
                    BindingHangHoaGoiHang();
                    Application.OpenForms[fr.Name].Text = "Lọc - Hàng hóa và gói hàng";
                }
                if (hanhdong == "HangHoaTraLai")
                {
                    BindingHangHoaTraLai(this.maNhaCungCap, loai);
                    Application.OpenForms[fr.Name].Text = "Lọc - Hàng hóa theo hóa đơn bán hàng";
                }
                if (hanhdong == "HangHoa")
                {
                    BindingHangHoa();
                    Application.OpenForms[fr.Name].Text = "Lọc - Hàng hóa";
                }
                if (hanhdong == "NhaCungCap")
                {
                    BindingNhaCungCap();
                    Application.OpenForms[fr.Name].Text = "Lọc - Nhà cung cấp";
                }
                if (hanhdong == "KhachHang")
                {
                    BindingKhachHang("");
                    Application.OpenForms[fr.Name].Text = "Lọc - Khách hàng";
                }
                if (hanhdong == "KhachHangTralaiHang")
                {
                    BindingKhachHangTralaiHang(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Khách hàng";
                }
                if (hanhdong == "HoaDonNhap")
                {
                    BindingNhaCungCap();
                    Application.OpenForms[fr.Name].Text = "Lọc - Hoa đơn nhập";
                }
                if (hanhdong == "DonDatHang")
                {
                    BindingDonDatHang();
                    Application.OpenForms[fr.Name].Text = "Lọc - Đơn đặt hàng";
                }
                if (hanhdong == "HoaDonHangHoa")
                {
                    BindingHangHoa();
                    Application.OpenForms[fr.Name].Text = "Lọc - Hóa đơn hàng hóa";
                }
                if (hanhdong == "MaDonDatHang")
                {
                    LayThongTinHoaDonNhap(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Đơn đặt hàng";
                }
                if (hanhdong == "HoaDonBanHang")
                {
                    LayHoaDonBanHang(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Hóa đơn bán hàng";
                }

                if (hanhdong == "DonDatHangNhaCungCap")
                {
                    LayDonDatHangNhaCungCap();
                    Application.OpenForms[fr.Name].Text = "Lọc - Đơn đặt hàng nhà cung cấp";
                }
                if (hanhdong == "LayChiTietTraLaiNhaCungCap")
                {
                    LayChiTietTraLaiNhaCungCap(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Đơn đặt hàng nhà cung cấp";
                }
                if (hanhdong == "TimHoaDonBanHangTheoMaKhachHang")
                {
                    TimHoaDonBanHangTheoMaKhachHang(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Hóa Đơn Bán Hàng Theo Mã Khách Hàng";
                }
                if (hanhdong == "TimHoaDonNhapTheoMa")
                {
                    TimHoaDonNhapTheoMaNhaCungCap(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Hóa Đơn Nhập Theo Mã Nhà Cung Cấp";
                }
                if (hanhdong == "ThongTinTraLaiNhaCungCap")
                {
                    ThongTinTraLaiNhaCungCap(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Hàng hóa theo hóa đơn nhập";
                }
                if (hanhdong == "KiemKeHangHoa")
                {
                    KiemKeHangHoa(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Hàng hóa theo kho hàng";
                }
                if (hanhdong == "HangHoaTheoKho")
                {
                    BindingHangHoaTheoMaKho(this.maNhaCungCap);
                    Application.OpenForms[fr.Name].Text = "Lọc - Hàng hóa theo kho hàng";
                }

            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
        }
 private void txtChungtugoc_KeyDown(object sender, KeyEventArgs e)
 {
     if (tenForm == "KhachHangTraLai")
     {
         if (e.KeyCode == Keys.F4 && hanhDong == "Them_KhachHangTraLai")
         {
             //hoa don nhap mua
             frmTraCuu fr = new frmTraCuu("HangTraLai_KhachHangTraLai_MaDonHang", "DonDatHang");
             fr.ShowDialog();
         }
         Binding();
     }
     if (tenForm == "TraLaiNhaCungCap")
     {
         if (e.KeyCode == Keys.F4 && hanhDong == "Them_TraLaiNhaCungCap")
         {
             //hoa don nhap mua
             frmTraCuu fr = new frmTraCuu("HangTraLai_TraLaiNhaCungCap", "DonDatHang");
             fr.ShowDialog();
         }
         Binding();
     }
 }
 private void btnTimchungtu_Click(object sender, EventArgs e)
 {
     frmTraCuu fr = new frmTraCuu();
     fr.ShowDialog();
 }
 private void btnTimmakhachhang_Click(object sender, EventArgs e)
 {
     if (tenForm == "KhachHangTraLai")
     {
         if (hanhDong == "Them_KhachHangTraLai")
         {
             frmTraCuu fr = new frmTraCuu("HangTraLai_KhachHangTraLai_KhachHang", "KhachHang");
             fr.ShowDialog();
         }
         Binding();
     }
     if (tenForm == "TraLaiNhaCungCap")
     {
         if (hanhDong == "Them_TraLaiNhaCungCap")
         {
             frmTraCuu fr = new frmTraCuu("HangTraLai_TraLaiNhaCungCap", "NhaCungCap");
             fr.ShowDialog();
         }
         Binding();
     }
 }
 private void btnTimmanhacungcap_Click(object sender, EventArgs e)
 {
     frmTraCuu fr = new frmTraCuu();
     fr.ShowDialog();
 }
        private void txtmahanghoa_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F4)
                {
                    frmTraCuu thh = new frmTraCuu();
                    thh.ShowDialog();
                    if (frmTraCuu.drvr != null)
                    {
                        mahanghoa = frmTraCuu.drvr.Cells["MaHangHoa"].Value.ToString();
                        frmTraCuu.drvr = null;

                    }
                }
            }
            catch
            {
            }
        }
 private void txtManhacungcap_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F4)
     {
         if (hanhdong == "Insert")
         {
             frmTraCuu fr = new frmTraCuu("HoaDonNhap_NhaCungCap", "HoaDonNhap");
             fr.ShowDialog();
             BindHangHoa();
         }
     }
 }
 private void btnTimnhacungcap_Click(object sender, EventArgs e)
 {
     frmTraCuu fr = new frmTraCuu("DonDatHang_NhaCungCap", "NhaCungCap");
     fr.ShowDialog();
     BindHangHoa();
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (hanhdong == "Insert")
     {
         frmTraCuu fr = new frmTraCuu("HoaDonNhap_MaDonDatHang", "MaDonDatHang");
         fr.ShowDialog();
         BindHangHoa();
     }
 }
 private void txtManhacungcap_KeyDown(object sender, KeyEventArgs e)
 {
     if (this.HanhDong == "Insert")
     {
         if (e.KeyCode == Keys.F4)
         {
             frmTraCuu fr = new frmTraCuu("DonDatHang_NhaCungCap", "NhaCungCap");
             fr.ShowDialog();
             BindHangHoa();
             ResetTool();
         }
     }
 }
        private void btnTimmanhacungcap_Click(object sender, EventArgs e)
        {
            frmTraCuu fr = new frmTraCuu();

            fr.ShowDialog();
        }