/// <summary>
 /// * Thêm
 /// - Gọi frm Chi Tiết
 /// 
 /// * Problem
 /// [ ] Refesh khi frm chi tiết đóng
 /// </summary>
 private void btnThem_Click(object sender, EventArgs e)
 {
     frmNhapKho nhapkho = new frmNhapKho(enumButton2.Them, "");
     nhapkho.Show();
 }
 /// <summary>
 /// * Sửa
 /// - Gọi frm Chi Tiết ứng với row đã chọn
 /// 
 /// * problem
 /// [ ] Cách thức để gọi frm, nên dùng delegate, truyền sang mã phiếu, rồi call hàm Get data theo mã phiếu đó.
 /// </summary>
 private void btnSua_Click(object sender, EventArgs e)
 {
     Int32 selectedRowCount = gridDanhSachPhieuNhap.CurrentCell.RowIndex;
     DataGridViewRow SelectedRow = gridDanhSachPhieuNhap.Rows[selectedRowCount];
     string strMaPhieuNhap = SelectedRow.Cells["Ma_phieu"].Value.ToString();
     if (clsPhieuNhapKho.KTVTChuaDuyet(strMaPhieuNhap) == true)// phieu nay da duyet
     {
         MessageBox.Show("Phiếu nhập này đã được phân vào kho, không thể xóa");
         return;
     }
     int idphieu = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["ID_phieu_nhap"].Value.ToString()) ? -1 : int.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["ID_phieu_nhap"].Value.ToString());
     int idloaiphieu = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["id_loai_phieu_nhap"].Value.ToString()) ? -1 : int.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["id_loai_phieu_nhap"].Value.ToString());
     bool isgoidau = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isgoidau"].Value.ToString()) ? false : Boolean.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isgoidau"].Value.ToString());
     bool isKNMN = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isKNMN"].Value.ToString()) ? false : Boolean.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isKNMN"].Value.ToString());
     bool isToTrinh = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isToTrinh"].Value.ToString()) ? false : Boolean.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isToTrinh"].Value.ToString());
     bool isKNTN = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isKNTN"].Value.ToString()) ? false : Boolean.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isKNTN"].Value.ToString());
     bool isKCMN = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isKCMN"].Value.ToString()) ? false : Boolean.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isKCMN"].Value.ToString());
     bool isKCTN = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isKCTN"].Value.ToString()) ? false : Boolean.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isKCTN"].Value.ToString());
     bool isNVMN = string.IsNullOrEmpty(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isNVMN"].Value.ToString()) ? false : Boolean.Parse(gridDanhSachPhieuNhap.Rows[selectedRowCount].Cells["isNVMN"].Value.ToString());
     if (isNVMN == true)
     {
         frmNhanVienMuaNgoai nvmn = new frmNhanVienMuaNgoai(enumButton2.Sua, strMaPhieuNhap, this);
         nvmn.Show();
         return;
     }
     if (isToTrinh == false && isKNTN == false && isKNMN == false && isKCMN == false && isKCTN == false)
     {
         frmNhapKho nhapkho = new frmNhapKho(enumButton2.Sua, strMaPhieuNhap,this);
         nhapkho.Show();
         return;
     }
     else
     {
         if (isToTrinh == true)
         {
             frmNhapKhoToTrinh totrinh = new frmNhapKhoToTrinh(enumButton2.Sua, strMaPhieuNhap,this);
             totrinh.Show();
             return;
         }
         else
         {
             frmMuonTraNo muontra = new frmMuonTraNo(enumButton2.Sua, strMaPhieuNhap,this);
             muontra.Show();
             return;
         }
     }
 }
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (Utilities.clsThamSoUtilities.isSectionLogin == true)
            {
                frmNhapKho frm = new frmNhapKho("PN");
                frm.Name = "Màn hình nhập vật tư";

                foreach (Form f in this.MdiChildren)
                {
                    if (f.Name == frm.Name)
                    {
                        f.Activate();
                        return;
                    }

                }

                frm.MdiParent = this;
                frm.WindowState = FormWindowState.Maximized;
                frm.Show();

            }
        }
 private void btnLuu_Click(object sender, EventArgs e)
 {
     Int32 selectedRowCount = gridDanhSachPhieuNhap.CurrentCell.RowIndex;
     DataGridViewRow SelectedRow = gridDanhSachPhieuNhap.Rows[selectedRowCount];
     string strMaPhieuNhap = SelectedRow.Cells["Ma_phieu"].Value.ToString();
     //string strMaPhieuNhap = SelectedRow.Cells["Ma_phieu"].Value.ToString();
     bool isNhapNgoai = (bool)SelectedRow.Cells["isNhapNgoai"].Value;
     if (isNhapNgoai == true)
     {
         frmNhapKhoToTrinh frmTT = new frmNhapKhoToTrinh(enumButton2.None, strMaPhieuNhap);
         frmTT.Show();
     }
     else
     {
         frmNhapKho nhapkho = new frmNhapKho(enumButton2.None, strMaPhieuNhap);
         nhapkho.Show();
     }
 }
        private void nhậpGốiĐầuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmNhapKho frm = new frmNhapKho("GD");
            frm.Name = "Màn hình nhập gối đầu";

            foreach (Form f in this.MdiChildren)
            {
                if (f.Name == frm.Name)
                {
                    f.Activate();
                    return;
                }

            }

            frm.MdiParent = this;
            frm.WindowState = FormWindowState.Maximized;
            frm.Show();
        }