MH: RRP Urlaubskonto
This commit is contained in:
@@ -59,6 +59,7 @@
|
||||
<DependentUpon>Mitarbeiterauslastung.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Service\CustomVacationService.cs" />
|
||||
<Compile Include="Translation\TranslationDictionary.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
64
ReportImp/RomanRogerPuth/Service/CustomVacationService.cs
Normal file
64
ReportImp/RomanRogerPuth/Service/CustomVacationService.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using BeWo.Service.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RomanRogerPuth.Service
|
||||
{
|
||||
public class CustomVacationService : VacationService
|
||||
{
|
||||
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)
|
||||
urlaubstage = (decimal)urlaubstageProJahr;
|
||||
|
||||
else if (endDate.Value.Day == 31 && endDate.Value.Month == 12)
|
||||
urlaubstage = (decimal)urlaubstageProJahr;
|
||||
|
||||
else
|
||||
{
|
||||
if (anzahlArbeitstage < 5) // weniger als 5 Tage
|
||||
urlaubstage = (decimal)urlaubstageProJahr / 5m * anzahlArbeitstage;
|
||||
else
|
||||
{
|
||||
if (anzahlArbeitstage == 5) // 5 Tage
|
||||
urlaubstage = (decimal)urlaubstageProJahr / 365m * restlicheTageImJahr;
|
||||
else if (anzahlArbeitstage == 6) // 6 Tage
|
||||
urlaubstage = (decimal)urlaubstageProJahr / 365m * restlicheTageImJahr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else // Mitten im Jahr
|
||||
{
|
||||
urlaubstage = (decimal)urlaubstageProJahr / 365m * restlicheTageImJahr;
|
||||
}
|
||||
|
||||
// Runden
|
||||
if (urlaubstage - (int)urlaubstage <= 0.1m)
|
||||
{
|
||||
urlaubstage = Math.Round(urlaubstage, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
else if (urlaubstage - (int)urlaubstage <= 0.5m)
|
||||
{
|
||||
decimal digits = urlaubstage - (int)urlaubstage;
|
||||
urlaubstage = urlaubstage - digits + 0.5m;
|
||||
}
|
||||
else if (urlaubstage - (int)urlaubstage <= 1.0m)
|
||||
{
|
||||
urlaubstage = Math.Ceiling(urlaubstage);
|
||||
}
|
||||
|
||||
return urlaubstage;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user