Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
3e2fc6905f
95 changed files with 47 additions and 33 deletions
|
|
@ -3,8 +3,6 @@ using BMA.EHR.Domain.Extensions;
|
|||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
//using Telerik.Reporting;
|
||||
//using Telerik.Reporting.Processing;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
{
|
||||
|
|
@ -123,27 +121,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return new { retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profile = profile_retire };
|
||||
}
|
||||
|
||||
//Report
|
||||
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"32-ประกาศเกษียณลูกจ้างประจำ.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);
|
||||
//}
|
||||
|
||||
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
//{
|
||||
// ReportDocument = report,
|
||||
//};
|
||||
|
||||
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
//RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||
//var content = result.DocumentBytes;
|
||||
//return File(content, "application/pdf", $"ประกาศเกษียณลูกจ้างประจำ_{null}.pdf");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Application.Repositories.Reports;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Telerik.Reporting;
|
||||
using Telerik.Reporting.Processing;
|
||||
|
|
@ -9,10 +10,10 @@ using Telerik.Reporting.Processing;
|
|||
namespace BMA.EHR.Report.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/report/retire")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
//[Authorize]
|
||||
[Authorize]
|
||||
[SwaggerTag("API รายงานระบบเกษียณ")]
|
||||
public class RetireReportController : BaseController
|
||||
{
|
||||
|
|
@ -27,17 +28,58 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// รายงานหน้าประกาศเกษียณ
|
||||
/// </summary>
|
||||
/// <param name="Id">Id ของรอบเกษียณ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{Id}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetProfileRetirement([FromRoute] Guid Id)
|
||||
{
|
||||
var retire = await _service.GetProfileRetirementdAsync(Id);
|
||||
if (retire == null)
|
||||
{
|
||||
return NotFound(retire);
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"32-ประกาศเกษียณลูกจ้างประจำ.trdp");
|
||||
var reportfile = "";
|
||||
var returnfile = "";
|
||||
switch (retire.GetType().GetProperty("Type").GetValue(retire))
|
||||
{
|
||||
case "OFFICER":
|
||||
if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "ADD")
|
||||
{
|
||||
reportfile = $"31-ประกาศเกษียณข้าราชการ-1.trdp";
|
||||
returnfile = $"ประกาศเกษียณข้าราชการ.pdf";
|
||||
}
|
||||
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "EDIT")
|
||||
{
|
||||
reportfile = $"31-ประกาศเกษียณข้าราชการ-2.trdp";
|
||||
returnfile = $"แก้ไขประกาศเกษียณข้าราชการ.pdf";
|
||||
}
|
||||
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "REMOVE")
|
||||
{
|
||||
reportfile = $"31-ประกาศเกษียณข้าราชการ-3.trdp";
|
||||
returnfile = $"ยกเลิกประกาศเกษียณข้าราชการ.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
return Error(retire.GetType().GetProperty("TypeReport").ToString());
|
||||
}
|
||||
break;
|
||||
case "EMPLOYEE":
|
||||
reportfile = $"32-ประกาศเกษียณลูกจ้างประจำ.trdp";
|
||||
returnfile = $"ประกาศเกษียณลูกจ้าง";
|
||||
break;
|
||||
default:
|
||||
return BadRequest(retire);
|
||||
}
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", reportfile);
|
||||
ReportPackager reportPacker = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
|
|
@ -63,12 +105,10 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
organizationOrganization = profile.GetType().GetProperty("organizationOrganization").GetValue(profile).ToString(),
|
||||
});
|
||||
}
|
||||
|
||||
//Binding to Table
|
||||
var tblProfile = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
||||
tblProfile.DataSource = _profileList;
|
||||
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
|
|
@ -78,11 +118,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||
var content = result.DocumentBytes;
|
||||
return File(content, "application/pdf", $"ประกาศเกษียณลูกจ้างประจำ{null}.pdf");
|
||||
return File(content, "application/pdf", returnfile);
|
||||
}
|
||||
//return Success(retire);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
BMA.EHR.Report.Service/Reports/29-คำสั่งให้ช่วยราชการ-1.trdp
Normal file
BIN
BMA.EHR.Report.Service/Reports/29-คำสั่งให้ช่วยราชการ-1.trdp
Normal file
Binary file not shown.
BIN
BMA.EHR.Report.Service/Reports/29-คำสั่งให้ช่วยราชการ-2.trdp
Normal file
BIN
BMA.EHR.Report.Service/Reports/29-คำสั่งให้ช่วยราชการ-2.trdp
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue