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(); + } + } +}