แก้reportใบสมัครสอบ

This commit is contained in:
Kittapath 2023-10-18 10:43:59 +07:00
parent 43f7eb7f6d
commit ba83fe2a73

View file

@ -809,6 +809,30 @@ namespace BMA.EHR.Application.Repositories.Reports
if (period == null)
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
var gender = (from r in await _dbContext.Set<InsigniaRequestProfile>()
.Include(x => x.Profile)
.ThenInclude(x => x.Gender)
.Include(x => x.Profile)
.ThenInclude(x => x.Prefix)
.Include(x => x.Request)
.ThenInclude(x => x.Period)
.Include(x => x.Request)
.ThenInclude(x => x.Organization)
.Include(x => x.RequestInsignia)
.ThenInclude(x => x.InsigniaType)
.ToListAsync()
where r.Request.Period == period
&& r.IsApprove == true
&& r.Status == "PENDING"
&& r.RequestInsignia.InsigniaType != null
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ"
select new
{
Male = r.Profile.Gender == null ? 0 : (r.Profile.Gender.Name == "ชาย" ? 1 : 0),
Female = r.Profile.Gender == null ? 0 : (r.Profile.Gender.Name == "หญิง" ? 1 : 0),
})
.Distinct()
.ToList();
var data = (from r in await _dbContext.Set<InsigniaRequestProfile>()
.Include(x => x.Profile)
.ThenInclude(x => x.Gender)
@ -833,8 +857,8 @@ namespace BMA.EHR.Application.Repositories.Reports
ProfileId = r.Profile.Id,
FullName = $"{r.Profile.Prefix?.Name}{r.Profile.FirstName} {r.Profile.LastName}",
Gender = r.Profile.Gender == null ? null : r.Profile.Gender.Name,
Male = r.Profile.Gender == null ? 0 : (r.Profile.Gender.Name == "ชาย" ? 1 : 0),
Female = r.Profile.Gender == null ? 0 : (r.Profile.Gender.Name == "หญิง" ? 1 : 0),
Male = gender.Sum(x => x.Male),
Female = gender.Sum(x => x.Female),
InsigniaId = r.RequestInsignia.Id,
OCName = _organizationCommonRepository.GetOrganizationNameFullPath(r.Request.Organization.Id, false, false)
})