MH: Umstellung Ministatistik
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared.DataContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SuchtkrankenhilfeOstfriesland.Service
|
||||
{
|
||||
public class CustomServiceRecordStatisticFactory : ServiceRecordStatisticFactory
|
||||
{
|
||||
public override SupportConceptStatisticsDC CreateSupportConceptStatisticsImpl(long costBearer2SupportConceptOid, DateTime statisticsDate, long? ignoreServiceRecordOid)
|
||||
{
|
||||
var stats = base.CreateSupportConceptStatisticsImpl(costBearer2SupportConceptOid, statisticsDate, ignoreServiceRecordOid);
|
||||
|
||||
var cb = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(DAOFactory.GenericDAO.GetByID<CostBearer2SupportConcept>(costBearer2SupportConceptOid));
|
||||
if (!cb.CostBearer.Name.ToLower().Contains("ab 01.09."))
|
||||
return stats;
|
||||
|
||||
decimal factor = 1.2m;
|
||||
|
||||
stats.MinutesApprovedPerWeek *= factor;
|
||||
stats.MinutesApprovedTotal *= factor;
|
||||
|
||||
foreach (var item in stats.PeriodStatistics)
|
||||
{
|
||||
// Bewilligt pro Woche/Gesamt
|
||||
item.MinutesApprovedPerWeek *= factor;
|
||||
item.MinutesApprovedTotal /= factor;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DateTime dtPeriod = statisticsDate.Date;
|
||||
if (item.SupportConceptApprovalPeriod.StartDate.HasValue && item.SupportConceptApprovalPeriod.StartDate > dtPeriod)
|
||||
{
|
||||
dtPeriod = item.SupportConceptApprovalPeriod.StartDate.Value;
|
||||
}
|
||||
|
||||
TimeSpan tsPeriod = item.SupportConceptApprovalPeriod.EndDate.Value.Subtract(dtPeriod);
|
||||
int daysPeriod = tsPeriod.Days + 1;
|
||||
if (daysPeriod < 0)
|
||||
daysPeriod = 0;
|
||||
|
||||
if (daysPeriod != 0)
|
||||
{
|
||||
item.MinutesFreePerWeek = (item.MinutesApprovedTotal - item.MinutesProvidedTotalRounded) / (daysPeriod / 7m);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.MinutesFreePerWeek = item.MinutesApprovedTotal - item.MinutesProvidedTotalRounded;
|
||||
}
|
||||
}
|
||||
|
||||
decimal freeTotal = stats.MinutesApprovedTotal - stats.MinutesProvidedTotalRounded;
|
||||
if (stats.MinutesFreePerWeekAverage > freeTotal)
|
||||
stats.MinutesFreePerWeekAverage = freeTotal;
|
||||
if (stats.MinutesFreePerWeekAverage < 0)
|
||||
stats.MinutesFreePerWeekAverage = 0;
|
||||
|
||||
return stats;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,7 @@
|
||||
<Compile Include="ServiceInvoiceReport.Designer.cs">
|
||||
<DependentUpon>ServiceInvoiceReport.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Service\CustomServiceRecordStatisticFactory.cs" />
|
||||
<Compile Include="Service\CustomVacationService.cs" />
|
||||
<Compile Include="SettlementReportMitBriefpapier.cs">
|
||||
<SubType>Component</SubType>
|
||||
|
||||
Reference in New Issue
Block a user