use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class CustomerAccountBO method getTotalPaymentDue.
@Override
public Money getTotalPaymentDue() {
Money totalAmt = getTotalAmountInArrears();
AccountActionDateEntity nextInstallment = getDetailsOfNextInstallment();
if (nextInstallment != null && !nextInstallment.isPaid()) {
totalAmt = totalAmt.add(getDueAmount(nextInstallment));
}
return totalAmt;
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsOverDueDepositsTag method buildUI.
StringBuilder buildUI(List<AccountActionDateEntity> installmentsInArrears, Locale locale) {
StringBuilder builder = new StringBuilder();
SavingsScheduleEntity installment = null;
Date actionDate = null;
Collections.sort(installmentsInArrears, new Comparator<AccountActionDateEntity>() {
@Override
public int compare(AccountActionDateEntity actionDate1, AccountActionDateEntity actionDate2) {
return actionDate1.getActionDate().compareTo(actionDate2.getActionDate());
}
});
for (int i = 0; i < installmentsInArrears.size(); ) {
actionDate = installmentsInArrears.get(i).getActionDate();
Money totalAmount = new Money(installmentsInArrears.get(i).getAccount().getCurrency());
do {
installment = (SavingsScheduleEntity) installmentsInArrears.get(i);
if (!(installment.getCustomer().getCustomerLevel().getId().equals(CustomerLevel.CLIENT.getValue()) && installment.getCustomer().getStatus().equals(CustomerStatus.CLIENT_CLOSED))) {
totalAmount = totalAmount.add(installment.getTotalDepositDue());
}
i++;
} while (i < installmentsInArrears.size() && actionDate.equals(installmentsInArrears.get(i).getActionDate()));
if (totalAmount.isGreaterThanZero()) {
builder.append(buildDepositDueUIRow(locale, actionDate, totalAmount));
}
}
return builder;
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsAction method getDepositDueDetails.
@TransactionDemarcate(saveToken = true)
public ActionForward getDepositDueDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In SavingsAction::getDepositDueDetails()");
SavingsActionForm actionform = (SavingsActionForm) form;
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
String savingsSystemId = actionform.getGlobalAccountNum();
SavingsBO savings = savingsDao.findBySystemId(savingsSystemId);
for (AccountActionDateEntity actionDate : savings.getAccountActionDates()) {
Hibernate.initialize(actionDate);
}
Hibernate.initialize(savings.getAccountNotes());
for (AccountFlagMapping accountFlagMapping : savings.getAccountFlags()) {
Hibernate.initialize(accountFlagMapping.getFlag());
}
Hibernate.initialize(savings.getAccountFlags());
savings.setUserContext(uc);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
SavingsAccountDepositDueDto depositDueDetails = this.savingsServiceFacade.retrieveDepositDueDetails(savingsSystemId);
return mapping.findForward("depositduedetails_success");
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanRepaymentTag method generateGroupSchedule.
private List<AccountActionDateEntity> generateGroupSchedule(List<LoanBO> memberAccounts, LoanBO parent) {
Money principal = new Money(Money.getDefaultCurrency(), 0.0), principalPaid = new Money(Money.getDefaultCurrency(), 0.0), interest = new Money(Money.getDefaultCurrency(), 0.0), interestPaid = new Money(Money.getDefaultCurrency(), 0.0), penalty = new Money(Money.getDefaultCurrency(), 0.0), penaltyPaid = new Money(Money.getDefaultCurrency(), 0.0), extraInterest = new Money(Money.getDefaultCurrency(), 0.0), extraInterestPaid = new Money(Money.getDefaultCurrency(), 0.0), miscFee = new Money(Money.getDefaultCurrency(), 0.0), miscFeePaid = new Money(Money.getDefaultCurrency(), 0.0), miscPenalty = new Money(Money.getDefaultCurrency(), 0.0), miscPenaltyPaid = new Money(Money.getDefaultCurrency(), 0.0);
List<List<AccountActionDateEntity>> accActionList = new ArrayList<List<AccountActionDateEntity>>();
for (LoanBO memberLoan : memberAccounts) {
accActionList.add(new ArrayList<AccountActionDateEntity>(memberLoan.getAccountActionDates()));
}
List<AccountActionDateEntity> newGroupSchedule = copyAndSetToZeroSchedule(principal, principalPaid, interest, interestPaid, penalty, extraInterest, extraInterestPaid, miscFee, miscFeePaid, miscPenalty, penaltyPaid, miscPenaltyPaid, new ArrayList<AccountActionDateEntity>(parent.getAccountActionDates()));
for (List<AccountActionDateEntity> accList : accActionList) {
for (int i = 0; i < accList.size(); i++) {
LoanScheduleEntity schedule = (LoanScheduleEntity) accList.get(i);
LoanScheduleEntity newSchedule = (LoanScheduleEntity) newGroupSchedule.get(i);
principal = principal.add(schedule.getPrincipal());
newSchedule.setPrincipal(newSchedule.getPrincipal().add(principal));
principal = new Money(Money.getDefaultCurrency(), 0.0);
principalPaid = principalPaid.add(schedule.getPrincipalPaid());
newSchedule.setPrincipalPaid(newSchedule.getPrincipalPaid().add(principalPaid));
principalPaid = new Money(Money.getDefaultCurrency(), 0.0);
interest = interest.add(schedule.getInterest());
newSchedule.setInterest(newSchedule.getInterest().add(interest));
interest = new Money(Money.getDefaultCurrency(), 0.0);
interestPaid = interestPaid.add(schedule.getInterestPaid());
newSchedule.setInterestPaid(newSchedule.getInterestPaid().add(interestPaid));
interestPaid = new Money(Money.getDefaultCurrency(), 0.0);
penalty = penalty.add(schedule.getPenalty());
newSchedule.setPenalty(newSchedule.getPenalty().add(penaltyPaid));
penalty = new Money(Money.getDefaultCurrency(), 0.0);
penaltyPaid = penaltyPaid.add(schedule.getPenaltyPaid());
newSchedule.setPenaltyPaid(newSchedule.getPenaltyPaid().add(penaltyPaid));
penaltyPaid = new Money(Money.getDefaultCurrency(), 0.0);
extraInterest = extraInterest.add(schedule.getExtraInterest());
newSchedule.setExtraInterest(newSchedule.getExtraInterest().add(extraInterest));
extraInterest = new Money(Money.getDefaultCurrency(), 0.0);
extraInterestPaid = extraInterestPaid.add(schedule.getExtraInterestPaid());
newSchedule.setExtraInterestPaid(newSchedule.getExtraInterestPaid().add(extraInterestPaid));
extraInterestPaid = new Money(Money.getDefaultCurrency(), 0.0);
miscFee = miscFee.add(schedule.getMiscFee());
newSchedule.setMiscFee(newSchedule.getMiscFee().add(miscFee));
miscFee = new Money(Money.getDefaultCurrency(), 0.0);
miscFeePaid = miscFeePaid.add(schedule.getMiscFeePaid());
newSchedule.setMiscFeePaid(newSchedule.getMiscFeePaid().add(miscFeePaid));
miscFeePaid = new Money(Money.getDefaultCurrency(), 0.0);
miscPenalty = miscPenalty.add(schedule.getMiscPenalty());
newSchedule.setMiscPenalty(newSchedule.getMiscPenalty().add(miscPenalty));
miscPenalty = new Money(Money.getDefaultCurrency(), 0.0);
miscPenaltyPaid = miscPenaltyPaid.add(schedule.getMiscPenaltyPaid());
newSchedule.setMiscPenaltyPaid(newSchedule.getMiscPenaltyPaid().add(miscPenaltyPaid));
miscPenaltyPaid = new Money(Money.getDefaultCurrency(), 0.0);
}
}
return newGroupSchedule;
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanTestUtils method getSortedAccountActionDateEntity.
public static LoanScheduleEntity[] getSortedAccountActionDateEntity(Set<AccountActionDateEntity> actionDateCollection) {
LoanScheduleEntity[] sortedList = new LoanScheduleEntity[actionDateCollection.size()];
// Don't know whether it will always be 6 for future tests, but
// right now it is...
Assert.assertEquals(6, actionDateCollection.size());
for (AccountActionDateEntity actionDateEntity : actionDateCollection) {
sortedList[actionDateEntity.getInstallmentId().intValue() - 1] = (LoanScheduleEntity) actionDateEntity;
}
return sortedList;
}
Aggregations