Exemplo n.º 1
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.BCThue> tem0 = ((Entities.BCThue[])dtgvhienthi.DataSource).ToList();
             //Entities.BCThue dau = new Entities.BCThue();
             //dau = tem0[0];
             Entities.BCThue cuoi = new Entities.BCThue();
             cuoi = tem0[tem0.Count - 1];
             //tem0.Remove(dau);
             tem0.Remove(cuoi);
             ////////////////////////////////////////////////
             hienthibaocao = tem0.ToArray();
             //hienthibaocao = (Entities.BCThue[])dtgvhienthi.DataSource;
             frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, mathue, giatrithue, truoc, sau, saveFileDialog1.FileName, "Word");
         }
     }
     catch
     {
     }
     finally
     {
         this.Enabled = true;
     }
 }
Exemplo n.º 2
0
        private void tsslchitiet_Click(object sender, EventArgs e)
        {
            //CongTy();
            //cl = new Server_Client.Client();
            //this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            //Entities.rptBCChiTietHangHoa kh = new Entities.rptBCChiTietHangHoa("Select");
            //Entities.rptBCChiTietHangHoa[] kh1 = new Entities.rptBCChiTietHangHoa[1];
            //clientstrem = cl.SerializeObj(this.client1, "BCChiTietHangHoa", kh);
            //kh1 = (Entities.rptBCChiTietHangHoa[])cl.DeserializeHepper1(clientstrem, kh1);
            //if (kh1 == null)
            //{
            //    MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
            //    return;
            //}
            //GUI.Report.rptBCChiTietHangHoa report = new GUI.Report.rptBCChiTietHangHoa();
            //report.SetDataSource(kh1);
            //crvReport.ReportSource = report;
            //report.SetParameterValue("TenCongTy", CT.TenCongTy);
            //report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
            //report.SetParameterValue("DienThoai", CT.SoDienThoai);
            //report.SetParameterValue("FaxCongTy", CT.Fax);
            //report.SetParameterValue("Web", CT.Website);
            //report.SetParameterValue("TenBaoCao", "Báo Cáo Chi Tiết Hàng Hóa");
            //report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
            //report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
            //report.SetParameterValue("Email", CT.Email);
            //crvReport.Show();
            //break;

            frmBaoCaorpt frm = new frmBaoCaorpt("ChiTietHangHoa");

            frm.ShowDialog();
        }
Exemplo n.º 3
0
 private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     this.Enabled = false;
     try
     {
         ///////////////////////////////MRK FIX Hiển thị
         List <Entities.BCThue> tem0 = ((Entities.BCThue[])dtgvhienthi.DataSource).ToList();
         //Entities.BCThue dau = new Entities.BCThue();
         //dau = tem0[0];
         Entities.BCThue cuoi = new Entities.BCThue();
         cuoi = tem0[tem0.Count - 1];
         //tem0.Remove(dau);
         tem0.Remove(cuoi);
         ////////////////////////////////////////////////
         hienthibaocao = tem0.ToArray();
         frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, mathue, giatrithue, truoc, sau);
         a.ShowDialog();
     }
     catch
     {
     }
     finally
     {
         this.Enabled = true;
     }
 }
        private void tsslExcel_Click(object sender, EventArgs e)
        {
            string makho  = dtgvhienthi.CurrentRow.Cells["MaKho"].Value.ToString();
            string tenkho = dtgvhienthi.CurrentRow.Cells["TenKho"].Value.ToString();

            if ((int)dtgvhienthi.CurrentRow.Cells["TongSoLuongNhap"].Value == 0)
            {
                MessageBox.Show("Không có hàng nhập kho" + tenkho + " trong Khoảng từ ngày : " + xulyNgay(BatDau) + " đến " + xulyNgay(KetThuc) + " ");
            }
            else
            {
                saveFileDialog1.Filter = "Excel |*.xls"; saveFileDialog1.FileName = "";
                if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    LayHoaDonNhap_TheoMaKho(makho);
                    LayKHTL_TheoMaKho(makho);
                    LayPhieuDieuChuyenKhoNoiBo_TheoKhoDen(makho);


                    LayChiTiet_HangHoaXuat_TheoKho(makho, tenkho);
                    LayChiTiet_SoLuong_HangHoaNhap_TheoKho();
                    frmBaoCaorpt frm = new frmBaoCaorpt(ctBCXH, BatDau, KetThuc, saveFileDialog1.FileName, "Excel");
                    frm.ShowDialog();
                }
            }
        }
        private void tsslchitiet_Click(object sender, EventArgs e)
        {
            if (i < 0)
                return;
            try
            {
                int sl = 0;

                for (int j = 0; j < hienthibaocao.Length; j++)
                {
                    string mahanghoa = dtgvhienthi.Rows[i].Cells["MaHangHoa"].Value.ToString();
                    if (hienthibaocao[j].MaHangHoa == dtgvhienthi.Rows[i].Cells["MaHangHoa"].Value.ToString())
                    {
                        sl++;
                    }
                }

                Entities.BCDTTheoHangHoa[] a = new Entities.BCDTTheoHangHoa[sl];
                sl = 0;
                for (int j = 0; j < hienthibaocao.Length; j++)
                {
                    if (hienthibaocao[j].MaHangHoa == dtgvhienthi.Rows[i].Cells["MaHangHoa"].Value.ToString())
                    {
                        a[sl] = hienthibaocao[j];
                        sl++;
                    }
                }
                frmBaoCaorpt b = new frmBaoCaorpt(hienthibaocao, truoc, sau);
                b.ShowDialog();
            }
            catch
            {
            }
        }
Exemplo n.º 6
0
 private void tsslWord_Click(object sender, EventArgs e)
 {
     try
     {
         if (i < 0)
         {
             return;
         }
         disable();
         saveFileDialog1.Filter = "Word |*.doc"; saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string manhomhang = dtgvhienthi["MaNhomHang", i].Value.ToString();
             Report.rptXuatNhapHangTheoNhomHang report = new Report.rptXuatNhapHangTheoNhomHang();
             report.SetDataSource(ChiTietNhom(manhomhang));
             report.SetParameterValue("Ky", thang.ToString() + "-" + nam.ToString());
             report.SetParameterValue("TenBaoCao", "Báo Cáo Xuất Nhập Tồn Theo Nhóm Hàng");
             frmBaoCaorpt a = new frmBaoCaorpt(report, saveFileDialog1.FileName, Report.ExportCrystalReport.TypeBC.WordForWindows);
             a.Dispose();
         }
     }
     catch
     {
     }
     finally
     {
         enable();
     }
 }
Exemplo n.º 7
0
 private void btnPDF_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     try
     {
         saveFileDialog1.Filter = "PDF |*.pdf"; saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             // Khach hang
             if (kh1 != null)
             {
                 string       maKhachHang  = kh1.MaKH;
                 string       tenKhachHang = kh1.Ten;
                 string       diaChi       = kh1.DiaChi;
                 double       duDauKy      = double.Parse(txtdudauky.Text);
                 double       duCuoiKy     = double.Parse(txtducuoiky.Text);
                 frmBaoCaorpt a            = new frmBaoCaorpt(list.ToArray(), maKhachHang, tenKhachHang, diaChi, duDauKy, duCuoiKy, "PDF", saveFileDialog1.FileName, "KH", "Khách Hàng");
             }
             else
             {
                 string       maKhachHang  = ncc1.MaNhaCungCap;
                 string       tenKhachHang = ncc1.TenNhaCungCap;
                 string       diaChi       = ncc1.DiaChi;
                 double       duDauKy      = double.Parse(txtdudauky.Text);
                 double       duCuoiKy     = double.Parse(txtducuoiky.Text);
                 frmBaoCaorpt a            = new frmBaoCaorpt(list.ToArray(), maKhachHang, tenKhachHang, diaChi, duDauKy, duCuoiKy, "PDF", saveFileDialog1.FileName, "NCC", "Nhà Cung Cấp");
             }
         }
     }
     catch
     {
     }
     finally { this.Enabled = true; }
 }
 private void tsslchitiet_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     //if (i < 0)
     //    return;
     try
     {
         Entities.BCNhapHangTheoNhom[] data = (Entities.BCNhapHangTheoNhom[])dtgvhienthi.DataSource;
         if (data == null)
         {
             return;
         }
         else if (data.Length == 0)
         {
             return;
         }
         //Xem
         string MaNhomHang = dtgvhienthi["MaNhomHang", i].Value.ToString();
         List <Entities.BCNhapHangTheoNhomChiTiet> L = (from k in HIENTHIBAOCAO where k.MaNhomHang.Equals(MaNhomHang) select k).ToList();
         frmBaoCaorpt a = new frmBaoCaorpt(L.ToArray(), thang.ToString(), nam.ToString());
         a.ShowDialog();
     }
     catch { }
     finally
     {
         this.Enabled = true;
     }
 }
Exemplo n.º 9
0
        private void tsslchitiet_Click(object sender, EventArgs e)
        {
            //CongTy();
            //cl = new Server_Client.Client();
            //this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            //Entities.rptBCChiTietHangHoa kh = new Entities.rptBCChiTietHangHoa("Select");
            //Entities.rptBCChiTietHangHoa[] kh1 = new Entities.rptBCChiTietHangHoa[1];
            //clientstrem = cl.SerializeObj(this.client1, "BCChiTietHangHoa", kh);
            //kh1 = (Entities.rptBCChiTietHangHoa[])cl.DeserializeHepper1(clientstrem, kh1);
            //if (kh1 == null)
            //{
            //    MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
            //    return;
            //}
            //GUI.Report.rptBCChiTietHangHoa report = new GUI.Report.rptBCChiTietHangHoa();
            //report.SetDataSource(kh1);
            //crvReport.ReportSource = report;
            //report.SetParameterValue("TenCongTy", CT.TenCongTy);
            //report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
            //report.SetParameterValue("DienThoai", CT.SoDienThoai);
            //report.SetParameterValue("FaxCongTy", CT.Fax);
            //report.SetParameterValue("Web", CT.Website);
            //report.SetParameterValue("TenBaoCao", "Báo Cáo Chi Tiết Hàng Hóa");
            //report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
            //report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
            //report.SetParameterValue("Email", CT.Email);
            //crvReport.Show();
            //break;

            frmBaoCaorpt frm = new frmBaoCaorpt("ChiTietHangHoa");
            frm.ShowDialog();
        }
Exemplo n.º 10
0
 private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (i < 0)
     {
         return;
     }
     try
     {
         disable();
         string manhomhang = dtgvhienthi["MaNhomHang", i].Value.ToString();
         Report.rptXuatNhapHangTheoNhomHang report = new Report.rptXuatNhapHangTheoNhomHang();
         report.SetDataSource(ChiTietNhom(manhomhang));
         report.SetParameterValue("Ky", thang.ToString() + "-" + nam.ToString());
         report.SetParameterValue("TenBaoCao", "Báo Cáo Xuất Nhập Tồn Theo Nhóm Hàng");
         frmBaoCaorpt a = new frmBaoCaorpt(report);
         a.ShowDialog();
     }
     catch
     {
     }
     finally
     {
         enable();
     }
 }
Exemplo n.º 11
0
        private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (i < 0)
            {
                return;
            }
            try
            {
                int sl = 0;

                for (int j = 0; j < hienthibaocao.Length; j++)
                {
                    if (hienthibaocao[j].MaHangHoa == dtgvhienthi.Rows[i].Cells["MaHangHoa"].Value.ToString())
                    {
                        sl++;
                    }
                }

                Entities.BCDTTheoHangHoa[] a = new Entities.BCDTTheoHangHoa[sl];
                sl = 0;
                for (int j = 0; j < hienthibaocao.Length; j++)
                {
                    if (hienthibaocao[j].MaHangHoa == dtgvhienthi.Rows[i].Cells["MaHangHoa"].Value.ToString())
                    {
                        a[sl] = hienthibaocao[j];
                        sl++;
                    }
                }
                frmBaoCaorpt b = new frmBaoCaorpt(a, truoc, sau);
                b.ShowDialog();
            }
            catch
            {
            }
        }
Exemplo n.º 12
0
 private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (i < 0)
     {
         return;
     }
     try
     {
         string b = "";
         string c = "01/" + cbbthang.Text + "/" + cbbnam.Text;
         if (cbbthang.Text == "12")
         {
             b = "01/01/" + (int.Parse(cbbnam.Text) + 1).ToString();
         }
         else
         {
             b = "01/" + (int.Parse(cbbthang.Text) + 1).ToString() + "/" + cbbnam.Text;
         }
         frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao.ToArray(), c, b, "");
         a.ShowDialog();
     }
     catch
     {
     }
 }
Exemplo n.º 13
0
 private void tsslexcel_Click(object sender, EventArgs e)
 {
     try
     {
         if (i < 0)
         {
             return;
         }
         saveFileDialog1.Filter = "Excel |*.xls"; saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string b = "";
             string c = new DateTime(Convert.ToInt32(cbbnam.Text), Convert.ToInt32(cbbthang.Text), 1).ToString();
             b = new DateTime(Convert.ToInt32(cbbnam.Text), Convert.ToInt32(cbbthang.Text), DateTime.DaysInMonth(Convert.ToInt32(cbbnam.Text), Convert.ToInt32(cbbthang.Text))).ToString();
             //string c = "01/" + cbbthang.Text + "/" + cbbnam.Text;
             //if (cbbthang.Text == "12")
             //    b = "01/01/" + (int.Parse(cbbnam.Text) + 1).ToString();
             //else
             //    b = "01/" + (int.Parse(cbbthang.Text) + 1).ToString() + "/" + cbbnam.Text;
             frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao.ToArray(), c, b, saveFileDialog1.FileName, "Excel");
         }
     }
     catch
     {
     }
 }
Exemplo n.º 14
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;
            }
        }
Exemplo n.º 15
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;
            }
        }
Exemplo n.º 16
0
 private void tsslexcel_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.BCTienTonKho[] data = (Entities.BCTienTonKho[])dtgvhienthi.DataSource;
         if (data == null)
         {
             return;
         }
         else if (data.Length == 0)
         {
             return;
         }
         if (chon < 0)
         {
             return;
         }
         string MK = dtgvhienthi["MaKho", chon].Value.ToString();
         foreach (Entities.BCTienTonKho item in data)
         {
             if (item.MaKho.Equals(MK))
             {
                 //XLS
                 saveFileDialog1.Filter = "Excel |*.xls"; saveFileDialog1.FileName = "";
                 if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     frmBaoCaorpt a = new frmBaoCaorpt(item, start.ToString("dd/MM/yyyy"), end.ToString("dd/MM/yyyy"), saveFileDialog1.FileName, "Excel");
                 }
             }
         }
     }
     catch { }
 }
Exemplo n.º 17
0
 private void tsslWord_Click(object sender, EventArgs e)
 {
     try
     {
         List <Entities.SoQuy> tem0 = ((Entities.SoQuy[])dtgvsoquy.DataSource).ToList();
         tem0.RemoveAt(tem0.Count - 1);
         Entities.SoQuy[] tem = tem0.ToArray();
         if (tem.Length > 0)
         {
             SaveFileDialog s = new SaveFileDialog();
             s.Filter = "DOC |*.doc";
             if (s.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 frmBaoCaorpt a = new frmBaoCaorpt("SoQuy_DOC", tem, s.FileName, true);
                 a.ShowDialog();
             }
         }
         else
         {
             MessageBox.Show("Vui lòng kiểm tra lại dữ liệu trước khi in!");
         }
     }
     catch
     {
     }
 }
Exemplo n.º 18
0
 private void tsslexcel_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     try
     {
         //if (i < 0)
         //    return;
         Entities.BCNhapHangTheoNhom[] data = (Entities.BCNhapHangTheoNhom[])dtgvhienthi.DataSource;
         if (data == null)
         {
             return;
         }
         else if (data.Length == 0)
         {
             return;
         }
         //XLS
         saveFileDialog1.Filter = "Excel |*.xls"; saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string MaNhomHang = dtgvhienthi["MaNhomHang", i].Value.ToString();
             List <Entities.BCNhapHangTheoNhomChiTiet> L = (from k in HIENTHIBAOCAO where k.MaNhomHang.Equals(MaNhomHang) select k).ToList();
             frmBaoCaorpt a = new frmBaoCaorpt(L.ToArray(), thang.ToString(), nam.ToString(), saveFileDialog1.FileName, "Excel");
         }
     }
     catch { }
     finally
     {
         this.Enabled = true;
     }
 }
Exemplo n.º 19
0
 private void tsslexcel_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     try
     {
         if (i < 0)
         {
             return;
         }
         HienThi(dtgvhienthi["MaKho", i].Value.ToString());
         if (kiemtra == false)
         {
             return;
         }
         saveFileDialog1.Filter = "Excel |*.xls"; saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             frmBaoCaorpt a = new frmBaoCaorpt(hienthi, saveFileDialog1.FileName, "Excel");
         }
     }
     catch
     {
     }
     finally
     {
         this.Enabled = true;
     }
 }
Exemplo n.º 20
0
 private void tsslExcel_Click(object sender, EventArgs e)
 {
     try
     {
         List <Entities.SoQuy> tem0 = ((Entities.SoQuy[])dtgvhienthi.DataSource).ToList();
         tem0.RemoveAt(tem0.Count - 1);
         Entities.SoQuy[] tem = tem0.ToArray();
         if (tem.Length > 0)
         {
             SaveFileDialog s = new SaveFileDialog();
             s.Filter = "XLS |*.xls";
             if (s.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 foreach (Entities.SoQuy item in tem)
                 {
                     item.MaTK     = lbhienthima.Text;
                     item.TenTK    = lbhienthiten.Text;
                     item.DuDauKy  = txtdudauky.Text;
                     item.DuCuoiKy = txtducuoiky.Text;
                 }
                 frmBaoCaorpt a = new frmBaoCaorpt("SoQuy_XLS", tem, s.FileName, false);
                 a.ShowDialog();
             }
         }
         else
         {
             MessageBox.Show("Vui lòng kiểm tra lại dữ liệu trước khi in!");
         }
     }
     catch
     {
     }
 }
Exemplo n.º 21
0
        private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            string makho  = dtgvhienthi.Rows[e.RowIndex].Cells["MaKho"].Value.ToString();
            string tenkho = dtgvhienthi.Rows[e.RowIndex].Cells["TenKho"].Value.ToString();

            if ((int)dtgvhienthi.Rows[e.RowIndex].Cells["TongSoLuongNhap"].Value == 0)
            {
                MessageBox.Show("Không có hàng nhập kho" + tenkho + " trong Khoảng từ ngày : " + xulyNgay(BatDau) + " đến " + xulyNgay(KetThuc) + " ");
            }
            else
            {
                LayHoaDonNhap_TheoMaKho(makho);
                LayKHTL_TheoMaKho(makho);
                LayPhieuDieuChuyenKhoNoiBo_TheoKhoDen(makho);


                LayChiTiet_HangHoaXuat_TheoKho(makho, tenkho);
                LayChiTiet_SoLuong_HangHoaNhap_TheoKho();
                frmBaoCaorpt frm = new frmBaoCaorpt(ctBCXH, BatDau, KetThuc);
                frm.ShowDialog();
            }
        }
Exemplo n.º 22
0
 private void tsslchitiet_Click(object sender, EventArgs e)
 {
     try
     {
         List <Entities.SoQuy> tem0 = ((Entities.SoQuy[])dtgvhienthi.DataSource).ToList();
         tem0.RemoveAt(tem0.Count - 1);
         Entities.SoQuy[] tem = tem0.ToArray();
         if (tem.Length > 0)
         {
             foreach (Entities.SoQuy item in tem)
             {
                 item.MaTK     = lbhienthima.Text;
                 item.TenTK    = lbhienthiten.Text;
                 item.DuDauKy  = txtdudauky.Text;
                 item.DuCuoiKy = txtducuoiky.Text;
             }
             frmBaoCaorpt a = new frmBaoCaorpt("SoQuy_In", tem, "", false);
             a.ShowDialog();
         }
         else
         {
             MessageBox.Show("Vui lòng kiểm tra lại dữ liệu trước khi in!");
         }
     }
     catch
     {
     }
 }
 private void tsslchitiet_Click(object sender, EventArgs e)
 {
     if (i < 0)
     {
         return;
     }
     try
     {
         disable();
         string maloaihang = dtgvhienthi["MaHangHoa", i].Value.ToString();
         Report.rptBaoCaoNhapHangTheoMatHang report = new Report.rptBaoCaoNhapHangTheoMatHang();
         report.SetDataSource(ChiTietHang(maloaihang));
         report.SetParameterValue("Ky", thang.ToString() + "-" + nam.ToString());
         report.SetParameterValue("TenBaoCao", "Báo Cáo Nhập Hàng Theo Hàng Hóa");
         frmBaoCaorpt a = new frmBaoCaorpt(report);
         a.ShowDialog();
     }
     catch
     {
     }
     finally
     {
         enable();
     }
 }
Exemplo n.º 24
0
 private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     this.Enabled = false;
     try
     {
         Entities.BCTienTonKho[] data = (Entities.BCTienTonKho[])dtgvhienthi.DataSource;
         if (data == null)
         {
             return;
         }
         else if (data.Length == 0)
         {
             return;
         }
         if (chon < 0)
         {
             return;
         }
         string MK = dtgvhienthi["MaKho", chon].Value.ToString();
         foreach (Entities.BCTienTonKho item in data)
         {
             if (item.MaKho.Equals(MK))
             {
                 //Xem
                 frmBaoCaorpt a = new frmBaoCaorpt(item, start.ToString("dd/MM/yyyy"), end.ToString("dd/MM/yyyy"));
                 a.ShowDialog();
             }
         }
     }
     catch { }
     finally
     {
         this.Enabled = true;
     }
 }
 private void tsslexcel_Click(object sender, EventArgs e)
 {
     try
     {
         if (i < 0)
         {
             return;
         }
         disable();
         saveFileDialog1.Filter = "Excel |*.xls"; saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string maloaihang = dtgvhienthi["MaHangHoa", i].Value.ToString();
             Report.rptBaoCaoNhapHangTheoMatHang report = new Report.rptBaoCaoNhapHangTheoMatHang();
             report.SetDataSource(ChiTietHang(maloaihang));
             report.SetParameterValue("Ky", thang.ToString() + "-" + nam.ToString());
             report.SetParameterValue("TenBaoCao", "Báo Cáo Nhập Hàng Theo Hàng Hóa");
             frmBaoCaorpt a = new frmBaoCaorpt(report, saveFileDialog1.FileName, Report.ExportCrystalReport.TypeBC.Excel);
             a.Dispose();
         }
     }
     catch
     {
     }
     finally
     {
         enable();
     }
 }
Exemplo n.º 26
0
 private void btnXem_Click(object sender, EventArgs e)
 {
     try
     {
         // Khach hang
         if (kh1 != null)
         {
             string       maKhachHang  = kh1.MaKH;
             string       tenKhachHang = kh1.Ten;
             string       diaChi       = kh1.DiaChi;
             double       duDauKy      = double.Parse(txtdudauky.Text);
             double       duCuoiKy     = double.Parse(txtducuoiky.Text);
             frmBaoCaorpt a            = new frmBaoCaorpt(list.ToArray(), maKhachHang, tenKhachHang, diaChi, duDauKy, duCuoiKy, "In", "", "KH", "Khách Hàng");
             a.ShowDialog();
         }
         else
         {
             string       maKhachHang  = ncc1.MaNhaCungCap;
             string       tenKhachHang = ncc1.TenNhaCungCap;
             string       diaChi       = ncc1.DiaChi;
             double       duDauKy      = double.Parse(txtdudauky.Text);
             double       duCuoiKy     = double.Parse(txtducuoiky.Text);
             frmBaoCaorpt a            = new frmBaoCaorpt(list.ToArray(), maKhachHang, tenKhachHang, diaChi, duDauKy, duCuoiKy, "In", "", "NCC", "Nhà Cung Cấp");
             a.ShowDialog();
         }
     }
     catch (Exception)
     { }
 }
Exemplo n.º 27
0
 private void tsslexcel_Click(object sender, EventArgs e)
 {
     //XLS
     SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "Excel |*.xls", FileName = string.Empty };
     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         frmBaoCaorpt a = new frmBaoCaorpt(_dsBcChiTietHangHoa, new Dictionary<string, object>(), saveFileDialog1.FileName, "Excel");
     }
 }
Exemplo n.º 28
0
 private void tsslchitiet_Click(object sender, EventArgs e)
 {
     try
     {
         frmBaoCaorpt a = new frmBaoCaorpt(baocao, truoc, sau);
         a.ShowDialog();
     }
     catch
     {
     }
 }
Exemplo n.º 29
0
 private void btnXem_Click(object sender, EventArgs e)
 {
     try
     {
         frmBaoCaorpt a = new frmBaoCaorpt(ctkhArr, truoc, sau, "In", "");
         a.ShowDialog();
     }
     catch
     {
     }
 }
Exemplo n.º 30
0
 /// <summary>
 /// chay thoi gian
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmLoad_Load(object sender, EventArgs e)
 {
     new Klib.Klib().KTime();
     Luu.GKOK = Klib2.KTienIch.GEN();
     timer1.Start();
     try
     {
         frmBaoCaorpt a = new frmBaoCaorpt("Test");
         a.Close();
     }
     catch { }
 }
Exemplo n.º 31
0
 /// <summary>
 /// chay thoi gian
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmLoad_Load(object sender, EventArgs e)
 {
     new Klib.Klib().KTime();
     Luu.GKOK = Klib2.KTienIch.GEN();
     timer1.Start();
     try
     {
         frmBaoCaorpt a = new frmBaoCaorpt("Test");
         a.Close();
     }
     catch { }
 }
Exemplo n.º 32
0
        private void tsslWord_Click(object sender, EventArgs e)
        {
            //DOC
            SaveFileDialog saveFileDialog1 = new SaveFileDialog {
                Filter = "Word |*.doc", FileName = string.Empty
            };

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                frmBaoCaorpt a = new frmBaoCaorpt(_dsBcChiTietHangHoa, new Dictionary <string, object>(), saveFileDialog1.FileName, "Word");
            }
        }
Exemplo n.º 33
0
 private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (i < 0)
         {
             return;
         }
         frmBaoCaorpt a = new frmBaoCaorpt("Kho", dtgvhienthi["MaKho", i].Value.ToString());
         a.ShowDialog();
     }
     catch { }
 }
Exemplo n.º 34
0
 private void tsslchitiet_Click(object sender, EventArgs e)
 {
     if (dtgvhienthi.RowCount > 1)
     {
         try
         {
             frmBaoCaorpt a = new frmBaoCaorpt("KhachHang");
             a.ShowDialog();
         }
         catch
         {
         }
     }
 }
Exemplo n.º 35
0
 private void tsslin_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     Entities.KhachHang kh = GetThongTinKhachHang(txtMakhachhang.Text);
     try
     {
         string khachtra = "0";
         if (txtkhachtra.Text == "")
             khachtra = "0";
         else
             khachtra = txtkhachtra.Text;
         frmBaoCaorpt bcrpt = new frmBaoCaorpt("HDBanBuon", txtSochungtu.Text, Double.Parse(txtTongchietkhau.Text), khachtra, txtdutra.Text, txtTongtien.Text, txtGTGT.Text, lbnhanvien.Text, "", makNgaychungtu.Text, txtgiatrithe.Text, "0", "", txtChietkhau.Text, kh.DiaChi, txtnguoinhanhang.Text, txtDiengiai.Text);
         bcrpt.ShowDialog();
     }
     catch
     {
     }
     finally
     {
         this.Enabled = true;
     }
 }
Exemplo n.º 36
0
 private void tsslchitiet_Click(object sender, EventArgs e)
 {
     try
     {
         frmBaoCaorpt a = new frmBaoCaorpt(baocao, truoc, sau);
         a.ShowDialog();
     }
     catch
     {
     }
 }
 private void TssWordClick(object sender, EventArgs e)
 {
     //Xuất ra word
     if (_bcThongKeMatHangBanRaTheoNhanViensGroup.Count == 0)
     {
         MessageBox.Show(Resources.MSG_DuLieuDangTrong, Resources.MSG_ThongBao);
         return;
     }
     Enabled = false;
     try
     {
         SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = Resources.MSG_SaveFileDialog_Filter_Word, FileName = string.Empty };
         if (saveFileDialog1.ShowDialog() == DialogResult.OK)
         {
             frmBaoCaorpt frmBaoCaorpt = new frmBaoCaorpt(_bcThongKeMatHangBanRaTheoNhanViensGroup, GetDicInput(), saveFileDialog1.FileName, "Word");
         }
     }
     catch { }
     Enabled = true;
 }
Exemplo n.º 38
0
 private void toolStripStatusLabel3_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     try
     {
         string khachtra = string.IsNullOrEmpty(txtkhachtra.Text) ? "0" : txtkhachtra.Text;
         frmBaoCaorpt bcrpt = new frmBaoCaorpt("HDBanLe", txtSochungtu.Text, Double.Parse(txtGiamgia.Text), khachtra, txtdutra.Text, txtKhachPhaiTra.Text, txtGTGT.Text, lbnhanvien.Text, "kin", mskngaychungtu.Text, txtGTTheVip.Text, txtGTTheGT.Text, "", txtChietkhau.Text, "", "", "");
         bcrpt.ShowDialog();
     }
     catch { }
     finally
     {
         this.Enabled = true;
     }
 }
Exemplo n.º 39
0
        private void tsslchitiet_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            try
            {
                ///////////////////////////////MRK FIX Hiển thị
                List<Entities.BCKhachHangTraHang> tem0 = ((Entities.BCKhachHangTraHang[])dtgvhienthi.DataSource).ToList();
                //Entities.BCKhachHangTraHang dau = new Entities.BCKhachHangTraHang();
                //dau = tem0[0];
                Entities.BCKhachHangTraHang cuoi = new Entities.BCKhachHangTraHang();
                cuoi = tem0[tem0.Count - 1];
                //tem0.Remove(dau);
                tem0.Remove(cuoi);
                ////////////////////////////////////////////////
                hienthibaocao = tem0.ToArray();
                //hienthibaocao = (Entities.BCKhachHangTraHang[])dtgvhienthi.DataSource;

                frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, truoc, sau);
                a.ShowDialog();
            }
            catch
            {
            }
            finally
            {
                this.Enabled = true;
            }
        }
Exemplo n.º 40
0
 private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dtgvhienthi.RowCount > 1)
     {
         try
         {
             frmBaoCaorpt a = new frmBaoCaorpt("KhachHang");
             a.ShowDialog();
         }
         catch
         {
         }
     }
 }
        private void tsslWord_Click(object sender, EventArgs e)
        {
            string maNhomHang = dtgvhienthi.CurrentRow.Cells["MaNhomHang"].Value.ToString();
            string tenNhomHang = dtgvhienthi.CurrentRow.Cells["TenNhomHang"].Value.ToString();
            if ((int)dtgvhienthi.CurrentRow.Cells["TongSoLuongXuat"].Value == 0)
            {
                MessageBox.Show("Không có Hàng Xuất từ kho" + tenNhomHang + " trong Khoảng từ ngày : " + xulyNgay(BatDau) + " đến " + xulyNgay(KetThuc) + " ");
            }
            else
            {
                saveFileDialog1.Filter = "Word |*.doc"; saveFileDialog1.FileName = "";
                 if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {

                     LayChiTiet_HangHoaXuat_TheoNhomHang(maNhomHang, tenNhomHang);
                     LayChiTiet_SoLuong_HangHoaXuat_TheoKho();

                     //dtgvhienthi.DataSource=ctBCXH;
                     //FixDatagridview();

                     frmBaoCaorpt frm = new frmBaoCaorpt(ctBCXH, BatDau, KetThuc,saveFileDialog1.FileName,"Word");

                     ctBCXH = null;
                 }
            }
        }
        private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string maNhomHang = dtgvhienthi.Rows[e.RowIndex].Cells["MaNhomHang"].Value.ToString();
            string tenNhomHang = dtgvhienthi.Rows[e.RowIndex].Cells["TenNhomHang"].Value.ToString();
            if ((int)dtgvhienthi.Rows[e.RowIndex].Cells["TongSoLuongXuat"].Value == 0)
            {
                MessageBox.Show("Không có Hàng Xuất từ kho" + tenNhomHang + " trong Khoảng từ ngày : " +xulyNgay( BatDau) + " đến " +xulyNgay( KetThuc) + " ");
            }
            else
            {
                LayChiTiet_HangHoaXuat_TheoNhomHang(maNhomHang, tenNhomHang);
                LayChiTiet_SoLuong_HangHoaXuat_TheoKho();

                //dtgvhienthi.DataSource=ctBCXH;
                //FixDatagridview();

                frmBaoCaorpt frm = new frmBaoCaorpt(ctBCXH, BatDau,KetThuc);
                frm.ShowDialog();
                ctBCXH = null;

            }
        }
Exemplo n.º 43
0
        /// <summary>
        /// Xuất báo cáo
        /// </summary>
        /// <param name="select">0: View, 1: PDF, 2: WORD, 3: EXCEL</param>
        void ExportBc(int select)
        {
            if (rdoTheoNgay.Checked)
            {
                #region theo ngày
                DateTime ngay;
                try
                {
                    string date = new Common.Utilities().MyDateConversion(maskedTextBox1.Text);
                    ngay = Convert.ToDateTime(date);
                }
                catch
                {
                    MessageBox.Show("không đúng định dạng ngày!");
                    return;
                }

                switch (@select)
                {
                    case 0:
                        {
                            frmBaoCaorpt bc = new frmBaoCaorpt(ngay, true, string.Empty, string.Empty);
                            bc.ShowDialog();
                        }
                        break;
                    case 1:
                        {
                            //PDF
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "PDF |*.pdf", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(ngay, false, saveFileDialog1.FileName, "PDF");
                            }
                        }
                        break;
                    case 2:
                        {
                            //DOC
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "Word |*.doc", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(ngay, false, saveFileDialog1.FileName, "Word");
                            }
                        }
                        break;
                    case 3:
                        {
                            //XLS
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "Excel |*.xls", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(ngay, false, saveFileDialog1.FileName, "Excel");
                            }
                        }
                        break;
                }
                #endregion
            }
            else if (rdoTheoThang.Checked)
            {
                #region theo tháng
                int Thang, Nam;
                try
                {
                    Thang = Convert.ToInt32(comboBox1.Text);
                    Nam = dateTimePicker1.Value.Year;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("nhập sai định dạng ngày tháng", "Hệ thống cảnh báo");
                    maskedTextBox1.Focus();
                    return;
                }

                switch (@select)
                {
                    case 0:
                        {
                            frmBaoCaorpt bc = new frmBaoCaorpt(Thang, Nam, true, string.Empty, string.Empty);
                            bc.ShowDialog();
                        }
                        break;
                    case 1:
                        {
                            //PDF
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "PDF |*.pdf", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(Thang, Nam, false, saveFileDialog1.FileName, "PDF");
                            }
                        }
                        break;
                    case 2:
                        {
                            //DOC
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "Word |*.doc", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(Thang, Nam, false, saveFileDialog1.FileName, "Word");
                            }
                        }
                        break;
                    case 3:
                        {
                            //XLS
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "Excel |*.xls", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(Thang, Nam, false, saveFileDialog1.FileName, "Excel");
                            }
                        }
                        break;
                }
                #endregion
            }
            else if (rdoTheoNam.Checked)
            {
                #region theo năm
                DateTime Truoc, Sau;
                string date1 = "", date2 = "";
                try
                {
                    date1 = new Common.Utilities().MyDateConversion(maskedTextBox2.Text);
                    Truoc = Convert.ToDateTime(date1);

                }
                catch (Exception ex)
                {
                    MessageBox.Show("nhập sai định dạng ngày tháng", "Hệ thống cảnh báo");
                    maskedTextBox2.Focus();
                    return;
                }
                try
                {
                    date2 = new Common.Utilities().MyDateConversion(maskedTextBox3.Text);
                    Sau = Convert.ToDateTime(date2);
                }
                catch
                {
                    MessageBox.Show("nhập sai định dạng ngày tháng", "Hệ thống cảnh báo");
                    maskedTextBox3.Focus();
                    return;
                }

                switch (@select)
                {
                    case 0:
                        {
                            frmBaoCaorpt bc = new frmBaoCaorpt(Truoc, Sau, true, string.Empty, string.Empty);
                            bc.ShowDialog();
                        }
                        break;
                    case 1:
                        {
                            //PDF
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "PDF |*.pdf", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(Truoc, Sau, false, saveFileDialog1.FileName, "PDF");
                            }
                        }
                        break;
                    case 2:
                        {
                            //DOC
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "Word |*.doc", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(Truoc, Sau, false, saveFileDialog1.FileName, "Word");
                            }
                        }
                        break;
                    case 3:
                        {
                            //XLS
                            SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "Excel |*.xls", FileName = string.Empty };
                            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                            {
                                frmBaoCaorpt bc = new frmBaoCaorpt(Truoc, Sau, false, saveFileDialog1.FileName, "Excel");
                            }
                        }
                        break;
                }
                #endregion
            }
        }
 private void tsslWord_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     try
     {
         if (i < 0)
             return;
         saveFileDialog1.Filter = "Word |*.doc"; saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             frmBaoCaorpt a = new frmBaoCaorpt("Nhom", dtgvhienthi["MaNhomHang", i].Value.ToString(), saveFileDialog1.FileName, "Word");
         }
     }
     catch
     {
     }
     finally
     {
         this.Enabled = true;
     }
 }
 private void tsslchitiet_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     try
     {
         if (i < 0)
             return;
         frmBaoCaorpt a = new frmBaoCaorpt("Nhom", dtgvhienthi["MaNhomHang", i].Value.ToString());
         a.ShowDialog();
     }
     catch
     {
     }
     finally
     {
         this.Enabled = true;
     }
 }
 private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (i < 0)
             return;
         frmBaoCaorpt a = new frmBaoCaorpt("Nhom", dtgvhienthi["MaNhomHang", i].Value.ToString());
         a.ShowDialog();
     }
     catch
     {
     }
 }
Exemplo n.º 47
0
 private void tsslWord_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.BCTienTonKho[] data = (Entities.BCTienTonKho[])dtgvhienthi.DataSource;
         if (data == null)
         {
             return;
         }
         else if (data.Length == 0)
         {
             return;
         }
         if (chon < 0)
         {
             return;
         }
         string MK = dtgvhienthi["MaKho", chon].Value.ToString();
         foreach (Entities.BCTienTonKho item in data)
         {
             if (item.MaKho.Equals(MK))
             {
                 //DOC
                 saveFileDialog1.Filter = "Word |*.doc"; saveFileDialog1.FileName = "";
                 if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     frmBaoCaorpt a = new frmBaoCaorpt(item, start.ToString("dd/MM/yyyy"), end.ToString("dd/MM/yyyy"), saveFileDialog1.FileName, "Word");
                 }
             }
         }
     }
     catch { }
 }
Exemplo n.º 48
0
 private void toolStripStatusLabel3_Click(object sender, EventArgs e)
 {
     ArrayList arr = new ArrayList();
     foreach (DataGridViewRow item in dgvInsertOrder.Rows)
     {
         Entities.BCKhachHangDatHang temp = new Entities.BCKhachHangDatHang();
         temp.MaDonDatHang = txtSodonhang.Text;
         temp.MaKH = txtManhacungcap.Text;
         temp.Ten = lblTennhacungcap.Text;
         temp.MaHang = item.Cells[1].Value.ToString();
         temp.TenHang = item.Cells[2].Value.ToString();
         temp.SoLuong = Convert.ToDouble(item.Cells[3].Value.ToString());
         temp.Gia = Convert.ToDouble(item.Cells[4].Value.ToString());
         temp.ChietKhau = Convert.ToDouble(item.Cells[7].Value.ToString());
         temp.Thue = Convert.ToDouble(item.Cells[8].Value.ToString());
         temp.TongTienCK = Convert.ToDouble(item.Cells[9].Value.ToString());
         temp.TongTien = Convert.ToDouble(item.Cells[11].Value.ToString());
         arr.Add(temp);
     }
     if (arr.Count > 0)
     {
         Entities.BCKhachHangDatHang[] rpt = new Entities.BCKhachHangDatHang[arr.Count];
         int i = 0;
         foreach (object item in arr)
         {
             rpt[i] = (Entities.BCKhachHangDatHang)item;
             i++;
         }
         if (check_loaidathang.Checked)
         {
             Report.rptDatHangNhaCungCap khdh = new Report.rptDatHangNhaCungCap();
             khdh.SetDataSource(rpt);
             khdh.SetParameterValue("TongTien", txtTienhang.Text);
             khdh.SetParameterValue("TongTienCK", txtChietkhau.Text);
             khdh.SetParameterValue("TienThue", txtGiatrigiatang.Text);
             khdh.SetParameterValue("TongTienCK", txtChietkhau.Text);
             khdh.SetParameterValue("TongTienDonHang", txtTongtien.Text);
             khdh.SetParameterValue("NgayTao", makNgaydonhang.Text);
             khdh.SetParameterValue("TenBaoCao", "Báo Cáo Đặt Hàng Nhà Cung Cấp");
             frmBaoCaorpt frm = new frmBaoCaorpt(khdh);
             frm.ShowDialog();
         }
         else
         {
             Report.rptKhachHangDatHang khdh = new Report.rptKhachHangDatHang();
             khdh.SetDataSource(rpt);
             khdh.SetParameterValue("TongTien", txtTienhang.Text);
             khdh.SetParameterValue("TongTienCK", txtChietkhau.Text);
             khdh.SetParameterValue("TienThue", txtGiatrigiatang.Text);
             khdh.SetParameterValue("TongTienCK", txtChietkhau.Text);
             khdh.SetParameterValue("TongTienDonHang", txtTongtien.Text);
             khdh.SetParameterValue("NgayTao", makNgaydonhang.Text);
             khdh.SetParameterValue("TenBaoCao", "Báo Cáo Khách Hàng Đặt Hàng");
             frmBaoCaorpt frm = new frmBaoCaorpt(khdh);
             frm.ShowDialog();
         }
     }
 }
Exemplo n.º 49
0
 private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     this.Enabled = false;
     try
     {
         Entities.BCTienTonKho[] data = (Entities.BCTienTonKho[])dtgvhienthi.DataSource;
         if (data == null)
         {
             return;
         }
         else if (data.Length == 0)
         {
             return;
         }
         if (chon < 0)
         {
             return;
         }
         string MK = dtgvhienthi["MaKho", chon].Value.ToString();
         foreach (Entities.BCTienTonKho item in data)
         {
             if (item.MaKho.Equals(MK))
             {
                 //Xem
                 frmBaoCaorpt a = new frmBaoCaorpt(item, start.ToString("dd/MM/yyyy"), end.ToString("dd/MM/yyyy"));
                 a.ShowDialog();
             }
         }
     }
     catch { }
     finally
     {
         this.Enabled = true;
     }
 }
Exemplo n.º 50
0
 private void tsslWord_Click(object sender, EventArgs e)
 {
     try
     {
         if (i < 0)
             return;
         saveFileDialog1.Filter = "Word |*.doc";
         saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             frmBaoCaorpt a = new frmBaoCaorpt("KhachHang", saveFileDialog1.FileName, "Word");
         }
     }
     catch
     {
     }
 }
Exemplo n.º 51
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)
         {
             frmBaoCaorpt a = new frmBaoCaorpt(baocao, truoc, sau, saveFileDialog1.FileName, "Word");
         }
     }
     catch
     {
     }
     finally
     { this.Enabled = true; }
 }
Exemplo n.º 52
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                DateTime Ngay;
                string date="";
                try
                {
                   date = new Common.Utilities().MyDateConversion(maskedTextBox1.Text);
                  Ngay =  Convert.ToDateTime(date);
                }
                catch
                {
                    MessageBox.Show("ngay ko dung dinh dang");
                    return;
                }
                frmBaoCaorpt bc = new frmBaoCaorpt(Ngay);
                bc.ShowDialog();
            }
            else if (radioButton2.Checked)
            {
                int Thang, Nam;
                try
                {
                    Thang = Convert.ToInt32(comboBox1.Text);
                    Nam = dateTimePicker1.Value.Year;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("nhập sai định dạng ngày tháng", "Hệ thống cảnh báo");
                    maskedTextBox1.Focus();
                    return;
                }
                frmBaoCaorpt bc = new frmBaoCaorpt(Thang,Nam);
                bc.ShowDialog();
            }
            else if (radioButton3.Checked)
            {
                DateTime Truoc, Sau;
                string date1 = "", date2 = "";
                try
                {
                    date1 = new Common.Utilities().MyDateConversion(maskedTextBox2.Text);
                    Truoc = Convert.ToDateTime(date1);

                }
                catch (Exception ex)
                {
                    MessageBox.Show("nhập sai định dạng ngày tháng","Hệ thống cảnh báo");
                    maskedTextBox2.Focus();
                    return;
                }
                try
                {
                    date2 = new Common.Utilities().MyDateConversion(maskedTextBox3.Text);
                    Sau = Convert.ToDateTime(date2);
                }
                catch
                {
                    MessageBox.Show("nhập sai định dạng ngày tháng", "Hệ thống cảnh báo");
                    maskedTextBox3.Focus();
                    return;
                }

                frmBaoCaorpt bc = new frmBaoCaorpt(Truoc, Sau);
                bc.ShowDialog();
            }
        }
Exemplo n.º 53
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.BCKhachHangTraHang> tem0 = ((Entities.BCKhachHangTraHang[])dtgvhienthi.DataSource).ToList();
                    //Entities.BCKhachHangTraHang dau = new Entities.BCKhachHangTraHang();
                    //dau = tem0[0];
                    Entities.BCKhachHangTraHang cuoi = new Entities.BCKhachHangTraHang();
                    cuoi = tem0[tem0.Count - 1];
                    //tem0.Remove(dau);
                    tem0.Remove(cuoi);
                    ////////////////////////////////////////////////
                    hienthibaocao = tem0.ToArray();
                    //hienthibaocao = (Entities.BCKhachHangTraHang[])dtgvhienthi.DataSource;
                    frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, truoc, sau, saveFileDialog1.FileName, "Word");
                }
            }
            catch
            {
            }
            finally
            {

                this.Enabled = true;
            }
        }
 private void toolStripStatusLabel3_Click(object sender, EventArgs e)
 {
     frmBaoCaorpt rpt = new frmBaoCaorpt(CtPdck_BaoCao, makNgaychungtu.Text, "", txtSochungtu.Text, cbxTukho.Text, cbxDenkho.Text);
     rpt.Show();
 }
