From 645dccbcd0600e5d9b9802be93efc8dcf2c7a8aa Mon Sep 17 00:00:00 2001 From: Marcel Hirschle Date: Thu, 8 Aug 2024 14:02:10 +0200 Subject: [PATCH] =?UTF-8?q?MH:=20LWLSettlementInvoiceCreation=20Basis=20Ab?= =?UTF-8?q?schneiden=20von=20zu=20vielen=20Stunden=20erm=C3=B6glicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Invoicing/LWLSettlementInvoiceCreation.cs | 57 +++++++++++++------ 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/Service/Invoicing/LWLSettlementInvoiceCreation.cs b/Service/Invoicing/LWLSettlementInvoiceCreation.cs index c63a16624..a5acdba28 100644 --- a/Service/Invoicing/LWLSettlementInvoiceCreation.cs +++ b/Service/Invoicing/LWLSettlementInvoiceCreation.cs @@ -17,7 +17,9 @@ namespace BeWo.Service.Invoicing [IDSpecificClass(Identifier = "LWLNEU")] public class LWLSettlementInvoiceCreation : SettlementInvoiceCreation { - public override bool CanCreateInvoiceTheOldWay(Settlement2DC si, CostBearer2SupportConcept c2s) + public virtual bool SchneideBeiErreichenDesBudgetsAb { get { return false; } } + + public override bool CanCreateInvoiceTheOldWay(Settlement2DC si, CostBearer2SupportConcept c2s) { return true; } @@ -98,9 +100,10 @@ namespace BeWo.Service.Invoicing Dictionary groupBookingDict = new Dictionary(); //decimal flmCleared = 0; - //decimal approvedMinutes = ((si.ApprovedFLS ?? 0) * 60) / rf; + records = records.OrderBy(sr => sr.Start.HasValue ? sr.Start.Value : DateTime.MinValue).ToList(); - + decimal maxApprovedMinutes = ((si.ApprovedFLS ?? 0) * 60) / rf; + decimal totalMinutes = 0; foreach (var iRecord in records) { if (iRecord.ServiceDescription.ServiceCategory.IsBillable) @@ -156,6 +159,24 @@ namespace BeWo.Service.Invoicing if (ap != null) { + //Christian wars:-) + if (SchneideBeiErreichenDesBudgetsAb) + { + + if (totalMinutes + dauerBudget > maxApprovedMinutes) + { + dauerBudget = maxApprovedMinutes - totalMinutes; + if (dauerBudget < 0) + { + dauerBudget = 0; + } + if (dauerAbrechenbar > dauerBudget) + { + dauerAbrechenbar = dauerBudget; + } + } + } + totalMinutes += dauerBudget; ap.RecordedMinutes += dauerAbrechenbar; ap.BudgetMinutes += dauerBudget; } @@ -294,21 +315,21 @@ namespace BeWo.Service.Invoicing hoursBudget *= (100 + rf) / 100; hoursBudget = Math.Round(hoursBudget, 2, MidpointRounding.AwayFromZero); - if (schneideBeiMaxAb) - { - if (totalHours + hoursBudget > maxApprovedFls) - { - hoursBudget = maxApprovedFls - totalHours; - if (hoursBudget < 0) - { - hoursBudget = 0; - } - if (hours > hoursBudget) - { - hours = hoursBudget; - } - } - } + //if (schneideBeiMaxAb) + //{ + // if (totalHours + hoursBudget > maxApprovedFls) + // { + // hoursBudget = maxApprovedFls - totalHours; + // if (hoursBudget < 0) + // { + // hoursBudget = 0; + // } + // if (hours > hoursBudget) + // { + // hours = hoursBudget; + // } + // } + //} totalHours += hoursBudget; ii.UnitCount = hours;