private void btnhienthi_Click(object sender, EventArgs e)
        {
            if (KiemTra())
            {
                LayNgay();
                LayKhoHang();
                LayHangHoa();
                LayHDNhap();
                LayChiTietHoaDonNhap();
                LayKHTL();
                LayCTKHTL();
                LayPhieuDieuChuyenKhoNoiBo();
                LayChiTiet_PhieuDieuChuyenKho();
                LayChiTiet_HangHoaXuat();
                ArrTongHangXuat();
                ///////////////////////////////MRK FIX
                List <Entities.BCNhapHangTheoKho> tem0 = new List <Entities.BCNhapHangTheoKho>();
                int tong0 = 0;
                foreach (Entities.BCNhapHangTheoKho item in ArrBCXH)
                {
                    if (item == null)
                    {
                        continue;
                    }
                    tong0 += item.TongSoLuongNhap;
                    tem0.Add(item);
                }
                Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
                tem1.TenKho          = "Tổng: ";
                tem1.TongSoLuongNhap = tong0;
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = ArrBCXH;
                dtgvhienthi.DataSource = tem0.ToArray();

                FixDatagridview();
                dtgvhienthi.Focus();
                ctBCXH_Search = ArrBCXH;
                if (ctHDN.Length > 0)
                {
                    tsslchitiet.Enabled = true;
                    tsslPdf.Enabled     = true;
                    tsslExcel.Enabled   = true;
                    tsslWord.Enabled    = true;
                }
                else
                {
                    tsslchitiet.Enabled = false;
                    tsslPdf.Enabled     = false;
                    tsslExcel.Enabled   = false;
                    tsslWord.Enabled    = false;
                }
            }
        }
        private void rdbTatCa_CheckedChanged(object sender, EventArgs e)
        {
            if (rdbTatCa.Checked == true)
            {
                txtTimKiem.Text = "";
                if (ctBCXH_Search.Length > 0)
                {
                    tsslchitiet.Enabled = true;
                    tsslPdf.Enabled     = true;
                    tsslExcel.Enabled   = true;
                    tsslWord.Enabled    = true;
                }
                else
                {
                    tsslchitiet.Enabled = false;
                    tsslPdf.Enabled     = false;
                    tsslExcel.Enabled   = false;
                    tsslWord.Enabled    = false;
                }
                ///////////////////////////////MRK FIX
                List <Entities.BCNhapHangTheoKho> tem0 = new List <Entities.BCNhapHangTheoKho>();
                int tong0 = 0;
                foreach (Entities.BCNhapHangTheoKho item in ctBCXH_Search)
                {
                    tong0 += item.TongSoLuongNhap;
                    tem0.Add(item);
                }
                Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
                tem1.TenKho          = "Tổng: ";
                tem1.TongSoLuongNhap = tong0;
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = ctBCXH_Search;
                dtgvhienthi.DataSource = tem0.ToArray();

                FixDatagridview();
            }
        }
        public void ArrTongHangXuat()
        {
            ArrBCXH = new Entities.BCNhapHangTheoKho[khohang.Length];
            for (int i = 0; i < khohang.Length; i++)
            {
                LayHoaDonNhap_TheoMaKho(khohang[i].MaKho);
                LayKHTL_TheoMaKho(khohang[i].MaKho);
                LayPhieuDieuChuyenKhoNoiBo_TheoKhoDen(khohang[i].MaKho);
                LayChiTiet_HangHoaXuat_TheoKho(khohang[i].MaKho, khohang[i].TenKho);
                LayChiTiet_SoLuong_HangHoaNhap_TheoKho();
                ArrBCXH[i] = new Entities.BCNhapHangTheoKho();

                int TongHangHoaXuatTheoKho = 0;
                for (int j = 0; j < ctBCXH.Length; j++)
                {
                    TongHangHoaXuatTheoKho = TongHangHoaXuatTheoKho + ctBCXH[j].TongSoLuongNhap;
                }
                ArrBCXH[i].MaKho           = khohang[i].MaKho;
                ArrBCXH[i].TenKho          = khohang[i].TenKho;
                ArrBCXH[i].TongSoLuongNhap = TongHangHoaXuatTheoKho;
                ctBCXH = null;
            }
        }
        public void ArrTongHangXuat()
        {
            ArrBCXH = new Entities.BCNhapHangTheoKho[khohang.Length];
            for (int i = 0; i < khohang.Length; i++)
            {
                LayHoaDonNhap_TheoMaKho(khohang[i].MaKho);
                LayKHTL_TheoMaKho(khohang[i].MaKho);
                LayPhieuDieuChuyenKhoNoiBo_TheoKhoDen(khohang[i].MaKho);
                LayChiTiet_HangHoaXuat_TheoKho(khohang[i].MaKho,khohang[i].TenKho);
                LayChiTiet_SoLuong_HangHoaNhap_TheoKho();
                ArrBCXH[i] = new Entities.BCNhapHangTheoKho();

                int TongHangHoaXuatTheoKho = 0;
                for (int j = 0; j < ctBCXH.Length; j++)
                {
                    TongHangHoaXuatTheoKho = TongHangHoaXuatTheoKho + ctBCXH[j].TongSoLuongNhap;
                }
                ArrBCXH[i].MaKho = khohang[i].MaKho;
                ArrBCXH[i].TenKho = khohang[i].TenKho;
                ArrBCXH[i].TongSoLuongNhap = TongHangHoaXuatTheoKho;
                ctBCXH = null;
            }
        }
        private void frmBCNhapHangTheoKho_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < cbbthang.Items.Count; i++)
            {
                if (cbbthang.Items[i].ToString() == datesv.Month.ToString())
                {
                    cbbthang.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < cbbnam.Items.Count; i++)
            {
                if (cbbnam.Items[i].ToString() == datesv.Year.ToString())
                {
                    cbbnam.SelectedIndex = i;
                    break;
                }
            }
            LayNgay();
            LayKhoHang();
            LayHangHoa();
            GoiHang();
            ChiTietGoiHang();

            LayHDNhap();
            LayChiTietHoaDonNhap();

            LayKHTL();
            LayCTKHTL();

            LayPhieuDieuChuyenKhoNoiBo();
            LayChiTiet_PhieuDieuChuyenKho();

            LayChiTiet_HangHoaXuat();

            ArrTongHangXuat();
            ///////////////////////////////MRK FIX
            List <Entities.BCNhapHangTheoKho> tem0 = new List <Entities.BCNhapHangTheoKho>();
            int tong0 = 0;

            foreach (Entities.BCNhapHangTheoKho item in ArrBCXH)
            {
                if (item == null)
                {
                    continue;
                }
                tong0 += item.TongSoLuongNhap;
                tem0.Add(item);
            }
            Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
            tem1.TenKho          = "Tổng: ";
            tem1.TongSoLuongNhap = tong0;
            tem0.Add(tem1);
            //////////////////////////////////////
            //dtgvhienthi.DataSource = ArrBCXH;
            dtgvhienthi.DataSource = tem0.ToArray();

            FixDatagridview();
            dtgvhienthi.Focus();
            ctBCXH_Search = ArrBCXH;
            if (ctHDN.Length > 0)
            {
                tsslchitiet.Enabled = true;
                tsslPdf.Enabled     = true;
                tsslExcel.Enabled   = true;
                tsslWord.Enabled    = true;
            }
            else
            {
                tsslchitiet.Enabled = false;
                tsslPdf.Enabled     = false;
                tsslExcel.Enabled   = false;
                tsslWord.Enabled    = false;
            }
        }
        private void txtTimKiem_TextChanged(object sender, EventArgs e)
        {
            if (rdbTen.Checked == true)
            {
                if (ctBCXH_Search == null)
                {
                    BCNhapHangTheoKho[] tkkt = new BCNhapHangTheoKho[0];
                    dtgvhienthi.DataSource = tkkt;
                    FixDatagridview();

                    tsslchitiet.Enabled = false;
                    tsslExcel.Enabled   = false;
                    tsslPdf.Enabled     = false;
                    tsslWord.Enabled    = false;
                }
                else
                if (ctBCXH_Search != null)
                {
                    if (txtTimKiem.Text.Length == 0)
                    {
                        BCNhapHangTheoKho[] tkkt = new BCNhapHangTheoKho[0];
                        dtgvhienthi.DataSource = tkkt;
                        FixDatagridview();

                        tsslchitiet.Enabled = false;
                        tsslExcel.Enabled   = false;
                        tsslPdf.Enabled     = false;
                        tsslWord.Enabled    = false;
                    }
                    else
                    {
                        int ctBCXH_Search_count = 0;

                        for (int i = 0; i < ctBCXH_Search.Length; i++)
                        {
                            int index = -1;
                            index = ctBCXH_Search[i].TenKho.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                            if (index >= 0)
                            {
                                ctBCXH_Search_count++;
                            }
                        }
                        BCNhapHangTheoKho[] ctBCXH_Search1 = new BCNhapHangTheoKho[ctBCXH_Search_count];
                        ctBCXH_Search_count = 0;

                        for (int i = 0; i < ctBCXH_Search.Length; i++)
                        {
                            int index = -1;
                            index = ctBCXH_Search[i].TenKho.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                            if (index >= 0)
                            {
                                ctBCXH_Search1[ctBCXH_Search_count] = ctBCXH_Search[i];
                                ctBCXH_Search_count++;
                            }
                        }
                        if (ctBCXH_Search_count == 0)
                        {
                            tsslchitiet.Enabled = false;
                            tsslExcel.Enabled   = false;
                            tsslPdf.Enabled     = false;
                            tsslWord.Enabled    = false;
                        }
                        else
                        {
                            tsslchitiet.Enabled = true;
                            tsslExcel.Enabled   = true;
                            tsslPdf.Enabled     = true;
                            tsslWord.Enabled    = true;
                        }
                        ///////////////////////////////MRK FIX
                        List <Entities.BCNhapHangTheoKho> tem0 = new List <Entities.BCNhapHangTheoKho>();
                        int tong0 = 0;
                        foreach (Entities.BCNhapHangTheoKho item in ctBCXH_Search1)
                        {
                            tong0 += item.TongSoLuongNhap;
                            tem0.Add(item);
                        }
                        Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
                        tem1.TenKho          = "Tổng: ";
                        tem1.TongSoLuongNhap = tong0;
                        tem0.Add(tem1);
                        //////////////////////////////////////
                        //dtgvhienthi.DataSource = ctBCXH_Search1;
                        dtgvhienthi.DataSource = tem0.ToArray();

                        FixDatagridview();
                    }
                }
            }
            else
            if (rdbMa.Checked == true)
            {
                if (ctBCXH_Search == null)
                {
                    BCNhapHangTheoKho[] tkkt = new BCNhapHangTheoKho[0];
                    dtgvhienthi.DataSource = tkkt;
                    FixDatagridview();

                    tsslchitiet.Enabled = false;
                    tsslExcel.Enabled   = false;
                    tsslPdf.Enabled     = false;
                    tsslWord.Enabled    = false;
                }
                else
                if (ctBCXH_Search != null)
                {
                    if (txtTimKiem.Text.Length == 0)
                    {
                        BCNhapHangTheoKho[] tkkt = new BCNhapHangTheoKho[0];
                        dtgvhienthi.DataSource = tkkt;
                        FixDatagridview();

                        tsslchitiet.Enabled = false;
                        tsslExcel.Enabled   = false;
                        tsslPdf.Enabled     = false;
                        tsslWord.Enabled    = false;
                    }
                    else
                    {
                        int ctBCXH_Search_count = 0;

                        for (int i = 0; i < ctBCXH_Search.Length; i++)
                        {
                            int index = -1;
                            index = ctBCXH_Search[i].MaKho.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                            if (index >= 0)
                            {
                                ctBCXH_Search_count++;
                            }
                        }
                        BCNhapHangTheoKho[] ctBCXH_Search1 = new BCNhapHangTheoKho[ctBCXH_Search_count];
                        ctBCXH_Search_count = 0;

                        for (int i = 0; i < ctBCXH_Search.Length; i++)
                        {
                            int index = -1;
                            index = ctBCXH_Search[i].MaKho.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                            if (index >= 0)
                            {
                                ctBCXH_Search1[ctBCXH_Search_count] = ctBCXH_Search[i];
                                ctBCXH_Search_count++;
                            }
                        }
                        if (ctBCXH_Search_count == 0)
                        {
                            tsslchitiet.Enabled = false;
                            tsslExcel.Enabled   = false;
                            tsslPdf.Enabled     = false;
                            tsslWord.Enabled    = false;
                        }
                        else
                        {
                            tsslchitiet.Enabled = true;
                            tsslExcel.Enabled   = true;
                            tsslPdf.Enabled     = true;
                            tsslWord.Enabled    = true;
                        }
                        ///////////////////////////////MRK FIX
                        List <Entities.BCNhapHangTheoKho> tem0 = new List <Entities.BCNhapHangTheoKho>();
                        int tong0 = 0;
                        foreach (Entities.BCNhapHangTheoKho item in ctBCXH_Search1)
                        {
                            tong0 += item.TongSoLuongNhap;
                            tem0.Add(item);
                        }
                        Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
                        tem1.TenKho          = "Tổng: ";
                        tem1.TongSoLuongNhap = tong0;
                        tem0.Add(tem1);
                        //////////////////////////////////////
                        //dtgvhienthi.DataSource = ctBCXH_Search1;
                        dtgvhienthi.DataSource = tem0.ToArray();

                        FixDatagridview();
                    }
                }
            }
        }
        private void rdbTatCa_CheckedChanged(object sender, EventArgs e)
        {
            if (rdbTatCa.Checked == true)
            {
                txtTimKiem.Text = "";
                if (ctBCXH_Search.Length > 0)
                {
                    tsslchitiet.Enabled = true;
                    tsslPdf.Enabled = true;
                    tsslExcel.Enabled = true;
                    tsslWord.Enabled = true;
                }
                else
                {
                    tsslchitiet.Enabled = false;
                    tsslPdf.Enabled = false;
                    tsslExcel.Enabled = false;
                    tsslWord.Enabled = false;
                }
                ///////////////////////////////MRK FIX
                List<Entities.BCNhapHangTheoKho> tem0 = new List<Entities.BCNhapHangTheoKho>();
                int tong0 = 0;
                foreach (Entities.BCNhapHangTheoKho item in ctBCXH_Search)
                {
                    tong0 += item.TongSoLuongNhap;
                    tem0.Add(item);
                }
                Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
                tem1.TenKho = "Tổng: ";
                tem1.TongSoLuongNhap = tong0;
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = ctBCXH_Search;
                dtgvhienthi.DataSource = tem0.ToArray();

                FixDatagridview();
            }
        }
        private void frmBCNhapHangTheoKho_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < cbbthang.Items.Count; i++)
            {
                if (cbbthang.Items[i].ToString() == datesv.Month.ToString())
                {
                    cbbthang.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < cbbnam.Items.Count; i++)
            {
                if (cbbnam.Items[i].ToString() == datesv.Year.ToString())
                {
                    cbbnam.SelectedIndex = i;
                    break;
                }
            }
            LayNgay();
            LayKhoHang();
            LayHangHoa();
            GoiHang();
            ChiTietGoiHang();

            LayHDNhap();
            LayChiTietHoaDonNhap();

            LayKHTL();
            LayCTKHTL();

            LayPhieuDieuChuyenKhoNoiBo();
            LayChiTiet_PhieuDieuChuyenKho();

            LayChiTiet_HangHoaXuat();

            ArrTongHangXuat();
            ///////////////////////////////MRK FIX
            List<Entities.BCNhapHangTheoKho> tem0 = new List<Entities.BCNhapHangTheoKho>();
            int tong0 = 0;
            foreach (Entities.BCNhapHangTheoKho item in ArrBCXH)
            {
                if (item == null)
                {
                    continue;
                }
                tong0 += item.TongSoLuongNhap;
                tem0.Add(item);
            }
            Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
            tem1.TenKho = "Tổng: ";
            tem1.TongSoLuongNhap = tong0;
            tem0.Add(tem1);
            //////////////////////////////////////
            //dtgvhienthi.DataSource = ArrBCXH;
            dtgvhienthi.DataSource = tem0.ToArray();

            FixDatagridview();
            dtgvhienthi.Focus();
            ctBCXH_Search = ArrBCXH;
            if (ctHDN.Length > 0)
            {
                tsslchitiet.Enabled = true;
                tsslPdf.Enabled = true;
                tsslExcel.Enabled = true;
                tsslWord.Enabled = true;
            }
            else
            {
                tsslchitiet.Enabled = false;
                tsslPdf.Enabled = false;
                tsslExcel.Enabled = false;
                tsslWord.Enabled = false;
            }
        }
        private void btnhienthi_Click(object sender, EventArgs e)
        {
            if (KiemTra())
            {
                LayNgay();
                LayKhoHang();
                LayHangHoa();
                LayHDNhap();
                LayChiTietHoaDonNhap();
                LayKHTL();
                LayCTKHTL();
                LayPhieuDieuChuyenKhoNoiBo();
                LayChiTiet_PhieuDieuChuyenKho();
                LayChiTiet_HangHoaXuat();
                ArrTongHangXuat();
                ///////////////////////////////MRK FIX
                List<Entities.BCNhapHangTheoKho> tem0 = new List<Entities.BCNhapHangTheoKho>();
                int tong0 = 0;
                foreach (Entities.BCNhapHangTheoKho item in ArrBCXH)
                {
                    if (item == null)
                    {
                        continue;
                    }
                    tong0 += item.TongSoLuongNhap;
                    tem0.Add(item);
                }
                Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
                tem1.TenKho = "Tổng: ";
                tem1.TongSoLuongNhap = tong0;
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = ArrBCXH;
                dtgvhienthi.DataSource = tem0.ToArray();

               FixDatagridview();
               dtgvhienthi.Focus();
               ctBCXH_Search = ArrBCXH;
                if (ctHDN.Length > 0)
                {
                    tsslchitiet.Enabled = true;
                    tsslPdf.Enabled = true;
                    tsslExcel.Enabled = true;
                    tsslWord.Enabled = true;
                }
                else
                {
                    tsslchitiet.Enabled = false;
                    tsslPdf.Enabled = false;
                    tsslExcel.Enabled = false;
                    tsslWord.Enabled = false;
                }
            }
        }
