diff --git a/Data/Entities/AbsenceTime.cs b/Data/Entities/AbsenceTime.cs
index 640aedd37..d3e2e0c2c 100644
--- a/Data/Entities/AbsenceTime.cs
+++ b/Data/Entities/AbsenceTime.cs
@@ -1,10 +1,12 @@
using System;
-
+using System.Diagnostics;
using BS.Shared;
using BS.Shared.Core;
namespace BeWo.Data.Entities
{
+ [DebuggerDisplay("{EmployeeOid}: {Start} - {End} {AbsenceReason.Description}")]
+
public class AbsenceTime : BeWoEntityBase
{
public static string PropertyName_AbsenceReason = "AbsenceReason";
diff --git a/ReportImp/LyvieKupfer/LyvieKupfer.csproj b/ReportImp/LyvieKupfer/LyvieKupfer.csproj
index 30b219163..5fa9b1a36 100644
--- a/ReportImp/LyvieKupfer/LyvieKupfer.csproj
+++ b/ReportImp/LyvieKupfer/LyvieKupfer.csproj
@@ -31,6 +31,7 @@
4
+
@@ -39,6 +40,7 @@
+
@@ -78,6 +80,7 @@
ServiceInvoiceReport.cs
+
diff --git a/ReportImp/LyvieKupfer/Service/CustomServiceRecordStatisticFactory.cs b/ReportImp/LyvieKupfer/Service/CustomServiceRecordStatisticFactory.cs
new file mode 100644
index 000000000..cb5f486c4
--- /dev/null
+++ b/ReportImp/LyvieKupfer/Service/CustomServiceRecordStatisticFactory.cs
@@ -0,0 +1,120 @@
+using BeWo.Data.Entities;
+using BeWo.Service.Plugins;
+using BS.Shared.DataContracts;
+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 LyvieKupfer.Service
+{
+ public class CustomServiceRecordStatisticFactory : ServiceRecordStatisticFactory
+ {
+ protected override void ProcessServiceRecord(ServiceRecord sr, CostBearer2SupportConcept cb2sc, SupportConceptStatisticsDC stats, DateTime statisticsDate, Calculations calc)
+ {
+ decimal minutesProvided = 0;
+ decimal minutesProvidedRounded = 0;
+ decimal minutesProvidedThisWeek = 0;
+ decimal minutesProvidedThisMonth = 0;
+ decimal minutesProvidedUntilLastMonth = 0;
+
+ bool billable = false;
+ if (sr.ServiceDescription != null && sr.ServiceDescription.ServiceCategory != null)
+ {
+ billable = sr.ServiceDescription.ServiceCategory.IsBillable;
+ }
+
+ bool outOfPeriod = true;
+ if (cb2sc.StartDate.HasValue && cb2sc.EndDate.HasValue)
+ {
+ outOfPeriod = false;
+ DateTime end = cb2sc.EndDate.Value;
+ if (end < DateTime.MaxValue.Date)
+ end = end.AddDays(1);
+ if (sr.Start < cb2sc.StartDate || sr.Start >= end)
+ {
+ outOfPeriod = true;
+ }
+ }
+
+ SupportConceptPeriodStatisticsDC periodStats =
+ GetPeriodDCFromServiceRecord(stats.PeriodStatistics, sr);
+
+
+ if (billable || (periodStats != null && periodStats.SupportConceptApprovalPeriod.ServiceCategory != null))
+ {
+ minutesProvided = (decimal)sr.DurationMinutes;
+
+ if (!billable && periodStats.SupportConceptApprovalPeriod.ServiceCategory != null &&
+ !periodStats.SupportConceptApprovalPeriod.ServiceCategory.IsBillable)
+ {
+ minutesProvidedRounded = minutesProvided;
+ }
+ else
+ {
+ var srDc = MapToServiceRecordDCForStatistic(sr);
+ minutesProvidedRounded = calc.GetDocumentedDurationInMinutes(srDc, true);
+ if (periodStats != null)
+ {
+
+ if (periodStats.ServiceRecords == null)
+ {
+ periodStats.ServiceRecords = new List();
+ }
+ periodStats.ServiceRecords.Add(srDc);
+ }
+ }
+
+
+ var firstOfMonthDt = new DateTime(statisticsDate.Year, statisticsDate.Month, 1);
+ DateTime mondayDt = statisticsDate.GetLast(DayOfWeek.Monday).Date;
+ DateTime sundayDt = statisticsDate.GetNext(DayOfWeek.Sunday).Date;
+
+ if (sr.Start >= mondayDt && sr.Start < mondayDt.AddDays(7))
+ {
+ minutesProvidedThisWeek = minutesProvidedRounded;
+ }
+ if (sr.Start >= firstOfMonthDt && sr.Start < firstOfMonthDt.AddMonths(1))
+ {
+ minutesProvidedThisMonth = minutesProvidedRounded;
+ }
+ if (sr.Start >= stats.StatisticsStartDate && sr.Start < firstOfMonthDt)
+ {
+ minutesProvidedUntilLastMonth += minutesProvidedRounded;
+ }
+
+ CalculateFixedAmountBudget(sr, periodStats, statisticsDate);
+
+
+ }
+
+ if (outOfPeriod)
+ {
+ stats.MinutesOutOfApprovedPeriod += minutesProvidedRounded;
+ }
+ stats.MinutesProvidedTotal += minutesProvided;
+ stats.MinutesProvidedTotalRounded += minutesProvidedRounded;
+ stats.MinutesProvidedThisMonth += minutesProvidedThisMonth;
+ stats.IstTotalUntilThisMonth += minutesProvidedUntilLastMonth;
+ stats.MinutesProvidedThisWeek += minutesProvidedThisWeek;
+
+
+ if (periodStats != null)
+ {
+ if (outOfPeriod)
+ {
+ periodStats.MinutesOutOfApprovedPeriod += minutesProvidedRounded;
+ }
+
+ periodStats.MinutesProvidedTotal += minutesProvided;
+ periodStats.MinutesProvidedTotalRounded += minutesProvidedRounded;
+ periodStats.MinutesProvidedThisWeek += minutesProvidedThisWeek;
+ periodStats.MinutesProvidedThisMonth += minutesProvidedThisMonth;
+ periodStats.IstTotalUntilThisMonth += minutesProvidedUntilLastMonth;
+ }
+ }
+ }
+}
diff --git a/ReportImp/Mittelpunkt/Mittelpunkt.csproj b/ReportImp/Mittelpunkt/Mittelpunkt.csproj
index d8e8706df..d577db15d 100644
--- a/ReportImp/Mittelpunkt/Mittelpunkt.csproj
+++ b/ReportImp/Mittelpunkt/Mittelpunkt.csproj
@@ -132,6 +132,7 @@
Teamstundenkonto.cs
+
diff --git a/ReportImp/Mittelpunkt/Validation/CustomServiceRecordValidator.cs b/ReportImp/Mittelpunkt/Validation/CustomServiceRecordValidator.cs
new file mode 100644
index 000000000..a9e5a0bc5
--- /dev/null
+++ b/ReportImp/Mittelpunkt/Validation/CustomServiceRecordValidator.cs
@@ -0,0 +1,65 @@
+using BeWo.Data.Access;
+using BeWo.Data.Entities;
+using BeWo.Service.Plugins;
+using BeWo.Service.Security;
+using BS.Shared;
+using BS.Shared.DataContracts;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Mittelpunkt.Validation
+{
+ public class CustomServiceRecordValidator : ServiceRecordValidator
+ {
+ public override ServiceRecordValidationResultDC CheckAbwesenheitMitarbeiter(ServiceRecordDC newServiceRecord, SupportConceptCostBearerRelDC reldc, decimal rd, bool isGroupRecord, List result)
+ {
+ var e = DAOFactory.GenericDAO.LoadByID(newServiceRecord.Employee.EmployeeOid);
+ long? userOid = SecurityUtils.GetLoggedInUser().Oid;
+
+ if (e.AbsenceTimes != null && e.AbsenceTimes.Count > 0)
+ {
+ if (e.AbsenceTimes.Any(a => a.AbsenceSpan.StartDate <= newServiceRecord.End.Value && (!a.End.HasValue || a.End >= newServiceRecord.End.Value)
+ || a.End.Value.Date == newServiceRecord.End.Value.Date))
+ {
+ foreach (var at in e.AbsenceTimes)
+ {
+ if (at.AbsenceReason.Description.ToLower().Contains("bereitschaft")) // Bei Rufbereitschaft soll nichts geprüft werden
+ continue;
+
+ if (
+ at.Start <= newServiceRecord.Start.Value && (!at.End.HasValue || at.End.Value >= newServiceRecord.Start.Value) // normalerweise
+ || (at.Start.Value.Date == newServiceRecord.Start.Value.Date && (!at.End.HasValue || at.End.Value >= newServiceRecord.Start.Value) && newServiceRecord.Start >= at.Start) // bei weniger als ganztägigen Abwesenheiten, kann es Überschneidung geben
+ || (at.End.HasValue && at.End.Value.Date == newServiceRecord.End.Value.Date && at.End.Value >= newServiceRecord.End.Value && newServiceRecord.Start <= at.Start) // bei weniger als ganztägigen Abwesenheiten, kann es Überschneidung geben
+ )
+ {
+ if (SecurityUtils.GetLoggedInUser().Oid.HasValue && newServiceRecord.Employee.EmployeeOid == SecurityUtils.GetLoggedInUser().Oid.Value)
+ {
+ String message = String.Format("Achtung bei Ihnen ist zu diesem Termin eine Abwesenheit eingetragen.\nMöchten Sie trotzdem speichern?");
+ return new ServiceRecordValidationResultDC
+ {
+ ResultType = ServiceRecordValidationResult.Custom,
+ Message = message,
+ Allow = true
+ };
+ }
+ else
+ {
+ String message = String.Format("{0} ist zu diesem Termin abwesend.\nMöchten Sie trotzdem speichern?", e.Person.FirstNameLastName);
+ return new ServiceRecordValidationResultDC
+ {
+ ResultType = ServiceRecordValidationResult.Custom,
+ Message = message,
+ Allow = true
+ };
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/ReportImp/VkmHamm/CustomerMitarbeiterstundenkontoBerechnung.cs b/ReportImp/VkmHamm/CustomerMitarbeiterstundenkontoBerechnung.cs
index f15692e52..f9c4fb35a 100644
--- a/ReportImp/VkmHamm/CustomerMitarbeiterstundenkontoBerechnung.cs
+++ b/ReportImp/VkmHamm/CustomerMitarbeiterstundenkontoBerechnung.cs
@@ -399,7 +399,7 @@ namespace VkmHamm
private bool IsUrlaubAbsenceServiceRecord(ServiceRecord item)
{
- if (item.Start.HasValue && item.Start.Value >= new DateTime(2024, 04, 1) && item.Notice != null && item.Notice.Length > 0 && item.Notice.Trim().ToLower() == "urlaub")
+ if (!item.CustomerOid.HasValue && item.Start.HasValue && item.Start.Value >= new DateTime(2024, 04, 1) && item.Notice != null && item.Notice.Length > 0 && item.Notice.Trim().ToLower() == "urlaub")
return true;
return false;
@@ -407,7 +407,7 @@ namespace VkmHamm
private bool IsKrankAbsenceServiceRecord(ServiceRecord item)
{
- if (item.Start.HasValue && item.Start.Value >= new DateTime(2024, 04, 1) && item.Notice != null && item.Notice.Length > 0 && item.Notice.Trim().ToLower() == "krank")
+ if (!item.CustomerOid.HasValue && item.Start.HasValue && item.Start.Value >= new DateTime(2024, 04, 1) && item.Notice != null && item.Notice.Length > 0 && item.Notice.Trim().ToLower() == "krank")
return true;
return false;
@@ -415,7 +415,7 @@ namespace VkmHamm
private bool IsOtherAbsenceServiceRecord(ServiceRecord item)
{
- if (item.Start.HasValue && item.Start.Value >= new DateTime(2025, 01, 01) && item.Notice != null && item.Notice.Length > 0 &&
+ if (!item.CustomerOid.HasValue && item.Start.HasValue && item.Start.Value >= new DateTime(2025, 01, 01) && item.Notice != null && item.Notice.Length > 0 &&
(/*item.Notice.Trim().ToLower() == "ü-frei" || item.Notice.Trim().ToLower() == "fortbildung" ||*/ item.Notice.Trim().ToLower().Contains("reha")))
return true;
diff --git a/ReportImp/VkmHamm/VkmHamm.csproj b/ReportImp/VkmHamm/VkmHamm.csproj
index 522d01d90..11a88d455 100644
--- a/ReportImp/VkmHamm/VkmHamm.csproj
+++ b/ReportImp/VkmHamm/VkmHamm.csproj
@@ -33,6 +33,7 @@
false
+
@@ -42,6 +43,7 @@
+