Search in sources :

Example 1 with ExpectedPaymentDto

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());
}
Also used : Money(org.mifos.framework.util.helpers.Money) LoanBO(org.mifos.accounts.loan.business.LoanBO) ExpectedPaymentDto(org.mifos.dto.screen.ExpectedPaymentDto)

Example 2 with ExpectedPaymentDto

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;
}
Also used : ExpectedPaymentDto(org.mifos.dto.screen.ExpectedPaymentDto) LocalDate(org.joda.time.LocalDate) Date(java.util.Date) LocalDate(org.joda.time.LocalDate)

Aggregations

ExpectedPaymentDto (org.mifos.dto.screen.ExpectedPaymentDto)2 Date (java.util.Date)1 LocalDate (org.joda.time.LocalDate)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 Money (org.mifos.framework.util.helpers.Money)1