MobileEV: Anpassung der Rundungslogik (für Landkreis Börde wie LWL) über Funktion bei der Organisation (statt ID vom Costbearer)
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace MobileEV
|
||||
{
|
||||
[IDSpecificClass(Identifier = "RundungWieLWL")]
|
||||
public class CustomCalculations : Calculations
|
||||
{
|
||||
public override int GetRoundedDuration(int minuteInterval, decimal durationInMinutes)
|
||||
{
|
||||
decimal lRoundedDuration = durationInMinutes;
|
||||
|
||||
if (minuteInterval > 0 && durationInMinutes >= 5)
|
||||
{
|
||||
lRoundedDuration = durationInMinutes % minuteInterval != 0
|
||||
? durationInMinutes + (minuteInterval - (durationInMinutes % minuteInterval))
|
||||
: durationInMinutes;
|
||||
}
|
||||
|
||||
return (int)Math.Round(lRoundedDuration, 0, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,6 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Calculations\CustomCalculations.cs" />
|
||||
<Compile Include="CustomMitarbeiterstundenkontoBerechnung.cs" />
|
||||
<Compile Include="CustomReportCreator.cs" />
|
||||
<Compile Include="Invoicing\BetreuungsaufwandHelper.cs" />
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MobileEV.Service
|
||||
{
|
||||
@@ -14,28 +10,49 @@ namespace MobileEV.Service
|
||||
public override void BeforeSaveServiceRecord(ServiceRecord sr)
|
||||
{
|
||||
|
||||
if (sr.CostBearer2SupportConcept != null && sr.CostBearer2SupportConcept.CostBearer.Organisation.Function != null && !sr.CostBearer2SupportConcept.CostBearer.Organisation.Function.Value.IsNullOrEmpty() && sr.CostBearer2SupportConcept.CostBearer.Organisation.Function.Value == "Rundung Selbstzahler wie LWL")
|
||||
{
|
||||
// Nach LWL-Regeln runden
|
||||
|
||||
if (sr.DurationMinutes <= 7)
|
||||
{
|
||||
sr.RoundedDuration = 0; // Runde auf 0 Minuten, da kleiner als 8
|
||||
}
|
||||
else
|
||||
{
|
||||
int rest = Convert.ToInt32(sr.DurationMinutes) % 15;
|
||||
if (sr.CostBearer2SupportConcept != null)
|
||||
{
|
||||
var costBearer = sr.CostBearer2SupportConcept.CostBearer;
|
||||
|
||||
if (rest <= 7)
|
||||
if (costBearer.Organisation.Function != null &&
|
||||
!costBearer.Organisation.Function.Value.IsNullOrEmpty())
|
||||
{
|
||||
var function = costBearer.Organisation.Function.Value;
|
||||
if (function.Equals("Rundung Selbstzahler wie LWL"))
|
||||
{
|
||||
sr.RoundedDuration = Convert.ToInt32(sr.DurationMinutes) - rest; // Abgerundet auf das vorherige Vielfache von 15
|
||||
if (sr.DurationMinutes <= 7)
|
||||
{
|
||||
sr.RoundedDuration = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int rest = Convert.ToInt32(sr.DurationMinutes) % 15;
|
||||
|
||||
if (rest <= 7)
|
||||
{
|
||||
sr.RoundedDuration = Convert.ToInt32(sr.DurationMinutes) - rest;
|
||||
}
|
||||
else
|
||||
{
|
||||
sr.RoundedDuration = Convert.ToInt32(sr.DurationMinutes) + (15 - rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sr.RoundedDuration = Convert.ToInt32(sr.DurationMinutes) + (15 - rest); // Auf das nächste Vielfache von 15 aufrunden
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (function.Equals("Rundung wie LWL"))
|
||||
{
|
||||
var duration = sr.DurationMinutes;
|
||||
|
||||
if (duration >= 5)
|
||||
{
|
||||
duration = duration % 10 != 0
|
||||
? duration + (10 - (duration % 10))
|
||||
: duration;
|
||||
}
|
||||
|
||||
sr.RoundedDuration = (int)Math.Round(duration, 0, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user