FinanceRO - Bugfix wenn Betreuung beendet und ein Zeitraum über Ende hinweg gewählt wird

SupportOID=160609
This commit is contained in:
2026-04-22 14:21:45 +02:00
parent fafd576d1f
commit e6a06ced42

View File

@@ -223,15 +223,20 @@ namespace BeWo.Report.ReportObjects
{
records = new List<ServiceRecordDC>();
}
// AB, 22.04.2026: Bugfix wenn Betreuung beendet und ein Zeitraum über Ende hinweg gewählt wird
var terminationDate = ro.Costbearer2Supportconcept.SupportConcept.Customer.TerminationDate;
DateTime? effectiveEnd = end;
if (terminationDate.HasValue && (!effectiveEnd.HasValue || terminationDate.Value < effectiveEnd.Value))
{
effectiveEnd = terminationDate.Value;
}
//1.
if (ro.SupportConceptApprovalPeriod != null && ro.SupportConceptApprovalPeriod.ServiceCategory != null)
{
ro.Leistungskategorie = ro.SupportConceptApprovalPeriod.ServiceCategory.Name;
ro.ServiceRecords = records.Where(sr =>
sr.ServiceDescription.Category.ServiceCategoryOid == ro.SupportConceptApprovalPeriod.ServiceCategory.ServiceCategoryOid)
.ToList();
ro.ServiceRecords = records.Where(sr => sr.ServiceDescription.Category.ServiceCategoryOid == ro.SupportConceptApprovalPeriod.ServiceCategory.ServiceCategoryOid).ToList();
}
else
{
@@ -272,7 +277,7 @@ namespace BeWo.Report.ReportObjects
}
else
{
ro.ApprovedHours = calc.GetApprovedHoursTillNow(ro.Costbearer2Supportconcept, end.Value) ?? 0;
ro.ApprovedHours = calc.GetApprovedHoursTillNow(ro.Costbearer2Supportconcept, effectiveEnd.Value) ?? 0;
}
ro.StundenNichtFehlkontakte = calc.GetBillableDurationInMinutes(flsRecords.Where(sr => sr.Start.Value.Date < end.Value.AddDays(1)).ToList()) / 60;
ro.StundenFehlkontakte = calc.GetBillableDurationInMinutes(fkRecords.Where(sr => sr.Start.Value.Date < end.Value.AddDays(1)).ToList()) / 60;
@@ -317,20 +322,20 @@ namespace BeWo.Report.ReportObjects
}
if (ro.SupportConceptApprovalPeriod != null)
{
ro.ApprovedHoursInReportTimeSpan = calc.GetApprovedHoursForPeriod(ro.SupportConceptApprovalPeriod, costRateDcs, start, end) ?? 0;
ro.ApprovedHoursInReportTimeSpan = calc.GetApprovedHoursForPeriod(ro.SupportConceptApprovalPeriod, costRateDcs, start, effectiveEnd) ?? 0;
}
else
{
ro.ApprovedHoursInReportTimeSpan = calc.GetApprovedHoursForPeriod(ro.Costbearer2Supportconcept, start.Value, end.Value);
ro.ApprovedHoursInReportTimeSpan = calc.GetApprovedHoursForPeriod(ro.Costbearer2Supportconcept, start.Value, effectiveEnd.Value);
}
if (splitByServiceCategory && ro.SupportConceptApprovalPeriod != null)
{
ro.ApprovedAmountInReportTimeSpan = (decimal)calc.GetApprovedAmountForPeriod(ro.Costbearer2Supportconcept, start.Value, end.Value, ro.SupportConceptApprovalPeriod.ServiceCategory);
ro.ApprovedAmountInReportTimeSpan = (decimal)calc.GetApprovedAmountForPeriod(ro.Costbearer2Supportconcept, start.Value, effectiveEnd.Value, ro.SupportConceptApprovalPeriod.ServiceCategory);
}
else
{
ro.ApprovedAmountInReportTimeSpan = (decimal)calc.GetApprovedAmountForPeriod(ro.Costbearer2Supportconcept, start.Value, end.Value, null);
ro.ApprovedAmountInReportTimeSpan = (decimal)calc.GetApprovedAmountForPeriod(ro.Costbearer2Supportconcept, start.Value, effectiveEnd.Value, null);
}
ro.AmountInReportTimeSpan = 0;
ro.AmountNichtFehlkontakteInReportTimeSpan = 0;