use of edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail in project cu-kfs by CU-CommunityApps.
the class RecurringDisbursementVoucherDocumentServiceImpl method updateRecurringDisbursementVoucherDetails.
@Override
public void updateRecurringDisbursementVoucherDetails(RecurringDisbursementVoucherDocument recurringDisbursementVoucherDocument) {
if (recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails() == null || recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails().isEmpty()) {
recurringDisbursementVoucherDocument.setRecurringDisbursementVoucherDetails(new ArrayList<RecurringDisbursementVoucherDetail>());
} else {
resetAmounts(recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails());
}
int rowId = 0;
for (Object accountingLine : recurringDisbursementVoucherDocument.getSourceAccountingLines()) {
ScheduledSourceAccountingLine scheduledAccountingLine = (ScheduledSourceAccountingLine) accountingLine;
TreeMap<Date, KualiDecimal> datesAndAmounts = getScheduledAccountingLineService().generateDatesAndAmounts(scheduledAccountingLine, rowId);
for (Date date : datesAndAmounts.keySet()) {
KualiDecimal amount = datesAndAmounts.get(date);
RecurringDisbursementVoucherDetail detail = getDetailtem(recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails(), date);
detail.setDvCheckAmount(amount.add(detail.getDvCheckAmount()));
detail.setRecurringDVDocumentNumber(recurringDisbursementVoucherDocument.getDocumentNumber());
if (StringUtils.isEmpty(detail.getDvCheckStub())) {
detail.setDvCheckStub(recurringDisbursementVoucherDocument.getDisbVchrCheckStubText());
}
}
rowId++;
}
recurringDisbursementVoucherDocument.setRecurringDisbursementVoucherDetails(removeZeroAmounts(recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails()));
Collections.sort(recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails());
}
Aggregations