MH: PerspektivenEV Urlaubskonto Regenerationstage Bugfix
This commit is contained in:
@@ -347,50 +347,54 @@ namespace PerspektivenEV.Service
|
||||
{
|
||||
Dictionary<string, decimal> sonderurlaub = new Dictionary<string, decimal>();
|
||||
|
||||
Contract contract = null;
|
||||
List<Contract> contracts = new List<Contract>();
|
||||
foreach (var c in employee.Contracts)
|
||||
{
|
||||
if (c.EntryDate.HasValue && !c.ContractEndDate.HasValue || c.EntryDate.HasValue && c.ContractEndDate.HasValue &&
|
||||
berechnungsjahr >= c.EntryDate.Value.Year && berechnungsjahr <= c.ContractEndDate.Value.Year)
|
||||
{
|
||||
contract = c;
|
||||
break;
|
||||
contracts.Add(c);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
// Wenn eine Behinderung von mind. 50 vorliegt stehen standardmäßig 5 Sonderurlaubstage zu
|
||||
if (contract != null && (contract.EntryDate.HasValue && contract.ContractEndDate.HasValue || contract.EntryDate.HasValue && !contract.ContractEndDate.HasValue))
|
||||
foreach (var contract in contracts)
|
||||
{
|
||||
var yearStart = new DateTime(berechnungsjahr, 1, 1);
|
||||
var yearEnd = new DateTime(berechnungsjahr, 12, 31);
|
||||
|
||||
// Schnittmenge aus Vertrag + Ausweis
|
||||
var overlapStart = contract.EntryDate > employee.AusweisGueltigVon ? contract.EntryDate : employee.AusweisGueltigVon;
|
||||
var overlapEnd = (contract.ContractEndDate ?? DateTime.MaxValue) < (employee.AusweisGueltigBis ?? DateTime.MaxValue) ? (contract.ContractEndDate ?? DateTime.MaxValue) : (employee.AusweisGueltigBis ?? DateTime.MaxValue);
|
||||
|
||||
// Jetzt prüfen: gibt es davon etwas im Jahr?
|
||||
if (overlapStart <= overlapEnd && overlapStart <= yearEnd && overlapEnd >= yearStart)
|
||||
if (contract != null && (contract.EntryDate.HasValue && contract.ContractEndDate.HasValue || contract.EntryDate.HasValue && !contract.ContractEndDate.HasValue))
|
||||
{
|
||||
if (employee.GradDerBehinderung != null && employee.GradDerBehinderung != "")
|
||||
{
|
||||
int.TryParse(employee.GradDerBehinderung, out int grad);
|
||||
if (grad >= 50)
|
||||
{
|
||||
// TODO Anteilig berechnen, (wenn Behinderung erst im Berechnungsjahr beginnt nur die "aktiven" Monate anrechnen und ab
|
||||
var yearStart = new DateTime(berechnungsjahr, 1, 1);
|
||||
var yearEnd = new DateTime(berechnungsjahr, 12, 31);
|
||||
|
||||
// Wenn keine Anzahl der wöchentlichen Arbeitstage gesetzt ist, 5 Tage
|
||||
// Sonst Anzahl der wöchentlichen Arbeitstage (gesdetzlich so geregelt)
|
||||
sonderurlaub.Add("Sonderurlaub aufgrund von Behinderungsgrad über 50", 5);
|
||||
// Schnittmenge aus Vertrag + Ausweis
|
||||
var overlapStart = contract.EntryDate > employee.AusweisGueltigVon ? contract.EntryDate : employee.AusweisGueltigVon;
|
||||
var overlapEnd = (contract.ContractEndDate ?? DateTime.MaxValue) < (employee.AusweisGueltigBis ?? DateTime.MaxValue) ? (contract.ContractEndDate ?? DateTime.MaxValue) : (employee.AusweisGueltigBis ?? DateTime.MaxValue);
|
||||
|
||||
// Jetzt prüfen: gibt es davon etwas im Jahr?
|
||||
if (overlapStart <= overlapEnd && overlapStart <= yearEnd && overlapEnd >= yearStart)
|
||||
{
|
||||
if (employee.GradDerBehinderung != null && employee.GradDerBehinderung != "")
|
||||
{
|
||||
int.TryParse(employee.GradDerBehinderung, out int grad);
|
||||
if (grad >= 50 && !sonderurlaub.ContainsKey("Sonderurlaub aufgrund von Behinderungsgrad über 50"))
|
||||
{
|
||||
// TODO Anteilig berechnen, (wenn Behinderung erst im Berechnungsjahr beginnt nur die "aktiven" Monate anrechnen und ab
|
||||
|
||||
// Wenn keine Anzahl der wöchentlichen Arbeitstage gesetzt ist, 5 Tage
|
||||
// Sonst Anzahl der wöchentlichen Arbeitstage (gesdetzlich so geregelt)
|
||||
sonderurlaub.Add("Sonderurlaub aufgrund von Behinderungsgrad über 50", 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Anpassung für Perspektiven:
|
||||
// CancellationPeriod im Vertrag sind die Regenerationstage hier.
|
||||
// Die Anzahl Tage, die da drin steht, soll als Sonderurlaub gutgeschrieben werden
|
||||
if (contract.CancellationPeriod > 0 && !sonderurlaub.ContainsKey("Regenerationstage"))
|
||||
sonderurlaub.Add("Regenerationstage", contract.CancellationPeriod);
|
||||
|
||||
}
|
||||
|
||||
// Anpassung für Perspektiven:
|
||||
// CancellationPeriod im Vertrag sind die Regenerationstage hier.
|
||||
// Die Anzahl Tage, die da drin steht, soll als Sonderurlaub gutgeschrieben werden
|
||||
if (contract.CancellationPeriod > 0)
|
||||
sonderurlaub.Add("Regenerationstage", contract.CancellationPeriod);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return sonderurlaub;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user