コード例 #1
0
 private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 4))
         {
             return;
         }
         for (int j = 0; j < 100; j++)
         {
             if (BaoDong == "")
             {
                 frmXuLyKiemKeKho kk = new frmXuLyKiemKeKho("Insert", "Thêm mới phiếu kiểm kê kho");
                 kk.ShowDialog();
                 SelectData("");
             }
             else
             {
                 BaoDong = "";
                 break;
             }
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
コード例 #2
0
 private void dgvHienThi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvHienThi.RowCount > 0)
         {
             frmXuLyKiemKeKho kk = new frmXuLyKiemKeKho("Update", "Sửa phiếu kiểm kê kho", getDatagridview());
             kk.ShowDialog();
             SelectData("");
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
コード例 #3
0
 private void toolStripStatus_Sua_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 2))
         {
             return;
         }
         if (dgvHienThi.RowCount > 0)
         {
             frmXuLyKiemKeKho kk = new frmXuLyKiemKeKho("Update", "Sửa phiếu kiểm kê kho", getDatagridview());
             kk.ShowDialog();
             SelectData("");
         }
         else
         {
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
コード例 #4
0
 private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 4))
         { return; }
         for (int j = 0; j < 100; j++)
         {
             if (BaoDong == "")
             {
                 frmXuLyKiemKeKho kk = new frmXuLyKiemKeKho("Insert","Thêm mới phiếu kiểm kê kho");
                 kk.ShowDialog();
                 SelectData("");
             }
             else
             {
                 BaoDong = "";
                 break;
             }
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
コード例 #5
0
 private void toolStripStatus_Sua_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 2))
         { return; }
         if (dgvHienThi.RowCount > 0)
         {
             frmXuLyKiemKeKho kk = new frmXuLyKiemKeKho("Update","Sửa phiếu kiểm kê kho", getDatagridview());
             kk.ShowDialog();
             SelectData("");
         }
         else
         {  }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
