use of org.mifos.dto.screen.ExpectedPaymentDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveExpectedPayment.
@Override
public ExpectedPaymentDto retrieveExpectedPayment(String globalAccountNumber, LocalDate paymentDueAsOf) {
LoanBO loan = loanDao.findByGlobalAccountNum(globalAccountNumber);
Money amountDue = loan.getTotalAmountDueOn(paymentDueAsOf);
return new ExpectedPaymentDto(globalAccountNumber, amountDue.getAmount());
}
use of org.mifos.dto.screen.ExpectedPaymentDto in project head by mifos.
the class LoanRepaymentController method retrieveExpectedPayment.
// called by spring webflow
public ExpectedPaymentDto retrieveExpectedPayment(final String loanGlobalAccountNumber, LoanRepaymentFormBean loanRepaymentFormBean) {
LocalDate paymentDueAsOf = new LocalDate();
ExpectedPaymentDto result = this.loanAccountServiceFacade.retrieveExpectedPayment(loanGlobalAccountNumber, paymentDueAsOf);
Date lastPaymentDate = this.accountServiceFacade.retrieveLatPaymentDate(loanGlobalAccountNumber);
LocalDate lastPaymentDateJoda = null;
if (lastPaymentDate != null) {
lastPaymentDateJoda = new LocalDate(lastPaymentDate);
}
loanRepaymentFormBean.setGlobalAccountNumber(result.getGlobalAccountNumber());
loanRepaymentFormBean.setLastPaymentDate(lastPaymentDateJoda);
if (loanRepaymentFormBean.getPaymentAmount().equals(BigDecimal.ZERO)) {
Double amount = Double.valueOf(result.getAmount().doubleValue());
loanRepaymentFormBean.setPaymentAmount(BigDecimal.valueOf(amount));
loanRepaymentFormBean.setPaymentDate(paymentDueAsOf);
} else {
loanRepaymentFormBean.setPaymentDate(new LocalDate());
}
loanRepaymentFormBean.setTruePrintReceipt(loanRepaymentFormBean.getPrintReceipt());
loanRepaymentFormBean.setPrintReceipt(false);
return result;
}
Aggregations