From 7016df503a23525501427ff67f8f8c38c0c8b598 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 31 Jul 2025 13:24:08 +0700 Subject: [PATCH] #1701 --- .../Reports/InsigniaReportRepository.cs | 16 +++++++++++----- .../Controllers/InsigniaReportController.cs | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Reports/InsigniaReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/InsigniaReportRepository.cs index 95bef940..e33f854b 100644 --- a/BMA.EHR.Application/Repositories/Reports/InsigniaReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/InsigniaReportRepository.cs @@ -844,13 +844,16 @@ namespace BMA.EHR.Application.Repositories.Reports OcId = x.Request.OrganizationId // Organization ID }) .ToListAsync(); - + var org = _userProfileRepository.GetOc(nodeId, node, AccessToken); + var organizationName = $"{(!string.IsNullOrEmpty(org.Child4) ? org.Child4 + "/" : "")}{(!string.IsNullOrEmpty(org.Child3) ? org.Child3 + "/" : "")}{(!string.IsNullOrEmpty(org.Child2) ? org.Child2 + "/" : "")}{(!string.IsNullOrEmpty(org.Child1) ? org.Child1 + "/" : "")}{org.Root ?? ""}"; var insignia = (from r in data group r by new { OcId = r.OcId, InsigniaInitial = r.InsigniaInitial } into g select new { RowNo = 1, - DepartmentName = _userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken).Root, //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false), + DepartmentName = organizationName, + //_userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken).Root, + //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false), InsigniaInitial = g.Key.InsigniaInitial, G1Male = g.Sum(x => x.Gendor == "ชาย" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0).ToString().ToThaiNumber(), G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0).ToString().ToThaiNumber(), @@ -1733,6 +1736,7 @@ namespace BMA.EHR.Application.Repositories.Reports RequestInsigniaName = x.RequestInsignia.Name, IsApprove = x.IsApprove, InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})", // Insignia's full name and short name + DatePayment = x.DatePayment, OcId = x.Root }).ToListAsync(); var insignia = (from r in data @@ -1743,8 +1747,10 @@ namespace BMA.EHR.Application.Repositories.Reports DepartmentName = g.Key.OcId, InsigniaTypeName = g.Key.InsigniaTypeName, RequestInsigniaName = g.Key.RequestInsigniaName, - Pending = g.Sum(x => x.IsApprove == false ? 1 : 0), - Done = g.Sum(x => x.IsApprove == true ? 1 : 0), + /* Pending = g.Sum(x => x.IsApprove == false ? 1 : 0), + Done = g.Sum(x => x.IsApprove == true ? 1 : 0),*/ + Pending = g.Sum(x => x.DatePayment == null ? 1 : 0), + Done = g.Sum(x => x.DatePayment != null ? 1 : 0), Remark = "", }).ToList(); @@ -1803,7 +1809,7 @@ namespace BMA.EHR.Application.Repositories.Reports { CitizenId = x.CitizenId, Prefix = x.Prefix, - FullName = $"{x.Prefix}{x.FirstName} {x.LastName}", + FullName = $"{x.FirstName} {x.LastName}", PosTypeName = x.PosTypeName, PosLevelName = x.PosLevelName, Position = x.Position, diff --git a/BMA.EHR.Insignia/Controllers/InsigniaReportController.cs b/BMA.EHR.Insignia/Controllers/InsigniaReportController.cs index e5c28e4f..448d69fb 100644 --- a/BMA.EHR.Insignia/Controllers/InsigniaReportController.cs +++ b/BMA.EHR.Insignia/Controllers/InsigniaReportController.cs @@ -731,7 +731,7 @@ namespace BMA.EHR.Insignia.Service.Controllers sum = (pending + done).ToString().ToThaiNumber(), }); pendingSum = pendingSum + pending; - doneSum = pendingSum + done; + doneSum = doneSum + done; pending = 0; done = 0; row = 1; @@ -763,7 +763,7 @@ namespace BMA.EHR.Insignia.Service.Controllers sum = (pending + done).ToString().ToThaiNumber(), }); pendingSum = pendingSum + pending; - doneSum = pendingSum + done; + doneSum = doneSum + done; detailList.Add(new { row = "",