แก้คิวรี่ ขร4

This commit is contained in:
Kittapath 2023-09-18 10:49:09 +07:00
parent 679cc2cfc2
commit 767705347b

View file

@ -665,54 +665,54 @@ namespace BMA.EHR.Application.Repositories.Reports
.Distinct() .Distinct()
.ToList(); .ToList();
var insignia_data = (from r in await _dbContext.Set<InsigniaRequestProfile>() // var insignia_data = (from r in await _dbContext.Set<InsigniaRequestProfile>()
.Include(x => x.Profile) // .Include(x => x.Profile)
.ThenInclude(x => x.Gender) // .ThenInclude(x => x.Gender)
.Include(x => x.Profile) // .Include(x => x.Profile)
.ThenInclude(x => x.Insignias) // .ThenInclude(x => x.Insignias)
.ThenInclude(x => x.Insignia) // .ThenInclude(x => x.Insignia)
.Include(x => x.Request) // .Include(x => x.Request)
.ThenInclude(x => x.Period) // .ThenInclude(x => x.Period)
.Include(x => x.Request) // .Include(x => x.Request)
.ThenInclude(x => x.Organization) // .ThenInclude(x => x.Organization)
.Include(x => x.RequestInsignia) // .Include(x => x.RequestInsignia)
.ThenInclude(x => x.InsigniaType) // .ThenInclude(x => x.InsigniaType)
.ToListAsync() // .ToListAsync()
where r.Request.Period == period // where r.Request.Period == period
&& r.IsApprove == true // && r.IsApprove == true
&& r.Status == "PENDING" // && r.Status == "PENDING"
&& r.RequestInsignia.InsigniaType != null // && r.RequestInsignia.InsigniaType != null
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ" // && r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ"
select new // select new
{ // {
InsigniaInitial = r.RequestInsignia.ShortName, // InsigniaInitial = r.RequestInsignia.ShortName,
InsigniaName = r.RequestInsignia.Name, // InsigniaName = r.RequestInsignia.Name,
ProfileId = r.Profile.Id, // ProfileId = r.Profile.Id,
CitizenId = r.Profile.CitizenId, // CitizenId = r.Profile.CitizenId,
FullName = $"", // FullName = $"",
ShowProfileId = Guid.Parse("00000000-0000-0000-0000-000000000000"), // ShowProfileId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
Type = "", // Type = "",
AcademicStanding = "", // AcademicStanding = "",
Level = "", // Level = "",
DateStart = "", // DateStart = "",
SalaryAmount = new double?(0), // SalaryAmount = new double?(0),
InsigniaRecv = r.Profile.Insignias.Count() == 0 ? null : // InsigniaRecv = r.Profile.Insignias.Count() == 0 ? null :
(r.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().Insignia == null ? null : r.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().Insignia.ShortName), // (r.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().Insignia == null ? null : r.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().Insignia.ShortName),
InsigniaRecvDate = r.Profile.Insignias.Count() == 0 ? null : // InsigniaRecvDate = r.Profile.Insignias.Count() == 0 ? null :
(r.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().DateAnnounce == null ? null : r.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().DateAnnounce.Value.ToThaiShortDate()), // (r.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().DateAnnounce == null ? null : r.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().DateAnnounce.Value.ToThaiShortDate()),
InsigniaRequest = "", // InsigniaRequest = "",
Remark = "", // Remark = "",
Position = "", // Position = "",
// Position = GetPositionByYear(r.Profile.Id, r.Request.Period.Year) + " ประเภท" + // // Position = GetPositionByYear(r.Profile.Id, r.Request.Period.Year) + " ประเภท" +
// GetPositionTypeByYear(r.Profile.Id, r.Request.Period.Year) + " ระดับ" + // // GetPositionTypeByYear(r.Profile.Id, r.Request.Period.Year) + " ระดับ" +
// GetPositionLevelByYear(r.Profile.Id, r.Request.Period.Year), // // GetPositionLevelByYear(r.Profile.Id, r.Request.Period.Year),
OCName = _organizationCommonRepository.GetOrganizationNameFullPath(r.Request.Organization.Id, false, false) // OCName = _organizationCommonRepository.GetOrganizationNameFullPath(r.Request.Organization.Id, false, false)
}) // })
.Distinct() // .Distinct()
.ToList(); // .ToList();
var data2 = teacher_data.Union(insignia_data).ToList(); // var data2 = teacher_data.Union(insignia_data).ToList();
return data2; return teacher_data;
} }
//44-บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ //44-บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