MH: BeWoNordeifel Rundung LWL wie bei LVR
This commit is contained in:
@@ -55,6 +55,9 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Calculation\CustomCalculations.cs" />
|
||||
<Compile Include="Calculation\CustomLWLCalculations.cs" />
|
||||
<Compile Include="Calculation\CustomServiceRecordDurationCalculator.cs" />
|
||||
<Compile Include="FLSGroupReport.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
19
ReportImp/BeWoNordeifel/Calculation/CustomCalculations.cs
Normal file
19
ReportImp/BeWoNordeifel/Calculation/CustomCalculations.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using BS.Shared;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeWoNordeifel.Calculation
|
||||
{
|
||||
public class CustomCalculations : Calculations
|
||||
{
|
||||
public override int GetRoundedDuration(BS.Shared.DataContracts.Compact.CompactOrganisationDC org, DateTime date, decimal durationInMinutes)
|
||||
{
|
||||
return base.GetRoundedDuration(org, date, durationInMinutes);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
ReportImp/BeWoNordeifel/Calculation/CustomLWLCalculations.cs
Normal file
27
ReportImp/BeWoNordeifel/Calculation/CustomLWLCalculations.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using BS.Shared.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeWoNordeifel.Calculation
|
||||
{
|
||||
public class CustomLWLCalculations : LWLCalculations
|
||||
{
|
||||
// Wie LVR
|
||||
public override int GetRoundedDuration(int minuteInterval, decimal durationInMinutes)
|
||||
{
|
||||
decimal lRoundedDuration = durationInMinutes;
|
||||
|
||||
if (minuteInterval > 0)
|
||||
{
|
||||
lRoundedDuration = durationInMinutes % minuteInterval != 0
|
||||
? durationInMinutes + (minuteInterval - (durationInMinutes % minuteInterval))
|
||||
: durationInMinutes;
|
||||
}
|
||||
|
||||
return (int)Math.Round(lRoundedDuration, 0, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeWoNordeifel.Calculation
|
||||
{
|
||||
public class CustomServiceRecordDurationCalculator : ServiceRecordDurationCalculator
|
||||
{
|
||||
public override void CalculateRoundedDuration(ServiceRecordDC newServiceRecord)
|
||||
{
|
||||
//Wird nur für die Validierung benötigt
|
||||
if (newServiceRecord.ServiceDescription.Category != null &&
|
||||
newServiceRecord.ServiceDescription.Category.IsBillable && newServiceRecord.CostBearer != null)
|
||||
{
|
||||
var duration = (decimal)newServiceRecord.End.Value.Subtract(newServiceRecord.Start.Value).TotalMinutes;
|
||||
|
||||
Calculations calc = new CustomCalculations();
|
||||
|
||||
var roundedDuration = calc.GetRoundedDuration(newServiceRecord.CostBearer, newServiceRecord.Start.Value, duration);
|
||||
|
||||
newServiceRecord.RoundedDuration = roundedDuration;
|
||||
}
|
||||
else
|
||||
{
|
||||
newServiceRecord.RoundedDuration = (decimal)newServiceRecord.End.Value.Subtract(newServiceRecord.Start.Value).TotalMinutes;
|
||||
}
|
||||
}
|
||||
public override void CalculateRoundedDuration(ServiceRecord newServiceRecord)
|
||||
{
|
||||
if (newServiceRecord.ServiceDescription.ServiceCategory != null &&
|
||||
newServiceRecord.ServiceDescription.ServiceCategory.IsBillable && newServiceRecord.CostBearer2SupportConcept != null)
|
||||
{
|
||||
var duration = (decimal)newServiceRecord.End.Value.Subtract(newServiceRecord.Start.Value).TotalMinutes;
|
||||
|
||||
Calculations calc = new CustomCalculations();
|
||||
|
||||
var org = MapperFactory.CompactOrganisationDC_Organisation.MapToNewDC(
|
||||
newServiceRecord.CostBearer2SupportConcept.CostBearer.Organisation);
|
||||
var roundedDuration = calc.GetRoundedDuration(org, newServiceRecord.Start.Value, duration);
|
||||
|
||||
newServiceRecord.RoundedDuration = roundedDuration;
|
||||
}
|
||||
else
|
||||
{
|
||||
newServiceRecord.RoundedDuration = (decimal)newServiceRecord.End.Value.Subtract(newServiceRecord.Start.Value).TotalMinutes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user