Merge branch 'develop' into working
This commit is contained in:
commit
7c1f09bbfc
2 changed files with 46 additions and 17 deletions
|
|
@ -340,6 +340,12 @@
|
||||||
<None Update="Reports\45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา.trdp">
|
<None Update="Reports\45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา.trdp">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="Reports\45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-1.trdp">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Reports\45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-2.trdp">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Update="Reports\46-ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลา.trdp">
|
<None Update="Reports\46-ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลา.trdp">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
using BMA.EHR.Application.Repositories.Reports;
|
using BMA.EHR.Application.Repositories.Reports;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Insignias;
|
using BMA.EHR.Domain.Models.Insignias;
|
||||||
using DocumentFormat.OpenXml.Drawing;
|
using DocumentFormat.OpenXml.Drawing;
|
||||||
|
using DocumentFormat.OpenXml.EMMA;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using Telerik.Reporting;
|
using Telerik.Reporting;
|
||||||
using Telerik.Reporting.Processing;
|
using Telerik.Reporting.Processing;
|
||||||
|
|
@ -441,14 +444,14 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
||||||
}
|
}
|
||||||
report.ReportParameters["YearInsigniaPeriod"].Value = YearInsignalPeriod;
|
report.ReportParameters["YearInsigniaPeriod"].Value = YearInsignalPeriod;
|
||||||
|
|
||||||
var tbl1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
var tbl1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
||||||
var _Khr6List = new List<dynamic>();
|
var _Khr6List = new List<dynamic>();
|
||||||
foreach (var _data in data)
|
foreach (var _data in data)
|
||||||
{
|
{
|
||||||
_Khr6List.Add(new
|
_Khr6List.Add(new
|
||||||
{
|
{
|
||||||
RowNo = _Khr6List.Count + 1,
|
RowNo = (_Khr6List.Count + 1).ToString().ToThaiNumber(),
|
||||||
DepartmentName = _data.GetType().GetProperty("DepartmentName").GetValue(_data),
|
DepartmentName = _data.GetType().GetProperty("DepartmentName").GetValue(_data),
|
||||||
G1Male = _data.GetType().GetProperty("G1Male").GetValue(_data),
|
G1Male = _data.GetType().GetProperty("G1Male").GetValue(_data),
|
||||||
G1Female = _data.GetType().GetProperty("G1Female").GetValue(_data),
|
G1Female = _data.GetType().GetProperty("G1Female").GetValue(_data),
|
||||||
|
|
@ -493,6 +496,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
var data = await _repository.GetCoinReport(id);
|
var data = await _repository.GetCoinReport(id);
|
||||||
var YearInsignalPeriod = await _repository.GetYearInsigniaPeriod(id);
|
var YearInsignalPeriod = await _repository.GetYearInsigniaPeriod(id);
|
||||||
var mimeType = "";
|
var mimeType = "";
|
||||||
|
|
@ -502,35 +506,54 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
}
|
}
|
||||||
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-1.trdp");
|
||||||
|
var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-2.trdp");
|
||||||
|
|
||||||
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา.trdp");
|
|
||||||
ReportPackager reportPacker = new ReportPackager();
|
ReportPackager reportPacker = new ReportPackager();
|
||||||
Telerik.Reporting.Report? report = null;
|
Telerik.Reporting.Report? report = null;
|
||||||
|
Telerik.Reporting.Report? report2 = null;
|
||||||
|
|
||||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
|
using (var sourceStream2 = System.IO.File.OpenRead(rptFile2))
|
||||||
{
|
{
|
||||||
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
||||||
|
report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2);
|
||||||
}
|
}
|
||||||
|
string OCName = string.Empty;
|
||||||
report.ReportParameters["YearInsignalPeriod"].Value = YearInsignalPeriod;
|
//foreach (var info in data)
|
||||||
|
|
||||||
//var _Khr3List = new List<dynamic>();
|
|
||||||
//int maxRows = 25;
|
|
||||||
//for (int i = 0; i < maxRows; i++)
|
|
||||||
//{
|
//{
|
||||||
// _Khr3List.Add(new
|
// OCName = info.GetType().GetProperty("OCName").GetValue(info);
|
||||||
// {
|
// break;
|
||||||
// RowNo = i + 1,
|
|
||||||
// FullName = string.Empty
|
|
||||||
// });
|
|
||||||
//}
|
//}
|
||||||
|
report.ReportParameters["YearInsignalPeriod"].Value = YearInsignalPeriod;
|
||||||
|
report.ReportParameters["OCName"].Value = OCName;
|
||||||
|
var dataList = new List<dynamic>(data);
|
||||||
|
var detailList = new List<dynamic>();
|
||||||
|
|
||||||
//var tbl1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
var ChkInsigniaName = string.IsNullOrEmpty(dataList[0].GetType().GetProperty("InsigniaName").GetValue(dataList[0]))? string.Empty: dataList[0].GetType().GetProperty("InsigniaName").GetValue(dataList[0]);
|
||||||
//tbl1.DataSource = _Khr3List;
|
|
||||||
|
|
||||||
|
for (int i = 0; i < dataList.Count; i++)
|
||||||
|
{
|
||||||
|
detailList.Add(new
|
||||||
|
{
|
||||||
|
row = detailList.Count+1,
|
||||||
|
Number = (detailList.Count+1).ToString().ToThaiNumber(),
|
||||||
|
InsigniaName = dataList[i].GetType().GetProperty("InsigniaName").GetValue(dataList[i]),
|
||||||
|
FullName = dataList[i].GetType().GetProperty("FullName").GetValue(dataList[i]),
|
||||||
|
InsigniaInitial = dataList[i].GetType().GetProperty("InsigniaInitial").GetValue(dataList[i]),
|
||||||
|
Male = dataList[i].GetType().GetProperty("Male").GetValue(dataList[i]),
|
||||||
|
Female = dataList[i].GetType().GetProperty("Female").GetValue(dataList[i]),
|
||||||
|
}); ;
|
||||||
|
}
|
||||||
|
report.DataSource = detailList;
|
||||||
|
|
||||||
|
var reportBook = new ReportBook();
|
||||||
|
reportBook.Reports.Add(report);
|
||||||
|
reportBook.Reports.Add(report2);
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
{
|
{
|
||||||
ReportDocument = report,
|
ReportDocument = reportBook,
|
||||||
};
|
};
|
||||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue