Merge branch 'master' of ssh://float.ownsoft.de/git/beyondSoft/BeWo

This commit is contained in:
2025-03-12 16:42:41 +01:00
7 changed files with 197 additions and 4 deletions

View File

@@ -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";

View File

@@ -31,6 +31,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.DataAccess.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Drawing.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Office.v23.2.Core, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
@@ -39,6 +40,7 @@
<Reference Include="DevExpress.Printing.v23.2.Core, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.Desktop.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpo.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Charts.v23.2.Core, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraCharts.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
@@ -78,6 +80,7 @@
<Compile Include="ServiceInvoiceReport.Designer.cs">
<DependentUpon>ServiceInvoiceReport.cs</DependentUpon>
</Compile>
<Compile Include="Service\CustomServiceRecordStatisticFactory.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Data\Data.csproj">

View File

@@ -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<ServiceRecordDC>();
}
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;
}
}
}
}

View File

@@ -132,6 +132,7 @@
<Compile Include="Teamstundenkonto.designer.cs">
<DependentUpon>Teamstundenkonto.cs</DependentUpon>
</Compile>
<Compile Include="Validation\CustomServiceRecordValidator.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Data\Data.csproj">

View File

@@ -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<ServiceRecordValidationResultDC> result)
{
var e = DAOFactory.GenericDAO.LoadByID<Employee>(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;
}
}
}

View File

@@ -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;

View File

@@ -33,6 +33,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.DataAccess.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Drawing.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Mvvm.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
@@ -42,6 +43,7 @@
<Reference Include="DevExpress.Printing.v23.2.Core, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.Desktop.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpo.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Charts.v23.2.Core, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraCharts.v23.2.Wizard, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />