ปรับ Report Resign, Deceased
This commit is contained in:
parent
197f8f7150
commit
6bb5c90964
3 changed files with 69 additions and 57 deletions
|
|
@ -73,8 +73,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
try
|
||||
{
|
||||
var head = await _repository.GetHeadRetirementDeceasedAsync(id);
|
||||
var data = await _repository.GetRetirementDeceasedAsync(id);
|
||||
if (data != null || head != null)
|
||||
var detail = await _repository.GetRetirementDeceasedAsync(id);
|
||||
if (detail != null && head != null)
|
||||
{
|
||||
var mergeData = new
|
||||
{
|
||||
|
|
@ -83,13 +83,13 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
Date = head.GetType().GetProperty("Date").GetValue(head),
|
||||
Subject = head.GetType().GetProperty("Subject").GetValue(head),
|
||||
Send = head.GetType().GetProperty("Send").GetValue(head),
|
||||
FullName = data.GetType().GetProperty("FullName").GetValue(data),
|
||||
Position = data.GetType().GetProperty("Position").GetValue(data),
|
||||
Reason = data.GetType().GetProperty("Reason").GetValue(data),
|
||||
DeceasedDate = data.GetType().GetProperty("Date").GetValue(data),
|
||||
CurrentDate = data.GetType().GetProperty("CurrentDate").GetValue(data),
|
||||
DeceasedNumber = data.GetType().GetProperty("Number").GetValue(data),
|
||||
Location = data.GetType().GetProperty("Location").GetValue(data),
|
||||
FullName = detail.GetType().GetProperty("FullName").GetValue(detail),
|
||||
Position = detail.GetType().GetProperty("Position").GetValue(detail),
|
||||
Reason = detail.GetType().GetProperty("Reason").GetValue(detail),
|
||||
DeceasedDate = detail.GetType().GetProperty("Date").GetValue(detail),
|
||||
CurrentDate = detail.GetType().GetProperty("CurrentDate").GetValue(detail),
|
||||
DeceasedNumber = detail.GetType().GetProperty("Number").GetValue(detail),
|
||||
Location = detail.GetType().GetProperty("Location").GetValue(detail),
|
||||
};
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
|
|
@ -99,22 +99,29 @@ 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", $"36-บันทึกเวียนแจ้งการถึงแก่กรรม.trdp");
|
||||
ReportPackager reportPacker = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
//var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"36-บันทึกเวียนแจ้งการถึงแก่กรรม.trdp");
|
||||
//ReportPackager reportPacker = new ReportPackager();
|
||||
//Telerik.Reporting.Report? report = null;
|
||||
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
//{
|
||||
// report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
||||
//}
|
||||
//report.DataSource = mergeData;
|
||||
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
//{
|
||||
// ReportDocument = report,
|
||||
//};
|
||||
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
//RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
||||
//return File(result.DocumentBytes, mimeType, $"รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม.{exportType.Trim().ToLower()}");
|
||||
var data = new
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
||||
}
|
||||
report.DataSource = mergeData;
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report,
|
||||
template = "deceased",
|
||||
reportName = "docx-report",
|
||||
data = mergeData
|
||||
};
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
||||
return File(result.DocumentBytes, mimeType, $"รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม.{exportType.Trim().ToLower()}");
|
||||
return Success(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue