diff --git a/ReportImp/MalteserJohanniterJohanneshaus/MalteserJohanniterJohanneshaus.csproj b/ReportImp/MalteserJohanniterJohanneshaus/MalteserJohanniterJohanneshaus.csproj
index 8b93dcafe..9ba4ed4bd 100644
--- a/ReportImp/MalteserJohanniterJohanneshaus/MalteserJohanniterJohanneshaus.csproj
+++ b/ReportImp/MalteserJohanniterJohanneshaus/MalteserJohanniterJohanneshaus.csproj
@@ -153,6 +153,7 @@
+
Component
diff --git a/ReportImp/MalteserJohanniterJohanneshaus/Service/CustomServiceRecordStatisticFactory.cs b/ReportImp/MalteserJohanniterJohanneshaus/Service/CustomServiceRecordStatisticFactory.cs
new file mode 100644
index 000000000..cbb48b370
--- /dev/null
+++ b/ReportImp/MalteserJohanniterJohanneshaus/Service/CustomServiceRecordStatisticFactory.cs
@@ -0,0 +1,104 @@
+using BeWo.Data.Access;
+using BeWo.Data.Entities;
+using BeWo.Service.DCEntityMapper;
+using BeWo.Service.Plugins;
+using BS.Shared.DataContracts;
+using DevExpress.Office.Utils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MalteserJohanniterJohanneshaus.Service
+{
+ public class CustomServiceRecordStatisticFactory : ServiceRecordStatisticFactory
+ {
+ public override SupportConceptStatisticsDC CreateSupportConceptStatisticsImpl(long costBearer2SupportConceptOid, DateTime statisticsDate, long? ignoreServiceRecordOid)
+ {
+ var stats = base.CreateSupportConceptStatisticsImpl(costBearer2SupportConceptOid, statisticsDate, ignoreServiceRecordOid);
+
+ try
+ {
+ if (stats.PeriodStatistics.Any(p => p.SupportConceptApprovalPeriod.ServiceCategory != null && String.IsNullOrEmpty(p.SupportConceptApprovalPeriod.ServiceCategory.Name)
+ && p.SupportConceptApprovalPeriod.ServiceCategory.Name == "Soziotherapie"))
+ {
+
+ decimal factor = 1.2m;
+
+ stats.IstTotalUntilThisMonth *= factor;
+ stats.MinutesFreePerMonthAverage *= factor;
+ stats.MinutesFreePerWeekAverage *= factor;
+ stats.MinutesOutOfApprovedPeriod *= factor;
+ stats.MinutesProvidedPerMonthAverage *= factor;
+ stats.MinutesProvidedPerWeekAverage *= factor;
+ stats.MinutesProvidedThisMonth *= factor;
+ stats.MinutesProvidedThisWeek *= factor;
+ stats.MinutesProvidedTotal *= factor;
+ stats.MinutesProvidedTotalRounded *= factor;
+
+ foreach (var s in stats.PeriodStatistics)
+ {
+ s.AmountConsumedThisInterval *= factor;
+ s.AmountConsumedTotal *= factor;
+ s.IstTotalUntilThisMonth *= factor;
+ s.MinutesFreePerWeek *= factor;
+ s.MinutesOutOfApprovedPeriod *= factor;
+ s.MinutesProvidedThisMonth *= factor;
+ s.MinutesProvidedThisWeek *= factor;
+ s.MinutesProvidedTotal *= factor;
+ s.MinutesProvidedTotalRounded *= factor;
+ s.SollTotalUntilThisMonth *= factor;
+
+ SetMinutesFreePerWeek(stats, s);
+ }
+ }
+
+ return stats;
+ }
+ catch
+ {
+ return stats;
+ }
+ }
+
+ private void SetMinutesFreePerWeek(SupportConceptStatisticsDC stat, SupportConceptPeriodStatisticsDC ps)
+ {
+ try
+ {
+ DateTime dtPeriod = stat.DateOfCreation.Date;
+ if (ps.SupportConceptApprovalPeriod.StartDate.HasValue && ps.SupportConceptApprovalPeriod.EndDate.HasValue)
+ {
+ if (ps.SupportConceptApprovalPeriod.StartDate.HasValue && ps.SupportConceptApprovalPeriod.StartDate > dtPeriod)
+ {
+ dtPeriod = ps.SupportConceptApprovalPeriod.StartDate.Value;
+ }
+ TimeSpan tsPeriod = ps.SupportConceptApprovalPeriod.EndDate.Value.Subtract(dtPeriod);
+ int daysPeriod = tsPeriod.Days + 1;
+ if (daysPeriod < 0)
+ {
+ daysPeriod = 0;
+ }
+ if (daysPeriod != 0)
+ {
+ ps.MinutesFreePerWeek = (ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded) / (daysPeriod / 7m);
+ ps.MinutesFreePerWeekStatisticDate = (ps.MinutesApprovedTotal - ps.IstTotalUntilThisMonth - ps.MinutesProvidedThisMonth) / (daysPeriod / 7m);
+ ps.MinutesFreePerMonth = (ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded) / (daysPeriod / 7m) * (365m / 84m);
+ ps.MinutesFreePerMonthStatisticDate = (ps.MinutesApprovedTotal - ps.IstTotalUntilThisMonth - ps.MinutesProvidedThisMonth) / (daysPeriod / 7m) * (365m / 84m);
+ }
+ else // Bewilligung ist abgelaufen
+ {
+ ps.MinutesFreePerWeek = ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded;
+ ps.MinutesFreePerWeekStatisticDate = ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded;
+ ps.MinutesFreePerMonth = ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded;
+ ps.MinutesFreePerMonthStatisticDate = ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded;
+ }
+ }
+ }
+ catch (Exception)
+ {
+ //Mach nichts. Das ist für den alten Mok bei dem die Felder MinutesFreePerWeekStatisticDate noch nicht in der alten Shared.dll existieren
+ }
+ }
+ }
+}