คำสั่งส่งตัวกลับ

This commit is contained in:
Suphonchai Phoonsawat 2023-09-27 12:36:21 +07:00
parent e5f73f42ef
commit c2021691fc
4 changed files with 96 additions and 18 deletions

View file

@ -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