From 9379e1b42133bb9356a45ff4af69cd0d6d3757a7 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 17 Oct 2023 12:39:36 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=84=E0=B8=B4?= =?UTF-8?q?=E0=B8=A7=E0=B8=A3=E0=B8=B5=E0=B9=88=E0=B9=80=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/Reports/CandidateReportRepository.cs | 3 --- .../Controllers/InsigniaRequestController.cs | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) 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)