รายงานแบบคำร้องขอโอน

This commit is contained in:
Harid Promsri (Bright) 2023-10-02 17:59:21 +07:00
parent 8842cde66d
commit 9f7a87e36b
6 changed files with 37 additions and 5 deletions

View file

@ -589,6 +589,18 @@
<None Update="Reports\13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Reports\21-คำร้องขอโอน-1.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Reports\21-คำร้องขอโอน-2.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Reports\21-คำร้องขอโอน-3.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Reports\21-คำร้องขอโอน-4.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Reports\22-หนังสือแจ้งสำนักงานการเจ้าหน้าที่-1.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View file

@ -60,7 +60,7 @@ namespace BMA.EHR.Report.Service.Controllers
{
try
{
var data = await _service.GetData2Transfer(id);
//var data = await _service.GetData2Transfer(id);
var mimeType = "";
switch (exportType.Trim().ToLower())
{
@ -69,27 +69,47 @@ namespace BMA.EHR.Report.Service.Controllers
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
}
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"22-หนังสือแจ้งสำนักงานการเจ้าหน้าที่-1.trdp");
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"21-คำร้องขอโอน-1.trdp");
var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"21-คำร้องขอโอน-2.trdp");
var rptFile3 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"21-คำร้องขอโอน-3.trdp");
var rptFile4 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"21-คำร้องขอโอน-4.trdp");
ReportPackager reportPacker = new ReportPackager();
Telerik.Reporting.Report? report = null;
Telerik.Reporting.Report? report2 = null;
Telerik.Reporting.Report? report3 = null;
Telerik.Reporting.Report? report4 = null;
using (var sourceStream = System.IO.File.OpenRead(rptFile))
using (var sourceStream2 = System.IO.File.OpenRead(rptFile2))
using (var sourceStream3 = System.IO.File.OpenRead(rptFile3))
using (var sourceStream4 = System.IO.File.OpenRead(rptFile4))
{
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2);
report3 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream3);
report4 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream4);
}
report.DataSource = data;
//report.DataSource = data;
var reportBook = new ReportBook();
reportBook.Reports.Add(report);
reportBook.Reports.Add(report2);
reportBook.Reports.Add(report3);
reportBook.Reports.Add(report4);
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
InstanceReportSource instanceReportSource = new InstanceReportSource()
{
ReportDocument = report,
ReportDocument = reportBook,
};
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
var content = result.DocumentBytes;
return File(content, mimeType, $"หนังสือแจ้งสำนักงานการเจ้าหน้าที่.{exportType.Trim().ToLower()}");
return File(content, mimeType, $"แบบคำร้องขอโอน.{exportType.Trim().ToLower()}");
}
catch
{