From 91b248d6763ca1f8e48756c754c6948dec7db0fe Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 28 Jul 2026 16:22:09 +0200 Subject: [PATCH] SKFAlsdorf/Invoicing/SettlementInvoiceCreation.cs - Avise auch ohne Rechnungspositionen SupportOID=169088 --- .../Invoicing/SettlementInvoiceCreation.cs | 44 +++++++++++++++++++ ReportImp/SKFAlsdorf/SKFAlsdorf.csproj | 1 + 2 files changed, 45 insertions(+) create mode 100644 ReportImp/SKFAlsdorf/Invoicing/SettlementInvoiceCreation.cs diff --git a/ReportImp/SKFAlsdorf/Invoicing/SettlementInvoiceCreation.cs b/ReportImp/SKFAlsdorf/Invoicing/SettlementInvoiceCreation.cs new file mode 100644 index 000000000..598bfc418 --- /dev/null +++ b/ReportImp/SKFAlsdorf/Invoicing/SettlementInvoiceCreation.cs @@ -0,0 +1,44 @@ +using BeWo.Data.Entities; +using BeWo.Service.Invoicing; +using BS.Shared.DataContracts; +using BS.Shared.Services; +using System; +using System.Collections.Generic; +using System.Linq; +using BS.Shared.Extensions; + + +namespace BeWo.SKFAlsdorf.Invoicing +{ + public class CustomSettlementInvoiceCreation : SettlementInvoiceCreation + { + public override void CalculateAdvancedPayments(Settlement2DC settlementInvoice, CostBearer2SupportConcept cb2sc) + { + // die haben eine Spitzabrechnung nach 2 Jahren ohne eine Buchung, wollen aber die Avise ausweisen, daher if invoiceItems != null entfernt + decimal amountTotal = 0; + var bookingList = cb2sc.AccountingTransactions; + + foreach (var item in bookingList) + { + if (item.GueltigkeitsDatum.HasValue) + { + foreach (var ii in settlementInvoice.InvoiceItems) + { + if (ii.ItemPeriodStart.HasValue && ii.ItemPeriodEnd.HasValue) + { + if (item.GueltigkeitsDatum.Value.InBetween(ii.ItemPeriodStart.Value, ii.ItemPeriodEnd.Value, true)) + { + ii.ReceivedAmount += item.Amount; + + break; + } + } + } + } + amountTotal += item.Amount; + } + + settlementInvoice.AmountAdvancedPayments = amountTotal; + } + } +} diff --git a/ReportImp/SKFAlsdorf/SKFAlsdorf.csproj b/ReportImp/SKFAlsdorf/SKFAlsdorf.csproj index eaec66280..6e47864cc 100644 --- a/ReportImp/SKFAlsdorf/SKFAlsdorf.csproj +++ b/ReportImp/SKFAlsdorf/SKFAlsdorf.csproj @@ -64,6 +64,7 @@ + Component