use of com.axelor.apps.supplychain.db.TimetableTemplateLine in project axelor-open-suite by axelor.
the class TimetableServiceImpl method applyTemplate.
public List<Timetable> applyTemplate(TimetableTemplate template, BigDecimal exTaxTotal, LocalDate computationDate) {
List<Timetable> timetables = new ArrayList<>();
for (TimetableTemplateLine templateLine : template.getTimetableTemplateLineList()) {
Timetable timetable = new Timetable();
timetable.setEstimatedDate(InvoiceToolService.getDueDate(templateLine.getPaymentCondition(), computationDate));
timetable.setPercentage(templateLine.getPercentage());
timetable.setAmount(exTaxTotal.multiply(templateLine.getPercentage()).divide(BigDecimal.valueOf(100)));
timetables.add(timetable);
}
timetables.sort(Comparator.comparing(Timetable::getEstimatedDate));
return timetables;
}
Aggregations