Exemplo n.º 55
0
        /// <summary>
        /// nút thêm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsslthem_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            try
            {
                if (KiemTra() == true)
                {
                    //CheckConflictInsert();
                    txtSochungtu.Text = ProID("HDBanHang");
                    kt = true;
                    if (kt == true)
                    {
                        cl = new Server_Client.Client();
                        this.Client1 = cl.Connect(Luu.IP, Luu.Ports);
                        string date = "";
                        try
                        {
                            date = new Common.Utilities().MyDateConversion(mskngaychungtu.Text);
                        }
                        catch
                        {
                            MessageBox.Show("Bạn nhập sai định dạng ngày tháng", "Hệ thống cảnh báo");
                            mskngaychungtu.Focus();
                            return;
                        }
                        string khachtra = "0";
                        if (txtkhachtra.Text == "")
                            khachtra = "0";
                        else
                            khachtra = txtkhachtra.Text;
                        if (Convert.ToDouble(khachtra) < (Convert.ToDouble(txtTongtien.Text) - Convert.ToDouble(txtGTTheVip.Text) - double.Parse(txtGTTheGT.Text)))
                        {
                            lbloi.Text = "Khách trả không thể nhỏ hơn Tổng tiền";
                            return;
                        }
                        Entities.HDBanHang pt = new Entities.HDBanHang();
                        string makho = LayMaKho(cbbkhohang.Text);
                        double ttn = 0;
                        Entities.TheVip tv1 = null;
                        Entities.TheGiamGia tgg1 = null;
                        // The Vip
                        if (Convert.ToDouble(txtTongtien.Text) < Convert.ToDouble(txtGTTheVip.Text))
                        {
                            ttn = Convert.ToDouble(txtGTTheVip.Text) - Convert.ToDouble(txtTongtien.Text);
                            tv1 = new Entities.TheVip("", txtMaTheVip.Text, "", ttn.ToString(), "", "", false);
                        }
                        else
                        {
                            ttn = Convert.ToDouble(txtTongtien.Text) - Convert.ToDouble(txtGTTheVip.Text);
                            tv1 = new Entities.TheVip("", txtMaTheVip.Text, "", "0", "", "", false);
                            // The Gia Tri.
                            if (Convert.ToDouble(txtTongtien.Text) - Convert.ToDouble(txtGTTheVip.Text) < Convert.ToDouble(txtGTTheGT.Text))
                            {
                                ttn = Convert.ToDouble(txtGTTheGT.Text) - (Convert.ToDouble(txtTongtien.Text) - Convert.ToDouble(txtGTTheVip.Text));
                                tgg1 = new Entities.TheGiamGia();
                                tgg1.MaTheGiamGia = txtMaTheGT.Text;
                                tgg1.GiaTriConLai = ttn.ToString();
                            }
                            else
                            {
                                ttn = Convert.ToDouble(txtTongtien.Text) - Convert.ToDouble(txtGTTheVip.Text) - Convert.ToDouble(txtGTTheVip.Text);
                                tgg1 = new TheGiamGia { MaTheGiamGia = txtMaTheGT.Text, GiaTriConLai = "0" };
                            }
                        }

                        chietkhau = (double.Parse(txtGiamgia.Text) + double.Parse(txtChietkhau.Text)).ToString();
                        string ckTongHoaDon = txtPhantramchietkhau.Text;
                        if (string.IsNullOrEmpty(txtPhantramchietkhau.Text))
                            ckTongHoaDon = "0";
                        pt = new HDBanHang("Insert", 0, txtSochungtu.Text, Convert.ToDateTime(date),
                            txtMakhachhang.Text, "0", " ", cbxHinhthucthanhtoan.Text, makho, _datesv, " ",
                            (_currentNhanVien != null) ? _currentNhanVien.MaNhanVien : Common.Utilities.User.NhanVienID, "TT_0001", txtGiamgia.Text, ttn.ToString(), "0",
                            txtGTGT.Text, txtTongtien.Text, true, txtMaTheVip.Text, txtGTTheVip.Text, txtDiengiai.Text, false,
                            Common.Utilities.User.TenDangNhap, txtkhachtra.Text, ckTongHoaDon, txtMaTheGT.Text, txtGTTheGT.Text)
                                 {
                                     ChiTietHDBanHang = CheckDataGridInsert(dtgvsanpham),
                                     ChiTietKhoHangTheoHoaHonNhap = CheckDataGridTruSL(dtgvsanpham),
                                     TheVip = tv1,
                                     TheGiamGia = tgg1
                                 };

                        Clientstrem = cl.SerializeObj(this.Client1, "HDBanHang", pt);

                        bool kt1 = false;
                        kt1 = (bool)cl.DeserializeHepper(Clientstrem, kt1);
                        if (kt1 == true)
                        {
                            //Cập nhật điểm thưởng cho khách hàng
                            if (!string.IsNullOrEmpty(txtMakhachhang.Text))
                            {
                                //Cập nhật điểm thưởng khách hàng thành công
                                bool kq = CapNhatDiemThuongKhachHang(txtMakhachhang.Text, txtTongtien.Text);
                            }
                            else
                            {
                                //Cập nhật điểm thưởng khách hàng thất bại
                            }
                            /////////////////////////////////////
                            khachtra = "0";
                            if (txtkhachtra.Text == "")
                                khachtra = "0";
                            else
                                khachtra = txtkhachtra.Text;

                            if (cbkiemtra.Checked == true)
                            {
                                frmBaoCaorpt bcrpt = new frmBaoCaorpt("HDBanLe", txtSochungtu.Text, double.Parse(txtGiamgia.Text), khachtra, txtdutra.Text, txtKhachPhaiTra.Text, txtGTGT.Text, lbnhanvien.Text, "in", mskngaychungtu.Text, txtGTTheVip.Text, txtGTTheGT.Text, "", txtChietkhau.Text, "", "", "");
                            }

                            GiaVonBanHang(pt.ChiTietHDBanHang);
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Thêm thất bại - xin thử lại", "Hệ thống cảnh báo");
                        }
                    }
                }
            }
            catch
            {
            }
            finally
            {
                this.Enabled = true;

            }
        }
 private void tsslchitiet_Click(object sender, EventArgs e)
 {
     if (i < 0)
         return;
     try
     {
         disable();
         string manhomhang = dtgvhienthi["MaNhomHang", i].Value.ToString();
         Report.rptXuatNhapHangTheoNhomHang report = new Report.rptXuatNhapHangTheoNhomHang();
         report.SetDataSource(ChiTietNhom(manhomhang));
         report.SetParameterValue("Ky", thang.ToString() + "-" + nam.ToString());
         report.SetParameterValue("TenBaoCao", "Báo Cáo Xuất Nhập Tồn Theo Nhóm Hàng");
         frmBaoCaorpt a = new frmBaoCaorpt(report);
         a.ShowDialog();
     }
     catch
     {
     }
     finally
     {
         enable();
     }
 }
