คำสั่งส่งตัวกลับ
This commit is contained in:
parent
e5f73f42ef
commit
c2021691fc
4 changed files with 96 additions and 18 deletions
|
|
@ -718,6 +718,51 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<CommandType16Response>> GetCommandType16Async(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var raw_data = await _dbContext.Set<CommandReceiver>()
|
||||
.Include(c => c.Command)
|
||||
.Where(c => c.Command.Id == id)
|
||||
.ToListAsync();
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var report_data = (from r in raw_data
|
||||
join p in _dbContext.Set<PlacementRepatriation>()
|
||||
.Include(p => p.Profile)
|
||||
.ThenInclude(p => p.Position)
|
||||
.Include(p => p.Profile)
|
||||
.ThenInclude(p => p.Salaries)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType16Response
|
||||
{
|
||||
CommandNo = r.Command.CommandNo.ToThaiNumber(),
|
||||
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
IssuerOrganizationName = r.Command.IssuerOrganizationName,
|
||||
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
|
||||
AuthorizedPosition = r.Command.AuthorizedPosition,
|
||||
GovAidCommandNo = r.Command.GovAidCommandNo.ToThaiNumber(),
|
||||
GovAidCommandDate = r.Command.GovAidCommandDate == null ? "" :
|
||||
r.Command.GovAidCommandDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
StartDate = "", // TODO: Frontend ไม่มีการเก็บค่าไว้ หรือไม่มีเก็บไว้จากระบบบรรจุ ทำให้ดึงมาแสดงไม่ได้
|
||||
ActiveDate = p.Date == null ? "" : p.Date.Value.ToThaiFullDate3().ToThaiNumber()
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return report_data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<CommandType17Response>> GetCommandType17AttachmentAsync(Guid id)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BMA.EHR.Application.Responses.Reports
|
||||
{
|
||||
public class CommandType16Response
|
||||
{
|
||||
public string CommandNo { get; set; } = string.Empty;
|
||||
|
||||
public string CommandYear { get; set; } = string.Empty;
|
||||
|
||||
public string IssuerOrganizationName { get; set; } = string.Empty;
|
||||
|
||||
public string CommandAffectDate { get; set; } = string.Empty;
|
||||
|
||||
public string AuthorizedUserFullName { get; set; } = string.Empty;
|
||||
|
||||
public string AuthorizedPosition { get; set; } = string.Empty;
|
||||
|
||||
public string GovAidCommandNo { get; set; } = string.Empty;
|
||||
|
||||
public string GovAidCommandDate { get; set; } = string.Empty;
|
||||
|
||||
public string StartDate { get; set; } = string.Empty;
|
||||
|
||||
public string ActiveDate { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -1666,23 +1666,25 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
||||
//var positionList = string.Empty;
|
||||
|
||||
var command = new
|
||||
{
|
||||
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
||||
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
PositionList = "",
|
||||
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||
GovAidCommandNo = raw_data.GovAidCommandNo.ToThaiNumber(),
|
||||
GovAidCommandDate = raw_data.GovAidCommandDate == null ? "" : raw_data.GovAidCommandDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
};
|
||||
//var command = new
|
||||
//{
|
||||
// CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
||||
// CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
// IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||
// ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
// ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
// ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
// ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
// PositionList = "",
|
||||
// Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||
// CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
// AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||
// AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||
// GovAidCommandNo = raw_data.GovAidCommandNo.ToThaiNumber(),
|
||||
// GovAidCommandDate = raw_data.GovAidCommandDate == null ? "" : raw_data.GovAidCommandDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
//};
|
||||
|
||||
var data = await _commandReportRepository.GetCommandType16Async(commandId);
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"30-คำสั่งส่งตัวกลับไปปฏิบัติงานทางต้นสังกัดเดิม.trdp");
|
||||
|
||||
|
|
@ -1693,7 +1695,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
|
||||
report.DataSource = command;
|
||||
report.DataSource = data;
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
if (exportType == "docx")
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue