2023-10-11 13:33:08 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using BeWo.Data.Entities;
|
|
|
|
|
|
using BeWo.Report.ReportObjects;
|
2026-07-17 02:40:28 +02:00
|
|
|
|
using BeWo.Service.Dienstplanung;
|
2023-10-11 13:33:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Biotop
|
|
|
|
|
|
{
|
|
|
|
|
|
public class CustomMitarbeiterstundenkontoBerechnung : MitarbeiterstundenkontoBerechnung
|
|
|
|
|
|
{
|
|
|
|
|
|
public override bool ShouldCreateDayDetails()
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override MitarbeiterstundenkontoRO.DayDetail CreateDayDetail(DateTime date, MitarbeiterstundenkontoRO.EmployeeDetail ed)
|
|
|
|
|
|
{
|
2024-03-11 13:07:42 +01:00
|
|
|
|
if (date.Date < new DateTime(2024, 01, 01))
|
2023-10-19 11:10:47 +02:00
|
|
|
|
return base.CreateDayDetail(date, ed);
|
|
|
|
|
|
|
2023-10-11 13:33:08 +02:00
|
|
|
|
var dd = base.CreateDayDetail(date, ed);
|
|
|
|
|
|
dd.MaxHoursUntilBreak = 6;
|
|
|
|
|
|
dd.MaxHoursUntilBreak2 = 9;
|
|
|
|
|
|
dd.BreakMinutes = 30;
|
|
|
|
|
|
dd.BreakMinutes2 = 15;
|
|
|
|
|
|
|
|
|
|
|
|
return dd;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
public override bool AddServiceRecordToDuration(StundenkontoServiceRecord item)
|
2023-10-11 13:33:08 +02:00
|
|
|
|
{
|
2026-07-17 02:40:28 +02:00
|
|
|
|
if (item.Start.Date < new DateTime(2024, 01, 01))
|
2023-10-19 11:10:47 +02:00
|
|
|
|
return base.AddServiceRecordToDuration(item);
|
|
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
if (item.ServiceDescription != null && item.ServiceDescription.Category != null)
|
2023-10-11 13:33:08 +02:00
|
|
|
|
{
|
2026-07-17 02:40:28 +02:00
|
|
|
|
if (item.ServiceDescription.Category.Name.ToLower().Contains("arbeitszeit")/* && !item.ServiceDescription.Name.ToLower().Contains("bürozeit")*/)
|
2023-10-11 13:33:08 +02:00
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2026-07-17 02:40:28 +02:00
|
|
|
|
//protected override decimal GetDuration(StundenkontoServiceRecord sr, MitarbeiterstundenkontoRO.EmployeeDetail ed)
|
2023-11-14 13:47:09 +01:00
|
|
|
|
//{
|
|
|
|
|
|
// var duration = base.GetDuration(sr, ed);
|
|
|
|
|
|
|
|
|
|
|
|
// if (sr.ServiceDescription.Name.ToLower().Contains("bürozeit"))
|
|
|
|
|
|
// duration = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// return duration;
|
|
|
|
|
|
//}
|
2023-10-11 13:33:08 +02:00
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
protected override ServiceRecordSummary BerechneStunden(MitarbeiterstundenkontoRO.EmployeeDetail empDetail, IList<StundenkontoServiceRecord> groupFilteredRecords, DateTime berichtsAnfang,
|
2023-10-11 13:33:08 +02:00
|
|
|
|
DateTime berichtsEnde)
|
|
|
|
|
|
{
|
|
|
|
|
|
decimal flsGesamt = 0;
|
|
|
|
|
|
decimal arbeitszeit = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var sum = new ServiceRecordSummary();
|
2026-07-17 02:40:28 +02:00
|
|
|
|
sum.RecordsImBerichtszeitraum = new List<StundenkontoServiceRecord>();
|
2023-10-11 13:33:08 +02:00
|
|
|
|
//base.CorrectOverlappingTimes(groupFilteredRecords);
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in groupFilteredRecords)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsServiceRecordFehlzeit(item))
|
|
|
|
|
|
{
|
2026-07-17 02:40:28 +02:00
|
|
|
|
if (item.Start >= berichtsAnfang && item.Start < berichtsEnde)
|
2023-10-11 13:33:08 +02:00
|
|
|
|
{
|
|
|
|
|
|
//if (AddServiceRecordToDuration(item))
|
|
|
|
|
|
//{
|
|
|
|
|
|
decimal duration = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (item.GroupRoundedDuration.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
duration = item.GroupRoundedDuration.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
duration = item.RoundedDuration;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (item.ServiceDescription != null &&
|
2026-07-17 02:40:28 +02:00
|
|
|
|
item.ServiceDescription.Category != null)
|
2023-10-11 13:33:08 +02:00
|
|
|
|
{
|
2026-07-17 02:40:28 +02:00
|
|
|
|
if (item.ServiceDescription.Category.Name.ToLower().Contains("arbeitszeit") /*&& !item.ServiceDescription.Name.ToLower().Contains("bürozeit")*/ && item.Start.Date >= new DateTime(2024, 01, 01))
|
2023-10-19 11:10:47 +02:00
|
|
|
|
{
|
2023-11-14 13:47:09 +01:00
|
|
|
|
if (item.ServiceDescription.Name.ToLower().Contains("bürozeit"))
|
|
|
|
|
|
{
|
|
|
|
|
|
arbeitszeit += 0;
|
|
|
|
|
|
empDetail.Custom1 += duration / 60;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
arbeitszeit += duration;
|
2023-10-19 11:10:47 +02:00
|
|
|
|
}
|
2026-07-17 02:40:28 +02:00
|
|
|
|
else if (item.Start.Date < new DateTime(2024, 01, 01))
|
2023-10-11 13:33:08 +02:00
|
|
|
|
{
|
|
|
|
|
|
arbeitszeit += duration;
|
|
|
|
|
|
}
|
2026-07-17 02:40:28 +02:00
|
|
|
|
else if (item.ServiceDescription.Category.IsBillable)
|
2023-10-11 13:33:08 +02:00
|
|
|
|
{
|
|
|
|
|
|
flsGesamt += duration;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
sum.RecordsImBerichtszeitraum.Add(item);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sum.IstAbrechenbar = flsGesamt;
|
|
|
|
|
|
sum.IstNichtAbrechenbar = arbeitszeit - flsGesamt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return sum;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|