2018-10-08 12:09:48 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
using BeWo.Data.Access;
|
|
|
|
|
|
using BeWo.Data.Entities;
|
|
|
|
|
|
using BS.Shared;
|
|
|
|
|
|
using BS.Shared.Core;
|
|
|
|
|
|
using BS.Shared.DataContracts;
|
|
|
|
|
|
using BS.Shared.Extensions;
|
|
|
|
|
|
using BS.Shared.Services;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WahlEv
|
|
|
|
|
|
{
|
|
|
|
|
|
public class WahlCalculations : BS.Shared.Services.Calculations
|
|
|
|
|
|
{
|
|
|
|
|
|
public override decimal? GetApprovedHoursForPeriod(SupportConceptApprovalPeriodDC scap, List<CostRatePeriodDC> costRatePeriods, DateTime? pStart,
|
|
|
|
|
|
DateTime? pEnd)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pStart.HasValue || !pEnd.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEPerInterval.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Weekly)
|
|
|
|
|
|
{
|
|
|
|
|
|
var months = GetTotalMonths(pStart.Value, pEnd.Value);
|
|
|
|
|
|
return months * 4.33m * scap.ApprovedBEPerInterval.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Monthly)
|
|
|
|
|
|
{
|
|
|
|
|
|
var months = GetTotalMonths(pStart.Value, pEnd.Value);
|
|
|
|
|
|
return months * scap.ApprovedBEPerInterval.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Quarterly)
|
|
|
|
|
|
{
|
|
|
|
|
|
var qs = GetTotalQuarters(pStart.Value, pEnd.Value);
|
|
|
|
|
|
return qs * scap.ApprovedBEPerInterval.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var periodInDays = (pEnd.Value.Date - pStart.Value.Date).Days + 1;
|
|
|
|
|
|
|
|
|
|
|
|
return this.GetApprovedHoursPerDay(scap, costRatePeriods) * periodInDays;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-17 15:50:00 +02:00
|
|
|
|
public override decimal? GetApprovedHoursPerWeek(SupportConceptApprovalPeriodDC scap, List<CostRatePeriodDC> costRatePeriods)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (scap.ApprovedBEPerInterval.HasValue && scap.ApprovedBEInterval.HasValue && scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Weekly)
|
|
|
|
|
|
{
|
|
|
|
|
|
return scap.ApprovedBEPerInterval;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (!scap.ApprovedBEPerInterval.HasValue && scap.ApprovedBETotal.HasValue && scap.StartDate.HasValue && scap.EndDate.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
var months = GetTotalMonths(scap.StartDate.Value, scap.EndDate.Value);
|
2023-08-16 10:25:05 +02:00
|
|
|
|
if (months != 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var monatlich = scap.ApprovedBETotal.Value / months;
|
2020-08-17 15:50:00 +02:00
|
|
|
|
|
2023-08-16 10:25:05 +02:00
|
|
|
|
return monatlich / 4.33m;
|
|
|
|
|
|
}
|
2020-08-17 15:50:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
return this.GetApprovedHoursPerDay(scap, costRatePeriods) * 7;
|
|
|
|
|
|
}
|
2018-10-08 12:09:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|