diff --git a/BMA.EHR.Application/Repositories/Reports/CandidateReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/CandidateReportRepository.cs index 027599ce..9e37e08b 100644 --- a/BMA.EHR.Application/Repositories/Reports/CandidateReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/CandidateReportRepository.cs @@ -59,7 +59,6 @@ namespace BMA.EHR.Application.Repositories.Reports var monthDiff = 0; var dayDiff = 0; var sb = new StringBuilder(); - var zxc = new List(); foreach (var career in careers) { if (career.DurationEnd < career.DurationStart) @@ -68,7 +67,6 @@ namespace BMA.EHR.Application.Repositories.Reports yearDiff = yearDiff + rangeObj.years; monthDiff = monthDiff + rangeObj.months; dayDiff = dayDiff + rangeObj.days; - zxc.Add(rangeObj); } else { @@ -76,7 +74,6 @@ namespace BMA.EHR.Application.Repositories.Reports yearDiff = yearDiff + rangeObj.years; monthDiff = monthDiff + rangeObj.months; dayDiff = dayDiff + rangeObj.days; - zxc.Add(rangeObj); } if (dayDiff >= 30) { diff --git a/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs index 4fa5f9c7..a2f92ec7 100644 --- a/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs @@ -2208,7 +2208,7 @@ namespace BMA.EHR.Insignia.Service.Controllers /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน [HttpPut("download/excel/{RequestId:length(36)}")] - public async Task> DownloadExcelInsigniaByFilter([FromForm] ExportFileInsigniaRequest req, Guid RequestId) + public async Task> DownloadExcelInsigniaByFilter([FromBody] ExportFileInsigniaRequest req, Guid RequestId) { var insigniaPeriod = await _context.InsigniaRequests .Include(x => x.Organization) @@ -2230,6 +2230,8 @@ namespace BMA.EHR.Insignia.Service.Controllers .ThenInclude(x => x.Profile) .ThenInclude(x => x.Insignias) .ThenInclude(x => x.Insignia) + .Include(x => x.RequestProfiles) + .ThenInclude(x => x.RequestInsignia) .FirstOrDefaultAsync(x => x.Id == RequestId); if (insigniaPeriod == null) return Error(GlobalMessages.InsigniaPeriodNotFound); @@ -2251,7 +2253,7 @@ namespace BMA.EHR.Insignia.Service.Controllers var workSheet = excel.Workbook.Worksheets[0]; var requestProfiles = insigniaPeriod.RequestProfiles.Where(x => x.Status == "PENDING").ToList(); if (req.ProfileType != null) - requestProfiles = requestProfiles.Where(x => x.Profile.ProfileType == req.ProfileType.Trim().ToUpper()).ToList(); + requestProfiles = requestProfiles.Where(x => x.Profile != null).Where(x => x.Profile.ProfileType.Trim().ToUpper() == req.ProfileType.Trim().ToUpper()).ToList(); if (req.InsigniaId != null) requestProfiles = requestProfiles.Where(x => x.RequestInsignia.Id == req.InsigniaId).ToList(); // if (req.OrgId != null)