diff --git a/ReportImp/Wabe/Invoicing/CollectiveInvoiceCreation.cs b/ReportImp/Wabe/Invoicing/CollectiveInvoiceCreation.cs index ec596e2c2..df8c230ec 100644 --- a/ReportImp/Wabe/Invoicing/CollectiveInvoiceCreation.cs +++ b/ReportImp/Wabe/Invoicing/CollectiveInvoiceCreation.cs @@ -101,13 +101,30 @@ namespace Wabe.Invoicing DateTime start; DateTime ende; if (scap.StartDate <= serviceInvoicePeriod.Start) + { start = serviceInvoicePeriod.Start.Value; + } else + { start = (DateTime)scap.StartDate; //Einzugstag wird mit abgerechnet - if (scap.EndDate >= serviceInvoicePeriod.End) - ende = serviceInvoicePeriod.End.Value; + } + if (cb2sc.SupportConcept.Customer.TerminationDate.HasValue && + cb2sc.SupportConcept.Customer.TerminationDate.Value <= scap.EndDate.Value + && cb2sc.SupportConcept.Customer.TerminationDate >= scap.StartDate.Value) + { + ende = cb2sc.SupportConcept.Customer.TerminationDate.Value.AddDays(-1); // finaler Auszugstag wird NICHT abgerechnet + } else - ende = (DateTime)scap.EndDate.Value.AddDays(-1); //Auszugstag wird NICHT abgerechnet + { + if (scap.EndDate >= serviceInvoicePeriod.End) + { + ende = serviceInvoicePeriod.End.Value; + } + else + { + ende = (DateTime)scap.EndDate.Value; + } + } decimal tagessatz = 0; var crList = scap.ServiceCategory.CostRatePeriods;