Search in sources :

Example 1 with OverDueAmounts

use of org.mifos.accounts.util.helpers.OverDueAmounts in project head by mifos.

the class LoanBO method getOverDueAmntsUptoInstallment.

/**
     * It calculates over due amounts till installment 1 less than the one passed,because whatever amount is associated
     * with the current installment it is the due amount and not the over due amount. It calculates that by iterating
     * over the accountActionDates associated and summing up all the principal and principalPaid till installment-1 and
     * then returning the difference of the two.It also takes into consideration any miscellaneous fee or miscellaneous
     * penalty.
     *
     * @param installmentId
     *            - Installment id till which we want over due amounts.
     *
     */
public OverDueAmounts getOverDueAmntsUptoInstallment(final Short installmentId) {
    Set<AccountActionDateEntity> accountActionDateEntities = getAccountActionDates();
    OverDueAmounts totalOverDueAmounts = new OverDueAmounts();
    if (null != accountActionDateEntities && accountActionDateEntities.size() > 0) {
        for (AccountActionDateEntity accountActionDateEntity : accountActionDateEntities) {
            LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity;
            if (loanScheduleEntity.getInstallmentId() < installmentId) {
                totalOverDueAmounts.add(loanScheduleEntity.getDueAmnts());
            }
        }
    }
    return totalOverDueAmounts;
}
Also used : OverDueAmounts(org.mifos.accounts.util.helpers.OverDueAmounts) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity)

Example 2 with OverDueAmounts

use of org.mifos.accounts.util.helpers.OverDueAmounts in project head by mifos.

the class LoanScheduleEntity method getDueAmnts.

public OverDueAmounts getDueAmnts() {
    OverDueAmounts overDueAmounts = new OverDueAmounts();
    overDueAmounts.setFeesOverdue(getTotalFeesDue().add(getMiscFeeDue()));
    overDueAmounts.setInterestOverdue(getInterestDue());
    overDueAmounts.setPenaltyOverdue(getPenaltyDue());
    overDueAmounts.setPrincipalOverDue(getPrincipalDue());
    overDueAmounts.setTotalPrincipalPaid(getPrincipalPaid());
    return overDueAmounts;
}
Also used : OverDueAmounts(org.mifos.accounts.util.helpers.OverDueAmounts)

Example 3 with OverDueAmounts

use of org.mifos.accounts.util.helpers.OverDueAmounts in project head by mifos.

the class LoanScheduleEntityIntegrationTest method testGetTotalDueAmounts.

@Ignore
@Test
public void testGetTotalDueAmounts() {
    LoanScheduleEntity accountActionDate = (LoanScheduleEntity) groupLoan.getAccountActionDates().toArray()[0];
    accountActionDate.setPrincipalPaid(new Money(getCurrency(), "10.0"));
    accountActionDate.setInterestPaid(new Money(getCurrency(), "2.0"));
    accountActionDate.setPenalty(new Money(getCurrency(), "20.0"));
    accountActionDate.setPenaltyPaid(new Money(getCurrency(), "5.0"));
    accountActionDate.setMiscPenalty(new Money(getCurrency(), "10.0"));
    accountActionDate.setMiscFee(new Money(getCurrency(), "20.0"));
    accountActionDate.setMiscFeePaid(new Money(getCurrency(), "5.0"));
    OverDueAmounts totalDue = accountActionDate.getDueAmnts();
    Assert.assertEquals(TestUtils.createMoney(115.0), totalDue.getFeesOverdue());
    Assert.assertEquals(TestUtils.createMoney(90.0), totalDue.getPrincipalOverDue());
    Assert.assertEquals(TestUtils.createMoney(10.0), totalDue.getInterestOverdue());
    Assert.assertEquals(TestUtils.createMoney(25.0), totalDue.getPenaltyOverdue());
}
Also used : OverDueAmounts(org.mifos.accounts.util.helpers.OverDueAmounts) Money(org.mifos.framework.util.helpers.Money) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

OverDueAmounts (org.mifos.accounts.util.helpers.OverDueAmounts)3 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 Money (org.mifos.framework.util.helpers.Money)1