diff --git a/ReportImp/SPZRatingen/Calculations/CustomDurationCalculator.cs b/ReportImp/SPZRatingen/Calculations/CustomDurationCalculator.cs new file mode 100644 index 000000000..ab22ca5bb --- /dev/null +++ b/ReportImp/SPZRatingen/Calculations/CustomDurationCalculator.cs @@ -0,0 +1,49 @@ +using System; +using BeWo.Data.Entities; +using BeWo.Service.Plugins; +using BS.Shared.DataContracts; + +namespace SpzRatingen +{ + public class CustomDurationCalculator : ServiceRecordDurationCalculator + { + public override void CalculateRoundedDuration(ServiceRecord sr) + { + if (sr.CostBearer2SupportConcept != null && sr.ServiceDescription.ServiceCategory != null && + sr.ServiceDescription.ServiceCategory.IsBillable && sr.ServiceDescription.ServiceCategory.Name == "Soziotherapie") + { + var durationInMinutes = (decimal)sr.End.Value.Subtract(sr.Start.Value).TotalMinutes; + + decimal lRoundedDuration = durationInMinutes; + lRoundedDuration = durationInMinutes % 25 != 0 + ? durationInMinutes + (25 - (durationInMinutes % 25)) + : durationInMinutes; + + sr.RoundedDuration = (int)Math.Round(lRoundedDuration, 0, MidpointRounding.AwayFromZero); + } + else + { + base.CalculateRoundedDuration(sr); + } + } + + public override void CalculateRoundedDuration(ServiceRecordDC sr) + { + if (sr.ServiceDescription.Category != null && sr.ServiceDescription.Category.IsBillable && sr.ServiceDescription.Category.Name == "Soziotherapie") + { + var durationInMinutes = (decimal)sr.End.Value.Subtract(sr.Start.Value).TotalMinutes; + + decimal lRoundedDuration = durationInMinutes; + lRoundedDuration = durationInMinutes % 25 != 0 + ? durationInMinutes + (25 - (durationInMinutes % 25)) + : durationInMinutes; + + sr.RoundedDuration = (int)Math.Round(lRoundedDuration, 0, MidpointRounding.AwayFromZero); + } + else + { + base.CalculateRoundedDuration(sr); + } + } + } +} \ No newline at end of file diff --git a/ReportImp/SPZRatingen/Properties/licenses.licx b/ReportImp/SPZRatingen/Properties/licenses.licx index e69de29bb..d59547a61 100644 --- a/ReportImp/SPZRatingen/Properties/licenses.licx +++ b/ReportImp/SPZRatingen/Properties/licenses.licx @@ -0,0 +1 @@ +DevExpress.XtraReports.UI.XtraReport, DevExpress.XtraReports.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/ReportImp/SPZRatingen/SPZRatingen.csproj b/ReportImp/SPZRatingen/SPZRatingen.csproj index 97d7cbbdb..b6940fb32 100644 --- a/ReportImp/SPZRatingen/SPZRatingen.csproj +++ b/ReportImp/SPZRatingen/SPZRatingen.csproj @@ -58,6 +58,7 @@ + Component