Ejemplo n.º 1
0
        private void tsslchitiet_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            try
            {
                ///////////////////////////////MRK FIX Hiển thị
                List <Entities.BCXuatHuyHangHoa> tem0 = ((Entities.BCXuatHuyHangHoa[])dtgvhienthi.DataSource).ToList();
                //Entities.BCXuatHuyHangHoa dau = new Entities.BCXuatHuyHangHoa();
                //dau = tem0[0];
                Entities.BCXuatHuyHangHoa cuoi = new Entities.BCXuatHuyHangHoa();
                cuoi = tem0[tem0.Count - 1];
                //tem0.Remove(dau);
                tem0.Remove(cuoi);
                ////////////////////////////////////////////////
                hienthibaocao = tem0.ToArray();
                //hienthibaocao = (Entities.BCXuatHuyHangHoa[])dtgvhienthi.DataSource;

                frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, truoc, sau);
                a.ShowDialog();
            }
            catch
            {
            }
            finally
            {
                this.Enabled = true;
            }
        }
Ejemplo n.º 2
0
        private void tsslexcel_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            try
            {
                saveFileDialog1.Filter = "Excel |*.xls"; saveFileDialog1.FileName = "";
                if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ///////////////////////////////MRK FIX Hiển thị
                    List <Entities.BCXuatHuyHangHoa> tem0 = ((Entities.BCXuatHuyHangHoa[])dtgvhienthi.DataSource).ToList();
                    //Entities.BCXuatHuyHangHoa dau = new Entities.BCXuatHuyHangHoa();
                    //dau = tem0[0];
                    Entities.BCXuatHuyHangHoa cuoi = new Entities.BCXuatHuyHangHoa();
                    cuoi = tem0[tem0.Count - 1];
                    //tem0.Remove(dau);
                    tem0.Remove(cuoi);
                    ////////////////////////////////////////////////
                    hienthibaocao = tem0.ToArray();
                    //hienthibaocao = (Entities.BCXuatHuyHangHoa[])dtgvhienthi.DataSource;

                    frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, truoc, sau, saveFileDialog1.FileName, "Excel");
                }
            }
            catch
            {
            }
            finally
            {
                this.Enabled = true;
            }
        }
Ejemplo n.º 3
0
 private void rdbtimkiem3_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (hienthi == null)
         {
             dtgvhienthi.DataSource = new Entities.BCXuatHuyHangHoa[0];
             return;
         }
         ///////////////////////////////MRK FIX
         List <Entities.BCXuatHuyHangHoa> tem0 = new List <Entities.BCXuatHuyHangHoa>();
         double tong0 = 0;
         foreach (Entities.BCXuatHuyHangHoa item in hienthi)
         {
             tong0 += item.SoLuong;
             tem0.Add(item);
         }
         Entities.BCXuatHuyHangHoa tem1 = new Entities.BCXuatHuyHangHoa();
         tem1.TenHangHoa = "Tổng: ";
         tem1.SoLuong    = tong0;
         tem0.Add(tem1);
         //////////////////////////////////////
         //dtgvhienthi.DataSource = hienthi;
         dtgvhienthi.DataSource = tem0.ToArray();
     }
     catch
     {
     }
     finally
     {
         fix();
     }
 }
Ejemplo n.º 4
0
        public void TongTienNhanVien()
        {
            try
            {
                List <Entities.BCXuatHuyHangHoa> hh = new List <Entities.BCXuatHuyHangHoa>();
                foreach (Entities.PhieuXuatHuy item in phieuxuathuy)
                {
                    if (item.NgayLap.Date >= truoc.Date && item.NgayLap.Date <= sau.Date && item.TrangThai && item.MaKho == makho)
                    {
                        foreach (Entities.ChiTietXuatHuy item1 in chitietphieuxuathuy)
                        {
                            if (item1.MaPhieuXuatHuy == item.MaPhieuXuatHuy)
                            {
                                foreach (Entities.HangHoa item2 in hanghoa)
                                {
                                    if (item1.MaHangHoa == item2.MaHangHoa)
                                    {
                                        Entities.BCXuatHuyHangHoa bc = new Entities.BCXuatHuyHangHoa();
                                        bc.MaChungTu   = item.MaPhieuXuatHuy;
                                        bc.MaHangHoa   = item2.MaHangHoa;
                                        bc.NgayChungTu = item.NgayLap.ToString("dd/MM/yyyy");
                                        bc.SoLuong     = item1.SoLuong;
                                        bc.TenHangHoa  = item2.TenHangHoa;
                                        hh.Add(bc);
                                    }
                                }
                            }
                        }
                    }
                }

                hienthi = (Entities.BCXuatHuyHangHoa[])hh.ToArray();
                ///////////////////////////////MRK FIX
                List <Entities.BCXuatHuyHangHoa> tem0 = new List <Entities.BCXuatHuyHangHoa>();
                double tong0 = 0;
                foreach (Entities.BCXuatHuyHangHoa item in hienthi)
                {
                    tong0 += item.SoLuong;
                    tem0.Add(item);
                }
                Entities.BCXuatHuyHangHoa tem1 = new Entities.BCXuatHuyHangHoa();
                tem1.TenHangHoa = "Tổng: ";
                tem1.SoLuong    = tong0;
                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();
            }
        }
