From adbfae7a57499b0b439f891aa5c21b7ad3f99669 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 14 Apr 2025 16:26:51 +0200 Subject: [PATCH] =?UTF-8?q?BeWoAuxilioRitter/Validation/ServiceRecordValid?= =?UTF-8?q?ator.cs=20-=20Warnung=20bei=20FK=20und=20FLS=20gleicht=C3=A4gig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Validation/ServiceRecordValidator.cs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/ReportImp/BeWoAuxilioRitter/Validation/ServiceRecordValidator.cs b/ReportImp/BeWoAuxilioRitter/Validation/ServiceRecordValidator.cs index a43dae062..6054de7ce 100644 --- a/ReportImp/BeWoAuxilioRitter/Validation/ServiceRecordValidator.cs +++ b/ReportImp/BeWoAuxilioRitter/Validation/ServiceRecordValidator.cs @@ -7,6 +7,7 @@ using BeWo.Data.Entities; using BeWo.Service.DCEntityMapper; using BeWo.Service.Plugins; using BS.Shared; +using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.Extensions; @@ -18,5 +19,51 @@ namespace BeWoAuxilioRitter.Validation { return new[] { "Arbeitszeit" }; } + + public override List ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, + int maxDaysEditServiceRecordsAllowed, IList employeeOids, IList cb2scOids) + { + var list = base.ValidateServiceRecord(newServiceRecord, statistics, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids); + + // Warnung bei Fehlkontakt, wenn bereits eine abrechenbare Leistung an dem Tag gebucht wurde + if (newServiceRecord.Start.HasValue && newServiceRecord.SupportConcept != null && newServiceRecord.SupportConcept.CostBearer.Contains("LVR") && newServiceRecord.ServiceDescription.Name.ToLower().Contains("fehlkontakt")) + { + // Alle Einträge des Tages holen, für den dokumentiert wird + var span = new DateTimeSpan() { StartDate = new DateTime(newServiceRecord.Start.Value.Year, newServiceRecord.Start.Value.Month, newServiceRecord.Start.Value.Day), EndDate = newServiceRecord.Start.Value.Date.AddDays(1) }; + var eintraegeAmTag = DAOFactory.SearchDAO.FindServiceRecordsInSpan(newServiceRecord.CostBearer2SupportConceptOid.Value, span); + + if (eintraegeAmTag != null && eintraegeAmTag.Count() > 0) + { + list.Add(new ServiceRecordValidationResultDC + { + ResultType = ServiceRecordValidationResult.Custom, + Allow = true, + Message = "Achtung, bitte beachten, dass bereits eine andere aberechenbare Leistung an diesem Tag im Hilfeplan erbracht wurde und ein Fehlkontakt daher nicht zulässig ist." + + "\nWollen Sie dennoch speichern?" + }); + } + } + + else if (newServiceRecord.Start.HasValue && newServiceRecord.SupportConcept != null && newServiceRecord.SupportConcept.CostBearer.Contains("LVR") + && newServiceRecord.ServiceDescription.Category.IsBillable && !newServiceRecord.ServiceDescription.Name.ToLower().Contains("fehlkontakt")) + { + // Alle Einträge des Tages holen, für den dokumentiert wird + var span = new DateTimeSpan() { StartDate = new DateTime(newServiceRecord.Start.Value.Year, newServiceRecord.Start.Value.Month, newServiceRecord.Start.Value.Day), EndDate = newServiceRecord.Start.Value.Date.AddDays(1) }; + var eintraegeAmTag = DAOFactory.SearchDAO.FindServiceRecordsInSpan(newServiceRecord.CostBearer2SupportConceptOid.Value, span); + + + if (eintraegeAmTag != null && eintraegeAmTag.Any(s => s.ServiceDescription.ServiceCategory.IsBillable && s.ServiceDescription.Name.ToLower().Contains("fehlkontakt"))) + { + list.Add(new ServiceRecordValidationResultDC + { + ResultType = ServiceRecordValidationResult.Custom, + Allow = true, + Message = "Achtung, bitte beachten, dass bereits ein Fehlkontakt an diesem Tag im Hilfeplan erbracht wurde und eine andere aberechenbare Leistung daher nicht zulässig ist." + + "\nWollen Sie dennoch speichern?" + }); + } + } + return list; + } } } \ No newline at end of file