use of org.mifos.accounts.business.AccountStatusChangeHistoryEntity in project head by mifos.
the class LoanBO method openStandardLoanAccount.
public static LoanBO openStandardLoanAccount(LoanOfferingBO loanProduct, CustomerBO customer, MeetingBO repaymentDayMeeting, LoanSchedule loanSchedule, AccountState loanState, FundBO fund, LoanProductOverridenDetail overridenDetail, LoanScheduleConfiguration configuration, InstallmentRange installmentRange, AmountRange loanAmountRange, CreationDetail creationDetail, PersonnelBO createdBy) {
LoanBO standardLoan = new LoanBO(loanProduct, customer, loanState, overridenDetail, repaymentDayMeeting, loanSchedule, configuration, installmentRange, loanAmountRange, creationDetail);
standardLoan.setFund(fund);
standardLoan.addAccountStatusChangeHistory(new AccountStatusChangeHistoryEntity(standardLoan.getAccountState(), standardLoan.getAccountState(), createdBy, standardLoan));
return standardLoan;
}
use of org.mifos.accounts.business.AccountStatusChangeHistoryEntity in project head by mifos.
the class LoanBO method approve.
public void approve(PersonnelBO createdBy, String comment, LocalDate approvalDate) {
AccountStateEntity approvedState = new AccountStateEntity(AccountState.LOAN_APPROVED);
AccountStatusChangeHistoryEntity historyEntity = new AccountStatusChangeHistoryEntity(this.getAccountState(), approvedState, createdBy, this);
AccountNotesEntity accountNotesEntity = new AccountNotesEntity(approvalDate.toDateMidnight().toDate(), comment, createdBy, this);
this.addAccountStatusChangeHistory(historyEntity);
this.setAccountState(approvedState);
this.addAccountNotes(accountNotesEntity);
}
use of org.mifos.accounts.business.AccountStatusChangeHistoryEntity in project head by mifos.
the class LoanBO method disburse.
public void disburse(PersonnelBO createdBy, AccountPaymentEntity disbursalPayment) throws AccountException {
Date transactionDate = disbursalPayment.getPaymentDate();
addLoanActivity(buildLoanActivity(getLoanAmount(), createdBy, AccountConstants.LOAN_DISBURSAL, transactionDate));
final AccountStateEntity newState = new AccountStateEntity(AccountState.LOAN_ACTIVE_IN_GOOD_STANDING);
addAccountStatusChangeHistory(new AccountStatusChangeHistoryEntity(getAccountState(), newState, createdBy, this));
setAccountState(newState);
if (getPerformanceHistory() != null) {
getPerformanceHistory().setLoanMaturityDate(getLastInstallmentAccountAction().getActionDate());
}
// build up account payment related data
AccountPaymentEntity accountPayment = null;
// Disbursal process has to create its own accountPayment taking into account any disbursement fees
Money feeAmountAtDisbursement = getFeesDueAtDisbursement();
accountPayment = new AccountPaymentEntity(this, getLoanAmount().subtract(feeAmountAtDisbursement), disbursalPayment.getReceiptNumber(), disbursalPayment.getReceiptDate(), getPaymentTypeEntity(disbursalPayment.getPaymentType().getId()), transactionDate);
accountPayment.setCreatedByUser(createdBy);
if (feeAmountAtDisbursement.isGreaterThanZero()) {
processFeesAtDisbursement(accountPayment, feeAmountAtDisbursement, disbursalPayment.getOtherTransferPaymentDto().getPaymentTypeId(), disbursalPayment.getOtherTransferPayment().getAccount().getAccountId());
}
// create trxn entry for disbursal
final LoanTrxnDetailEntity loanTrxnDetailEntity = new LoanTrxnDetailEntity(accountPayment, AccountActionTypes.DISBURSAL, Short.valueOf("0"), transactionDate, createdBy, transactionDate, getLoanAmount(), "-", null, getLoanAmount(), new Money(getCurrency()), new Money(getCurrency()), new Money(getCurrency()), new Money(getCurrency()), null, null);
accountPayment.addAccountTrxn(loanTrxnDetailEntity);
addAccountPayment(accountPayment);
buildFinancialEntries(accountPayment.getAccountTrxns());
}
use of org.mifos.accounts.business.AccountStatusChangeHistoryEntity in project head by mifos.
the class SavingsAction method getStatusHistory.
@TransactionDemarcate(joinToken = true)
public ActionForward getStatusHistory(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In SavingsAction::getRecentActivity()");
String globalAccountNum = request.getParameter("globalAccountNum");
List<SavingsStatusChangeHistoryDto> savingsStatusHistoryDtoList = this.savingsServiceFacade.retrieveStatusChangeHistory(globalAccountNum);
SavingsBO savings = this.savingsDao.findBySystemId(globalAccountNum);
Hibernate.initialize(savings.getAccountStatusChangeHistory());
savings.setUserContext((UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession()));
List<AccountStatusChangeHistoryEntity> savingsStatusHistoryViewList = new ArrayList<AccountStatusChangeHistoryEntity>(savings.getAccountStatusChangeHistory());
SessionUtils.setCollectionAttribute(SavingsConstants.STATUS_CHANGE_HISTORY_LIST, savingsStatusHistoryViewList, request);
return mapping.findForward("getStatusHistory_success");
}
use of org.mifos.accounts.business.AccountStatusChangeHistoryEntity in project head by mifos.
the class LoanAccountAction method viewStatusHistory.
@TransactionDemarcate(joinToken = true)
public ActionForward viewStatusHistory(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
UserContext userContext = getUserContext(request);
String globalAccountNum = request.getParameter(GLOBAL_ACCOUNT_NUM);
LoanBO loan = this.loanDao.findByGlobalAccountNum(globalAccountNum);
loan.updateDetails(userContext);
List<AccountStatusChangeHistoryEntity> accStatusChangeHistory = new ArrayList<AccountStatusChangeHistoryEntity>(loan.getAccountStatusChangeHistory());
SessionUtils.setCollectionAttribute(STATUS_HISTORY, accStatusChangeHistory, request);
return mapping.findForward(ActionForwards.viewStatusHistory.toString());
}
Aggregations