コード例 #1
0
        private void rdbtimkiem3_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (hienthi == null)
                {
                    dtgvhienthi.DataSource = new Entities.BCTonKhoTheoNhomHangDGV[0];
                    return;
                }
                ///////////////////////////////MRK FIX
                List <Entities.BCTonKhoTheoNhomHangDGV> tem0 = new List <Entities.BCTonKhoTheoNhomHangDGV>();
                int tong0 = 0;
                foreach (Entities.BCTonKhoTheoNhomHangDGV item in hienthi)
                {
                    tong0 += int.Parse(item.SoLuong);
                    tem0.Add(item);
                }
                Entities.BCTonKhoTheoNhomHangDGV tem1 = new Entities.BCTonKhoTheoNhomHangDGV();
                tem1.HanhDong = "Tổng: ";
                tem1.SoLuong  = tong0.ToString();
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = hienthi;
                dtgvhienthi.DataSource = tem0.ToArray();

                if (dtgvhienthi.RowCount > 0)
                {
                    tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true;
                }
                else
                {
                    tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false;
                }
            }
            catch
            {
            }
            finally
            {
                fix();
            }
        }
コード例 #2
0
        public void HienThiTongThe()
        {
            try
            {
                hienthi = new Entities.BCTonKhoTheoNhomHangDGV[nh.Length];
                for (int i = 0; i < nh.Length; i++)
                {
                    int soluong = 0;
                    for (int j = 0; j < tonkho.Length; j++)
                    {
                        if (nh[i].MaNhomHang == tonkho[j].MaNhomHang)
                        {
                            soluong += tonkho[j].SoLuong;
                        }
                    }
                    hienthi[i] = new Entities.BCTonKhoTheoNhomHangDGV("", nh[i].MaNhomHang, nh[i].TenNhomHang, soluong.ToString());
                }
                Entities.BCTonKhoTheoNhomHangDGV[] test = new Entities.BCTonKhoTheoNhomHangDGV[hienthi.Length];
                int sotang = 0;
                for (int i = 0; i < hienthi.Length; i++)
                {
                    if (int.Parse(hienthi[i].SoLuong) != 0)
                    {
                        test[sotang] = hienthi[i];
                        sotang++;;
                    }
                }
                hienthi = new Entities.BCTonKhoTheoNhomHangDGV[sotang];
                for (int i = 0; i < hienthi.Length; i++)
                {
                    if (test[i].MaNhomHang != "")
                    {
                        hienthi[i] = test[i];
                    }
                }
                ///////////////////////////////MRK FIX
                List <Entities.BCTonKhoTheoNhomHangDGV> tem0 = new List <Entities.BCTonKhoTheoNhomHangDGV>();
                int tong0 = 0;
                foreach (Entities.BCTonKhoTheoNhomHangDGV item in hienthi)
                {
                    tong0 += int.Parse(item.SoLuong);
                    tem0.Add(item);
                }
                Entities.BCTonKhoTheoNhomHangDGV tem1 = new Entities.BCTonKhoTheoNhomHangDGV();
                tem1.HanhDong = "Tổng: ";
                tem1.SoLuong  = tong0.ToString();
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = hienthi;
                dtgvhienthi.DataSource = tem0.ToArray();

                if (hienthi.Length > 0)
                {
                    tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true;
                }
                else
                {
                    tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false;
                }
            }
            catch
            {
            }
            finally
            {
                fix();
            }
        }
