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