SeWo/Zeitzuschlagsbeleg - Bugfix bei Vertragsende im laufenden Monat
This commit is contained in:
@@ -60,30 +60,47 @@ namespace BeWo.SeWo
|
||||
|
||||
if (ed.ServiceRecordsInSelectedTimeSpan != null)
|
||||
{
|
||||
foreach (var sr in ed.ServiceRecordsInSelectedTimeSpan)
|
||||
if (ed.ServiceRecordsInSelectedTimeSpan.Count == 0 && ed.StundenGesamtIst > 0 && ed.Employee.Contracts != null) // Bug wenn Vertrag im Monat endet
|
||||
{
|
||||
if (sr.DistanceInMeter.HasValue)
|
||||
var lastDay = monat.AddMonths(1).AddTicks(-1);
|
||||
var lastContract = ed.Employee.Contracts.Where(c => c.ContractEndDate.HasValue && c.ContractEndDate.Value.Year == monat.Year && c.ContractEndDate.Value.Month == monat.Month).FirstOrDefault();
|
||||
if (lastContract != null && lastContract.ContractEndDate.HasValue && lastContract.ContractEndDate.Value.Year == lastDay.Year)
|
||||
{
|
||||
kmTotal += sr.DistanceInMeter.Value;
|
||||
var lastDayContract = lastContract.ContractEndDate.Value.AddDays(1).AddTicks(-1);
|
||||
lastDay = lastDayContract;
|
||||
var records = ed.AllServiceRecords.Where(s => s.End >= monat && s.Start <= lastDay).ToList();
|
||||
if (records != null && records.Count > 0)
|
||||
{
|
||||
ed.ServiceRecordsInSelectedTimeSpan = records;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ed.ServiceRecordsInSelectedTimeSpan != null)
|
||||
{
|
||||
foreach (var sr in ed.ServiceRecordsInSelectedTimeSpan)
|
||||
{
|
||||
if (sr.DistanceInMeter.HasValue)
|
||||
{
|
||||
kmTotal += sr.DistanceInMeter.Value;
|
||||
}
|
||||
|
||||
if (sr.ServiceDescription.ServiceCategory.Name == "SeWo Ruf")
|
||||
{
|
||||
rufTotal += GetDuration(sr);
|
||||
if (sr.ServiceDescription.ServiceCategory.Name == "SeWo Ruf")
|
||||
{
|
||||
rufTotal += GetDuration(sr);
|
||||
}
|
||||
else if (sr.ServiceDescription.ServiceCategory.Name == "SeWo Notdienst")
|
||||
{
|
||||
notdienstTotal += GetDuration(sr);
|
||||
}
|
||||
else if (sr.ServiceDescription.Name != null && sr.ServiceDescription.Name == "HD Pause")
|
||||
{
|
||||
hdPause += GetDuration(sr);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddValueToTable(sr);
|
||||
}
|
||||
}
|
||||
else if (sr.ServiceDescription.ServiceCategory.Name == "SeWo Notdienst")
|
||||
{
|
||||
notdienstTotal += GetDuration(sr);
|
||||
}
|
||||
else if (sr.ServiceDescription.Name != null && sr.ServiceDescription.Name == "HD Pause")
|
||||
{
|
||||
hdPause += GetDuration(sr);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddValueToTable(sr);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user