コード例 #3
0
 private void txttimkiem_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (rdbtimkiem3.Checked == true)
         {
             return;
         }
         if (txttimkiem.Text.Length == 0)
         {
             dtgvhienthi.DataSource = new Entities.BCTonKhoTheoNhomHangDGV[0];
             return;
         }
         int soluong = 0;
         if (hienthi != null)
         {
             if (rdbtimkiem1.Checked == true)
             {
                 for (int i = 0; i < hienthi.Length; i++)
                 {
                     int kiemtra = hienthi[i].MaNhomHang.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                     if (kiemtra >= 0)
                     {
                         soluong++;
                     }
                 }
                 if (soluong == 0)
                 {
                     dtgvhienthi.DataSource = new Entities.BCTonKhoTheoNhomHangDGV[0];
                     return;
                 }
                 Entities.BCTonKhoTheoNhomHangDGV[] hienthitheoid = new Entities.BCTonKhoTheoNhomHangDGV[soluong];
                 soluong = 0;
                 for (int i = 0; i < hienthi.Length; i++)
                 {
                     int kiemtra = hienthi[i].MaNhomHang.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                     if (kiemtra >= 0)
                     {
                         hienthitheoid[soluong] = hienthi[i];
                         soluong++;
                     }
                 }
                 ///////////////////////////////MRK FIX
                 List <Entities.BCTonKhoTheoNhomHangDGV> tem0 = new List <Entities.BCTonKhoTheoNhomHangDGV>();
                 int tong0 = 0;
                 foreach (Entities.BCTonKhoTheoNhomHangDGV item in hienthitheoid)
                 {
                     tong0 += int.Parse(item.SoLuong);
                     tem0.Add(item);
                 }
                 Entities.BCTonKhoTheoNhomHangDGV tem1 = new Entities.BCTonKhoTheoNhomHangDGV();
                 tem1.HanhDong = "Tổng: ";
                 tem1.SoLuong  = tong0.ToString();
                 tem0.Add(tem1);
                 //////////////////////////////////////
                 //dtgvhienthi.DataSource = hienthitheoid;
                 dtgvhienthi.DataSource = tem0.ToArray();
             }
             if (rdbtimkiem2.Checked == true)
             {
                 for (int i = 0; i < hienthi.Length; i++)
                 {
                     int kiemtra = hienthi[i].TenNhomHang.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                     if (kiemtra >= 0)
                     {
                         soluong++;
                     }
                 }
                 if (soluong == 0)
                 {
                     dtgvhienthi.DataSource = new Entities.BCTonKhoTheoNhomHangDGV[0];
                     return;
                 }
                 Entities.BCTonKhoTheoNhomHangDGV[] hienthitheoma = new Entities.BCTonKhoTheoNhomHangDGV[soluong];
                 soluong = 0;
                 for (int i = 0; i < hienthi.Length; i++)
                 {
                     int kiemtra = hienthi[i].TenNhomHang.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                     if (kiemtra >= 0)
                     {
                         hienthitheoma[soluong] = hienthi[i];
                         soluong++;
                     }
                 }
                 ///////////////////////////////MRK FIX
                 List <Entities.BCTonKhoTheoNhomHangDGV> tem0 = new List <Entities.BCTonKhoTheoNhomHangDGV>();
                 int tong0 = 0;
                 foreach (Entities.BCTonKhoTheoNhomHangDGV item in hienthitheoma)
                 {
                     tong0 += int.Parse(item.SoLuong);
                     tem0.Add(item);
                 }
                 Entities.BCTonKhoTheoNhomHangDGV tem1 = new Entities.BCTonKhoTheoNhomHangDGV();
                 tem1.HanhDong = "Tổng: ";
                 tem1.SoLuong  = tong0.ToString();
                 tem0.Add(tem1);
                 //////////////////////////////////////
                 //dtgvhienthi.DataSource = hienthitheoma;
                 dtgvhienthi.DataSource = tem0.ToArray();
             }
             if (dtgvhienthi.RowCount > 0)
             {
                 tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true;
             }
             else
             {
                 tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false;
             }
         }
     }
     finally
     {
         fix();
     }
 }
コード例 #4
0
        public void HienThiTongThe()
        {
            try
            {
                hienthi = new Entities.BCTonKhoTheoNhomHangDGV[nh.Length];
                for (int i = 0; i < nh.Length; i++)
                {
                    int soluong = 0;
                    for (int j = 0; j < tonkho.Length; j++)
                    {
                        if (nh[i].MaNhomHang == tonkho[j].MaNhomHang)
                        {
                            soluong += tonkho[j].SoLuong;
                        }
                    }
                    hienthi[i] = new Entities.BCTonKhoTheoNhomHangDGV("", nh[i].MaNhomHang, nh[i].TenNhomHang, soluong.ToString());
                }
                Entities.BCTonKhoTheoNhomHangDGV[] test = new Entities.BCTonKhoTheoNhomHangDGV[hienthi.Length];
                int sotang = 0;
                for (int i = 0; i < hienthi.Length; i++)
                {
                    if (int.Parse(hienthi[i].SoLuong) != 0)
                    {
                        test[sotang] = hienthi[i];
                        sotang++; ;
                    }
                }
                hienthi = new Entities.BCTonKhoTheoNhomHangDGV[sotang];
                for (int i = 0; i < hienthi.Length; i++)
                {
                    if (test[i].MaNhomHang != "")
                        hienthi[i] = test[i];
                }
                ///////////////////////////////MRK FIX
                List<Entities.BCTonKhoTheoNhomHangDGV> tem0 = new List<Entities.BCTonKhoTheoNhomHangDGV>();
                int tong0 = 0;
                foreach (Entities.BCTonKhoTheoNhomHangDGV item in hienthi)
                {
                    tong0 += int.Parse(item.SoLuong);
                    tem0.Add(item);
                }
                Entities.BCTonKhoTheoNhomHangDGV tem1 = new Entities.BCTonKhoTheoNhomHangDGV();
                tem1.HanhDong = "Tổng: ";
                tem1.SoLuong = tong0.ToString();
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = hienthi;
                dtgvhienthi.DataSource = tem0.ToArray();

                if (hienthi.Length > 0)
                {
                    tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true;
                }
                else
                {
                    tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false;
                }
            }
            catch
            {
            }
            finally
            {
                fix();
            }
        }
