From e90b59fe187a6750b93b68cb1c328babd8a5f3ec Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 21 Oct 2024 16:34:49 +0200 Subject: [PATCH] =?UTF-8?q?CaritasverbandKelheim/Service/CustomGroupDurati?= =?UTF-8?q?onCalculator=20-=20Rundung=20auch=20f=C3=BCr=20Gruppen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/CustomGroupDurationCalculator.cs | 42 +++++++++++++++++++ .../Service/CustomSaveInterceptor.cs | 6 +-- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 ReportImp/CaritasverbandKelheim/Service/CustomGroupDurationCalculator.cs diff --git a/ReportImp/CaritasverbandKelheim/Service/CustomGroupDurationCalculator.cs b/ReportImp/CaritasverbandKelheim/Service/CustomGroupDurationCalculator.cs new file mode 100644 index 000000000..0f84e20c8 --- /dev/null +++ b/ReportImp/CaritasverbandKelheim/Service/CustomGroupDurationCalculator.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Service.DCEntityMapper; +using BeWo.Service.Plugins; +using BS.Shared.Core; +using BS.Shared.DataContracts; +using BS.Shared.Services; + +namespace CaritasverbandKelheim.Calculation +{ + public class CustomGroupDurationCalculator : GroupDurationCalculator + { + public override GroupDurationDC CalculateGroupDuration(int personCount, int employeeCount, decimal totalDuration, + long[] costBearer2SupportConceptArray) + { + if (totalDuration <= 7) + { + totalDuration = 0; // Runde auf 0 Minuten, da kleiner als 8 + } + else + { + int rest = Convert.ToInt32(totalDuration) % 15; + + if (rest <= 7) + { + totalDuration = Convert.ToInt32(totalDuration) - rest; // Abgerundet auf das vorherige Vielfache von 15 + } + else + { + totalDuration = Convert.ToInt32(totalDuration) + (15 - rest); // Auf das nächste Vielfache von 15 aufrunden + } + } + return new GroupDurationDC() + { + SingleDuration = totalDuration /personCount, + TotalDuration = totalDuration + }; + } + } +} diff --git a/ReportImp/CaritasverbandKelheim/Service/CustomSaveInterceptor.cs b/ReportImp/CaritasverbandKelheim/Service/CustomSaveInterceptor.cs index bb5c0989a..d82eaafde 100644 --- a/ReportImp/CaritasverbandKelheim/Service/CustomSaveInterceptor.cs +++ b/ReportImp/CaritasverbandKelheim/Service/CustomSaveInterceptor.cs @@ -13,8 +13,8 @@ namespace CaritasverbandKelheim.Service public override void BeforeSaveServiceRecord(ServiceRecord sr) { // Vor 7 Minuten soll abgerundet, danach 15 aufgerundet werden, wenn bei KT 15 Min eingestellt ist und es Bezirk Niederbayern ist - if (sr.CostBearer2SupportConcept != null && sr.CostBearer2SupportConcept.CostBearer.Organisation.Name.ToLower().Contains("bezirk niederbayern") && sr.Start.HasValue && sr.End.HasValue) - { + //if (sr.CostBearer2SupportConcept != null && sr.CostBearer2SupportConcept.CostBearer.Organisation.Name.ToLower().Contains("bezirk niederbayern") && sr.Start.HasValue && sr.End.HasValue) + //{ if (sr.DurationMinutes <= 7) { sr.RoundedDuration = 0; // Runde auf 0 Minuten, da kleiner als 8 @@ -32,7 +32,7 @@ namespace CaritasverbandKelheim.Service sr.RoundedDuration = Convert.ToInt32(sr.DurationMinutes) + (15 - rest); // Auf das nächste Vielfache von 15 aufrunden } } - } + //} } } }