คำสั่งวินัย

This commit is contained in:
Kittapath 2023-12-23 13:48:56 +07:00
parent f644654384
commit 1747891818
15 changed files with 6826 additions and 83 deletions

View file

@ -1277,6 +1277,42 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
public async Task<CommandType23Response?> GetCommandType25AttachmentAsync(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 pf in _dbContext.Set<Profile>()
.Include(x => x.Position)
.Include(x => x.PosNo)
.Include(x => x.Salaries)
on r.CitizenId equals pf.CitizenId
orderby r.Sequence
select new CommandType23Response
{
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Positionname = pf.Position == null ? "" : pf.Position.Name,
Positionno = pf.PosNo == null ? "" : pf.PosNo.Name,
Organizationname = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
Salary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
}).FirstOrDefault();
return report_data;
}
catch
{
throw;
}
}
#endregion
}
}