MH: Frommen Feiertage + Urlaubskontorundung
This commit is contained in:
@@ -4,12 +4,27 @@ using BeWo.Data.Entities;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BeWo.Service.Configuration;
|
||||
using BS.Shared.Core;
|
||||
|
||||
using BS.Shared.DataContracts;
|
||||
|
||||
namespace ChristinaFrommen
|
||||
{
|
||||
public class CustomMitarbeiterStundenkontoBerechnung : MitarbeiterstundenkontoBerechnung
|
||||
{
|
||||
public override List<DateTime> GetFeiertage(int year)
|
||||
{
|
||||
var feiertage = base.GetFeiertage(year);
|
||||
|
||||
feiertage.Add(new DateTime(year, 12, 31));
|
||||
|
||||
return feiertage;
|
||||
}
|
||||
public override decimal GetFeiertagsFaktor(DateTime start)
|
||||
{
|
||||
if (start.Month == 12 && (start.Day == 24 || start.Day == 31))
|
||||
return 0.5m;
|
||||
else
|
||||
return base.GetFeiertagsFaktor(start);
|
||||
}
|
||||
public override bool ShouldCreateDayDetails()
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared.DataContracts;
|
||||
@@ -11,11 +12,35 @@ namespace ChristinaFrommen.Service
|
||||
{
|
||||
var feiertage = base.GetFeiertage(year, bundesland);
|
||||
|
||||
var weihnachten = feiertage.FirstOrDefault(f => f.Name == "Heilig Abend");
|
||||
if (weihnachten != null)
|
||||
feiertage.Remove(weihnachten);
|
||||
feiertage.Add(new FeiertagDC() { Datum = new System.DateTime(year, 12, 31), Name = "Silvester" });
|
||||
|
||||
return feiertage;
|
||||
}
|
||||
public override decimal GetFeiertagsFaktor(DateTime start)
|
||||
{
|
||||
if (start.Month == 12 && (start.Day == 24 || start.Day == 31))
|
||||
return 0.5m;
|
||||
else
|
||||
return base.GetFeiertagsFaktor(start);
|
||||
}
|
||||
|
||||
public override decimal UrlaubstageRunden(decimal urlaubstage)
|
||||
{
|
||||
if (urlaubstage - (int)urlaubstage < 0.25m)
|
||||
{
|
||||
urlaubstage = Math.Round(urlaubstage, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
else if (urlaubstage - (int)urlaubstage >= 0.25m && urlaubstage - (int)urlaubstage < 0.75m)
|
||||
{
|
||||
decimal digits = urlaubstage - (int)urlaubstage;
|
||||
urlaubstage = urlaubstage - digits + 0.5m;
|
||||
}
|
||||
else if (urlaubstage - (int)urlaubstage >= 0.75m)
|
||||
{
|
||||
urlaubstage = Math.Ceiling(urlaubstage);
|
||||
}
|
||||
|
||||
return urlaubstage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user