CaritasverbandKelheim/Service/CustomGroupDurationCalculator - Rundung auch für Gruppen
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace CaritasverbandKelheim.Calculation
|
||||
{
|
||||
public class CustomGroupDurationCalculator : GroupDurationCalculator
|
||||
{
|
||||
public override GroupDurationDC CalculateGroupDuration(int personCount, int employeeCount, decimal totalDuration,
|
||||
long[] costBearer2SupportConceptArray)
|
||||
{
|
||||
if (totalDuration <= 7)
|
||||
{
|
||||
totalDuration = 0; // Runde auf 0 Minuten, da kleiner als 8
|
||||
}
|
||||
else
|
||||
{
|
||||
int rest = Convert.ToInt32(totalDuration) % 15;
|
||||
|
||||
if (rest <= 7)
|
||||
{
|
||||
totalDuration = Convert.ToInt32(totalDuration) - rest; // Abgerundet auf das vorherige Vielfache von 15
|
||||
}
|
||||
else
|
||||
{
|
||||
totalDuration = Convert.ToInt32(totalDuration) + (15 - rest); // Auf das nächste Vielfache von 15 aufrunden
|
||||
}
|
||||
}
|
||||
return new GroupDurationDC()
|
||||
{
|
||||
SingleDuration = totalDuration /personCount,
|
||||
TotalDuration = totalDuration
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,8 @@ namespace CaritasverbandKelheim.Service
|
||||
public override void BeforeSaveServiceRecord(ServiceRecord sr)
|
||||
{
|
||||
// Vor 7 Minuten soll abgerundet, danach 15 aufgerundet werden, wenn bei KT 15 Min eingestellt ist und es Bezirk Niederbayern ist
|
||||
if (sr.CostBearer2SupportConcept != null && sr.CostBearer2SupportConcept.CostBearer.Organisation.Name.ToLower().Contains("bezirk niederbayern") && sr.Start.HasValue && sr.End.HasValue)
|
||||
{
|
||||
//if (sr.CostBearer2SupportConcept != null && sr.CostBearer2SupportConcept.CostBearer.Organisation.Name.ToLower().Contains("bezirk niederbayern") && sr.Start.HasValue && sr.End.HasValue)
|
||||
//{
|
||||
if (sr.DurationMinutes <= 7)
|
||||
{
|
||||
sr.RoundedDuration = 0; // Runde auf 0 Minuten, da kleiner als 8
|
||||
@@ -32,7 +32,7 @@ namespace CaritasverbandKelheim.Service
|
||||
sr.RoundedDuration = Convert.ToInt32(sr.DurationMinutes) + (15 - rest); // Auf das nächste Vielfache von 15 aufrunden
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user