Search in sources :

Example 6 with AccountStatusChangeHistoryEntity

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;
}
Also used : AccountStatusChangeHistoryEntity(org.mifos.accounts.business.AccountStatusChangeHistoryEntity)

Example 7 with AccountStatusChangeHistoryEntity

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);
}
Also used : AccountNotesEntity(org.mifos.accounts.business.AccountNotesEntity) AccountStatusChangeHistoryEntity(org.mifos.accounts.business.AccountStatusChangeHistoryEntity) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity)

Example 8 with AccountStatusChangeHistoryEntity

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());
}
Also used : Money(org.mifos.framework.util.helpers.Money) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) AccountStatusChangeHistoryEntity(org.mifos.accounts.business.AccountStatusChangeHistoryEntity) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity) Date(java.util.Date) InstallmentDate(org.mifos.accounts.util.helpers.InstallmentDate) LocalDate(org.joda.time.LocalDate)

Example 9 with AccountStatusChangeHistoryEntity

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");
}
Also used : SavingsStatusChangeHistoryDto(org.mifos.dto.domain.SavingsStatusChangeHistoryDto) ArrayList(java.util.ArrayList) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) AccountStatusChangeHistoryEntity(org.mifos.accounts.business.AccountStatusChangeHistoryEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 10 with AccountStatusChangeHistoryEntity

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());
}
Also used : UserContext(org.mifos.security.util.UserContext) LoanBO(org.mifos.accounts.loan.business.LoanBO) ArrayList(java.util.ArrayList) AccountStatusChangeHistoryEntity(org.mifos.accounts.business.AccountStatusChangeHistoryEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

AccountStatusChangeHistoryEntity (org.mifos.accounts.business.AccountStatusChangeHistoryEntity)21 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)11 AccountException (org.mifos.accounts.exceptions.AccountException)8 PersistenceException (org.mifos.framework.exceptions.PersistenceException)7 Money (org.mifos.framework.util.helpers.Money)6 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)5 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 LocalDate (org.joda.time.LocalDate)3 Test (org.junit.Test)3 LoanBO (org.mifos.accounts.loan.business.LoanBO)3 AccountState (org.mifos.accounts.util.helpers.AccountState)3 AccountNotesEntity (org.mifos.accounts.business.AccountNotesEntity)2 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)2 InstallmentDate (org.mifos.accounts.util.helpers.InstallmentDate)2 SavingsStatusChangeHistoryDto (org.mifos.dto.domain.SavingsStatusChangeHistoryDto)2 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)2 UserContext (org.mifos.security.util.UserContext)2 BigDecimal (java.math.BigDecimal)1