From 673636fdade1f9c106174e5148e9a87aa2dbfbbd Mon Sep 17 00:00:00 2001 From: Alexandra Date: Thu, 6 Mar 2025 08:05:10 +0100 Subject: [PATCH] PerspektivenEV/Invoicing/diverse Bugs aus Finanzauswertung gefixt (leere HPs etc) --- .../Invoicing/CollectiveInvoiceCreationBthg.cs | 9 ++++++--- .../Invoicing/CustomInvoiceCreation.cs | 10 +++++----- .../Invoicing/CustomInvoiceFactory.cs | 15 +++++++++++---- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreationBthg.cs b/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreationBthg.cs index 744930711..0bc29b42b 100644 --- a/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreationBthg.cs +++ b/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreationBthg.cs @@ -148,7 +148,7 @@ namespace PerspektivenEV.Invoicing decimal LG = 1; var cat = supportConceptApprovalPeriod.ServiceCategory; - if (cat != null) + if (cat != null && cat.Abbreviation != null && cat.Abbreviation.Length > 4) { var ii = new InvoiceItem { @@ -195,7 +195,7 @@ namespace PerspektivenEV.Invoicing } } // Gesondert Vorgehaltene Flächen - Extrabetrag aus Leistungskategorie pro Kalendertag - else if (cat.Abbreviation.Substring(cat.Abbreviation.Length - 3) == "GVF") + else if (cat.Abbreviation != null && cat.Abbreviation.Length > 3 && cat.Abbreviation.Substring(cat.Abbreviation.Length - 3) == "GVF") { ii.Notice = "1"; ii.AmountPerUnit = data[0].AmountTotal; @@ -304,7 +304,10 @@ namespace PerspektivenEV.Invoicing ii.GrossAmountTotal = ii.AmountTotal; serviceInvoicePeriod.InvoiceItemList.Add(ii); - var test = supportConceptApprovalPeriod.StartDate.Value.AddMonths(13); + if (supportConceptApprovalPeriod.StartDate.HasValue) + { + var test = supportConceptApprovalPeriod.StartDate.Value.AddMonths(13); + } // ToDo!!! alle 12 Monate und letzter Monat wird bei Kompensatorischer Assistenz spitzabgerechnet!!! if (cat.Abbreviation.Substring(cat.Abbreviation.Length - 2) == "KA" && (supportConceptApprovalPeriod.EndDate.Value <= accountingPeriodEnd.Value.AddMonths(1) diff --git a/ReportImp/PerspektivenEV/Invoicing/CustomInvoiceCreation.cs b/ReportImp/PerspektivenEV/Invoicing/CustomInvoiceCreation.cs index 9002cd54f..1b0fe2264 100644 --- a/ReportImp/PerspektivenEV/Invoicing/CustomInvoiceCreation.cs +++ b/ReportImp/PerspektivenEV/Invoicing/CustomInvoiceCreation.cs @@ -107,7 +107,7 @@ namespace PerspektivenEV.Invoicing public override void SetServiceInvoicePeriods(ServiceInvoice invoice, CostBearer2SupportConcept costBearer2SupportConcept, DateTimeSpan invoicePeriod, List serviceRecords) { - if (serviceRecords.Any(s => s.ServiceDescription.Category.Abbreviation.Contains("TS") && s.ServiceDescription.Category.Abbreviation.Contains("ANW"))) + if (serviceRecords.Any(s => s.ServiceDescription.Category.Abbreviation != null && s.ServiceDescription.Category.Abbreviation.Contains("TS") && s.ServiceDescription.Category.Abbreviation.Contains("ANW"))) { //var serviceRecordsTS = serviceRecords.Where(s => s.ServiceDescription.Category.Abbreviation.Contains("TS") && s.ServiceDescription.Category.Abbreviation.Contains("ANW") && !s.ServiceDescription.Category.Abbreviation.Contains("TS")).ToList(); serviceRecords = serviceRecords.Where(s => s.ServiceDescription.Category.Abbreviation.Contains("TS") && s.ServiceDescription.Category.Abbreviation.Contains("ANW") || !s.ServiceDescription.Category.Abbreviation.Contains("TS")).ToList(); @@ -176,7 +176,7 @@ namespace PerspektivenEV.Invoicing public override bool ShouldCreateFixedAmounts(ServiceInvoicePeriod serviceInvoicePeriod, SupportConceptApprovalPeriodDC supportConceptApprovalPeriod, CostBearer2SupportConcept cb2sc) { - if (cb2sc.CostBearer.Organisation.Name.Contains("SELBSTZAHLER") && supportConceptApprovalPeriod.ServiceCategory.Abbreviation.Contains("TS")) + if (cb2sc.CostBearer.Organisation.Name.Contains("SELBSTZAHLER") && supportConceptApprovalPeriod.ServiceCategory.Abbreviation != null && supportConceptApprovalPeriod.ServiceCategory.Abbreviation.Contains("TS")) { return false; } @@ -193,7 +193,7 @@ namespace PerspektivenEV.Invoicing var cat = supportConceptApprovalPeriod.ServiceCategory; if (cb2sc.CostBearer.Organisation.Function != null && cb2sc.CostBearer.Organisation.Function.Value.Contains("BTHG") && cb2sc.CostBearer.Organisation.Name == "SELBSTZAHLER") { - if (cat.Abbreviation.Substring(cat.Abbreviation.Length - 3) == "GVF") + if (cat.Abbreviation != null && cat.Abbreviation.Length > 2 && cat.Abbreviation.Substring(cat.Abbreviation.Length - 3) == "GVF") { DateTime start = accountingPeriodStart.Value; DateTime end = accountingPeriodEnd.Value; @@ -269,7 +269,7 @@ namespace PerspektivenEV.Invoicing public override IList CreateInvoiceItems(List serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc) { IList list = new List(); - if (serviceRecordsInPeriod.Any(s => s.ServiceDescription.Category.Abbreviation.StartsWith("TS") && s.ServiceDescription.Category.Abbreviation.Contains("ANW"))) + if (serviceRecordsInPeriod.Any(s => s.ServiceDescription.Category.Abbreviation != null && s.ServiceDescription.Category.Abbreviation.StartsWith("TS") && s.ServiceDescription.Category.Abbreviation.Contains("ANW"))) { var tsitem = CreateInvoiceItemsTagesstaette(serviceRecordsInPeriod, invoicePeriod, scap, calc); if (tsitem != null) @@ -321,7 +321,7 @@ namespace PerspektivenEV.Invoicing var data = calc.GetFixedBillingData(scapDC, invoicePeriod.StartDate, invoicePeriod.EndDate); var cat = scap.ServiceCategory; - if (cat.Abbreviation.Substring(cat.Abbreviation.Length - 3) == "GVF") + if (cat.Abbreviation != null && cat.Abbreviation.Substring(cat.Abbreviation.Length - 3) == "GVF") { DateTime start = accountingPeriodStart.Value; DateTime end = accountingPeriodEnd.Value; diff --git a/ReportImp/PerspektivenEV/Invoicing/CustomInvoiceFactory.cs b/ReportImp/PerspektivenEV/Invoicing/CustomInvoiceFactory.cs index dbf667461..dcd58585a 100644 --- a/ReportImp/PerspektivenEV/Invoicing/CustomInvoiceFactory.cs +++ b/ReportImp/PerspektivenEV/Invoicing/CustomInvoiceFactory.cs @@ -19,7 +19,7 @@ namespace PerspektivenEV.Invoicing { if (sr.CostBearer != null) { - if ((!sr.CostBearer.Function.IsNullOrEmpty() && sr.CostBearer.Function.ToLower().Contains("pfk"))) + if (!sr.CostBearer.Function.IsNullOrEmpty() && sr.CostBearer.Function.ToLower().Contains("pfk")) { if (sr.Start < new DateTime(2025, 01, 01)) { @@ -53,14 +53,21 @@ namespace PerspektivenEV.Invoicing { foreach (var item in supportConcepts2ServiceRecords.Keys) { - if (item.CostBearerList[0].OrganisationName.Contains("SELBSTZAHLER") || item.CostBearerList[0].OrganisationName.Contains("EIGENANTEIL") || item.CostBearerList[0].Organisation.Function.ToLower().Contains("pfk")) + if (item != null && item.CostBearerList != null && item.CostBearerList.Count > 0) { - return new CustomInvoiceCreation(); + if (item.CostBearerList[0].OrganisationName.Contains("SELBSTZAHLER") || item.CostBearerList[0].OrganisationName.Contains("EIGENANTEIL")) + { + return new CustomInvoiceCreation(); + } + if (item.CostBearerList[0].Organisation.Function.ToLower().Contains("pfk")) + { + return new CustomPfkInvoiceCreation(); + } } } } } - return new CollectiveInvoiceCreationBthg(); // zur Zeit für alle Fälle mit Fahrkosten, Anfahrten oder Handgeld etabliert + return new CollectiveInvoiceCreationBthg(); } } }