public XtraReportWithSubReport() : base() { this.PageHeader = new DevExpress.XtraReports.UI.PageHeaderBand(); this.xrSubreport1 = new DevExpress.XtraReports.UI.XRSubreport(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); this.PageHeader.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { this.xrSubreport1 }); this.PageHeader.HeightF = 89.99998F; this.PageHeader.Name = "PageHeader"; this.xrSubreport1.Id = 0; this.xrSubreport1.LocationFloat = new DevExpress.Utils.PointFloat(10.00001F, 10.00001F); this.xrSubreport1.Name = "xrSubreport1"; this.xrSubreport1.ReportSource = new ReportV2Demo.Module.XtraReportSubReport(); this.xrSubreport1.SizeF = new System.Drawing.SizeF(630F, 43.54165F); this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { this.PageHeader }); this.Name = "XtraReportWithSub"; this.Version = AssemblyInfo.VersionShort; this.DisplayName = "Report with sub report"; ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); }
private MemoryStream PrintPayrollSilp(string master, string dateTime1, string dateTime2, string person) { string dateFrom = Helper.Safe.SafeDateStr(dateTime1); string dateTo = Helper.Safe.SafeDateStr(dateTime2); DateTime from = DateTime.ParseExact(dateFrom, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); DateTime to = DateTime.ParseExact(dateTo, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); string user = HttpContext.Current.User.Identity.Name; XtraReport rpt = new XtraReport(); string role = SafeValue.SafeString(ConnectSql_mb.ExecuteScalar(string.Format(@"select HrRole from Hr_Person where Id={0}", person))); if (role.ToLower() == "driver") { rpt.LoadLayout(Server.MapPath(@"~\Modules\Hr\Report\repx\PayrollSlip_driver.repx")); } else { rpt.LoadLayout(Server.MapPath(@"~\Modules\Hr\Report\repx\PayrollSlip.repx")); } DataSet set = HrPrint.PrintPaySlip(master, from, to); DataTable tab_mast = set.Tables[0]; DataTable tab_det = set.Tables[1]; DataTable tab_det1 = set.Tables[2]; if (tab_det.Rows.Count > 0) { DevExpress.XtraReports.UI.PageHeaderBand header = rpt.Report.Bands["PageHeader"] as DevExpress.XtraReports.UI.PageHeaderBand; if (header != null) { DevExpress.XtraReports.UI.XRSubreport subReport_Ot = header.FindControl("Overtime_sub", true) as DevExpress.XtraReports.UI.XRSubreport; subReport_Ot.Name = "Overtime_sub"; XtraReport rpt_Inv = new XtraReport(); rpt_Inv.LoadLayout(Server.MapPath(@"~\Modules\Hr\Report\repx\PayrollSlip_sub.repx")); subReport_Ot.ReportSource = rpt_Inv; rpt_Inv.DataSource = tab_det; } } if (tab_det1.Rows.Count > 0) { DevExpress.XtraReports.UI.PageHeaderBand header = rpt.Report.Bands["PageHeader"] as DevExpress.XtraReports.UI.PageHeaderBand; if (header != null) { DevExpress.XtraReports.UI.XRSubreport subReport_Ot = header.FindControl("Overtime_sub2", true) as DevExpress.XtraReports.UI.XRSubreport; subReport_Ot.Name = "Overtime_sub2"; XtraReport rpt_Inv = new XtraReport(); rpt_Inv.LoadLayout(Server.MapPath(@"~\Modules\Hr\Report\repx\PayrollSlip_sub.repx")); subReport_Ot.ReportSource = rpt_Inv; rpt_Inv.DataSource = tab_det1; } } rpt.DataSource = set; System.IO.MemoryStream str = new MemoryStream(); rpt.ExportToPdf(str); return(str); }