DomizielAnsbach/ZVBerichtBezirk.cs - Fehler Enddatum ZV im Monat
SupportOID=168537
This commit is contained in:
@@ -33,17 +33,43 @@ namespace DomizielAnsbach
|
|||||||
for (int i = listLength - 1; i >= 0; i--)
|
for (int i = listLength - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var sc = pRO.SupportConceptFinanceList[i];
|
var sc = pRO.SupportConceptFinanceList[i];
|
||||||
if (sc.Costbearer2Supportconcept.ApprovalPeriodList != null &&
|
if (sc.Costbearer2Supportconcept.ApprovalPeriodList != null && sc.Costbearer2Supportconcept.ApprovalPeriodList[0].ServiceCategory == null ||
|
||||||
sc.Costbearer2Supportconcept.ApprovalPeriodList[0].ServiceCategory == null ||
|
|
||||||
sc.Costbearer2Supportconcept.ApprovalPeriodList[0].ServiceCategory.Name != "Zuverdienst - Arbeitszeit")
|
sc.Costbearer2Supportconcept.ApprovalPeriodList[0].ServiceCategory.Name != "Zuverdienst - Arbeitszeit")
|
||||||
pRO.SupportConceptFinanceList.Remove(sc);
|
pRO.SupportConceptFinanceList.Remove(sc);
|
||||||
}
|
}
|
||||||
pRO.SupportConceptFinanceList = pRO.SupportConceptFinanceList.GroupBy(s => s.Costbearer2Supportconcept.SupportConcept.Customer.CustomerOid).Select(g => g.FirstOrDefault()).ToList();
|
var extendedEndByRo = new Dictionary<FinanceRO.SupportConceptFinanceRO, DateTime?>();
|
||||||
|
pRO.SupportConceptFinanceList = pRO.SupportConceptFinanceList
|
||||||
|
.GroupBy(s => s.Costbearer2Supportconcept.SupportConcept.Customer.CustomerOid)
|
||||||
|
.Select(g =>
|
||||||
|
{
|
||||||
|
// Pro Kunde nur eine Zeile/ein Block (wie bisher). Hat ein Kunde aber mehrere aufeinanderfolgende HPs,
|
||||||
|
// wird die frueheste Zuordnung als Repraesentant genommen und das spaeteste EndDate aller Zuordnungen als effektives Ende gemerkt.
|
||||||
|
var ordered = g.OrderBy(s => s.Costbearer2Supportconcept.StartDate).ToList();
|
||||||
|
var rep = ordered.First();
|
||||||
|
if (ordered.Count > 1)
|
||||||
|
{
|
||||||
|
if (ordered.Any(s => !s.Costbearer2Supportconcept.EndDate.HasValue))
|
||||||
|
{
|
||||||
|
extendedEndByRo[rep] = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
extendedEndByRo[rep] = ordered.Max(s => s.Costbearer2Supportconcept.EndDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rep;
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
listLength = pRO.SupportConceptFinanceList.Count;
|
listLength = pRO.SupportConceptFinanceList.Count;
|
||||||
for (int i = 0; i < listLength; i++)
|
for (int i = 0; i < listLength; i++)
|
||||||
{
|
{
|
||||||
var sc = pRO.SupportConceptFinanceList[i];
|
var sc = pRO.SupportConceptFinanceList[i];
|
||||||
|
DateTime? scEndDate;
|
||||||
|
if (!extendedEndByRo.TryGetValue(sc, out scEndDate))
|
||||||
|
{
|
||||||
|
scEndDate = sc.Costbearer2Supportconcept.EndDate;
|
||||||
|
}
|
||||||
DateTime periodEnd = DateTime.MinValue;
|
DateTime periodEnd = DateTime.MinValue;
|
||||||
cCount += 1;
|
cCount += 1;
|
||||||
bool firstRow = true;
|
bool firstRow = true;
|
||||||
@@ -52,7 +78,7 @@ namespace DomizielAnsbach
|
|||||||
if (sc.Costbearer2Supportconcept.SupportConcept.Customer.Oid.HasValue)
|
if (sc.Costbearer2Supportconcept.SupportConcept.Customer.Oid.HasValue)
|
||||||
c = DAOFactory.GenericDAO.LoadByID<Customer>(sc.Costbearer2Supportconcept.SupportConcept.Customer.Oid.Value);
|
c = DAOFactory.GenericDAO.LoadByID<Customer>(sc.Costbearer2Supportconcept.SupportConcept.Customer.Oid.Value);
|
||||||
|
|
||||||
if (sc.Costbearer2Supportconcept.EndDate >= start && sc.Costbearer2Supportconcept.StartDate <= end)
|
if (scEndDate >= start && sc.Costbearer2Supportconcept.StartDate <= end)
|
||||||
{
|
{
|
||||||
if (sc.Costbearer2Supportconcept.StartDate <= start)
|
if (sc.Costbearer2Supportconcept.StartDate <= start)
|
||||||
monthStart = start;
|
monthStart = start;
|
||||||
@@ -81,7 +107,7 @@ namespace DomizielAnsbach
|
|||||||
|
|
||||||
var ro = new FinanceRO.SupportConceptFinanceRO();
|
var ro = new FinanceRO.SupportConceptFinanceRO();
|
||||||
ro.CustomerName = sc.CustomerName;
|
ro.CustomerName = sc.CustomerName;
|
||||||
if (ro.CustomerName.Contains("Rohloff"))
|
if (ro.CustomerName.Contains("Gruber"))
|
||||||
{
|
{
|
||||||
int tuao = 1;
|
int tuao = 1;
|
||||||
}
|
}
|
||||||
@@ -97,7 +123,7 @@ namespace DomizielAnsbach
|
|||||||
ro.ApprovedHours = GetVertraglicheZeit(c, periodEnd, monthStart);
|
ro.ApprovedHours = GetVertraglicheZeit(c, periodEnd, monthStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ro.ApprovedHours == 0 && sc.Costbearer2Supportconcept.EndDate < monthEnd && krankEnd <= monthEnd)
|
if (ro.ApprovedHours == 0 && scEndDate < monthEnd && krankEnd <= monthEnd)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -115,12 +141,20 @@ namespace DomizielAnsbach
|
|||||||
{
|
{
|
||||||
if (periodEnd == DateTime.MinValue)
|
if (periodEnd == DateTime.MinValue)
|
||||||
periodEnd = monthEnd;
|
periodEnd = monthEnd;
|
||||||
if (sc.Costbearer2Supportconcept.EndDate.HasValue && sc.Costbearer2Supportconcept.EndDate > monthStart && periodEnd > sc.Costbearer2Supportconcept.EndDate) // falls direkt im ersten Monat wieder beendet wird
|
if (scEndDate.HasValue && scEndDate > monthStart && periodEnd > scEndDate) // falls direkt im ersten Monat wieder beendet wird
|
||||||
periodEnd = sc.Costbearer2Supportconcept.EndDate.Value;
|
{
|
||||||
|
periodEnd = scEndDate.Value;
|
||||||
|
}
|
||||||
ro.Custom2 = String.Format("{0:dd.MM.yyyy}", periodEnd);
|
ro.Custom2 = String.Format("{0:dd.MM.yyyy}", periodEnd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ro.Custom2 = String.Format("{0:dd.MM.yyyy}", monthEnd);
|
ro.Custom2 = String.Format("{0:dd.MM.yyyy}", monthEnd);
|
||||||
|
if (scEndDate.HasValue && scEndDate > monthStart && scEndDate < monthEnd)
|
||||||
|
{
|
||||||
|
ro.Custom2 = String.Format("{0:dd.MM.yyyy}", scEndDate.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (firstRow == true)
|
if (firstRow == true)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user