Exemplo n.º 57
0
 private void tsslin_Click(object sender, EventArgs e)
 {
     try
     {
         ArrayList dulieu = new ArrayList();
         Entities.HDThanhToanKH[] tem = new Entities.HDThanhToanKH[0];
         tem = (Entities.HDThanhToanKH[])dtgvNCC.DataSource;
         if (tem.Length > 0)
         {
             List<Entities.BCPhieuTTCuaKH> tem1 = new List<Entities.BCPhieuTTCuaKH>();
             foreach (Entities.HDThanhToanKH item in tem)
             {
                 Entities.BCPhieuTTCuaKH bientam = new Entities.BCPhieuTTCuaKH();
                 bientam.MaDonHang = item.MaHDBanHang;
                 bientam.TongTienHoaDon = double.Parse(item.TongTienThanhToan.Replace(",", ""));
                 bientam.SoTienNo = double.Parse(item.SoNo.Replace(",", ""));
                 bientam.ThanhToan = double.Parse(item.ThanhToan.Replace(",", ""));
                 tem1.Add(bientam);
             }
             Entities.NhaCungCap kh = new Entities.NhaCungCap(); kh = laynhacungcap(txtmancc.Text);
             dulieu.Add(tem1);    //dữ liệu trong datagridview   (0)
             dulieu.Add(txtsochungtu.Text);   //Mã phiếu (1)
             dulieu.Add(kh.TenNhaCungCap); //Tên nhà cung cấp    (2)
             dulieu.Add(kh.DiaChi);   //Địa chỉ (3)
             dulieu.Add(txtnguoinhaptien.Text);   //Người nhận tiền   (4)
             dulieu.Add(txtdiengiai.Text);   //Diễn giải   (5)
             dulieu.Add(txttongthanhtoan.Text);   //Tổng thanh toán   (6)
             frmBaoCaorpt a = new frmBaoCaorpt("InPhieuThanhToanCuaNCC", dulieu);
             a.ShowDialog();
         }
     }
     catch
     {
     }
 }
 private void tsslWord_Click(object sender, EventArgs e)
 {
     try
     {
         if (i < 0)
             return;
         disable();
         saveFileDialog1.Filter = "Word |*.doc"; saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string manhomhang = dtgvhienthi["MaNhomHang", i].Value.ToString();
             Report.rptXuatNhapHangTheoNhomHang report = new Report.rptXuatNhapHangTheoNhomHang();
             report.SetDataSource(ChiTietNhom(manhomhang));
             report.SetParameterValue("Ky", thang.ToString() + "-" + nam.ToString());
             report.SetParameterValue("TenBaoCao", "Báo Cáo Xuất Nhập Tồn Theo Nhóm Hàng");
             frmBaoCaorpt a = new frmBaoCaorpt(report, saveFileDialog1.FileName, Report.ExportCrystalReport.TypeBC.WordForWindows);
             a.Dispose();
         }
     }
     catch
     {
     }
     finally
     {
         enable();
     }
 }
Exemplo n.º 59
0
        private void tsslthem_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            try
            {
                if (KiemTra() == true)
                {
                    //CheckConflictInsert();
                    txtSochungtu.Text = ProID("HDBanHang");
                    kt = true;
                    if (kt == true)
                    {
                        cl = new Server_Client.Client();
                        this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                        string date = "", date2 = "";
                        date = new Common.Utilities().MyDateConversion(makNgaychungtu.Text);
                        try
                        {
                            date2 = new Common.Utilities().MyDateConversion(makHanthanhtoan.Text);
                        }
                        catch
                        {
                            MessageBox.Show("Nhập sai định dạng ngày tháng", "Hệ thông cảnh báo");
                            date2 = "";
                            return;
                        }
                        Entities.HDBanHang pt = new Entities.HDBanHang();
                        string makho = LayMaKho(cbbKhoban.Text);
                        string matt = LayMaTT(cbbtientetygia.Text);

                        if (string.IsNullOrEmpty(txtPhantramchietkhau.Text))
                            txtPhantramchietkhau.Text = "0";
                        if (string.IsNullOrEmpty(txtkhachtra.Text))
                            txtkhachtra.Text = "0";

                        pt = new Entities.HDBanHang("Insert", 0, txtSochungtu.Text, Convert.ToDateTime(date), txtMakhachhang.Text,
                            txtNohienthoi.Text, txtnguoinhanhang.Text, cbbHinhthucthanhtoan.Text, makho, DateTime.Parse(date2),
                            txtDondatbanhang.Text, (_currentNhanVien != null) ? _currentNhanVien.MaNhanVien : Common.Utilities.User.NhanVienID, matt, txtTongchietkhau.Text, "0",
                            txtThanhtoanngay.Text, txtGTGT.Text, txtTongtien.Text, false, " ", "0", txtDiengiai.Text,
                            false, Common.Utilities.User.TenDangNhap, txtkhachtra.Text, txtPhantramchietkhau.Text, string.Empty, "0");
                        pt.ChiTietHDBanHang = CheckDataGridInsert(dtgvsanpham);
                        if (txtDondatbanhang.Text.Length != 0)
                        {
                            pt.DonDatHang = CapNhatTrangThaiDonDatHang("Update", txtDondatbanhang.Text, "Đã thành công");
                        }
                        pt.ChiTietKhoHangTheoHoaHonNhap = CheckDataGridTruSL(dtgvsanpham);
                        double khNo = 0;
                        double tongTienHD = 0;
                        double tongThanhToan = 0;

                        if (!string.IsNullOrEmpty(txtTongtien.Text))
                            tongTienHD = double.Parse(txtTongtien.Text);

                        if (!string.IsNullOrEmpty(txtkhachtra.Text))
                            tongThanhToan = double.Parse(txtkhachtra.Text);

                        if (tongThanhToan > tongTienHD)
                            khNo = 0;
                        else
                            khNo = tongTienHD - tongThanhToan;

                        pt.KhachHang = new Entities.KhachHang("UpdateDuNo", txtMakhachhang.Text, khNo.ToString());
                        clientstrem = cl.SerializeObj(this.client1, "HDBanHang", pt);
                        bool kt1 = false;
                        kt1 = (bool)cl.DeserializeHepper(clientstrem, kt1);
                        if (kt1 == true)
                        {
                            ////Cập nhật điểm thưởng cho khách hàng
                            //if (CapNhatDiemThuongKhachHang(txtMakhachhang.Text, txtTongtien.Text))
                            //{
                            //    //Cập nhật điểm thưởng khách hàng thành công
                            //}
                            //else
                            //{
                            //    //Cập nhật điểm thưởng khách hàng thất bại
                            //}
                            ///////////////////////////////////////

                            string khachtra = "0";
                            if (txtkhachtra.Text == "")
                                khachtra = "0";
                            else
                                khachtra = txtkhachtra.Text;
                            //timerRun.Start();
                            if (cbkiemtra.Checked == true)
                            {
                                Entities.KhachHang kh = GetThongTinKhachHang(txtMakhachhang.Text);
                                frmBaoCaorpt bcrpt = new frmBaoCaorpt("HDBanBuon", txtSochungtu.Text,
                                    Double.Parse(txtTongchietkhau.Text), khachtra, txtdutra.Text, txtTongtien.Text,
                                    txtGTGT.Text, Common.Utilities.User.TenNhanVien, "in", makNgaychungtu.Text, txtgiatrithe.Text, "0", "", txtChietkhau.Text, kh.DiaChi, txtnguoinhanhang.Text, txtDiengiai.Text);
                            }
                            //timerRun.Stop();
                            GiaVonBanHang(pt.ChiTietHDBanHang);
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Thêm thất bại - xin hãy thử lại", "Hệ thống cảnh báo");
                        }

                    }
                }
            }
            catch
            {

            }
            finally
            {
                this.Enabled = true;
            }
        }
Exemplo n.º 60
0
 private void tssWord_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.KhachHang kh = GetThongTinKhachHang(txtMakhachhang.Text);
         if (i < 0)
             return;
         saveFileDialog1.Filter = "Word |*.doc";
         saveFileDialog1.FileName = "";
         if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             frmBaoCaorpt bcrpt = new frmBaoCaorpt("HDBanBuon", txtSochungtu.Text, Double.Parse(txtTongchietkhau.Text), txtkhachtra.Text, txtdutra.Text, txtTongtien.Text, txtGTGT.Text, lbnhanvien.Text, "Word", makNgaychungtu.Text, txtgiatrithe.Text, "0", saveFileDialog1.FileName, txtChietkhau.Text, kh.DiaChi, txtnguoinhanhang.Text, txtDiengiai.Text);
         }
     }
     catch
     {
     }
 }