From 0abc8d6ac10f9dc55c790a2538fad0f4eafb2ce2 Mon Sep 17 00:00:00 2001 From: Marcel Hirschle Date: Wed, 13 Sep 2023 09:39:10 +0200 Subject: [PATCH] MH: ASB Poolabrechnung --- .../AsbRheinErftDuerenSBD.csproj | 2 +- .../Invoicing/CustomInvoiceFactory.cs | 2 +- ...oiceCreation.cs => PoolInvoiceCreation.cs} | 36 ++++++++++++++----- 3 files changed, 30 insertions(+), 10 deletions(-) rename ReportImp/AsbRheinErftDuerenSBD/Invoicing/{ChristophorusPoolInvoiceCreation.cs => PoolInvoiceCreation.cs} (86%) diff --git a/ReportImp/AsbRheinErftDuerenSBD/AsbRheinErftDuerenSBD.csproj b/ReportImp/AsbRheinErftDuerenSBD/AsbRheinErftDuerenSBD.csproj index 7c07a5d91..b2aab6888 100644 --- a/ReportImp/AsbRheinErftDuerenSBD/AsbRheinErftDuerenSBD.csproj +++ b/ReportImp/AsbRheinErftDuerenSBD/AsbRheinErftDuerenSBD.csproj @@ -74,7 +74,7 @@ - + Component diff --git a/ReportImp/AsbRheinErftDuerenSBD/Invoicing/CustomInvoiceFactory.cs b/ReportImp/AsbRheinErftDuerenSBD/Invoicing/CustomInvoiceFactory.cs index 48e3286c0..54a5ccdc3 100644 --- a/ReportImp/AsbRheinErftDuerenSBD/Invoicing/CustomInvoiceFactory.cs +++ b/ReportImp/AsbRheinErftDuerenSBD/Invoicing/CustomInvoiceFactory.cs @@ -24,7 +24,7 @@ namespace AsbRheinErftDuerenSBD.Invoicing return new CustomInvoiceCreationAldenhoven(); } else if (sc.CostBearer.Contains("Sozialamt Düren Pools")) - return new ChristophorusPoolInvoiceCreation(); + return new PoolInvoiceCreation(); //else if (sc.CostBearer.Contains("Sozialamt Kreis Düren")) //{ // return new CustomInvoiceCreationAldenhoven(); diff --git a/ReportImp/AsbRheinErftDuerenSBD/Invoicing/ChristophorusPoolInvoiceCreation.cs b/ReportImp/AsbRheinErftDuerenSBD/Invoicing/PoolInvoiceCreation.cs similarity index 86% rename from ReportImp/AsbRheinErftDuerenSBD/Invoicing/ChristophorusPoolInvoiceCreation.cs rename to ReportImp/AsbRheinErftDuerenSBD/Invoicing/PoolInvoiceCreation.cs index 78d87c47b..352af478e 100644 --- a/ReportImp/AsbRheinErftDuerenSBD/Invoicing/ChristophorusPoolInvoiceCreation.cs +++ b/ReportImp/AsbRheinErftDuerenSBD/Invoicing/PoolInvoiceCreation.cs @@ -10,7 +10,7 @@ using System.Linq; namespace AsbRheinErftDuerenSBD.Invoicing { - public class ChristophorusPoolInvoiceCreation : InvoiceCreation + public class PoolInvoiceCreation : InvoiceCreation { public override void SetInvoiceId(ServiceInvoice invoice) { @@ -42,11 +42,11 @@ namespace AsbRheinErftDuerenSBD.Invoicing if (team == null) return; - var anzFK = 0; + decimal anzFK = 0; var preiseFK = DAOFactory.GenericDAO.GetAllActive().FirstOrDefault(sc => sc.Name == "Pool - Fachkraft (FK)").CostRatePeriods.ToList(); - var anzHK = 0; + decimal anzHK = 0; var preiseHK = DAOFactory.GenericDAO.GetAllActive().FirstOrDefault(sc => sc.Name == "Pool-Nichtfachkraft (HK)").CostRatePeriods.ToList(); - var anzHKTeilzeit = 0; + decimal anzHKTeilzeit = 0; var preiseHKTeilzeit = DAOFactory.GenericDAO.GetAllActive().FirstOrDefault(sc => sc.Name == "Pool-Nichtfachkraft(HK)").CostRatePeriods.ToList(); var employee = MapperFactory.EmployeeDC_Employee.MapToNewDCs(DAOFactory.GenericDAO.GetActiveByIDs(team.Member.Select(m => m.EmployeeOid).ToList())); @@ -55,16 +55,26 @@ namespace AsbRheinErftDuerenSBD.Invoicing foreach (var e in employee) { - if (allServiceRecords.Any(s => s.EmployeeOid == e.EmployeeOid && s.ServiceDescription.ServiceCategory.Name.ToLower().Contains("poolpauschale"))) + var sr = allServiceRecords.FirstOrDefault(s => s.EmployeeOid == e.EmployeeOid && s.ServiceDescription.ServiceCategory.Name.ToLower().Contains("poolpauschale")); + if (sr != null) { serviceInvoicePeriod.Notice += e.FirstName + " " + e.LastName + ", "; + // Wenn Mitarbeiter erst Mitte oder 3/4 des Monats angefangen hat, wird der Anteil um 50 bzw 75% verringert if (e.LastName.Contains("Bugla") && e.FirstName.Contains("Frank")) // Hier Ausnahme, also Teilzeit-MA, einfügen - anzHKTeilzeit++; + { + anzHKTeilzeit += VerringerungUeberpruefen(sr); + } else if (e.IsQualified.HasValue && e.IsQualified.Value) - anzFK++; + { + anzFK += VerringerungUeberpruefen(sr); + + } else if (!e.IsQualified.HasValue || e.IsQualified.HasValue && !e.IsQualified.Value) - anzHK++; + { + anzHK += VerringerungUeberpruefen(sr); + + } } } if (!serviceInvoicePeriod.Notice.IsNullOrEmpty()) @@ -126,6 +136,16 @@ namespace AsbRheinErftDuerenSBD.Invoicing } } + private decimal VerringerungUeberpruefen(ServiceRecord sr) + { + if (sr.ServiceDescription.Name.Contains("50%")) + return 0.5m; + else if (sr.ServiceDescription.Name.Contains("25%")) + return 0.25m; + else + return 1m; + } + private static decimal GetPreis(DateTime datum, List preise) { var preis = 0.0m;