SKFAlsdorf/Invoicing/SettlementInvoiceCreation.cs - Avise auch ohne Rechnungspositionen

SupportOID=169088
This commit is contained in:
2026-07-28 16:22:09 +02:00
parent a25e69eba2
commit 91b248d676
2 changed files with 45 additions and 0 deletions

View File

@@ -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;
}
}
}

View File

@@ -64,6 +64,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CustomMitarbeiterstundenkontoBerechnung.cs" />
<Compile Include="Invoicing\SettlementInvoiceCreation.cs" />
<Compile Include="Mitarbeiterstundenkonto.cs">
<SubType>Component</SubType>
</Compile>