コード例 #6
0
 private void dgvHienThi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvHienThi.RowCount > 0)
         {
             frmXuLyKiemKeKho kk = new frmXuLyKiemKeKho("Update", "Sửa phiếu kiểm kê kho", getDatagridview());
             kk.ShowDialog();
             SelectData("");
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
コード例 #7
0
ファイル: frmTraCuu.cs プロジェクト: mrk29vn/vna-accounting
        private void TraveLoai()
        {
            try
            {
                if (names == "Lay_HangHoa_GoiHang")
                {
                    GiaTriCanLuu.Loaitrave = "Lay_HangHoa_GoiHang";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "DonDatHang_HangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoa";
                    frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "HoaDonDat_HangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "HoaDonDat_HangHoa";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "DonDatHang_NhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "DonDatHang_NhaCungCap";
                    frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "HoaDonNhap_NhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "HoaDonNhap_NhaCungCap";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "ThongTin_KhachHangTraLai")
                {
                    GiaTriCanLuu.Loaitrave = "ThongTin_KhachHangTraLai";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HoaDonNhap_DonDatHang")
                {
                    GiaTriCanLuu.Loaitrave = "HoaDonNhap_DonDatHang";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HangTraLai_KhachHangTraLai_MaDonHang")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_MaDonHang";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HangTraLai_KhachHangTraLai_KhachHang")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_KhachHang";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "HangTraLai_TraLaiNhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_TraLaiNhaCungCap";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "ChiTietKhachHangTraLaiHang_HangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "ChiTietKhachHangTraLaiHang_HangHoa";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "ChiTietTraLaiNhaCungCap_MaHangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "ChiTietTraLaiNhaCungCap_MaHangHoa";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HoaDonNhap_MaDonDatHang")
                {
                    GiaTriCanLuu.Loaitrave = "HoaDonNhap_MaDonDatHang";
                    frmXuLyNhapKho fr = new frmXuLyNhapKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }

                if (names == "KiemKeKho_HangHoa")
                {
                    GiaTriCanLuu.Loaitrave = "KiemKeKho_HangHoa";
                    frmXuLyKiemKeKho fr = new frmXuLyKiemKeKho();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HangTraLai_DonDatHangNhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_DonDatHangNhaCungCap";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "HangTraLai_MaTraLaiNhaCungCap")
                {
                    GiaTriCanLuu.Loaitrave = "HangTraLai_MaTraLaiNhaCungCap";
                    frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "XuLyKhachHang")
                {
                    GiaTriCanLuu.Loaitrave = "XuLyKhachHang";
                    frmXuLyKhachHang fr = new frmXuLyKhachHang();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
                if (names == "DonDatHang_KhachHang")
                {
                    GiaTriCanLuu.Loaitrave = "DonDatHang_KhachHang";
                    frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                    Application.OpenForms[fr.Name].Focus();
                    this.Close();
                }
            }
            catch (Exception ex)
            { string s = ex.Message; }
        }
コード例 #8
0
ファイル: frmTraCuu.cs プロジェクト: mrk29vn/vna-accounting
        private void TraVe()
        {
            try
            {
                if (names == "Lay_HangHoa_GoiHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells["MaHang"].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells["TenHang"].Value.ToString();
                        string Gia = dgvHieThi.Rows[vitri].Cells["GiaNhap"].Value.ToString();
                        string banbuon = dgvHieThi.Rows[vitri].Cells["GiaBanBuon"].Value.ToString();
                        string banle = dgvHieThi.Rows[vitri].Cells["GiaBanLe"].Value.ToString();
                        string giatrigiatang = dgvHieThi.Rows[vitri].Cells["Thue"].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "Lay_HangHoa_GoiHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = Gia;
                        GiaTriCanLuu.Giatri2 = banbuon;
                        GiaTriCanLuu.TonKho = banle;
                        GiaTriCanLuu.giatrigiatang = giatrigiatang;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "DonDatHang_HangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoa";
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString();
                        string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString();
                        string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString();
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = Gia;
                        GiaTriCanLuu.Giatri2 = banbuon;
                        GiaTriCanLuu.TonKho = banle;
                        GiaTriCanLuu.giatrigiatang = giatrigiatang;
                        frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HoaDonDat_HangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString();
                        string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString();
                        string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HoaDonDat_HangHoa";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = Gia;
                        GiaTriCanLuu.Giatri2 = banbuon;
                        GiaTriCanLuu.TonKho = banle;
                        GiaTriCanLuu.giatrigiatang = giatrigiatang;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "DonDatHang_NhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string giatri = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "DonDatHang_NhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.Giatri2 = giatri;
                        frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "HoaDonNhap_NhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string no = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HoaDonNhap_NhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.TonKho = no;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "ThongTin_KhachHangTraLai")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "ThongTin_KhachHangTraLai";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HoaDonNhap_DonDatHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HoaDonNhap_DonDatHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HangTraLai_KhachHangTraLai_MaDonHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[0].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_MaDonHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HangTraLai_KhachHangTraLai_KhachHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string duno = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_KhachHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri2 = duno;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "HangTraLai_TraLaiNhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string nohienthoi = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_TraLaiNhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.Giatri2 = nohienthoi;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "ChiTietKhachHangTraLaiHang_HangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        frmXuLyHangTraLai.soluongmua = doituong;
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string sl = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        string giatrigiatrang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "ChiTietKhachHangTraLaiHang_HangHoa";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.Giatri2 = sl;
                        GiaTriCanLuu.giatrigiatang = giatrigiatrang;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "ChiTietTraLaiNhaCungCap_MaHangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        frmXuLyHangTraLai.soluongmua = doituong;
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string sl = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        string g = dgvHieThi.Rows[vitri].Cells[5].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "ChiTietTraLaiNhaCungCap_MaHangHoa";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        GiaTriCanLuu.makhachhang = sl;
                        GiaTriCanLuu.giatrigiatang = g;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HoaDonNhap_MaDonDatHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HoaDonNhap_MaDonDatHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyNhapKho fr = new frmXuLyNhapKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "KiemKeKho_HangHoa")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        int temVITRI = dgvHieThi.CurrentRow.Index;
                        string ID = dgvHieThi.Rows[temVITRI].Cells["MaHangHoa"].Value.ToString();
                        string Name = dgvHieThi.Rows[temVITRI].Cells["TenHangHoa"].Value.ToString();
                        string add = dgvHieThi.Rows[temVITRI].Cells["GiaNhap"].Value.ToString();
                        string ton = dgvHieThi.Rows[temVITRI].Cells["Tonkho"].Value.ToString();
                        string sl = dgvHieThi.Rows[temVITRI].Cells["Tonkho"].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "KiemKeKho_HangHoa";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.TonKho = ton;
                        GiaTriCanLuu.Giatri2 = sl;
                        GiaTriCanLuu.Giatri = add;
                        frmXuLyKiemKeKho fr = new frmXuLyKiemKeKho();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                ///-------------------------------------------------------------------
                if (names == "DonDatHang_HangHoaTheoKho")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoaTheoKho";
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString();
                        string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString();
                        string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString();
                        string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString();
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri = Gia;
                        GiaTriCanLuu.Giatri2 = banbuon;
                        GiaTriCanLuu.TonKho = banle;
                        GiaTriCanLuu.giatrigiatang = giatrigiatang;
                        frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

                if (names == "HangTraLai_DonDatHangNhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[0].Value.ToString();
                        string ngay = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_DonDatHangNhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = ngay;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "HangTraLai_MaTraLaiNhaCungCap")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string ngay = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "HangTraLai_MaTraLaiNhaCungCap";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = ngay;
                        frmXuLyHangTraLai fr = new frmXuLyHangTraLai();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "XuLyKhachHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string ngay = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "XuLyKhachHang";
                        GiaTriCanLuu.Ma = ID;
                        frmXuLyKhachHang fr = new frmXuLyKhachHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }
                if (names == "DonDatHang_KhachHang")
                {
                    int x = dgvHieThi.RowCount;
                    int y = dgvHieThi.ColumnCount;
                    if (y <= -1 || x <= -1)
                    { }
                    else
                    {
                        string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString();
                        string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString();
                        string duno = dgvHieThi.Rows[vitri].Cells[4].Value.ToString();
                        GiaTriCanLuu.Loaitrave = "DonDatHang_KhachHang";
                        GiaTriCanLuu.Ma = ID;
                        GiaTriCanLuu.Ten = Name;
                        GiaTriCanLuu.Giatri2 = duno;
                        frmXuLyDonDatHang fr = new frmXuLyDonDatHang();
                        Application.OpenForms[fr.Name].Focus();
                        this.Close();
                    }
                }

            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
        }