Ejemplo n.º 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.BCXuatHuyHangHoa[0];
             return;
         }
         int soluong = 0;
         if (hienthi != null)
         {
             if (rdbtimkiem1.Checked == true)
             {
                 for (int i = 0; i < hienthi.Length; i++)
                 {
                     int kiemtra = hienthi[i].MaHangHoa.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                     if (kiemtra >= 0)
                     {
                         soluong++;
                     }
                 }
                 if (soluong == 0)
                 {
                     dtgvhienthi.DataSource = new Entities.BCXuatHuyHangHoa[0];
                     return;
                 }
                 Entities.BCXuatHuyHangHoa[] hienthitheoid = new Entities.BCXuatHuyHangHoa[soluong];
                 soluong = 0;
                 for (int i = 0; i < hienthi.Length; i++)
                 {
                     int kiemtra = hienthi[i].MaHangHoa.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                     if (kiemtra >= 0)
                     {
                         hienthitheoid[soluong] = hienthi[i];
                         soluong++;
                     }
                 }
                 ///////////////////////////////MRK FIX
                 List <Entities.BCXuatHuyHangHoa> tem0 = new List <Entities.BCXuatHuyHangHoa>();
                 double tong0 = 0;
                 foreach (Entities.BCXuatHuyHangHoa item in hienthitheoid)
                 {
                     tong0 += item.SoLuong;
                     tem0.Add(item);
                 }
                 Entities.BCXuatHuyHangHoa tem1 = new Entities.BCXuatHuyHangHoa();
                 tem1.TenHangHoa = "Tổng: ";
                 tem1.SoLuong    = tong0;
                 tem0.Add(tem1);
                 //////////////////////////////////////
                 //dtgvhienthi.DataSource = hienthitheoid;
                 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();
     }
 }
Ejemplo n.º 6
0
        public void TongTienNhanVien()
        {
            try
            {
                List<Entities.BCXuatHuyHangHoa> hh = new List<Entities.BCXuatHuyHangHoa>();
                foreach (Entities.PhieuXuatHuy item in phieuxuathuy)
                {
                    if (item.NgayLap.Date >= truoc.Date && item.NgayLap.Date <= sau.Date && item.TrangThai && item.MaKho == makho)
                    {
                        foreach (Entities.ChiTietXuatHuy item1 in chitietphieuxuathuy)
                        {
                            if (item1.MaPhieuXuatHuy == item.MaPhieuXuatHuy)
                            {
                                foreach (Entities.HangHoa item2 in hanghoa)
                                {
                                    if (item1.MaHangHoa == item2.MaHangHoa)
                                    {
                                        Entities.BCXuatHuyHangHoa bc = new Entities.BCXuatHuyHangHoa();
                                        bc.MaChungTu = item.MaPhieuXuatHuy;
                                        bc.MaHangHoa = item2.MaHangHoa;
                                        bc.NgayChungTu = item.NgayLap.ToString("dd/MM/yyyy");
                                        bc.SoLuong = item1.SoLuong;
                                        bc.TenHangHoa = item2.TenHangHoa;
                                        hh.Add(bc);
                                    }
                                }
                            }
                        }
                    }
                }

                hienthi = (Entities.BCXuatHuyHangHoa[])hh.ToArray();
                ///////////////////////////////MRK FIX
                List<Entities.BCXuatHuyHangHoa> tem0 = new List<Entities.BCXuatHuyHangHoa>();
                double tong0 = 0;
                foreach (Entities.BCXuatHuyHangHoa item in hienthi)
                {
                    tong0 += item.SoLuong;
                    tem0.Add(item);
                }
                Entities.BCXuatHuyHangHoa tem1 = new Entities.BCXuatHuyHangHoa();
                tem1.TenHangHoa = "Tổng: ";
                tem1.SoLuong = tong0;
                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();
            }
        }
