BeWoAuxilioRitter/Validation/ServiceRecordValidator.cs - Warnung bei FK und FLS gleichtägig
This commit is contained in:
@@ -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<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics,
|
||||
int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user