From bad64fd5b538ca1688eb102f50d648476073b178 Mon Sep 17 00:00:00 2001 From: Kojo Date: Mon, 12 Jan 2026 17:44:20 +0100 Subject: [PATCH] Humanitas: Heiligabend und Silvester (ab 2025) als volle Arbeitstage behandeln (in Mitarbeiterstundenkonto + Urlaubskonto) --- ...CustomMitarbeiterstundenkontoBerechnung.cs | 34 ++------------- ReportImp/Humanitas/Humanitas.csproj | 1 + .../Service/CustomVacationService.cs | 42 +++++++++++++++++++ 3 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 ReportImp/Humanitas/Service/CustomVacationService.cs diff --git a/ReportImp/Humanitas/CustomMitarbeiterstundenkontoBerechnung.cs b/ReportImp/Humanitas/CustomMitarbeiterstundenkontoBerechnung.cs index 33ec8ef76..80c3ea1d9 100644 --- a/ReportImp/Humanitas/CustomMitarbeiterstundenkontoBerechnung.cs +++ b/ReportImp/Humanitas/CustomMitarbeiterstundenkontoBerechnung.cs @@ -1,44 +1,18 @@ using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; using BeWo.Report.ReportObjects; - namespace Humanitas { public class CustomMitarbeiterstundenkontoBerechnung : MitarbeiterstundenkontoBerechnung { public override decimal GetFeiertagsFaktor(DateTime start) { - var list = GetFeiertage(start.Year); - var osterSonntag = GetOsterSonntag(start.Year); - if (start.Date == osterSonntag.AddDays(-52)) - { + // Weiberfastnacht und Rosenmontag halbe Arbeitstage + var osterSonntag = GetOsterSonntag(start.Year); + if (start.Date == osterSonntag.AddDays(-52) || start.Date == osterSonntag.AddDays(-48)) return 0.5m; - } - if (start.Date == osterSonntag.AddDays(-48)) - { - return 0.5m; - } - return base.GetFeiertagsFaktor(start); - } - public override List GetFeiertage(int year) - { - var list = base.GetFeiertage(year); - - if (year <= 2024) - { - list.Add(new DateTime(year, 12, 31)); - } - - var osterSonntag = GetOsterSonntag(year); - list.Add(osterSonntag.AddDays(-48)); // "Rosenmontag" - - list.Add(osterSonntag.AddDays(-52)); // "Weiberfastnacht" - - return list; + return base.GetFeiertagsFaktor(start); } } } diff --git a/ReportImp/Humanitas/Humanitas.csproj b/ReportImp/Humanitas/Humanitas.csproj index 21da1839d..d80aec8b3 100644 --- a/ReportImp/Humanitas/Humanitas.csproj +++ b/ReportImp/Humanitas/Humanitas.csproj @@ -90,6 +90,7 @@ ServicesOverviewReport.cs + Component diff --git a/ReportImp/Humanitas/Service/CustomVacationService.cs b/ReportImp/Humanitas/Service/CustomVacationService.cs new file mode 100644 index 000000000..cb4adae4d --- /dev/null +++ b/ReportImp/Humanitas/Service/CustomVacationService.cs @@ -0,0 +1,42 @@ +using BeWo.Service.Plugins; +using BS.Shared.DataContracts; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Humanitas.Service +{ + public class CustomVacationService : VacationService + { + public override List GetFeiertage(int year, string bundesland) + { + var feiertage = base.GetFeiertage(year, bundesland); + + if (year >= 2025) + { + var heiligabend = feiertage.FirstOrDefault(f => f.Name == "Heilig Abend"); + if (heiligabend != null) + feiertage.Remove(heiligabend); + } + + if (year <= 2024) + feiertage.Add(new FeiertagDC { Datum = new DateTime(year, 12, 31), Name = "Silvester" }); + + return feiertage; + } + + public override decimal GetFeiertagsFaktor(DateTime start) + { + if (start.Year > 2025) + { + DateTime osterSonntag = GetOsterSonntag(start.Year); + if (start.Date == osterSonntag.AddDays(-52).Date || start.Date == osterSonntag.AddDays(-48).Date) + { + return 0.5m; + } + } + + return base.GetFeiertagsFaktor(start); + } + } +}