}
}
private DirectAdvanceAssignment calculateFakeDirectAdvanceAssignmentChildren(
IndirectAdvanceAssignment indirectAdvanceAssignment) {
DirectAdvanceAssignment newDirectAdvanceAssignment = DirectAdvanceAssignment
.create();
newDirectAdvanceAssignment.setFake(true);
newDirectAdvanceAssignment.setMaxValue(new BigDecimal(100));
newDirectAdvanceAssignment.setAdvanceType(indirectAdvanceAssignment
.getAdvanceType());
newDirectAdvanceAssignment.setOrderElement(this);
Set<DirectAdvanceAssignment> directAdvanceAssignments = new HashSet<DirectAdvanceAssignment>();
for (OrderElement orderElement : children) {
directAdvanceAssignments.addAll(orderElement
.getAllDirectAdvanceAssignmentsReportGlobal());
}
List<AdvanceMeasurement> advanceMeasurements = new ArrayList<AdvanceMeasurement>();
for (DirectAdvanceAssignment directAdvanceAssignment : directAdvanceAssignments) {
advanceMeasurements.addAll(directAdvanceAssignment
.getAdvanceMeasurements());
}
List<LocalDate> measurementDates = getMeasurementDates(advanceMeasurements);
SortedSet<AdvanceMeasurement> newAdvanceMeasurements = new TreeSet<AdvanceMeasurement>(
new AdvanceMeasurementComparator());
for (LocalDate localDate : measurementDates) {
BigDecimal value = getAdvancePercentageChildren(localDate)
.multiply(new BigDecimal(100));
AdvanceMeasurement advanceMeasurement = AdvanceMeasurement.create(
localDate, value);
advanceMeasurement.setAdvanceAssignment(newDirectAdvanceAssignment);
newAdvanceMeasurements.add(advanceMeasurement);
}
newDirectAdvanceAssignment
.setAdvanceMeasurements(newAdvanceMeasurements);
return newDirectAdvanceAssignment;
}