use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class ClientPerformanceHistoryEntity method getDelinquentPortfolioAmount.
public Money getDelinquentPortfolioAmount() {
// we don't know what currency to use when we start totaling these
// so don't initialize them with a currency
Money amountOverDue = null;
Money totalOutStandingAmount = null;
for (AccountBO accountBO : client.getAccounts()) {
if (accountBO.isLoanAccount() && ((LoanBO) accountBO).isAccountActive()) {
Money totalPrincipalAmountInArrears = ((LoanBO) accountBO).getTotalPrincipalAmountInArrears();
if (amountOverDue == null) {
amountOverDue = totalPrincipalAmountInArrears;
} else {
amountOverDue = amountOverDue.add(totalPrincipalAmountInArrears);
}
Money originalPrincipal = ((LoanBO) accountBO).getLoanSummary().getOriginalPrincipal();
if (totalOutStandingAmount == null) {
totalOutStandingAmount = originalPrincipal;
} else {
totalOutStandingAmount = totalOutStandingAmount.add(originalPrincipal);
}
}
}
// FIXME: this seems like it should just be returning a BigDecimal rather than a Money object
if (totalOutStandingAmount != null && !totalOutStandingAmount.getAmount().equals(BigDecimal.ZERO)) {
return new Money(amountOverDue.getCurrency(), amountOverDue.divide(totalOutStandingAmount));
}
return new Money(getCurrency());
}
use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class AccountAppAction method getTrxnHistory.
@TransactionDemarcate(joinToken = true)
public ActionForward getTrxnHistory(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String globalAccountNum = request.getParameter("globalAccountNum");
AccountBO accountBO = getAccountBusinessService().findBySystemId(globalAccountNum);
List<TransactionHistoryDto> transactionHistoryDto = this.centerServiceFacade.retrieveAccountTransactionHistory(globalAccountNum);
if (accountBO.isGroupLoanAccount() && null == ((LoanBO) accountBO).getParentAccount()) {
SessionUtils.setAttribute(Constants.TYPE_OF_GROUP_LOAN, "parentAcc", request);
} else if (accountBO.isGroupLoanAccount() && null != ((LoanBO) accountBO).getParentAccount()) {
SessionUtils.setAttribute(Constants.TYPE_OF_GROUP_LOAN, "memberAcc", request);
}
SessionUtils.setCollectionAttribute(SavingsConstants.TRXN_HISTORY_LIST, transactionHistoryDto, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, accountBO, request);
request.setAttribute("GlNamesMode", AccountingRules.getGlNamesMode());
return mapping.findForward("getTransactionHistory_success");
}
use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class AccountAppAction method waiveChargeOverDue.
@TransactionDemarcate(joinToken = true)
public ActionForward waiveChargeOverDue(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USERCONTEXT, request.getSession());
Integer accountId = getIntegerValue(request.getParameter("accountId"));
WaiveEnum waiveEnum = getWaiveType(request.getParameter(AccountConstants.WAIVE_TYPE));
this.centerServiceFacade.waiveChargesOverDue(accountId, waiveEnum.ordinal());
AccountBO account = getAccountBusinessService().getAccount(accountId);
account.updateDetails(uc);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, account, request);
return mapping.findForward("waiveChargesOverDue_Success");
}
use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class AccountAppAction method waiveChargeDue.
@TransactionDemarcate(joinToken = true)
public ActionForward waiveChargeDue(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USERCONTEXT, request.getSession());
Integer accountId = getIntegerValue(request.getParameter("accountId"));
WaiveEnum waiveEnum = getWaiveType(request.getParameter(AccountConstants.WAIVE_TYPE));
this.centerServiceFacade.waiveChargesDue(accountId, waiveEnum.ordinal());
AccountBO account = getAccountBusinessService().getAccount(accountId);
account.updateDetails(uc);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, account, request);
return mapping.findForward("waiveChargesDue_Success");
}
use of org.mifos.accounts.business.AccountBO in project head by mifos.
the class AccountServiceIntegrationTest method testGetAppllicableFees.
@Test
public void testGetAppllicableFees() throws Exception {
AccountBusinessService accountBusinessService = new AccountBusinessService();
accountBO = getLoanAccount();
StaticHibernateUtil.flushSession();
center = TestObjectFactory.getCustomer(center.getCustomerId());
group = TestObjectFactory.getCustomer(group.getCustomerId());
accountBO = TestObjectFactory.getObject(AccountBO.class, accountBO.getAccountId());
UserContext uc = TestUtils.makeUser();
List<ApplicableCharge> applicableChargeList = accountBusinessService.getAppllicableFees(accountBO.getAccountId(), uc);
Assert.assertEquals(2, applicableChargeList.size());
}
Aggregations