MitarbeiterstundenkontoBerechnung GetDuration in Report.dll und ein paar Projekten
This commit is contained in:
@@ -975,7 +975,7 @@ namespace BeWo.Report.ReportObjects
|
||||
|
||||
String test = String.Format("{0:dd.MM. HH:mm} - {1:HH:mm}, {2}", item.Start, item.End, item.RoundedDuration);
|
||||
|
||||
decimal duration = GetDuration(item);
|
||||
decimal duration = GetDuration(item, empDetail);
|
||||
|
||||
|
||||
|
||||
@@ -1329,7 +1329,7 @@ namespace BeWo.Report.ReportObjects
|
||||
|
||||
if (!IsServiceRecordFehlzeit(sr) && AddServiceRecordToDuration(sr))
|
||||
{
|
||||
decimal duration = GetDuration(sr);
|
||||
decimal duration = GetDuration(sr, ed);
|
||||
|
||||
|
||||
dd.MinutesTotal += duration;
|
||||
@@ -1364,7 +1364,7 @@ namespace BeWo.Report.ReportObjects
|
||||
{
|
||||
continue;
|
||||
}
|
||||
decimal duration = GetDuration(sr);
|
||||
decimal duration = GetDuration(sr, ed);
|
||||
|
||||
|
||||
DateTime dtEnd = sr.Start.Value.AddMinutes((double)duration);
|
||||
@@ -1471,7 +1471,7 @@ namespace BeWo.Report.ReportObjects
|
||||
var dd = CreateDayDetail(sr.Start.Value, ed);
|
||||
details.Add(dd);
|
||||
|
||||
decimal duration = GetDuration(sr);
|
||||
decimal duration = GetDuration(sr, ed);
|
||||
|
||||
|
||||
dd.MinutesTotal += duration;
|
||||
@@ -1499,7 +1499,7 @@ namespace BeWo.Report.ReportObjects
|
||||
return details.OrderBy(dd => dd.Date).ToList();
|
||||
}
|
||||
|
||||
protected virtual decimal GetDuration(ServiceRecord sr)
|
||||
protected virtual decimal GetDuration(ServiceRecord sr, MitarbeiterstundenkontoRO.EmployeeDetail ed)
|
||||
{
|
||||
decimal duration = 0;
|
||||
|
||||
@@ -1983,7 +1983,7 @@ namespace BeWo.Report.ReportObjects
|
||||
if (AddServiceRecordToDuration(item))
|
||||
{
|
||||
|
||||
decimal duration = GetDuration(item);
|
||||
decimal duration = GetDuration(item, edOrig);
|
||||
|
||||
|
||||
minutenMonat += duration;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace AWOMuensterlandRecklinghausen
|
||||
private decimal maxWochenstunden = 40;
|
||||
private const int ANZ_WOCHENTAGE = 5;
|
||||
|
||||
private CustomVacationService customVacationService = new CustomVacationService();
|
||||
private CustomVacationService customVacationService = new CustomVacationService();
|
||||
|
||||
public override List<DateTime> GetFeiertage(int year)
|
||||
{
|
||||
@@ -30,7 +30,6 @@ namespace AWOMuensterlandRecklinghausen
|
||||
protected override void StarteBerechnung(DateTime berichtsAnfang, DateTime berichtsEnde, MitarbeiterstundenkontoRO.EmployeeDetail empDetail)
|
||||
{
|
||||
BerechneFerienTage = false;
|
||||
|
||||
var c = empDetail.Employee.GetValidContractForDate(berichtsAnfang);
|
||||
if (c?.EmploymentType != null)
|
||||
{
|
||||
@@ -79,15 +78,11 @@ namespace AWOMuensterlandRecklinghausen
|
||||
{
|
||||
if (sr.Start.HasValue && sr.Start >= berichtStart && sr.Start < berichtEnde && sr.End.HasValue)
|
||||
{
|
||||
//if (sr.Start.Value.Day == 8)
|
||||
//{
|
||||
// int test = 0;
|
||||
//}
|
||||
if (!IsServiceRecordFehlzeit(sr) && AddServiceRecordToDuration(sr) && !(sr.ServiceDescription.Name.Contains("TAN") && sr.DurationMinutes == 0))
|
||||
{
|
||||
var dd = CreateDayDetail(sr.Start.Value, ed);
|
||||
details.Add(dd);
|
||||
decimal duration = GetDuration(sr);
|
||||
decimal duration = GetDuration(sr, ed);
|
||||
|
||||
dd.MinutesTotal += duration;
|
||||
if (dd.ServiceRecords == null)
|
||||
@@ -101,7 +96,6 @@ namespace AWOMuensterlandRecklinghausen
|
||||
dd.StartDateTime1 = sr.Start;
|
||||
dd.EndDateTime1 = dtEnd;
|
||||
}
|
||||
|
||||
CalculateSpecialHours(dd, sr, duration);
|
||||
}
|
||||
}
|
||||
@@ -144,6 +138,112 @@ namespace AWOMuensterlandRecklinghausen
|
||||
return dd;
|
||||
}
|
||||
|
||||
public override decimal BerechneSollStundenFuerTag(MitarbeiterstundenkontoRO.EmployeeDetail ed, DateTime date)
|
||||
{
|
||||
decimal sollDiesenTag = 0;
|
||||
var faktor = GetFeiertagsFaktor(date);
|
||||
decimal vertragsSoll = 0;
|
||||
|
||||
if (faktor < 1)
|
||||
{
|
||||
//Berechne Soll, entweder aus Vertrag oder Arbeitszeiten
|
||||
if (HatArbeitszeitImZeitraum(ed.Employee.Arbeitszeiten, date, date))
|
||||
{
|
||||
sollDiesenTag = GetSollNachArbeitszeitenFuerTag(ed.Employee, date);
|
||||
}
|
||||
else
|
||||
{
|
||||
var c = ed.Employee.GetValidContractForDate(date);
|
||||
if (c != null)
|
||||
{
|
||||
decimal wth = 0;
|
||||
int apw = ANZ_WOCHENTAGE;
|
||||
if (c.WeeklyDays.HasValue && c.WeeklyDays.Value > 0)
|
||||
{
|
||||
apw = c.WeeklyDays.Value;
|
||||
}
|
||||
if (c.WeeklyTotalHours.HasValue)
|
||||
{
|
||||
wth = c.WeeklyTotalHours.Value;
|
||||
}
|
||||
if (c.Notice != null && c.Notice == "Done")
|
||||
{
|
||||
vertragsSoll = wth / apw;
|
||||
wth = Math.Round(wth / 117 * 100, 2, MidpointRounding.AwayFromZero); // Soll-Stunden für Überstunden ohne Faktor
|
||||
}
|
||||
else if (c.MonthlyTotalHours.HasValue && ed.ArbeitstageImBerichtszeitraum > 0)
|
||||
{
|
||||
wth = c.MonthlyTotalHours.Value / ed.ArbeitstageImBerichtszeitraum;
|
||||
wth *= apw;
|
||||
}
|
||||
|
||||
|
||||
sollDiesenTag = wth / apw;
|
||||
|
||||
bool istWochenende = date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday;
|
||||
if (apw == 6)
|
||||
{
|
||||
istWochenende = date.DayOfWeek == DayOfWeek.Sunday;
|
||||
}
|
||||
else if (apw > 6)
|
||||
{
|
||||
istWochenende = false;
|
||||
}
|
||||
if (istWochenende)
|
||||
{
|
||||
sollDiesenTag = 0;
|
||||
}
|
||||
}
|
||||
if (faktor != 0)
|
||||
{
|
||||
sollDiesenTag *= faktor; //halbe Feiertage etc. berücksichtigen
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ed.AllServiceRecords != null && ed.AllServiceRecords.Count > 0)
|
||||
{
|
||||
foreach (var item in ed.AllServiceRecords)
|
||||
{
|
||||
if (item.ServiceDescription != null && (item.ServiceDescription.Name.Contains("UT") || item.ServiceDescription.Name.Contains("Unterrichtsfrei")) && item.Start.Value.Date == date.Date)
|
||||
{
|
||||
if (HatArbeitszeitImZeitraum(ed.Employee.Arbeitszeiten, date, date))
|
||||
{
|
||||
var c = ed.Employee.GetValidContractForDate(date);
|
||||
if (c != null)
|
||||
{
|
||||
decimal wth = 0;
|
||||
int apw = ANZ_WOCHENTAGE;
|
||||
if (c.WeeklyDays.HasValue && c.WeeklyDays.Value > 0)
|
||||
{
|
||||
apw = c.WeeklyDays.Value;
|
||||
}
|
||||
if (c.WeeklyTotalHours.HasValue)
|
||||
{
|
||||
wth = c.WeeklyTotalHours.Value;
|
||||
}
|
||||
if (c.Notice != null && c.Notice == "Done")
|
||||
{
|
||||
vertragsSoll = wth / apw;
|
||||
wth = Math.Round(wth / 117 * 100, 2, MidpointRounding.AwayFromZero); // Soll-Stunden für Überstunden ohne Faktor
|
||||
}
|
||||
else if (c.MonthlyTotalHours.HasValue && ed.ArbeitstageImBerichtszeitraum > 0)
|
||||
{
|
||||
wth = c.MonthlyTotalHours.Value / ed.ArbeitstageImBerichtszeitraum;
|
||||
wth *= apw;
|
||||
}
|
||||
sollDiesenTag = wth / apw;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sollDiesenTag = vertragsSoll;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sollDiesenTag;
|
||||
}
|
||||
|
||||
public override void CalculateSpecialHours(MitarbeiterstundenkontoRO.DayDetail dd, ServiceRecord sr, decimal duration)
|
||||
{
|
||||
if (!sr.Start.HasValue || dd.NightStart == null || dd.NightEnd == null)
|
||||
@@ -174,34 +274,25 @@ namespace AWOMuensterlandRecklinghausen
|
||||
dd.HoursSaturday += (decimal)d1.GetIntersectingMinutes(unroundedEnd, saturdayStart, saturdayEnd);
|
||||
}
|
||||
|
||||
public override void HandleServiceRecord(MitarbeiterstundenkontoRO.EmployeeDetail emp, ServiceRecord item)
|
||||
protected override decimal GetDuration(ServiceRecord item, MitarbeiterstundenkontoRO.EmployeeDetail ed)
|
||||
{
|
||||
decimal duration = 0;
|
||||
var duration = base.GetDuration(item, ed);
|
||||
|
||||
if (item.GroupRoundedDuration.HasValue)
|
||||
if (item.ServiceDescription != null && (item.ServiceDescription.Name.Contains("UT") || item.ServiceDescription.Name.Contains("Unterrichtsfrei")))
|
||||
{
|
||||
duration = item.GroupRoundedDuration.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
duration = item.RoundedDuration;
|
||||
}
|
||||
|
||||
if (item.ServiceDescription != null && (item.ServiceDescription.Name.Contains("UT") || item.ServiceDescription.Name.Contains("Unterrichtsfrei")))
|
||||
{
|
||||
if (emp.Custom6 > 360)
|
||||
duration = ed.Custom6;
|
||||
if (ed.Custom6 > 360)
|
||||
{
|
||||
emp.Custom6 = emp.Custom6 + 30;
|
||||
duration += 30;
|
||||
}
|
||||
duration = emp.Custom6;
|
||||
}
|
||||
|
||||
if (!item.Notice.IsNullOrEmpty() && item.Notice.StartsWith("KF-Pauschale"))
|
||||
{
|
||||
duration = 645;
|
||||
}
|
||||
if (!item.Notice.IsNullOrEmpty() && item.Notice.StartsWith("KF-Pauschale"))
|
||||
{
|
||||
duration = 645;
|
||||
}
|
||||
|
||||
var d1 = item.Start.Value;
|
||||
var d1 = item.Start.Value;
|
||||
//if (item.Start.Value > new DateTime(2023, 05, 19))
|
||||
//{
|
||||
// string test = "jep";
|
||||
@@ -223,384 +314,69 @@ namespace AWOMuensterlandRecklinghausen
|
||||
{
|
||||
duration += HoursSaturday * (decimal)0.2;
|
||||
}
|
||||
item.RoundedDuration = duration;
|
||||
return duration;
|
||||
}
|
||||
|
||||
|
||||
public override void HandleServiceRecords(MitarbeiterstundenkontoRO.EmployeeDetail empDetail, IList<ServiceRecord> groupFilteredRecords, Contract contract)
|
||||
{
|
||||
groupFilteredRecords = groupFilteredRecords.Where(r => r.ServiceDescription != null && r.ServiceDescription.Name.Contains("TAN")).ToList();
|
||||
|
||||
CorrectOverlappingTimes(groupFilteredRecords.OrderBy(s => s.Start).ToList());
|
||||
}
|
||||
|
||||
public override MitarbeiterstundenkontoRO.EmployeeDetail BerechneUeberstundenBis(MitarbeiterstundenkontoRO.EmployeeDetail edOrig, IList<ServiceRecord> records, DateTime monat, out decimal? ueberstunden, out decimal alteExtraUeberstunden)
|
||||
public override Contract GetContractForDate(Employee emp, DateTime start, DateTime ende)
|
||||
{
|
||||
var edTotal = base.BerechneUeberstundenBis(edOrig, records, monat, out ueberstunden, out alteExtraUeberstunden);
|
||||
|
||||
edOrig.Custom4 = edTotal.StundenSollOhneUrlaubKrankheit; // Soll in den Vormonaten
|
||||
|
||||
return edTotal;
|
||||
var c = base.GetContractForDate(emp, start, ende);
|
||||
if (c != null)
|
||||
{
|
||||
if (c.EmploymentType != null && c.EmploymentType.Name.StartsWith("MA mit"))
|
||||
{
|
||||
if (c.WeeklyTotalHours != null)
|
||||
{
|
||||
if (c.Notice == null || (c.Notice != null && c.Notice != "Done"))
|
||||
{
|
||||
c.WeeklyTotalHours += c.WeeklyTotalHours.Value * 0.17m;
|
||||
c.Notice = "Done";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
public override void CreateEmployeeDetails(MitarbeiterstundenkontoRO ro)
|
||||
{
|
||||
//zwei Anpassungen: a) Für MA mit Ferienausgleich -> Sollstd + 17 %
|
||||
// b) Abwesenheiten durch Servicerecords ganz am Ende
|
||||
foreach (var empDetail in ro.EmployeeDetailList)
|
||||
{
|
||||
//zwei Anpassungen: a) Für MA mit Ferienausgleich -> Sollstd + 17 % in GetContractForDate
|
||||
// b) Abwesenheiten durch Servicerecords
|
||||
|
||||
DateTime monatsAnfang = ro.ReportStartDate;
|
||||
DateTime monatsEnde = monatsAnfang.AddMonths(1);
|
||||
DateTime berichtsAnfang = monatsAnfang;
|
||||
DateTime berichtsEnde = monatsEnde;
|
||||
|
||||
Employee emp = empDetail.Employee;
|
||||
|
||||
decimal bu = 0;
|
||||
|
||||
var c = GetContractForDate(emp, ro.ReportStartDate, ro.ReportEndDate);
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
if (c.EntryDate.HasValue && c.EntryDate > monatsAnfang)
|
||||
{
|
||||
berichtsAnfang = c.EntryDate.Value;
|
||||
}
|
||||
if (c.ContractEndDate.HasValue && c.ContractEndDate < monatsEnde)
|
||||
{
|
||||
berichtsEnde = c.ContractEndDate.Value.Date.AddDays(1);
|
||||
}
|
||||
empDetail.HasContract = true;
|
||||
}
|
||||
|
||||
ServiceRecordSummary summaryTotal = new ServiceRecordSummary();
|
||||
summaryTotal.RecordsImBerichtszeitraum = new List<ServiceRecord>();
|
||||
|
||||
decimal pause1 = 0;
|
||||
decimal pause2 = 0;
|
||||
decimal weeklyTotalHours = 0;
|
||||
decimal flsSollGesamt = 0;
|
||||
decimal? fehlZeitenGesamt = null;
|
||||
decimal? tageUrlaubGesamt = null;
|
||||
decimal? tageKrankheitGesamt = null;
|
||||
decimal? abwesenheitTageGesamt = null;
|
||||
decimal workdaysTotal = 0;
|
||||
decimal stundenSollGesamt = 0;
|
||||
decimal tatSollStdGesamt = 0;
|
||||
|
||||
IList<ServiceRecord> groupFilteredRecords = empDetail.AllServiceRecords;
|
||||
|
||||
if (groupFilteredRecords == null)
|
||||
{
|
||||
IList<ServiceRecord> recordsAll = DAOFactory.SearchDAO.FindServiceRecords(emp.Oid, null);
|
||||
recordsAll = AnalysisServiceImp.FilterActiveServiceRecords(recordsAll);
|
||||
|
||||
//
|
||||
groupFilteredRecords = new List<ServiceRecord>();
|
||||
Dictionary<long, bool> groupBookingDict = new Dictionary<long, bool>();
|
||||
foreach (var item in recordsAll)
|
||||
{
|
||||
|
||||
if (!item.GroupOid.HasValue || !groupBookingDict.ContainsKey(item.GroupOid.Value))
|
||||
{
|
||||
groupFilteredRecords.Add(item);
|
||||
if (item.GroupOid.HasValue)
|
||||
{
|
||||
groupBookingDict.Add(item.GroupOid.Value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
empDetail.AllServiceRecords = groupFilteredRecords;
|
||||
}
|
||||
while (berichtsAnfang < berichtsEnde)
|
||||
{
|
||||
StarteBerechnung(berichtsAnfang, berichtsEnde, empDetail);
|
||||
|
||||
empDetail.ArbeitstageImBerichtszeitraum = GetArbeitstageImBereich(berichtsAnfang, berichtsEnde, emp);
|
||||
empDetail.ArbeitstageProWoche = ANZ_WOCHENTAGE;
|
||||
|
||||
|
||||
workdaysTotal += empDetail.ArbeitstageImBerichtszeitraum;
|
||||
weeklyTotalHours = 0;
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
if (c.WeeklyTotalHours.HasValue)
|
||||
{
|
||||
empDetail.Custom6 = c.WeeklyTotalHours.Value;
|
||||
if (c.EmploymentType != null && c.EmploymentType.Name.StartsWith("MA mit"))
|
||||
{
|
||||
weeklyTotalHours = c.WeeklyTotalHours.Value + (c.WeeklyTotalHours.Value * 0.17m);
|
||||
}
|
||||
else
|
||||
{
|
||||
weeklyTotalHours = c.WeeklyTotalHours.Value;
|
||||
}
|
||||
bu = weeklyTotalHours / this.maxWochenstunden;
|
||||
}
|
||||
if (c.WeeklyDays.HasValue && c.WeeklyDays.Value > 0)
|
||||
{
|
||||
empDetail.ArbeitstageProWoche = c.WeeklyDays.Value;
|
||||
}
|
||||
|
||||
|
||||
empDetail.WeeklyFLS = c.WeeklyFLS;
|
||||
empDetail.HourlyRate = c.HourlyRate;
|
||||
empDetail.EmploymentType = c.EmploymentType;
|
||||
}
|
||||
empDetail.Custom6 = empDetail.Custom6 * 60 / empDetail.ArbeitstageProWoche; // echte Sollzeit auch für MA-Mit Ferienausgleich
|
||||
empDetail.SollProTag = weeklyTotalHours / empDetail.ArbeitstageProWoche;
|
||||
empDetail.SollProWoche = weeklyTotalHours; //BerechneSollProWoche(c, empDetail);
|
||||
|
||||
HandleServiceRecords(empDetail, groupFilteredRecords, c);
|
||||
|
||||
if (CheckIst)
|
||||
{
|
||||
|
||||
var summary = BerechneStunden(empDetail, groupFilteredRecords, berichtsAnfang, berichtsEnde);
|
||||
summaryTotal.IstAbrechenbar += summary.IstAbrechenbar;
|
||||
summaryTotal.IstNichtAbrechenbar += summary.IstNichtAbrechenbar;
|
||||
summaryTotal.RecordsImBerichtszeitraum.AddRange(summary.RecordsImBerichtszeitraum);
|
||||
|
||||
if (SollPauseBerechnen())
|
||||
{
|
||||
pause1 += BerechnePauseMinuten(summary.RecordsImBerichtszeitraum);
|
||||
pause2 += BerechneAutoPausen(summary.RecordsImBerichtszeitraum);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
decimal? stundenSollProMonat = null;
|
||||
decimal? stundenSollImVertragsUndBerichtzeitraum = null;
|
||||
if (empDetail.HasContract)
|
||||
{
|
||||
stundenSollImVertragsUndBerichtzeitraum = GetSollNachArbeitszeiten(empDetail.Employee, berichtsAnfang, berichtsEnde);
|
||||
}
|
||||
|
||||
if (!stundenSollImVertragsUndBerichtzeitraum.HasValue)
|
||||
{
|
||||
stundenSollProMonat = BerechneSollProMonat(emp, berichtsAnfang, berichtsEnde);
|
||||
stundenSollImVertragsUndBerichtzeitraum = stundenSollProMonat;
|
||||
}
|
||||
|
||||
if (!stundenSollImVertragsUndBerichtzeitraum.HasValue)
|
||||
{
|
||||
if (!stundenSollImVertragsUndBerichtzeitraum.HasValue)
|
||||
{
|
||||
if (empDetail.ArbeitstageProWoche <= 5)
|
||||
{
|
||||
stundenSollImVertragsUndBerichtzeitraum =
|
||||
empDetail.ArbeitstageImBerichtszeitraum * (weeklyTotalHours / 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
stundenSollImVertragsUndBerichtzeitraum =
|
||||
empDetail.ArbeitstageImBerichtszeitraum * (weeklyTotalHours / empDetail.ArbeitstageProWoche);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stundenSollGesamt += stundenSollImVertragsUndBerichtzeitraum ?? 0;
|
||||
|
||||
|
||||
empDetail.StundenSollMax = stundenSollGesamt;
|
||||
|
||||
|
||||
var tatSollStdImVertragsUndBerichtzeitraum = stundenSollImVertragsUndBerichtzeitraum ?? 0;
|
||||
|
||||
|
||||
decimal? fehlZeiten = GetFehlzeiten(groupFilteredRecords, berichtsAnfang, berichtsEnde);
|
||||
if (fehlZeiten.HasValue)
|
||||
{
|
||||
if (!fehlZeitenGesamt.HasValue)
|
||||
fehlZeitenGesamt = 0;
|
||||
fehlZeitenGesamt += fehlZeiten;
|
||||
|
||||
tatSollStdImVertragsUndBerichtzeitraum -= fehlZeiten.Value;
|
||||
}
|
||||
|
||||
AktuellBearbeitetesEmployeeDetail = empDetail;
|
||||
var ath = GetAbsenceTimeDaysWithWorkWeeks(emp, berichtsAnfang, berichtsEnde, empDetail.ArbeitstageProWoche);
|
||||
empDetail.AbsenceTimeDays = ath;
|
||||
|
||||
if (ath.TageUrlaub.HasValue)
|
||||
{
|
||||
if (!tageUrlaubGesamt.HasValue)
|
||||
tageUrlaubGesamt = 0;
|
||||
tageUrlaubGesamt += ath.TageUrlaub;
|
||||
}
|
||||
if (ath.TageKrankheit.HasValue)
|
||||
{
|
||||
if (!tageKrankheitGesamt.HasValue)
|
||||
tageKrankheitGesamt = 0;
|
||||
tageKrankheitGesamt += ath.TageKrankheit;
|
||||
}
|
||||
|
||||
|
||||
if (ath.TageGesamt.HasValue)
|
||||
{
|
||||
if (!abwesenheitTageGesamt.HasValue)
|
||||
abwesenheitTageGesamt = 0;
|
||||
abwesenheitTageGesamt += ath.TageGesamt;
|
||||
|
||||
var minusStunden = BerechneStundenDurchAbwesenheiten(ath, berichtsAnfang, berichtsEnde, c, empDetail);
|
||||
tatSollStdImVertragsUndBerichtzeitraum -= minusStunden;
|
||||
if (tatSollStdImVertragsUndBerichtzeitraum < 0 && !StundenDurchAbwesenheitenDuerfenNegativSein())
|
||||
{
|
||||
|
||||
tatSollStdImVertragsUndBerichtzeitraum = 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var ath2 = GetAbwesenheitenDurchServiceRecords(empDetail, c, groupFilteredRecords, berichtsAnfang, berichtsEnde);
|
||||
|
||||
if (ath2 != null)
|
||||
{
|
||||
|
||||
var stunden = ath2.StundenKrankheit + ath2.StundenUrlaub + ath2.StundenSonstiges;
|
||||
|
||||
tatSollStdImVertragsUndBerichtzeitraum -= stunden;
|
||||
|
||||
if (tatSollStdImVertragsUndBerichtzeitraum < 0 && !StundenDurchAbwesenheitenDuerfenNegativSein())
|
||||
{
|
||||
tatSollStdImVertragsUndBerichtzeitraum = 0;
|
||||
}
|
||||
|
||||
if (empDetail.SollProTag > 0)
|
||||
{
|
||||
if (!abwesenheitTageGesamt.HasValue)
|
||||
abwesenheitTageGesamt = 0;
|
||||
abwesenheitTageGesamt += stunden / empDetail.SollProTag;
|
||||
|
||||
if (ath2.StundenKrankheit > 0)
|
||||
{
|
||||
if (!tageKrankheitGesamt.HasValue)
|
||||
{
|
||||
tageKrankheitGesamt = 0;
|
||||
}
|
||||
tageKrankheitGesamt += ath2.StundenKrankheit / empDetail.SollProTag;
|
||||
}
|
||||
|
||||
if (ath2.StundenUrlaub > 0)
|
||||
{
|
||||
if (!tageUrlaubGesamt.HasValue)
|
||||
{
|
||||
tageUrlaubGesamt = 0;
|
||||
}
|
||||
tageUrlaubGesamt += ath2.StundenUrlaub / empDetail.SollProTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tatSollStdGesamt += tatSollStdImVertragsUndBerichtzeitraum;
|
||||
flsSollGesamt += BerechneFlsSoll(emp, c, berichtsAnfang, berichtsEnde, tatSollStdImVertragsUndBerichtzeitraum, stundenSollProMonat);
|
||||
berichtsAnfang = berichtsEnde;
|
||||
berichtsEnde = monatsEnde;
|
||||
c = GetNextValidContractForDate(berichtsAnfang, emp);
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
if (c.EntryDate.HasValue && c.EntryDate >= berichtsAnfang)
|
||||
berichtsAnfang = c.EntryDate.Value;
|
||||
if (c.ContractEndDate.HasValue && c.ContractEndDate < monatsEnde)
|
||||
{
|
||||
berichtsEnde = c.ContractEndDate.Value.Date.AddDays(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (AddRateFactorToIst() != 1)
|
||||
{
|
||||
summaryTotal.IstAbrechenbar *= AddRateFactorToIst();
|
||||
}
|
||||
summaryTotal.IstAbrechenbar /= 60m;
|
||||
summaryTotal.IstNichtAbrechenbar /= 60m;
|
||||
|
||||
empDetail.WorkDaysThisMonth = workdaysTotal;
|
||||
//decimal stundenSollMax = arbeitstage * (maxWochenstunden / xxx) * bu;
|
||||
|
||||
|
||||
|
||||
empDetail.Fehlzeiten = fehlZeitenGesamt;
|
||||
empDetail.TageUrlaub = tageUrlaubGesamt;
|
||||
empDetail.TageKrankheit = tageKrankheitGesamt;
|
||||
empDetail.UrlaubUndKrankheit = abwesenheitTageGesamt;
|
||||
empDetail.StundenSollOhneUrlaubKrankheit = tatSollStdGesamt;
|
||||
empDetail.FlsSoll = flsSollGesamt;
|
||||
empDetail.MittelbarIst = summaryTotal.IstNichtAbrechenbar;
|
||||
empDetail.Bu = bu;
|
||||
empDetail.FlsIst = summaryTotal.IstAbrechenbar;
|
||||
empDetail.FlsDiff = summaryTotal.IstAbrechenbar - empDetail.FlsSoll;
|
||||
empDetail.StundenMittelbarIst = summaryTotal.IstNichtAbrechenbar;
|
||||
empDetail.StundenGesamtIst = summaryTotal.IstAbrechenbar + summaryTotal.IstNichtAbrechenbar;
|
||||
|
||||
empDetail.StundenGesamtIst -= pause1 / 60;
|
||||
empDetail.StundenGesamtIst -= pause2 / 60;
|
||||
|
||||
if (empDetail.FlsSoll != 0)
|
||||
empDetail.RelationIstSoll = (empDetail.FlsIst / empDetail.FlsSoll) * 100m;
|
||||
|
||||
|
||||
decimal? ueberstunden = empDetail.StundenGesamtIst - empDetail.StundenSollOhneUrlaubKrankheit;
|
||||
decimal? ueberstundenVormonat;
|
||||
|
||||
|
||||
decimal alteExtraUeberstunden = 0;
|
||||
BerechneUeberstundenBis(empDetail, groupFilteredRecords, ro.ReportStartDate, out ueberstundenVormonat,
|
||||
out alteExtraUeberstunden); // ABCDEF statt alle SR alle Diensteinträge abarbeiten
|
||||
|
||||
var alleDiensteintraege = DAOFactory.GenericDAO.GetAllActive<DienstEintrag>().Where(d => d.EmployeeOid == empDetail.Employee.Oid).ToList();
|
||||
var alleDienstvertretungen = DAOFactory.GenericDAO.GetAllActive<Dienstvertretung>().Where(d => d.EmployeeOid == empDetail.Employee.Oid).ToList();
|
||||
|
||||
decimal? ueberstundenVormonatFuerDienstplanung;
|
||||
decimal? alteExtraUeberstundenDienstplanung;
|
||||
empDetail.DienstplanIst += BerechneDienstplanIst(empDetail, alleDiensteintraege, alleDienstvertretungen, ro.ReportStartDate,
|
||||
out ueberstundenVormonatFuerDienstplanung, out alteExtraUeberstundenDienstplanung); // ABCDEF
|
||||
|
||||
var dienstplanIstAlsStunden = empDetail.DienstplanIst / 60;
|
||||
|
||||
decimal extraStunden = 0;
|
||||
|
||||
BerechneExtraUeberstunden(emp, monatsAnfang, monatsEnde, out extraStunden); // OverTimes
|
||||
|
||||
if (ShouldCreateDayDetails())
|
||||
{
|
||||
|
||||
empDetail.Days = CreateDayDetails(monatsAnfang, monatsEnde, empDetail, summaryTotal.RecordsImBerichtszeitraum);
|
||||
var ah = GetAdditionalHours(empDetail.Days, monatsAnfang, monatsEnde, empDetail, summaryTotal.RecordsImBerichtszeitraum);
|
||||
ueberstunden += ah;
|
||||
empDetail.StundenGesamtIst += ah;
|
||||
}
|
||||
|
||||
if (empDetail.StundenGesamtIst != 0)
|
||||
empDetail.RelationFlsZuMittelbar = (summaryTotal.IstAbrechenbar / empDetail.StundenGesamtIst) * 100;
|
||||
|
||||
empDetail.Ueberstunden = ueberstunden;
|
||||
empDetail.UeberstundenVormonat = ueberstundenVormonat;
|
||||
if (!empDetail.UeberstundenGesamt.HasValue)
|
||||
empDetail.UeberstundenGesamt = ((ueberstundenVormonat ?? 0) + (ueberstunden ?? 0)) + extraStunden;
|
||||
else
|
||||
empDetail.UeberstundenGesamt += ((ueberstundenVormonat ?? 0) + (ueberstunden ?? 0)) + extraStunden;
|
||||
empDetail.UeberstundenAusbezahlt = extraStunden;
|
||||
|
||||
//Urlaubskonto (todo)
|
||||
empDetail.UrlaubGesamtImAktuellenJahr =
|
||||
GetAbsenceTimeDaysWithWorkWeeks(emp, new DateTime(monatsAnfang.Year, 1, 1), monatsEnde, empDetail.ArbeitstageProWoche).TageUrlaub;
|
||||
|
||||
CalculateEmployeeSalary(empDetail, berichtsAnfang, berichtsEnde);
|
||||
}
|
||||
|
||||
ro.EmployeeDetailList = FilterEmployeeList(ro.EmployeeDetailList);
|
||||
|
||||
foreach (var ed in ro.EmployeeDetailList)
|
||||
foreach (var ed in ro.EmployeeDetailList)
|
||||
{
|
||||
var c = ed.Employee.GetValidContractForDate(ro.ReportStartDate);
|
||||
if (c != null)
|
||||
{
|
||||
if (c.EmploymentType != null && c.EmploymentType.Name.StartsWith("MA mit"))
|
||||
{
|
||||
if (c.WeeklyTotalHours != null)
|
||||
{
|
||||
ed.Custom6 = c.WeeklyTotalHours ?? 0;
|
||||
ed.ArbeitstageProWoche = ANZ_WOCHENTAGE;
|
||||
if (c.WeeklyDays.HasValue && c.WeeklyDays.Value > 0)
|
||||
{
|
||||
ed.ArbeitstageProWoche = c.WeeklyDays.Value;
|
||||
}
|
||||
ed.Custom6 = Math.Round(ed.Custom6 * 60 / ed.ArbeitstageProWoche, 2, MidpointRounding.AwayFromZero); //Soll-Stunden für Abwesenheitstage ohne Faktor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.CreateEmployeeDetails(ro);
|
||||
|
||||
foreach (var ed in ro.EmployeeDetailList)
|
||||
{
|
||||
var c = GetContractForDate(ed.Employee, ro.ReportStartDate, ro.ReportEndDate);
|
||||
if (c != null)
|
||||
{
|
||||
AbsenceTimeHours athYear = GetAbwesenheitenDurchServiceRecords(ed, c, ed.AllServiceRecords, new DateTime(ro.ReportStartDate.Year, 1, 1), ro.ReportEndDate);
|
||||
ed.UrlaubGesamtImAktuellenJahr = athYear.StundenUrlaub;
|
||||
|
||||
@@ -401,7 +401,7 @@ namespace ApiBerlin
|
||||
|
||||
if (!IsServiceRecordFehlzeit(sr) && AddServiceRecordToDuration(sr) || sr.ServiceDescription.Name == "Pause")
|
||||
{
|
||||
decimal duration = GetDuration(sr);
|
||||
decimal duration = GetDuration(sr, ed);
|
||||
|
||||
|
||||
dd.MinutesTotal += duration;
|
||||
@@ -436,7 +436,7 @@ namespace ApiBerlin
|
||||
{
|
||||
continue;
|
||||
}
|
||||
decimal duration = GetDuration(sr);
|
||||
decimal duration = GetDuration(sr, ed);
|
||||
|
||||
if (duration > 0)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Humanitas
|
||||
{
|
||||
public class CustomReportCreator : DefaultReportCreator
|
||||
{
|
||||
public override XtraReport CreateFinanceReport(DateTime? start, DateTime? end, bool onlyNotApproved)
|
||||
public override XtraReport CreateFinanceReport(DateTime? start, DateTime? end, bool splitByServiceCategory, bool onlyNotApproved)
|
||||
{
|
||||
var ro = FinanceRO.Create(null, null, onlyNotApproved);
|
||||
ro.ReportStartDate = start;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace SHKService
|
||||
{
|
||||
//if (AddServiceRecordToDuration(item))
|
||||
//{
|
||||
var duration = GetDuration(item);
|
||||
var duration = GetDuration(item, empDetail);
|
||||
|
||||
if (item.ServiceDescription != null &&
|
||||
item.ServiceDescription.ServiceCategory != null)
|
||||
@@ -96,7 +96,7 @@ namespace SHKService
|
||||
{
|
||||
if (sr.Start.HasValue && sr.Start >= berichtStart && sr.Start < berichtEnde && sr.End.HasValue && sr.Start.Value.Day == dd.Date.Day)
|
||||
{
|
||||
decimal duration = GetDuration(sr);
|
||||
decimal duration = GetDuration(sr, ed);
|
||||
|
||||
if (sr.ServiceDescription.Name == "Pause")
|
||||
{
|
||||
@@ -129,9 +129,9 @@ namespace SHKService
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override decimal GetDuration(ServiceRecord sr)
|
||||
protected override decimal GetDuration(ServiceRecord sr, MitarbeiterstundenkontoRO.EmployeeDetail ed)
|
||||
{
|
||||
var d = base.GetDuration(sr);
|
||||
var d = base.GetDuration(sr, ed);
|
||||
|
||||
if (sr.ServiceDescription.ServiceCategory.Name == "Arbeitszeit" && sr.ServiceDescription.Name == "Zeitabzug")
|
||||
{
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace SHKServiceSBD
|
||||
{
|
||||
if (sr.Start.HasValue && sr.Start >= berichtStart && sr.Start < berichtEnde && sr.End.HasValue && sr.Start.Value.Day == dd.Date.Day)
|
||||
{
|
||||
decimal duration = GetDuration(sr);
|
||||
decimal duration = GetDuration(sr, ed);
|
||||
|
||||
if (sr.ServiceDescription.Name == "Pause")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user