Search in sources :

Example 11 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class LoanBO method toRepaymentScheduleDto.

public List<RepaymentScheduleInstallment> toRepaymentScheduleDto(Locale userLocale) {
    List<RepaymentScheduleInstallment> installments = new ArrayList<RepaymentScheduleInstallment>();
    for (AccountActionDateEntity actionDate : this.getAccountActionDates()) {
        LoanScheduleEntity loanSchedule = (LoanScheduleEntity) actionDate;
        installments.add(loanSchedule.toDto());
    }
    Collections.sort(installments, new Comparator<RepaymentScheduleInstallment>() {

        @Override
        public int compare(final RepaymentScheduleInstallment act1, final RepaymentScheduleInstallment act2) {
            return act1.getInstallment().compareTo(act2.getInstallment());
        }
    });
    return installments;
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment) ArrayList(java.util.ArrayList)

Example 12 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class LoanBO method getDetailsOfLateInstallmentsPeriod.

public List<LoanScheduleEntity> getDetailsOfLateInstallmentsPeriod(final LocalDate after, final LocalDate before) {
    List<LoanScheduleEntity> lateInstallments = new ArrayList<LoanScheduleEntity>();
    Set<AccountActionDateEntity> accountActionDates = getAccountActionDates();
    if (accountActionDates != null && !accountActionDates.isEmpty()) {
        for (AccountActionDateEntity accountAction : accountActionDates) {
            if (!accountAction.isPaid() && accountAction.isAfter(after) && accountAction.isBefore(before)) {
                lateInstallments.add((LoanScheduleEntity) accountAction);
            }
        }
    }
    return lateInstallments;
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) ArrayList(java.util.ArrayList)

Example 13 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class LoanBO method waivePenaltyAmountDue.

private void waivePenaltyAmountDue() throws AccountException {
    List<AccountActionDateEntity> accountActionDateList = getApplicableIdsForNextInstallmentAndArrears();
    LoanScheduleEntity accountActionDateEntity = (LoanScheduleEntity) accountActionDateList.get(accountActionDateList.size() - 1);
    Money principal = new Money(getCurrency());
    Money interest = new Money(getCurrency());
    Money fee = new Money(getCurrency());
    Money chargeWaived = accountActionDateEntity.waivePenaltyCharges();
    if (chargeWaived != null && chargeWaived.isGreaterThanZero()) {
        updateTotalPenaltyAmount(chargeWaived);
        updateAccountActivity(principal, interest, fee, chargeWaived, userContext.getId(), LoanConstants.PENALTY_WAIVED);
        waiveChargesFromMemberAccounts(LoanConstants.PENALTY_WAIVED);
    }
    try {
        getlegacyLoanDao().createOrUpdate(this);
    } catch (PersistenceException e) {
        throw new AccountException(e);
    }
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) Money(org.mifos.framework.util.helpers.Money) AccountException(org.mifos.accounts.exceptions.AccountException) PersistenceException(org.mifos.framework.exceptions.PersistenceException)

Example 14 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class LoanBO method getTotalInterestToBePaid.

public Money getTotalInterestToBePaid() {
    Money amount = new Money(getCurrency());
    List<AccountActionDateEntity> actionDateList = getAllInstallments();
    for (AccountActionDateEntity accountActionDateEntity : actionDateList) {
        LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity;
        amount = amount.add(loanScheduleEntity.getInterest());
    }
    return amount;
}
Also used : Money(org.mifos.framework.util.helpers.Money) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity)

Example 15 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class CustomerAccountBO method updateAccountActionDateEntity.

@Override
public Money updateAccountActionDateEntity(final List<Short> intallmentIdList, final Short feeId) {
    Money totalFeeAmount = new Money(getCurrency());
    Set<AccountActionDateEntity> accountActionDateEntitySet = this.getAccountActionDates();
    for (AccountActionDateEntity accountActionDateEntity : accountActionDateEntitySet) {
        if (intallmentIdList.contains(accountActionDateEntity.getInstallmentId())) {
            totalFeeAmount = totalFeeAmount.add(((CustomerScheduleEntity) accountActionDateEntity).removeFees(feeId));
        }
    }
    return totalFeeAmount;
}
Also used : Money(org.mifos.framework.util.helpers.Money) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity)

Aggregations

AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)211 Money (org.mifos.framework.util.helpers.Money)80 Test (org.junit.Test)69 ArrayList (java.util.ArrayList)58 LocalDate (org.joda.time.LocalDate)42 Date (java.util.Date)39 DateTime (org.joda.time.DateTime)33 MeetingBO (org.mifos.application.meeting.business.MeetingBO)33 AccountException (org.mifos.accounts.exceptions.AccountException)24 PaymentData (org.mifos.accounts.util.helpers.PaymentData)24 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)21 Date (java.sql.Date)19 SavingsScheduleEntity (org.mifos.accounts.savings.business.SavingsScheduleEntity)19 LoanBO (org.mifos.accounts.loan.business.LoanBO)17 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)15 LoanScheduleEntity (org.mifos.accounts.loan.business.LoanScheduleEntity)14 UserContext (org.mifos.security.util.UserContext)14 Calendar (java.util.Calendar)13 GregorianCalendar (java.util.GregorianCalendar)13 CenterBuilder (org.mifos.domain.builders.CenterBuilder)13