คิวรี่ชื่อสังกัด เกษียณ
This commit is contained in:
parent
978e1bada1
commit
3328bdf726
2 changed files with 130 additions and 19 deletions
|
|
@ -20,6 +20,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -27,10 +28,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
public RetireReportRepository(IApplicationDBContext dbContext,
|
||||
MinIOService documentService,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
_organizationCommonRepository = organizationCommonRepository;
|
||||
_documentService = documentService;
|
||||
}
|
||||
|
||||
|
|
@ -66,6 +69,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
var retire = await _dbContext.Set<RetirementPeriod>()
|
||||
.Include(x => x.RetirementProfiles)
|
||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||
var retires = new List<dynamic>();
|
||||
if (retire == null)
|
||||
{
|
||||
var retireHistorys = await _dbContext.Set<RetirementPeriodHistory>().AsQueryable()
|
||||
|
|
@ -116,7 +120,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
{
|
||||
profiles = profiles.OrderBy(x => x.order).ToList();
|
||||
}
|
||||
return new { retireHistorys.Detail, retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profile = profiles};
|
||||
return new { retireHistorys.Detail, retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profile = profiles };
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -135,19 +139,44 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
prefix = x.Profile.Prefix == null ? string.Empty : x.Profile.Prefix.Name,
|
||||
fullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
|
||||
organizationOrganization = x.Profile.OrganizationOrganization,
|
||||
oc = x.Profile.Oc,
|
||||
ocId = x.Profile.OcId,
|
||||
position = x.Profile.Position == null ? string.Empty : x.Profile.Position.Name,
|
||||
positionType = x.Profile.PositionType == null ? string.Empty : x.Profile.PositionType.Name,
|
||||
positionExecutive = x.Profile.PositionExecutive,
|
||||
posNo = x.Profile.PosNo == null ? string.Empty : x.Profile.PosNo.Name,
|
||||
positionEmployeePosition = x.Profile.PositionEmployeePosition,
|
||||
positionEmployeeLevel = x.Profile.PositionEmployeeLevel,
|
||||
positionEmployeeGroup = x.Profile.PositionEmployeeGroup,
|
||||
posNoEmployee = x.Profile.PosNoEmployee,
|
||||
})
|
||||
.ToListAsync();
|
||||
positionEmployeePosition = x.Profile.PositionEmployeePosition == null ? null : x.Profile.PositionEmployeePosition.Name,
|
||||
positionEmployeeLevel = x.Profile.PositionEmployeeLevel == null ? null : x.Profile.PositionEmployeeLevel.Name,
|
||||
positionEmployeeGroup = x.Profile.PositionEmployeeGroup == null ? null : x.Profile.PositionEmployeeGroup.Name,
|
||||
posNoEmployee = x.Profile.PosNoEmployee,
|
||||
})
|
||||
.ToListAsync();
|
||||
foreach (var r in profile_retire)
|
||||
{
|
||||
var data = new ProfileJsonRequest
|
||||
{
|
||||
order = r.order,
|
||||
id = r.id,
|
||||
reason = r.reason,
|
||||
remove = r.remove,
|
||||
profileId = r.profileId,
|
||||
citizenId = r.citizenId,
|
||||
prefix = r.prefix,
|
||||
fullName = r.fullName,
|
||||
organizationOrganization = r.organizationOrganization,
|
||||
oc = r.ocId == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(r.ocId.Value),
|
||||
position = r.position,
|
||||
positionType = r.positionType,
|
||||
positionExecutive = r.positionExecutive,
|
||||
posNo = r.posNo,
|
||||
positionEmployeePosition = r.positionEmployeePosition,
|
||||
positionEmployeeLevel = r.positionEmployeeLevel,
|
||||
positionEmployeeGroup = r.positionEmployeeGroup,
|
||||
posNoEmployee = r.posNoEmployee,
|
||||
};
|
||||
retires.Add(data);
|
||||
}
|
||||
|
||||
return new { retire.Detail, 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 };
|
||||
return new { retire.Detail, retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profile = retires };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue