รายงาน กก.1 เพิ่มเครื่องราช, การลา

This commit is contained in:
Bright 2024-07-08 16:47:18 +07:00
parent c7515e2a26
commit fc449e60ad
3 changed files with 34 additions and 2 deletions

View file

@ -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))
{

Binary file not shown.

Binary file not shown.