diff --git a/ReportImp/DrobDrogenhilfe/DrobDrogenhilfe.csproj b/ReportImp/DrobDrogenhilfe/DrobDrogenhilfe.csproj
index e08d69732..0773c6129 100644
--- a/ReportImp/DrobDrogenhilfe/DrobDrogenhilfe.csproj
+++ b/ReportImp/DrobDrogenhilfe/DrobDrogenhilfe.csproj
@@ -60,6 +60,7 @@
+
True
diff --git a/ReportImp/DrobDrogenhilfe/Invoicing/CustomSettlementInvoiceCreation.cs b/ReportImp/DrobDrogenhilfe/Invoicing/CustomSettlementInvoiceCreation.cs
index 0c2a9605c..bee55926d 100644
--- a/ReportImp/DrobDrogenhilfe/Invoicing/CustomSettlementInvoiceCreation.cs
+++ b/ReportImp/DrobDrogenhilfe/Invoicing/CustomSettlementInvoiceCreation.cs
@@ -15,5 +15,90 @@ namespace DrobDrogenhilfe
internal class CustomSettlementInvoiceCreation : LWLSettlementInvoiceCreation
{
+ // muss doch permanent bei denen sein, geht nur um zusammenfassen der Items in Zeile 27
+ // die haben tatsächlich den gleichen Preis zweimal bekommen und brauchen den getrennt ausgewiesen
+ // das kann zu Ärger führen, wenn jemand in einem Zeitraum 2 Bewilligungen hat, dann hätte der LWL die gern zusammen gefasst, also nicht als Standard tauglich
+ public override List CreateInvoiceItems(Settlement2DC si, IList apList, bool schneideBeiMaxAb)
+ {
+ List iiList = new List();
+ var apsByHourlyRate = new Dictionary>();
+
+ foreach (var ap in apList)
+ {
+ IList list = null;
+ String key = String.Format("{0}_{1}_{2:ddMMyyy}", ap.AmountPerUnit, ap.RateFactor, ap.PeriodStartDate);
+
+ if (apsByHourlyRate.ContainsKey(key))
+ {
+ list = apsByHourlyRate[key];
+ }
+ else
+ {
+ list = new List();
+ apsByHourlyRate[key] = list;
+ }
+
+ list.Add(ap);
+ }
+
+ decimal maxApprovedFls = si.ApprovedFLS ?? 0;
+ decimal totalHours = 0;
+ foreach (var key in apsByHourlyRate.Keys)
+ {
+ IList list = apsByHourlyRate[key];
+ var ii = new InvoiceItemDC();
+
+ decimal minutesTotal = 0;
+ decimal minutesTotalBudget = 0;
+
+ DateTime start = DateTime.MaxValue;
+ DateTime end = DateTime.MinValue;
+
+ decimal rf = si.RateFactor ?? 0;
+ decimal hr = 0;
+
+ foreach (var approvalPeriod in list)
+ {
+ minutesTotal += approvalPeriod.RecordedMinutes;
+ minutesTotalBudget += approvalPeriod.BudgetMinutes;
+ if (approvalPeriod.PeriodStartDate < start)
+ start = approvalPeriod.PeriodStartDate;
+ if (approvalPeriod.PeriodEndDate > end)
+ end = approvalPeriod.PeriodEndDate;
+
+ hr = approvalPeriod.AmountPerUnit;
+ if (approvalPeriod.RateFactor.HasValue)
+ {
+ rf = approvalPeriod.RateFactor.Value;
+ }
+ if (!String.IsNullOrEmpty(approvalPeriod.Notice) && approvalPeriod.Notice == "Fehlkontakte")
+ {
+ hr *= 0.8m;
+ ii.ItemDescription = "Fehlkontakte";
+ }
+ }
+ ii.ItemPeriodStart = start;
+ ii.ItemPeriodEnd = end;
+ ii.RateFactor = rf;
+ ii.AmountPerUnit = hr;
+ decimal hours = Math.Round(minutesTotal / 60m, 2, MidpointRounding.AwayFromZero);
+ hours *= (100 + rf) / 100;
+ hours = Math.Round(hours, 2, MidpointRounding.AwayFromZero);
+
+ decimal hoursBudget = Math.Round(minutesTotalBudget / 60m, 2, MidpointRounding.AwayFromZero);
+ hoursBudget *= (100 + rf) / 100;
+ hoursBudget = Math.Round(hoursBudget, 2, MidpointRounding.AwayFromZero);
+ totalHours += hoursBudget;
+
+ ii.UnitCount = hours;
+ ii.UnitCountBudget = hoursBudget;
+ ii.AmountTotal = Math.Round(hr * hours, 2, MidpointRounding.AwayFromZero);
+ ii.GrossAmountTotal = ii.AmountTotal;
+
+ iiList.Add(ii);
+ }
+
+ return iiList.OrderBy(ii => ii.ItemPeriodStart).ToList();
+ }
}
}