SPZRatingen/Calculations/CustomDurationCalculator - Rundung Soziotherapie

This commit is contained in:
2024-05-16 09:08:40 +02:00
parent cd8a10fee9
commit 2fd7f71efd
3 changed files with 51 additions and 0 deletions

View File

@@ -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);
}
}
}
}

View File

@@ -0,0 +1 @@
DevExpress.XtraReports.UI.XtraReport, DevExpress.XtraReports.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -58,6 +58,7 @@
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="Calculations\CustomDurationCalculator.cs" />
<Compile Include="CustomReportCreator.cs" />
<Compile Include="InvoiceCustomerReport.cs">
<SubType>Component</SubType>