예제 #10
0
        private void txtTimKiem_TextChanged(object sender, EventArgs e)
        {
            if (rdbTen.Checked == true)
            {

                if (ctBCXH_Search == null)
                {
                    BCNhapHangTheoKho[] tkkt = new BCNhapHangTheoKho[0];
                    dtgvhienthi.DataSource = tkkt;
                    FixDatagridview();

                    tsslchitiet.Enabled = false;
                    tsslExcel.Enabled = false;
                    tsslPdf.Enabled = false;
                    tsslWord.Enabled = false;
                }
                else
                    if (ctBCXH_Search != null)
                    {
                        if (txtTimKiem.Text.Length == 0)
                        {
                            BCNhapHangTheoKho[] tkkt = new BCNhapHangTheoKho[0];
                            dtgvhienthi.DataSource = tkkt;
                            FixDatagridview();

                            tsslchitiet.Enabled = false;
                            tsslExcel.Enabled = false;
                            tsslPdf.Enabled = false;
                            tsslWord.Enabled = false;
                        }
                        else
                        {
                            int ctBCXH_Search_count = 0;

                            for (int i = 0; i < ctBCXH_Search.Length; i++)
                            {
                                int index = -1;
                                index = ctBCXH_Search[i].TenKho.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                                if (index >= 0)
                                {
                                    ctBCXH_Search_count++;
                                }
                            }
                            BCNhapHangTheoKho[] ctBCXH_Search1 = new BCNhapHangTheoKho[ctBCXH_Search_count];
                            ctBCXH_Search_count = 0;

                            for (int i = 0; i < ctBCXH_Search.Length; i++)
                            {
                                int index = -1;
                                index = ctBCXH_Search[i].TenKho.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                                if (index >= 0)
                                {
                                    ctBCXH_Search1[ctBCXH_Search_count] = ctBCXH_Search[i];
                                    ctBCXH_Search_count++;
                                }
                            }
                            if (ctBCXH_Search_count == 0)
                            {
                                tsslchitiet.Enabled = false;
                                tsslExcel.Enabled = false;
                                tsslPdf.Enabled = false;
                                tsslWord.Enabled = false;
                            }
                            else
                            {
                                tsslchitiet.Enabled = true;
                                tsslExcel.Enabled = true;
                                tsslPdf.Enabled = true;
                                tsslWord.Enabled = true;
                            }
                            ///////////////////////////////MRK FIX
                            List<Entities.BCNhapHangTheoKho> tem0 = new List<Entities.BCNhapHangTheoKho>();
                            int tong0 = 0;
                            foreach (Entities.BCNhapHangTheoKho item in ctBCXH_Search1)
                            {
                                tong0 += item.TongSoLuongNhap;
                                tem0.Add(item);
                            }
                            Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
                            tem1.TenKho = "Tổng: ";
                            tem1.TongSoLuongNhap = tong0;
                            tem0.Add(tem1);
                            //////////////////////////////////////
                            //dtgvhienthi.DataSource = ctBCXH_Search1;
                            dtgvhienthi.DataSource = tem0.ToArray();

                            FixDatagridview();
                        }
                    }
            }
            else
                if (rdbMa.Checked == true)
                {
                    if (ctBCXH_Search == null)
                    {
                        BCNhapHangTheoKho[] tkkt = new BCNhapHangTheoKho[0];
                        dtgvhienthi.DataSource = tkkt;
                        FixDatagridview();

                        tsslchitiet.Enabled = false;
                        tsslExcel.Enabled = false;
                        tsslPdf.Enabled = false;
                        tsslWord.Enabled = false;

                    }
                    else
                        if (ctBCXH_Search != null)
                        {
                            if (txtTimKiem.Text.Length == 0)
                            {
                                BCNhapHangTheoKho[] tkkt = new BCNhapHangTheoKho[0];
                                dtgvhienthi.DataSource = tkkt;
                                FixDatagridview();

                                tsslchitiet.Enabled = false;
                                tsslExcel.Enabled = false;
                                tsslPdf.Enabled = false;
                                tsslWord.Enabled = false;

                            }
                            else
                            {
                                int ctBCXH_Search_count = 0;

                                for (int i = 0; i < ctBCXH_Search.Length; i++)
                                {
                                    int index = -1;
                                    index = ctBCXH_Search[i].MaKho.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                                    if (index >= 0)
                                    {
                                        ctBCXH_Search_count++;
                                    }
                                }
                                BCNhapHangTheoKho[] ctBCXH_Search1 = new BCNhapHangTheoKho[ctBCXH_Search_count];
                                ctBCXH_Search_count = 0;

                                for (int i = 0; i < ctBCXH_Search.Length; i++)
                                {
                                    int index = -1;
                                    index = ctBCXH_Search[i].MaKho.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                                    if (index >= 0)
                                    {
                                        ctBCXH_Search1[ctBCXH_Search_count] = ctBCXH_Search[i];
                                        ctBCXH_Search_count++;
                                    }
                                }
                                if (ctBCXH_Search_count == 0)
                                {
                                    tsslchitiet.Enabled = false;
                                    tsslExcel.Enabled = false;
                                    tsslPdf.Enabled = false;
                                    tsslWord.Enabled = false;
                                }
                                else
                                {
                                    tsslchitiet.Enabled = true;
                                    tsslExcel.Enabled = true;
                                    tsslPdf.Enabled = true;
                                    tsslWord.Enabled = true;
                                }
                                ///////////////////////////////MRK FIX
                                List<Entities.BCNhapHangTheoKho> tem0 = new List<Entities.BCNhapHangTheoKho>();
                                int tong0 = 0;
                                foreach (Entities.BCNhapHangTheoKho item in ctBCXH_Search1)
                                {
                                    tong0 += item.TongSoLuongNhap;
                                    tem0.Add(item);
                                }
                                Entities.BCNhapHangTheoKho tem1 = new Entities.BCNhapHangTheoKho();
                                tem1.TenKho = "Tổng: ";
                                tem1.TongSoLuongNhap = tong0;
                                tem0.Add(tem1);
                                //////////////////////////////////////
                                //dtgvhienthi.DataSource = ctBCXH_Search1;
                                dtgvhienthi.DataSource = tem0.ToArray();

                                FixDatagridview();
                            }
                        }
                }
        }