diff --git a/ReportImp/MobileEV/Calculations/CustomCalculations.cs b/ReportImp/MobileEV/Calculations/CustomCalculations.cs
deleted file mode 100644
index 8b9b7720f..000000000
--- a/ReportImp/MobileEV/Calculations/CustomCalculations.cs
+++ /dev/null
@@ -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);
- }
- }
-}
\ No newline at end of file
diff --git a/ReportImp/MobileEV/MobileEV.csproj b/ReportImp/MobileEV/MobileEV.csproj
index f9f73a331..426b36c1c 100644
--- a/ReportImp/MobileEV/MobileEV.csproj
+++ b/ReportImp/MobileEV/MobileEV.csproj
@@ -55,7 +55,6 @@
-
diff --git a/ReportImp/MobileEV/Service/CustomSaveInterceptor.cs b/ReportImp/MobileEV/Service/CustomSaveInterceptor.cs
index 4f0deeb4a..5169befc8 100644
--- a/ReportImp/MobileEV/Service/CustomSaveInterceptor.cs
+++ b/ReportImp/MobileEV/Service/CustomSaveInterceptor.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);
+ }
+ }
+ }
}
}
}