コード例 #5
0
        private void txttimkiem_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (rdbtimkiem3.Checked == true)
                {
                    return;
                }
                if (txttimkiem.Text.Length == 0)
                {
                    dtgvhienthi.DataSource = new Entities.BCTonKhoTheoNhomHangDGV[0];
                    return;
                }
                int soluong = 0;
                if (hienthi != null)
                {
                    if (rdbtimkiem1.Checked == true)
                    {
                        for (int i = 0; i < hienthi.Length; i++)
                        {
                            int kiemtra = hienthi[i].MaNhomHang.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                            if (kiemtra >= 0)
                            {
                                soluong++;
                            }
                        }
                        if (soluong == 0)
                        {
                            dtgvhienthi.DataSource = new Entities.BCTonKhoTheoNhomHangDGV[0];
                            return;
                        }
                        Entities.BCTonKhoTheoNhomHangDGV[] hienthitheoid = new Entities.BCTonKhoTheoNhomHangDGV[soluong];
                        soluong = 0;
                        for (int i = 0; i < hienthi.Length; i++)
                        {
                            int kiemtra = hienthi[i].MaNhomHang.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                            if (kiemtra >= 0)
                            {
                                hienthitheoid[soluong] = hienthi[i];
                                soluong++;
                            }
                        }
                        ///////////////////////////////MRK FIX
                        List<Entities.BCTonKhoTheoNhomHangDGV> tem0 = new List<Entities.BCTonKhoTheoNhomHangDGV>();
                        int tong0 = 0;
                        foreach (Entities.BCTonKhoTheoNhomHangDGV item in hienthitheoid)
                        {
                            tong0 += int.Parse(item.SoLuong);
                            tem0.Add(item);
                        }
                        Entities.BCTonKhoTheoNhomHangDGV tem1 = new Entities.BCTonKhoTheoNhomHangDGV();
                        tem1.HanhDong = "Tổng: ";
                        tem1.SoLuong = tong0.ToString();
                        tem0.Add(tem1);
                        //////////////////////////////////////
                        //dtgvhienthi.DataSource = hienthitheoid;
                        dtgvhienthi.DataSource = tem0.ToArray();

                    }
                    if (rdbtimkiem2.Checked == true)
                    {
                        for (int i = 0; i < hienthi.Length; i++)
                        {
                            int kiemtra = hienthi[i].TenNhomHang.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                            if (kiemtra >= 0)
                            {
                                soluong++;
                            }
                        }
                        if (soluong == 0)
                        {
                            dtgvhienthi.DataSource = new Entities.BCTonKhoTheoNhomHangDGV[0];
                            return;
                        }
                        Entities.BCTonKhoTheoNhomHangDGV[] hienthitheoma = new Entities.BCTonKhoTheoNhomHangDGV[soluong];
                        soluong = 0;
                        for (int i = 0; i < hienthi.Length; i++)
                        {
                            int kiemtra = hienthi[i].TenNhomHang.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                            if (kiemtra >= 0)
                            {
                                hienthitheoma[soluong] = hienthi[i];
                                soluong++;
                            }
                        }
                        ///////////////////////////////MRK FIX
                        List<Entities.BCTonKhoTheoNhomHangDGV> tem0 = new List<Entities.BCTonKhoTheoNhomHangDGV>();
                        int tong0 = 0;
                        foreach (Entities.BCTonKhoTheoNhomHangDGV item in hienthitheoma)
                        {
                            tong0 += int.Parse(item.SoLuong);
                            tem0.Add(item);
                        }
                        Entities.BCTonKhoTheoNhomHangDGV tem1 = new Entities.BCTonKhoTheoNhomHangDGV();
                        tem1.HanhDong = "Tổng: ";
                        tem1.SoLuong = tong0.ToString();
                        tem0.Add(tem1);
                        //////////////////////////////////////
                        //dtgvhienthi.DataSource = hienthitheoma;
                        dtgvhienthi.DataSource = tem0.ToArray();

                    }
                    if (dtgvhienthi.RowCount > 0)
                    {
                        tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true;
                    }
                    else
                    {
                        tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false;
                    }
                }
            }
            finally
            {
                fix();
            }
        }
コード例 #6
0
        private void rdbtimkiem3_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (hienthi == null)
                {
                    dtgvhienthi.DataSource = new Entities.BCTonKhoTheoNhomHangDGV[0];
                    return;
                }
                ///////////////////////////////MRK FIX
                List<Entities.BCTonKhoTheoNhomHangDGV> tem0 = new List<Entities.BCTonKhoTheoNhomHangDGV>();
                int tong0 = 0;
                foreach (Entities.BCTonKhoTheoNhomHangDGV item in hienthi)
                {
                    tong0 += int.Parse(item.SoLuong);
                    tem0.Add(item);
                }
                Entities.BCTonKhoTheoNhomHangDGV tem1 = new Entities.BCTonKhoTheoNhomHangDGV();
                tem1.HanhDong = "Tổng: ";
                tem1.SoLuong = tong0.ToString();
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = hienthi;
                dtgvhienthi.DataSource = tem0.ToArray();

                if (dtgvhienthi.RowCount > 0)
                {
                    tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true;
                }
                else
                {
                    tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false;
                }
            }
            catch
            {
            }
            finally
            {
                fix();

            }
        }