รายงาน และ แก้คำสั้่ง

This commit is contained in:
Suphonchai Phoonsawat 2023-09-04 13:44:34 +07:00
parent 0eac2a0c61
commit 248870d884
6 changed files with 181 additions and 12 deletions

View file

@ -578,6 +578,49 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
public async Task<List<CommandType03Response>> GetCommandType14AttachmentAsync(Guid id)
{
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<PlacementReceive>()
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
select new CommandType03Response
{
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.OrganizationPositionOld,
OldPositionName = p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld,
OldPositionType = p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld,
OldSalary = p.AmountOld == null ? 0 : p.AmountOld.Value,
NewOc = _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name,
NewSalary = p.Amount == null ? 0 : p.Amount.Value,
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
})
.ToList();
return report_data;
}
public async Task<List<CommandType15Response>> GetCommandType15AttachmentAsync(Guid id)
{
try