From 52223304c612df5b5b6fa86e0b5910a606a12186 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 19 Sep 2023 10:48:44 +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=20report=2046=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/Reports/InsigniaReportRepository.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Reports/InsigniaReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/InsigniaReportRepository.cs index 4cf804b5..45b27ff0 100644 --- a/BMA.EHR.Application/Repositories/Reports/InsigniaReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/InsigniaReportRepository.cs @@ -883,16 +883,16 @@ namespace BMA.EHR.Application.Repositories.Reports var data = (from r in await _dbContext.Set() .Include(x => x.Profile) .ToListAsync() - join p in positions on r.PositionId equals p.Id into pGroup + join p in positions on r?.PositionId equals p.Id into pGroup from p in pGroup.DefaultIfEmpty() - join o in organizations on r.OcId equals o.Id into oGroup + join o in organizations on r?.OcId equals o.Id into oGroup from o in oGroup.DefaultIfEmpty() where r.Profile == profile select new { DateTh = r.Date == null ? "-" : r.Date.Value.ToThaiShortDate().ToString().ToThaiNumber(), - Position = p.Name, - OCName = o.Parent == null ? "-" : (o.Parent.OrganizationOrganization == null ? "-" : o.Parent.OrganizationOrganization.Name), + Position = p == null ? "-" : p.Name, + OCName = o == null || o.Parent == null ? "-" : (o.Parent.OrganizationOrganization == null ? "-" : o.Parent.OrganizationOrganization.Name), Age = r.Date == null ? "-" : r.Date.Value.CalculateBetweenDateV2(DateTime.Now).ToThaiNumber(), Amount = r.Amount == null ? null : r.Amount.Value.ToNumericText().ToThaiNumber(), Date = r.Date,