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;
}
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;
}
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());
}
Aggregations