diff --git a/ReportImp/ahaEV/CustomVacationService.cs b/ReportImp/ahaEV/CustomVacationService.cs index 34d62e2d4..ce11a77fa 100644 --- a/ReportImp/ahaEV/CustomVacationService.cs +++ b/ReportImp/ahaEV/CustomVacationService.cs @@ -31,6 +31,37 @@ namespace ahaEV } return 0; } + public override decimal CalcCorrectNumberOfLeaveDaysForSpecialContractSituation(DateTime entryDate, DateTime? endDate, int anzahlArbeitstage, int restlicheTageImJahr, decimal? urlaubstageProJahr) + { + decimal urlaubstage = 0; + if (urlaubstageProJahr == null) + urlaubstageProJahr = 0m; + + if (entryDate.Day == 1 && entryDate.Month == 1 || entryDate.Day == 2 && entryDate.Month == 1) //Erster Tag im Jahr + { + //Prüfen, ob Enddatum Ende des Jahres oder früher ist + if (endDate == null || (endDate.HasValue && endDate.Value.Day == 31 && endDate.Value.Month == 12)) + urlaubstage = (decimal)urlaubstageProJahr; + else + urlaubstage = (decimal)urlaubstageProJahr / 365m * restlicheTageImJahr; + } + else + { + urlaubstage = (decimal)urlaubstageProJahr / 365m * restlicheTageImJahr; + } + + // Runden + + // Vor 2025 das hier + if (entryDate.Year <= 2024 || endDate.HasValue && endDate.Value.Year <= 2024) + urlaubstage = UrlaubstageRunden(urlaubstage); + // Ab 2025 das hier + else + urlaubstage = base.UrlaubstageRunden(urlaubstage); + + + return urlaubstage; + } public override decimal UrlaubstageRunden(decimal urlaubstage) {