diff --git a/ReportImp/AutismusKoelnBonn/AutismusKoelnBonn.csproj b/ReportImp/AutismusKoelnBonn/AutismusKoelnBonn.csproj index 5db34c1d1..381f97bbd 100644 --- a/ReportImp/AutismusKoelnBonn/AutismusKoelnBonn.csproj +++ b/ReportImp/AutismusKoelnBonn/AutismusKoelnBonn.csproj @@ -56,6 +56,7 @@ + diff --git a/ReportImp/AutismusKoelnBonn/Invoicing/CustomInvoiceFactory.cs b/ReportImp/AutismusKoelnBonn/Invoicing/CustomInvoiceFactory.cs index 5fe8971e7..7b0499d80 100644 --- a/ReportImp/AutismusKoelnBonn/Invoicing/CustomInvoiceFactory.cs +++ b/ReportImp/AutismusKoelnBonn/Invoicing/CustomInvoiceFactory.cs @@ -37,5 +37,9 @@ namespace AutismusKoelnBonn.Invoicing return new InvoiceCreation(); } - } + public override SettlementInvoiceCreation CreateSettlementInvoiceCreator(string costbearerId, string tenant, CostBearer2SupportConcept lCb2Sc) + { + return new CustomSettlementInvoiceCreation(); + } + } } diff --git a/ReportImp/AutismusKoelnBonn/Invoicing/CustomSettlementInvoiceCreation.cs b/ReportImp/AutismusKoelnBonn/Invoicing/CustomSettlementInvoiceCreation.cs new file mode 100644 index 000000000..dfbd470a5 --- /dev/null +++ b/ReportImp/AutismusKoelnBonn/Invoicing/CustomSettlementInvoiceCreation.cs @@ -0,0 +1,52 @@ +using BeWo.Service.Invoicing; +using BS.Shared.DataContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AutismusKoelnBonn.Invoicing +{ + public class CustomSettlementInvoiceCreation : SettlementInvoiceCreation + { + // Änderung: Rundung von AmountTotal + public override void CalculateInvoiceItemAmounts(Settlement2DC si) + { + decimal maxApprovedFls = si.ApprovedFLS ?? 0; + + foreach (var ii in si.InvoiceItems) + { + if (ii.UnitCount.HasValue) + { + var unitCountBudget = Math.Round(ii.UnitCountBudget ?? ii.UnitCount ?? 0, 2, MidpointRounding.AwayFromZero); + if (maxApprovedFls < unitCountBudget) + unitCountBudget = maxApprovedFls; + + maxApprovedFls -= unitCountBudget; + + if (unitCountBudget < ii.UnitCount) + { + ii.UnitCount = unitCountBudget; + } + if (ii.AmountPerUnit.HasValue) + { + // ÄNDERUNG NACHFOLGENDE ZEILE + ii.AmountTotal = Math.Round(ii.UnitCount.Value, 2, MidpointRounding.AwayFromZero) * ii.AmountPerUnit.Value; + if (ii.RateFactor.HasValue && ii.RateFactor.Value != 0) + ii.GrossAmountTotal = Math.Round(ii.AmountTotal.Value * ((100m + ii.RateFactor.Value) / 100m), 2, + MidpointRounding.AwayFromZero); + else + ii.GrossAmountTotal = ii.AmountTotal; + + } + if (ii.MaxApprovedUnitCount < ii.UnitCount) + { + ii.MaxApprovedUnitCount = ii.UnitCount; + } + } + } + + } + } +}