Ejemplo n.º 7
0
        private void txttimkiem_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (rdbtimkiem3.Checked == true)
                {
                    return;
                }
                if (txttimkiem.Text.Length == 0)
                {
                    dtgvhienthi.DataSource = new Entities.BCXuatHuyHangHoa[0];
                    return;
                }
                int soluong = 0;
                if (hienthi != null)
                {
                    if (rdbtimkiem1.Checked == true)
                    {
                        for (int i = 0; i < hienthi.Length; i++)
                        {
                            int kiemtra = hienthi[i].MaHangHoa.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                            if (kiemtra >= 0)
                            {
                                soluong++;
                            }
                        }
                        if (soluong == 0)
                        {
                            dtgvhienthi.DataSource = new Entities.BCXuatHuyHangHoa[0];
                            return;
                        }
                        Entities.BCXuatHuyHangHoa[] hienthitheoid = new Entities.BCXuatHuyHangHoa[soluong];
                        soluong = 0;
                        for (int i = 0; i < hienthi.Length; i++)
                        {
                            int kiemtra = hienthi[i].MaHangHoa.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper());
                            if (kiemtra >= 0)
                            {
                                hienthitheoid[soluong] = hienthi[i];
                                soluong++;
                            }
                        }
                        ///////////////////////////////MRK FIX
                        List<Entities.BCXuatHuyHangHoa> tem0 = new List<Entities.BCXuatHuyHangHoa>();
                        double tong0 = 0;
                        foreach (Entities.BCXuatHuyHangHoa item in hienthitheoid)
                        {
                            tong0 += item.SoLuong;
                            tem0.Add(item);
                        }
                        Entities.BCXuatHuyHangHoa tem1 = new Entities.BCXuatHuyHangHoa();
                        tem1.TenHangHoa = "Tổng: ";
                        tem1.SoLuong = tong0;
                        tem0.Add(tem1);
                        //////////////////////////////////////
                        //dtgvhienthi.DataSource = hienthitheoid;
                        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();
            }
        }
Ejemplo n.º 8
0
        private void tsslWord_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            try
            {

                saveFileDialog1.Filter = "Word |*.doc"; saveFileDialog1.FileName = "";
                if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ///////////////////////////////MRK FIX Hiển thị
                    List<Entities.BCXuatHuyHangHoa> tem0 = ((Entities.BCXuatHuyHangHoa[])dtgvhienthi.DataSource).ToList();
                    //Entities.BCXuatHuyHangHoa dau = new Entities.BCXuatHuyHangHoa();
                    //dau = tem0[0];
                    Entities.BCXuatHuyHangHoa cuoi = new Entities.BCXuatHuyHangHoa();
                    cuoi = tem0[tem0.Count - 1];
                    //tem0.Remove(dau);
                    tem0.Remove(cuoi);
                    ////////////////////////////////////////////////
                    hienthibaocao = tem0.ToArray();
                    //hienthibaocao = (Entities.BCXuatHuyHangHoa[])dtgvhienthi.DataSource;

                    frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, truoc, sau, saveFileDialog1.FileName, "Word");
                }
            }
            catch
            {
            }
            finally
            {

                this.Enabled = true;
            }
        }
Ejemplo n.º 9
0
        private void tsslchitiet_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            try
            {
                ///////////////////////////////MRK FIX Hiển thị
                List<Entities.BCXuatHuyHangHoa> tem0 = ((Entities.BCXuatHuyHangHoa[])dtgvhienthi.DataSource).ToList();
                //Entities.BCXuatHuyHangHoa dau = new Entities.BCXuatHuyHangHoa();
                //dau = tem0[0];
                Entities.BCXuatHuyHangHoa cuoi = new Entities.BCXuatHuyHangHoa();
                cuoi = tem0[tem0.Count - 1];
                //tem0.Remove(dau);
                tem0.Remove(cuoi);
                ////////////////////////////////////////////////
                hienthibaocao = tem0.ToArray();
                //hienthibaocao = (Entities.BCXuatHuyHangHoa[])dtgvhienthi.DataSource;

                frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, truoc, sau);
                a.ShowDialog();
            }
            catch
            {
            }
            finally
            {
                this.Enabled = true;
            }
        }
Ejemplo n.º 10
0
        private void rdbtimkiem3_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (hienthi == null)
                {
                    dtgvhienthi.DataSource = new Entities.BCXuatHuyHangHoa[0];
                    return;
                }
                ///////////////////////////////MRK FIX
                List<Entities.BCXuatHuyHangHoa> tem0 = new List<Entities.BCXuatHuyHangHoa>();
                double tong0 = 0;
                foreach (Entities.BCXuatHuyHangHoa item in hienthi)
                {
                    tong0 += item.SoLuong;
                    tem0.Add(item);
                }
                Entities.BCXuatHuyHangHoa tem1 = new Entities.BCXuatHuyHangHoa();
                tem1.TenHangHoa = "Tổng: ";
                tem1.SoLuong = tong0;
                tem0.Add(tem1);
                //////////////////////////////////////
                //dtgvhienthi.DataSource = hienthi;
                dtgvhienthi.DataSource = tem0.ToArray();

            }
            catch
            {
            }
            finally
            {
                fix();

            }
        }