MH: LWLSettlementInvoiceCreation Basis Abschneiden von zu vielen Stunden ermöglicht

This commit is contained in:
2024-08-08 14:02:10 +02:00
parent 8e595ea996
commit 645dccbcd0

View File

@@ -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<long, bool> groupBookingDict = new Dictionary<long, bool>();
//decimal flmCleared = 0;
//decimal approvedMinutes = ((si.ApprovedFLS ?? 0) * 60) / rf;
records = records.OrderBy<ServiceRecord, DateTime>(sr => sr.Start.HasValue ? sr.Start.Value : DateTime.MinValue).ToList<ServiceRecord>();
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;