public frmBaoCaorpt(DateTime Truoc, DateTime Sau, bool isView, string path, string hanhDong)
 {
     try
     {
         InitializeComponent();
         CongTy();
         cl = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.BCDTTheoThoiGian ctxh = new Entities.BCDTTheoThoiGian("SelectTheoKhoang", Truoc, Sau);
         Entities.BCDTTheoThoiGian[] pt1 = new Entities.BCDTTheoThoiGian[1];
         clientstrem = cl.SerializeObj(this.client1, "BCDTTheoThoiGian", ctxh);
         pt1 = (Entities.BCDTTheoThoiGian[])cl.DeserializeHepper1(clientstrem, pt1);
         if (pt1 == null)
         {
             MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
             return;
         }
         else
         {
             GUI.Report.rptBCDoanhThuTheoThoiGian report = new GUI.Report.rptBCDoanhThuTheoThoiGian();
             report.SetDataSource(pt1);
             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 Doanh Thu Theo Khoảng Thời Gian");
             report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
             report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
             report.SetParameterValue("Email", CT.Email);
             report.SetParameterValue("Tu", new Common.Utilities().XuLy(2, Truoc.ToShortDateString()));
             report.SetParameterValue("Den", new Common.Utilities().XuLy(2, Sau.ToShortDateString()));
             if (isView) crvReport.Show();
             else
             {
                 switch (hanhDong)
                 {
                     case "Excel":
                         new Report.ExportCrystalReport().Export(report, path, Report.ExportCrystalReport.TypeBC.Excel);
                         break;
                     case "Word":
                         new Report.ExportCrystalReport().Export(report, path, Report.ExportCrystalReport.TypeBC.WordForWindows);
                         break;
                     case "PDF":
                         new Report.ExportCrystalReport().Export(report, path, Report.ExportCrystalReport.TypeBC.PortableDocFormat);
                         break;
                 }
             }
         }
     }
     catch { }
 }
 public frmBaoCaorpt(int Thang, int Nam)
 {
     try
     {
         InitializeComponent();
         CongTy();
         cl = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.BCDTTheoThoiGian ctxh = new Entities.BCDTTheoThoiGian("SelectTheoThang", Thang, Nam);
         Entities.BCDTTheoThoiGian[] pt1 = new Entities.BCDTTheoThoiGian[1];
         clientstrem = cl.SerializeObj(this.client1, "BCDTTheoThoiGian", ctxh);
         pt1 = (Entities.BCDTTheoThoiGian[])cl.DeserializeHepper1(clientstrem, pt1);
         if (pt1 == null)
         {
             MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
             return;
         }
         else
         {
             GUI.Report.rptBCDoanhThuTheoThoiGian report = new GUI.Report.rptBCDoanhThuTheoThoiGian();
             report.SetDataSource(pt1);
             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 Doanh Thu Theo Tháng " + Thang + "/" + Nam);
             report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
             report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
             report.SetParameterValue("Email", CT.Email);
             report.SetParameterValue("Tu", "");
             report.SetParameterValue("Den", "");
             crvReport.Show();
         }
     }
     catch { }
 }