2023-02-08 19:02:19 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using BeWo.Data.Access;
|
|
|
|
|
|
using BeWo.Data.Entities;
|
|
|
|
|
|
using BS.Shared.Core;
|
|
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
|
|
using BeWo.Report;
|
|
|
|
|
|
using BeWo.Service.DCEntityMapper;
|
|
|
|
|
|
using BeWo.Service.Plugins;
|
|
|
|
|
|
using DevExpress.Charts.Native;
|
2023-02-15 17:33:28 +01:00
|
|
|
|
using System.Data;
|
2026-07-17 02:40:28 +02:00
|
|
|
|
using BeWo.Service.Dienstplanung;
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
|
|
|
|
|
namespace BeWoDarmstadt
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class Zeitzuschlagsbeleg : DevExpress.XtraReports.UI.XtraReport
|
|
|
|
|
|
{
|
|
|
|
|
|
private VacationService _vs = null;
|
|
|
|
|
|
|
2023-02-15 17:33:28 +01:00
|
|
|
|
private Dictionary<int, DateTime> beginn = new Dictionary<int, DateTime>();
|
2023-02-08 19:02:19 +01:00
|
|
|
|
private Dictionary<int, double> samstag2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> sonntag2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> feiertag2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> heiligSil2Minuten = new Dictionary<int, double>();
|
2023-03-17 07:59:28 +01:00
|
|
|
|
//private Dictionary<int, double> OsterSa2Minuten = new Dictionary<int, double>();
|
2023-02-08 19:02:19 +01:00
|
|
|
|
private Dictionary<int, double> nacht2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> nachtSa2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> nachtSo2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> nachtFe2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> direkteBetr2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> indirekteBetr2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> vorArbeiten2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> flsX2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> flsY2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> fobiUrKr2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> team2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> subervis2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> gremArbeit2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> div2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> fahrzeit2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> qz2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
private Dictionary<int, double> leitung2Minuten = new Dictionary<int, double>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Zeitzuschlagsbeleg()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetReportDataSource(DateTime monat, MitarbeiterstundenkontoRO.EmployeeDetail ed)
|
|
|
|
|
|
{
|
|
|
|
|
|
ed.FirstName = "";
|
2023-03-17 22:11:18 +01:00
|
|
|
|
DateTime ende = monat.AddMonths(1);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
|
|
|
|
|
if (ed.Custom9 > 0 || ed.Custom8 > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
ed.FirstName = String.Format("{0:0.##} / {1:0.##}", ed.Custom9, ed.Custom8);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_vs = PluginLoader.FindClass<VacationService>();
|
|
|
|
|
|
InitTable(monat);
|
|
|
|
|
|
FillTableData(monat, ed);
|
|
|
|
|
|
|
|
|
|
|
|
lblZeitraum.Text = String.Format("{0:MMMM yyyy}", monat);
|
|
|
|
|
|
lblStelle.Text = String.Format("{0:0.00}", ed.SollProWoche/40);
|
|
|
|
|
|
|
2024-02-23 13:52:02 +01:00
|
|
|
|
decimal anteilFLS = (decimal)0.75;
|
2025-06-17 14:40:20 +02:00
|
|
|
|
if (ed.WeeklyFLS.HasValue && ed.SollProWoche != 0)
|
2024-02-23 13:52:02 +01:00
|
|
|
|
{
|
|
|
|
|
|
anteilFLS = Math.Round((decimal)ed.WeeklyFLS / ed.SollProWoche, 2, MidpointRounding.AwayFromZero);
|
|
|
|
|
|
}
|
2023-03-17 22:11:18 +01:00
|
|
|
|
//foreach (var ot in ed.Employee.Overtimes)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ed.Custom6 += ot.Betrag;
|
|
|
|
|
|
//}
|
2024-03-27 14:41:50 +01:00
|
|
|
|
//if (ed.UeberstundenVormonat != null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (ed.UeberstundenVormonat < 0 && ed.Custom15 > 0)
|
|
|
|
|
|
// ed.Custom14 = (decimal)ed.UeberstundenVormonat + ed.Custom15;
|
|
|
|
|
|
// else
|
|
|
|
|
|
// ed.Custom14 = (decimal)ed.UeberstundenVormonat - ed.Custom15; // <20>berstunden Vormonate nur Mittelbare
|
|
|
|
|
|
//}
|
2023-02-22 10:50:49 +01:00
|
|
|
|
|
2023-03-17 22:11:18 +01:00
|
|
|
|
var emp = ed.Employee;
|
|
|
|
|
|
if (emp.Overtimes != null)
|
2023-02-22 10:50:49 +01:00
|
|
|
|
{
|
2023-03-17 22:11:18 +01:00
|
|
|
|
foreach (var ot in emp.Overtimes)
|
2023-03-17 07:59:28 +01:00
|
|
|
|
{
|
2025-01-15 17:20:57 +01:00
|
|
|
|
if (ot.Date < monat && ot.Auszahlungsart is object)
|
2023-03-17 07:59:28 +01:00
|
|
|
|
{
|
2023-03-17 22:11:18 +01:00
|
|
|
|
if (ot.Auszahlungsart.Name.Contains("FLS"))
|
|
|
|
|
|
ed.Custom15 += ot.Betrag; // <20>berstunden Vormonate nur FLS unter Ber<65>cksichtigung Auszahlung
|
|
|
|
|
|
else if (ot.Auszahlungsart.Name.Contains("Rahmenzeit"))
|
|
|
|
|
|
ed.Custom14 += ot.Betrag; // <20>berstunden Vormonate nur Mittelbare
|
|
|
|
|
|
}
|
2025-01-15 17:20:57 +01:00
|
|
|
|
if (ot.Date >= monat && ot.Date < ende && ot.Auszahlungsart is object)
|
2023-03-17 22:11:18 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (ot.Auszahlungsart.Name.Contains("FLS"))
|
|
|
|
|
|
ed.Custom12 -= ot.Betrag;
|
|
|
|
|
|
else if (ot.Auszahlungsart.Name.Contains("Rahmenzeit"))
|
|
|
|
|
|
ed.Custom11 -= ot.Betrag;
|
2023-03-17 07:59:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-02-22 10:50:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-17 22:11:18 +01:00
|
|
|
|
ed.Ueberstunden = ed.Ueberstunden - ed.FlsDiff; // <20>berstunden nur Mittelbare
|
|
|
|
|
|
ed.Custom10 = ed.FlsDiff - ed.Custom12; // <20>berstunden lfd. Monat nach Auszahlung nur FLS
|
|
|
|
|
|
ed.Custom9 = (decimal)ed.Ueberstunden - ed.Custom11; // <20>berstunden lfd. Monat nach Auszahlung nur mittelbare
|
|
|
|
|
|
ed.Custom8 = ed.Custom15 + ed.Custom10; // <20>berstundenGesamt nur FLS - abzgl. Auszahlung anteilig
|
|
|
|
|
|
ed.Custom7 = ed.Custom14 + ed.Custom9; // <20>berstundenGesamt nur MB -abzgl.Auszahlung anteilig
|
2023-02-22 10:50:49 +01:00
|
|
|
|
|
2023-02-08 19:02:19 +01:00
|
|
|
|
this.bindingSource1.DataSource = ed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void FillTableData(DateTime monat, MitarbeiterstundenkontoRO.EmployeeDetail ed)
|
|
|
|
|
|
{
|
|
|
|
|
|
decimal kmTotal = 0;
|
|
|
|
|
|
decimal rufTotal = 0;
|
|
|
|
|
|
decimal notdienstTotal = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (ed.ServiceRecordsInSelectedTimeSpan != null)
|
|
|
|
|
|
{
|
2023-02-15 17:33:28 +01:00
|
|
|
|
var sortedServiceRecords = ed.ServiceRecordsInSelectedTimeSpan.OrderBy(sr => sr.Start).ToList();
|
|
|
|
|
|
foreach (var sr in sortedServiceRecords)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
2026-07-17 02:40:28 +02:00
|
|
|
|
if (sr.DistanceInMeter > 0)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
2026-07-17 02:40:28 +02:00
|
|
|
|
kmTotal += sr.DistanceInMeter;
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
AddValueToTableZuschlag(sr);
|
|
|
|
|
|
AddValueToTableLeistungen(sr);
|
2023-03-17 07:59:28 +01:00
|
|
|
|
// In Absprache wird diese Tabelle zur Zeit von Hand bef<65>llt
|
|
|
|
|
|
//AddValueToTableZeitraum(sr, tableZeitraum, beginn);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
BerechneGesamtsummen();
|
2023-02-15 17:33:28 +01:00
|
|
|
|
BerechneSpaltensumme(tableFLS);
|
|
|
|
|
|
BerechneSpaltensumme(tableRahmenzeit);
|
2023-03-17 07:59:28 +01:00
|
|
|
|
AddAbwesenheitToTableLeistungen(ed);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
lblStelle.Text = String.Format("{0:0.00} Std.", notdienstTotal / 60);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void BerechneGesamtsummen()
|
|
|
|
|
|
{
|
|
|
|
|
|
BerechneGesamtsumme(table1.Rows[1], samstag2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(table1.Rows[2], sonntag2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(table1.Rows[3], heiligSil2Minuten);
|
2023-03-17 07:59:28 +01:00
|
|
|
|
//BerechneGesamtsumme(table1.Rows[5], OsterSa2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(table1.Rows[4], feiertag2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(table1.Rows[5], nacht2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(table1.Rows[6], nachtSa2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(table1.Rows[7], nachtSo2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(table1.Rows[8], nachtFe2Minuten);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
BerechneGesamtsumme(tableFLS.Rows[1], direkteBetr2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableFLS.Rows[2], indirekteBetr2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableFLS.Rows[3], vorArbeiten2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableFLS.Rows[4], flsX2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableFLS.Rows[5], flsY2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableRahmenzeit.Rows[1], fobiUrKr2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableRahmenzeit.Rows[2], team2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableRahmenzeit.Rows[3], subervis2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableRahmenzeit.Rows[4], gremArbeit2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableRahmenzeit.Rows[5], div2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableRahmenzeit.Rows[6], fahrzeit2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableRahmenzeit.Rows[7], qz2Minuten);
|
|
|
|
|
|
BerechneGesamtsumme(tableRahmenzeit.Rows[8], leitung2Minuten);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void BerechneGesamtsumme(XRTableRow row, Dictionary<int, double> dict)
|
|
|
|
|
|
{
|
|
|
|
|
|
double gesamt = 0;
|
|
|
|
|
|
for (int i = 1; i <= 31; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (dict.ContainsKey(i))
|
|
|
|
|
|
{
|
|
|
|
|
|
gesamt += dict[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
row.Cells[33].Text = String.Format("{0:0.00}", gesamt / 60);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-15 17:33:28 +01:00
|
|
|
|
private void BerechneSpaltensumme(XRTable table)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 2; i < 33; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
decimal sum = 0;
|
|
|
|
|
|
for (int j = 1; j < table.Rows.Count; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (table.Rows[j].Cells[i].Text != null && table.Rows[j].Cells[i].Text.Length > 0)
|
|
|
|
|
|
sum += Convert.ToDecimal(table.Rows[j].Cells[i].Text);
|
|
|
|
|
|
}
|
|
|
|
|
|
table.Rows.LastRow.Cells[i].Text = String.Format("{0:0.0#}", sum);
|
|
|
|
|
|
}
|
|
|
|
|
|
decimal EndSum = 0;
|
|
|
|
|
|
for (int j = 1; j < table.Rows.Count; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (table.Rows[j].Cells[33].Text != null && table.Rows[j].Cells[33].Text.Length > 0)
|
|
|
|
|
|
EndSum += Convert.ToDecimal(table.Rows[j].Cells[33].Text);
|
|
|
|
|
|
}
|
|
|
|
|
|
table.Rows.LastRow.Cells[33].Text = String.Format("{0:0.00}", EndSum);
|
|
|
|
|
|
}
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
|
|
|
|
|
private void InitTable(DateTime monat)
|
|
|
|
|
|
{
|
|
|
|
|
|
int rowIdx = 0;
|
|
|
|
|
|
|
|
|
|
|
|
foreach (XRTableRow row in table1.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (rowIdx > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool isHeaderRow = false;
|
|
|
|
|
|
|
|
|
|
|
|
int maxDays = 31;
|
|
|
|
|
|
if (rowIdx == 1 || rowIdx == 4 || rowIdx == 7 || rowIdx == 10 || rowIdx == 13)
|
|
|
|
|
|
{
|
|
|
|
|
|
isHeaderRow = true;
|
|
|
|
|
|
int days = DateTime.DaysInMonth(monat.Year, monat.Month);
|
|
|
|
|
|
|
|
|
|
|
|
maxDays = days;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int cellIdx = 0;
|
|
|
|
|
|
foreach (XRTableCell cell in row.Cells)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (cellIdx > 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
cell.Text = "";
|
|
|
|
|
|
if (cellIdx <= 32)
|
|
|
|
|
|
{
|
2024-03-04 15:55:19 +01:00
|
|
|
|
cell.Font = new DevExpress.Drawing.DXFont(cell.Font.Name, 7, DevExpress.Drawing.DXFontStyle.Regular);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-17 22:11:18 +01:00
|
|
|
|
//bool setBackground = false;
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2023-03-17 22:11:18 +01:00
|
|
|
|
//setBackground = !isHeaderRow || (maxDays < 31 && cellIdx > maxDays + 1 && cellIdx <= 32);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2023-03-17 22:11:18 +01:00
|
|
|
|
//if (setBackground)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// cell.BackColor = Color.LightGray;
|
|
|
|
|
|
//}
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
cellIdx++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
rowIdx++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (XRTableRow row in tableFLS.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (rowIdx > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool isHeaderRow = false;
|
|
|
|
|
|
|
|
|
|
|
|
int maxDays = 31;
|
|
|
|
|
|
if (rowIdx == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
isHeaderRow = true;
|
|
|
|
|
|
int days = DateTime.DaysInMonth(monat.Year, monat.Month);
|
|
|
|
|
|
|
|
|
|
|
|
maxDays = days;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
rowIdx++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
private void AddValueToTableZuschlag(StundenkontoServiceRecord sr)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
2026-07-17 02:40:28 +02:00
|
|
|
|
DateTime datum = sr.Start;
|
2023-04-14 13:44:28 +02:00
|
|
|
|
var zs = BerechneZuschlag(sr);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2023-04-14 13:44:28 +02:00
|
|
|
|
if (zs.MinutenHeiligabendSilvester14_21 > 0)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
2023-04-14 13:44:28 +02:00
|
|
|
|
AddValueToCell(zs.MinutenHeiligabendSilvester14_21, datum, table1.Rows[3], heiligSil2Minuten);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
2023-04-14 13:44:28 +02:00
|
|
|
|
else if (zs.MinutenFeiertag6_21 > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddValueToCell(zs.MinutenFeiertag6_21, datum, table1.Rows[4], feiertag2Minuten);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (zs.MinutenSamstag13_21 > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddValueToCell(zs.MinutenSamstag13_21, datum, table1.Rows[1], samstag2Minuten);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (zs.MinutenSonntag6_21 > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddValueToCell(zs.MinutenSonntag6_21, datum, table1.Rows[2], sonntag2Minuten);
|
|
|
|
|
|
}
|
|
|
|
|
|
//if (zs.MinutenOsterPfSa12_24 > 0)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// AddValueToCell(zs.MinutenOsterPfSa12_24, datum, table1.Rows[4], OsterSa2Minuten);
|
|
|
|
|
|
//}
|
|
|
|
|
|
if (zs.MinutenNachtFe21_6 > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddValueToCell(zs.MinutenNachtFe21_6, datum, table1.Rows[8], nachtFe2Minuten);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (zs.MinutenNacht21_6 > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddValueToCell(zs.MinutenNacht21_6, datum, table1.Rows[5], nacht2Minuten);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (zs.MinutenNachtSa21_6 > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddValueToCell(zs.MinutenNachtSa21_6, datum, table1.Rows[6], nachtSa2Minuten);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (zs.MinutenNachtSo21_6 > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddValueToCell(zs.MinutenNachtSo21_6, datum, table1.Rows[7], nachtSo2Minuten);
|
|
|
|
|
|
}
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
private void AddValueToTableLeistungen(StundenkontoServiceRecord sr)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
2026-07-17 02:40:28 +02:00
|
|
|
|
DateTime datum = sr.Start;
|
2023-02-08 19:02:19 +01:00
|
|
|
|
var duration = GetDuration(sr);
|
|
|
|
|
|
Zeitverteilung zv = new Zeitverteilung();
|
|
|
|
|
|
zv.minutenLeistung = CheckUhrzeiten(datum, 0, 24, (double)duration);
|
|
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
if (sr.ServiceDescription.Category.Name.ToLower().Contains("eingliederungshilfe") || sr.ServiceDescription.Category.Name.ToLower().Contains("jugendhilfe")
|
|
|
|
|
|
|| sr.ServiceDescription.Category.Name.ToLower().Contains("qualifizierte assistenz")
|
|
|
|
|
|
|| sr.ServiceDescription.Category.Name.ToLower().Contains("kompensatorische assistenz"))
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
2024-02-23 13:52:02 +01:00
|
|
|
|
if (sr.ServiceDescription.Name.ToLower().StartsWith("indirekte"))
|
2023-04-14 13:44:28 +02:00
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableFLS.Rows[2], indirekteBetr2Minuten);
|
2024-10-03 14:19:33 +02:00
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("nacharbeiten") || sr.ServiceDescription.Name.ToLower().Contains("nachbereiten"))
|
2023-04-14 13:44:28 +02:00
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableFLS.Rows[3], vorArbeiten2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("(x)"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableFLS.Rows[4], flsX2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("(y)"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableFLS.Rows[5], flsY2Minuten);
|
2024-02-23 13:52:02 +01:00
|
|
|
|
//if (sr.ServiceDescription.Name.ToLower().StartsWith("direkte") || sr.ServiceDescription.Name.ToLower().StartsWith("gruppe"))
|
|
|
|
|
|
else
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableFLS.Rows[1], direkteBetr2Minuten);
|
2023-04-14 13:44:28 +02:00
|
|
|
|
}
|
2026-07-17 02:40:28 +02:00
|
|
|
|
else if (sr.ServiceDescription.Category.Name.ToLower().Contains("rahmenzeit"))
|
2023-04-14 13:44:28 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (sr.ServiceDescription.Name.ToLower().Contains("fortbildung"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableRahmenzeit.Rows[1], fobiUrKr2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().StartsWith("team"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableRahmenzeit.Rows[2], team2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("superv"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableRahmenzeit.Rows[3], subervis2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("gremien"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableRahmenzeit.Rows[4], gremArbeit2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("diverses"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableRahmenzeit.Rows[5], div2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("fahrtzeit"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableRahmenzeit.Rows[6], fahrzeit2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("qz"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableRahmenzeit.Rows[7], qz2Minuten);
|
|
|
|
|
|
else if (sr.ServiceDescription.Name.ToLower().Contains("leitung"))
|
|
|
|
|
|
AddValueToCell(zv.minutenLeistung, datum, tableRahmenzeit.Rows[8], leitung2Minuten);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void AddValueToCell(double minuten, DateTime datum, XRTableRow row, Dictionary<int, double> dict)
|
|
|
|
|
|
{
|
|
|
|
|
|
XRTableCell cell = row.Cells[datum.Day + 1];
|
|
|
|
|
|
|
|
|
|
|
|
if (!dict.ContainsKey(datum.Day))
|
|
|
|
|
|
{
|
|
|
|
|
|
dict[datum.Day] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dict[datum.Day] += minuten;
|
2023-02-15 17:33:28 +01:00
|
|
|
|
cell.Text = String.Format("{0:0.0}", dict[datum.Day] / 60);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-17 07:59:28 +01:00
|
|
|
|
private void AddAbwesenheitToTableLeistungen(MitarbeiterstundenkontoRO.EmployeeDetail ed)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ed.Days != null)
|
|
|
|
|
|
foreach (var day in ed.Days)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (day.HoursSick > 0)
|
|
|
|
|
|
AddAbwesenheitToCell(day.Date, "K");
|
|
|
|
|
|
else if (day.HoursInVacation > 0)
|
|
|
|
|
|
AddAbwesenheitToCell(day.Date, "U");
|
2024-02-27 09:19:11 +01:00
|
|
|
|
else if (day.Custom6 != null)
|
|
|
|
|
|
AddAbwesenheitToCell(day.Date, day.Custom6);
|
2023-03-17 07:59:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void AddAbwesenheitToCell(DateTime datum, string abwesenheit)
|
|
|
|
|
|
{
|
|
|
|
|
|
XRTableRow row = tableRahmenzeit.Rows[1];
|
|
|
|
|
|
XRTableCell cell = row.Cells[datum.Day + 1];
|
|
|
|
|
|
cell.Text = abwesenheit;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
private decimal GetDuration(StundenkontoServiceRecord sr)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
|
|
|
|
|
decimal duration = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (sr.GroupRoundedDuration.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
duration = sr.GroupRoundedDuration.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
duration = sr.RoundedDuration;
|
|
|
|
|
|
}
|
2026-07-17 02:40:28 +02:00
|
|
|
|
decimal p = sr.ServiceDescription.Category.ProzentStundenkonto ?? 0;
|
2023-02-08 19:02:19 +01:00
|
|
|
|
if (p != 100 && p > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
duration *= (p / 100);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
p = sr.ServiceDescription.ProzentStundenkonto ?? 0;
|
|
|
|
|
|
if (p != 100 && p > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
duration *= (p / 100);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return duration;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
public virtual Zeitverteilung BerechneZuschlag(StundenkontoServiceRecord sr)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
|
|
|
|
|
Zeitverteilung zv = new Zeitverteilung();
|
2026-07-17 02:40:28 +02:00
|
|
|
|
DateTime datum = sr.Start;
|
2023-02-08 19:02:19 +01:00
|
|
|
|
var duration = GetDuration(sr);
|
|
|
|
|
|
int nachtStart = 21;
|
|
|
|
|
|
|
|
|
|
|
|
if (duration > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (datum.Month == 12 && (datum.Day == 24 || datum.Day == 31))
|
|
|
|
|
|
{
|
|
|
|
|
|
zv.MinutenHeiligabendSilvester14_21 = CheckUhrzeiten(datum, 14, 21, (double) duration);
|
|
|
|
|
|
zv.MinutenNachtFe21_6 = CheckUhrzeiten(datum, nachtStart, 6, (double)duration);
|
|
|
|
|
|
|
2026-07-17 02:40:28 +02:00
|
|
|
|
if (sr.Start.DayOfWeek == DayOfWeek.Saturday)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
|
|
|
|
|
zv.MinutenSamstag13_21 = CheckUhrzeiten(datum, 13, 21, (double) duration);
|
|
|
|
|
|
}
|
2026-07-17 02:40:28 +02:00
|
|
|
|
else if (sr.Start.DayOfWeek == DayOfWeek.Sunday)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
|
|
|
|
|
zv.MinutenSonntag6_21 = CheckUhrzeiten(datum, 6, 21, (double) duration);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//nachtStart = 21;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (_vs.IstFeiertag(datum))
|
|
|
|
|
|
{
|
2023-03-17 07:59:28 +01:00
|
|
|
|
//DateTime OsterSo = GetOsterSonntag(datum.Year);
|
|
|
|
|
|
//if (datum == OsterSo.AddDays(-1) || datum == OsterSo.AddDays(48))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// zv.MinutenOsterPfSa12_24 = CheckUhrzeiten(datum, 12, 24, (double)duration);
|
|
|
|
|
|
// zv.MinutenNachtFe21_6 = CheckUhrzeiten(datum, 24, 6, (double)duration);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
2023-02-08 19:02:19 +01:00
|
|
|
|
zv.MinutenFeiertag6_21 = CheckUhrzeiten(datum, 6, 21, (double)duration);
|
|
|
|
|
|
zv.MinutenNachtFe21_6 = CheckUhrzeiten(datum, nachtStart, 6, (double)duration);
|
2023-03-17 07:59:28 +01:00
|
|
|
|
//}
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
2026-07-17 02:40:28 +02:00
|
|
|
|
else if (sr.Start.DayOfWeek == DayOfWeek.Sunday)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
|
|
|
|
|
zv.MinutenSonntag6_21 = CheckUhrzeiten(datum, 6, 21, (double) duration);
|
|
|
|
|
|
zv.MinutenNachtSo21_6 = CheckUhrzeiten(datum, nachtStart, 6, (double)duration);
|
|
|
|
|
|
}
|
2026-07-17 02:40:28 +02:00
|
|
|
|
else if (sr.Start.DayOfWeek == DayOfWeek.Saturday)
|
2023-02-08 19:02:19 +01:00
|
|
|
|
{
|
|
|
|
|
|
zv.MinutenSamstag13_21 = CheckUhrzeiten(datum, 13, 21, (double) duration);
|
|
|
|
|
|
zv.MinutenNachtFe21_6 = CheckUhrzeiten(datum, nachtStart, 6, (double)duration);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
zv.MinutenNacht21_6 = CheckUhrzeiten(datum, nachtStart, 6, (double) duration);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return zv;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private double CheckUhrzeiten(DateTime start, int startStunde, int endStunde, double minuten)
|
|
|
|
|
|
{
|
2023-09-25 19:03:08 +02:00
|
|
|
|
if (startStunde > 0 && start.Hour == 0 && start.Minute == 0 && start.Second > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2023-02-08 19:02:19 +01:00
|
|
|
|
if (startStunde > endStunde) //Nachts
|
|
|
|
|
|
{
|
|
|
|
|
|
DateTime nachtStartDt = start.Date.AddHours(startStunde);
|
|
|
|
|
|
DateTime nachtEndDt = start.Date.AddDays(1).AddHours(endStunde);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime dtEnd = start.AddMinutes(minuten);
|
|
|
|
|
|
|
|
|
|
|
|
double minutes = GetOverlappingMinutes(start, dtEnd, nachtStartDt, nachtEndDt);
|
|
|
|
|
|
minutes += GetOverlappingMinutes(start, dtEnd, nachtStartDt.AddDays(-1), nachtEndDt.AddDays(-1));
|
|
|
|
|
|
minutes += GetOverlappingMinutes(start, dtEnd, nachtStartDt.AddDays(1), nachtEndDt.AddDays(1));
|
|
|
|
|
|
|
|
|
|
|
|
return minutes;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2023-09-25 19:03:08 +02:00
|
|
|
|
{
|
2023-02-08 19:02:19 +01:00
|
|
|
|
DateTime tagsStartDt = start.Date.AddHours(startStunde);
|
|
|
|
|
|
DateTime tagsEndDt = start.Date.AddHours(endStunde);
|
|
|
|
|
|
DateTime dtEnd = start.AddMinutes(minuten);
|
|
|
|
|
|
double minutes = GetOverlappingMinutes(start, dtEnd, tagsStartDt, tagsEndDt);
|
|
|
|
|
|
return minutes;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private double GetOverlappingMinutes(DateTime start, DateTime end, DateTime start2, DateTime end2)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (end > start2 && start < end2)
|
|
|
|
|
|
{
|
|
|
|
|
|
DateTime dtStart = start;
|
|
|
|
|
|
|
|
|
|
|
|
if (dtStart < start2)
|
|
|
|
|
|
dtStart = start2;
|
|
|
|
|
|
|
|
|
|
|
|
DateTime dtEnd = end;
|
|
|
|
|
|
|
|
|
|
|
|
if (dtEnd > end2)
|
|
|
|
|
|
dtEnd = end2;
|
|
|
|
|
|
TimeSpan ts = dtEnd.Subtract(dtStart);
|
|
|
|
|
|
|
|
|
|
|
|
return ts.TotalMinutes;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-17 07:59:28 +01:00
|
|
|
|
//protected DateTime GetOsterSonntag(int year)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// return VacationService.GetOsterSonntag(year);
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
// In Absprache wird diese Tabelle zur Zeit von Hand bef<65>llt
|
|
|
|
|
|
//private void AddValueToTableZeitraum(ServiceRecord sr, XRTable table, Dictionary<int, DateTime> beginn)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// DateTime start = sr.Start.Value;
|
|
|
|
|
|
// DateTime ende = sr.End.Value;
|
|
|
|
|
|
// if (!beginn.ContainsKey(start.Day))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// beginn[start.Day] = start;
|
|
|
|
|
|
// if (start.Hour >= 8 && start.Hour <= 21 && ende.Hour >= 8 && ende.Hour < 21)
|
|
|
|
|
|
// table.Rows[1].Cells[start.Day].Text = "X";
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// table.Rows[2].Cells[start.Day].Text = String.Format("{0:HH:mm}", start);
|
|
|
|
|
|
// table.Rows[3].Cells[ende.Day].Text = String.Format("{0:HH:mm}", ende);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (ende.Hour < 8 && ende.Hour >= 21)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// table.Rows[1].Cells[start.Day].Text = "";
|
|
|
|
|
|
// table.Rows[2].Cells[start.Day].Text = String.Format("{0:HH:mm}", beginn[start.Day]);
|
|
|
|
|
|
// table.Rows[3].Cells[ende.Day].Text = String.Format("{0:HH:mm}", ende);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else if (beginn[start.Day].Hour >= 8 && beginn[start.Day].Hour <= 21 && ende.Hour >= 8 && ende.Hour < 21)
|
|
|
|
|
|
// table.Rows[1].Cells[start.Day].Text = "X";
|
|
|
|
|
|
// }
|
2023-02-15 17:33:28 +01:00
|
|
|
|
}
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class Zeitverteilung
|
|
|
|
|
|
{
|
|
|
|
|
|
public double MinutenSamstag13_21 { get; set; }
|
|
|
|
|
|
public double MinutenSonntag6_21 { get; set; }
|
|
|
|
|
|
public double MinutenFeiertag6_21 { get; set; }
|
|
|
|
|
|
public double MinutenHeiligabendSilvester14_21 { get; set; }
|
2023-03-17 07:59:28 +01:00
|
|
|
|
//public double MinutenOsterPfSa12_24 { get; set; }
|
2023-02-08 19:02:19 +01:00
|
|
|
|
public double MinutenNacht21_6 { get; set; }
|
|
|
|
|
|
public double MinutenNachtSa21_6 { get; set; }
|
|
|
|
|
|
public double MinutenNachtSo21_6 { get; set; }
|
|
|
|
|
|
public double MinutenNachtFe21_6 { get; set; }
|
|
|
|
|
|
public double minutenLeistung { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
}
|