diff --git a/Controllers/ProfileReportController.cs b/Controllers/ProfileReportController.cs index c3598d8..dda3401 100644 --- a/Controllers/ProfileReportController.cs +++ b/Controllers/ProfileReportController.cs @@ -485,9 +485,14 @@ namespace BMA.EHR.Report.Service.Controllers // Field = "" // }); // } - + var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page0.trdp"); + ReportPackager reportPackager0 = new ReportPackager(); + Telerik.Reporting.Report? report0 = null; + using (var sourceStream0 = System.IO.File.OpenRead(rptFile0)) + { + report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0); + } var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page1.trdp"); - ReportPackager reportPackager = new ReportPackager(); Telerik.Reporting.Report? report = null; using (var sourceStream = System.IO.File.OpenRead(rptFile)) @@ -511,6 +516,14 @@ namespace BMA.EHR.Report.Service.Controllers { return Error("ไม่พบข้อมูลนี้ในระบบ", 404); } + + report0.DataSource = org.result.Profile; + var tblInsignia = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblInsignia"]; + tblInsignia.DataSource = org.result.Insignia; + + var tblLeave= (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblLeave"]; + tblLeave.DataSource = org.result.Leave; ; + report.DataSource = org.result.Profile; // binding to table var tblCertificate = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblCertificate"]; @@ -541,6 +554,16 @@ namespace BMA.EHR.Report.Service.Controllers // catch { } // } + System.Collections.Hashtable deviceInfo0 = new System.Collections.Hashtable(); + InstanceReportSource instanceReportSource0 = new InstanceReportSource() + { + ReportDocument = report0 + }; + + ReportProcessor reportProcessor0 = new ReportProcessor(_configuration); + RenderingResult result0 = reportProcessor0.RenderReport("PDF", instanceReportSource0, deviceInfo0); + var content0 = result0.DocumentBytes; + System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); InstanceReportSource instanceReportSource = new InstanceReportSource() @@ -642,6 +665,15 @@ namespace BMA.EHR.Report.Service.Controllers { using (PdfDocument pdf = new PdfDocument(new PdfWriter(ms).SetSmartMode(true))) { + using (MemoryStream memoryStream = new MemoryStream(content0)) + { + using (PdfReader reader = new PdfReader(memoryStream)) + { + PdfDocument srcDoc = new PdfDocument(reader); + srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf); + } + } + // Create reader from bytes using (MemoryStream memoryStream = new MemoryStream(content)) { diff --git a/Report/Profile/rptKK1_Page0.trdp b/Report/Profile/rptKK1_Page0.trdp new file mode 100644 index 0000000..1c2dfcb Binary files /dev/null and b/Report/Profile/rptKK1_Page0.trdp differ diff --git a/Report/Profile/rptKK1_Page2.trdp b/Report/Profile/rptKK1_Page2.trdp index aa346ee..6a30cb0 100644 Binary files a/Report/Profile/rptKK1_Page2.trdp and b/Report/Profile/rptKK1_Page2.trdp differ