From d1f93bb2d26330fe673171459bbf29328f661fe7 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Wed, 17 Dec 2025 11:05:52 +0100 Subject: [PATCH] EndartFabrik/Invoicing/CustomInvoiceCreation - Bezeichung Leistung u Faktor auch auf Verwaltungspreisen --- ReportImp/EndartFabrik/EndartFabrik.csproj | 2 + .../Invoicing/CustomInvoiceCreation.cs | 39 +++++++++++++++++++ .../Invoicing/CustomInvoiceFactory.cs | 17 ++++++++ 3 files changed, 58 insertions(+) create mode 100644 ReportImp/EndartFabrik/Invoicing/CustomInvoiceCreation.cs create mode 100644 ReportImp/EndartFabrik/Invoicing/CustomInvoiceFactory.cs diff --git a/ReportImp/EndartFabrik/EndartFabrik.csproj b/ReportImp/EndartFabrik/EndartFabrik.csproj index e6cbb8b20..33319ae7b 100644 --- a/ReportImp/EndartFabrik/EndartFabrik.csproj +++ b/ReportImp/EndartFabrik/EndartFabrik.csproj @@ -63,6 +63,8 @@ InvoiceCustomerReport.cs + + diff --git a/ReportImp/EndartFabrik/Invoicing/CustomInvoiceCreation.cs b/ReportImp/EndartFabrik/Invoicing/CustomInvoiceCreation.cs new file mode 100644 index 000000000..104b4e4de --- /dev/null +++ b/ReportImp/EndartFabrik/Invoicing/CustomInvoiceCreation.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Service.DCEntityMapper; +using BeWo.Service.Invoicing; +using BeWo.Service.Plugins; +using BS.Shared; +using BS.Shared.Core; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; +using BS.Shared.Extensions; +using BS.Shared.Services; + +namespace EndartFabrik.Invoicing +{ + public class CustomInvoiceCreation : InvoiceCreation + { + public override InvoiceItem CreateInvoiceItem(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, BS.Shared.Services.Calculations calc) + { + var ii = base.CreateInvoiceItem(iServiceRecord, scap, calc); + ii.ItemDescription = "Fachleistung"; + + if (!ii.RateFactor.HasValue) + { + var rateFactor = iServiceRecord.CostBearer.CostRatePeriods.GetCostRatePeriodForDate(CostRatePeriodType.RateFactor, iServiceRecord.Start.Value); + if (rateFactor != null && rateFactor.CostRateValue.HasValue + && !(iServiceRecord.ServiceDescription.Name.ToLower().Contains("fehlkontakt") || (iServiceRecord.ServiceDescription.ProzentAbrechnung.HasValue && iServiceRecord.ServiceDescription.ProzentAbrechnung.Value < 100))) + { + ii.RateFactor = rateFactor.CostRateValue; + //ii.UnitCount = ii.UnitCount.Value * ((100 + ii.RateFactor.Value) / 100); + //ii.GrossAmountTotal = ii.UnitCount * (ii.AmountPerUnit ?? 0); + } + } + return ii; + } + } +} diff --git a/ReportImp/EndartFabrik/Invoicing/CustomInvoiceFactory.cs b/ReportImp/EndartFabrik/Invoicing/CustomInvoiceFactory.cs new file mode 100644 index 000000000..a643c0821 --- /dev/null +++ b/ReportImp/EndartFabrik/Invoicing/CustomInvoiceFactory.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using BeWo.Data.Entities; +using BeWo.Service.Invoicing; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; + +namespace EndartFabrik.Invoicing +{ + public class CustomInvoiceFactory : InvoiceFactory + { + public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary> supportConcepts2ServiceRecords) + { + return new CustomInvoiceCreation(); + } + } +}