FeidPartnerReports/Statistics/CustomServiceRecordStatisticFactory - Änderung der Dokumentation und Statistik
This commit is contained in:
@@ -112,6 +112,7 @@
|
||||
<Compile Include="CollectiveBillingReport.Designer.cs">
|
||||
<DependentUpon>CollectiveBillingReport.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CustomSupportConceptAnalysisCreator.cs" />
|
||||
<Compile Include="Invoicing\CollectiveInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -121,6 +122,7 @@
|
||||
<Compile Include="ServicesOverviewReport.Designer.cs">
|
||||
<DependentUpon>ServicesOverviewReport.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Statistics\CustomServiceRecordStatisticFactory.cs" />
|
||||
<Compile Include="SupportConceptReport.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace FeidPartnerReports.Statistics
|
||||
{
|
||||
public class CustomServiceRecordStatisticFactory : ServiceRecordStatisticFactory
|
||||
{
|
||||
public override SupportConceptStatisticsDC CreateSupportConceptStatisticsImpl(long costBearer2SupportConceptOid, DateTime statisticsDate, long? ignoreServiceRecordOid)
|
||||
{
|
||||
var stat = base.CreateSupportConceptStatisticsImpl(costBearer2SupportConceptOid, statisticsDate, ignoreServiceRecordOid);
|
||||
|
||||
foreach (var item in stat.PeriodStatistics)
|
||||
{
|
||||
DateTime start = item.SupportConceptApprovalPeriod.StartDate.Value;
|
||||
DateTime end = item.SupportConceptApprovalPeriod.EndDate.Value;
|
||||
DateTime bewStart = item.SupportConceptApprovalPeriod.StartDate.Value;
|
||||
DateTime bewEnd = item.SupportConceptApprovalPeriod.EndDate.Value;
|
||||
|
||||
|
||||
if (statisticsDate < end)
|
||||
{
|
||||
end = statisticsDate;
|
||||
}
|
||||
|
||||
if(bewStart <= DateTime.Now && bewEnd >= DateTime.Now && item.MinutesProvidedThisWeek == 0)
|
||||
{
|
||||
item.MinutesProvidedThisWeek = item.MinutesApprovedPerWeek;
|
||||
stat.MinutesProvidedThisWeek = item.MinutesApprovedPerWeek;
|
||||
}
|
||||
//if (item.MinutesProvidedThisMonth == 0)
|
||||
//{
|
||||
// item.MinutesProvidedThisMonth = item.MinutesApprovedPerMonth;
|
||||
//}
|
||||
//if (stat.MinutesProvidedThisMonth == 0)
|
||||
//{
|
||||
// stat.MinutesProvidedThisWeek = stat.MinutesApprovedPerMonth;
|
||||
//}
|
||||
|
||||
while (start < end.Date)
|
||||
{
|
||||
if (!EnthaeltEintraege(start, start.AddDays(7), item.ServiceRecords))
|
||||
{
|
||||
//item.MinutesProvidedThisMonth += item.MinutesApprovedPerWeek;
|
||||
item.MinutesProvidedTotal += item.MinutesApprovedPerWeek;
|
||||
item.MinutesProvidedTotalRounded += item.MinutesApprovedPerWeek;
|
||||
stat.MinutesProvidedTotal += item.MinutesApprovedPerWeek;
|
||||
stat.MinutesProvidedTotalRounded += item.MinutesApprovedPerWeek;
|
||||
}
|
||||
start = start.AddDays(7);
|
||||
}
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
|
||||
private bool EnthaeltEintraege(DateTime start, DateTime end, List<ServiceRecordDC> serviceRecords)
|
||||
{
|
||||
bool vorhandeneEintraege = false;
|
||||
if (serviceRecords != null && serviceRecords.Count > 0)
|
||||
{
|
||||
vorhandeneEintraege = serviceRecords.Any(s => s.Start.Value.Date >= start.Date && s.Start.Value.Date <= end.Date && s.RoundedDuration > 0);
|
||||
}
|
||||
return vorhandeneEintraege;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user