Search in sources :

Example 6 with FeesTrxnDetailEntity

use of org.mifos.accounts.business.FeesTrxnDetailEntity in project head by mifos.

the class LoanBO method addFeeTransactions.

private void addFeeTransactions(LoanTrxnDetailEntity loanTrxnDetailEntity, Set<AccountFeesActionDetailEntity> accountFeesActionDetails) {
    for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : accountFeesActionDetails) {
        if (accountFeesActionDetailEntity.getFeeDue().isGreaterThanZero()) {
            FeesTrxnDetailEntity feesTrxnDetailEntity = new FeesTrxnDetailEntity(loanTrxnDetailEntity, accountFeesActionDetailEntity.getAccountFee(), accountFeesActionDetailEntity.getFeeDue());
            loanTrxnDetailEntity.addFeesTrxnDetail(feesTrxnDetailEntity);
        }
    }
}
Also used : AccountFeesActionDetailEntity(org.mifos.accounts.business.AccountFeesActionDetailEntity) FeesTrxnDetailEntity(org.mifos.accounts.business.FeesTrxnDetailEntity)

Example 7 with FeesTrxnDetailEntity

use of org.mifos.accounts.business.FeesTrxnDetailEntity in project head by mifos.

the class CustomerAccountFeesAccountingEntry method applySpecificAccountActionEntry.

@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
    CustomerTrxnDetailEntity customertrxn = (CustomerTrxnDetailEntity) financialActivity.getAccountTrxn();
    Set<FeesTrxnDetailEntity> feesTrxns = customertrxn.getFeesTrxnDetails();
    FinancialActionTypeEntity finActionFee = getFinancialAction(FinancialActionConstants.FEEPOSTING);
    for (FeesTrxnDetailEntity feeTrxn : feesTrxns) {
        addAccountEntryDetails(feeTrxn.getFeeAmount(), finActionFee, feeTrxn.getAccountFees().getFees().getGlCode(), FinancialConstants.CREDIT);
        addAccountEntryDetails(feeTrxn.getFeeAmount(), finActionFee, getGLcode(finActionFee.getApplicableDebitCharts()), FinancialConstants.DEBIT);
    }
    // For Misc Fee
    FinancialActionTypeEntity finActionMiscFee = FinancialActionCache.getFinancialAction(FinancialActionConstants.CUSTOMERACCOUNTMISCFEESPOSTING);
    addAccountEntryDetails(customertrxn.getMiscFeeAmount(), finActionMiscFee, getGLcode(finActionMiscFee.getApplicableDebitCharts()), FinancialConstants.DEBIT);
    addAccountEntryDetails(customertrxn.getMiscFeeAmount(), finActionMiscFee, getGLcode(finActionMiscFee.getApplicableCreditCharts()), FinancialConstants.CREDIT);
}
Also used : CustomerTrxnDetailEntity(org.mifos.customers.business.CustomerTrxnDetailEntity) FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) FeesTrxnDetailEntity(org.mifos.accounts.business.FeesTrxnDetailEntity)

Example 8 with FeesTrxnDetailEntity

use of org.mifos.accounts.business.FeesTrxnDetailEntity in project head by mifos.

the class FeesAccountingEntry method applySpecificAccountActionEntry.

@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
    LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
    Set<FeesTrxnDetailEntity> feesTrxn = loanTrxn.getFeesTrxnDetails();
    Iterator<FeesTrxnDetailEntity> iterFees = feesTrxn.iterator();
    FinancialActionTypeEntity finActionFee = getFinancialAction(FinancialActionConstants.FEEPOSTING);
    while (iterFees.hasNext()) {
        FeesTrxnDetailEntity feeTrxn = iterFees.next();
        addAccountEntryDetails(feeTrxn.getFeeAmount(), finActionFee, feeTrxn.getAccountFees().getFees().getGlCode(), FinancialConstants.CREDIT);
        addAccountEntryDetails(feeTrxn.getFeeAmount(), finActionFee, getGLcode(finActionFee.getApplicableDebitCharts()), FinancialConstants.DEBIT);
    }
    // For Misc Fee
    FinancialActionTypeEntity finActionMiscFee = FinancialActionCache.getFinancialAction(FinancialActionConstants.MISCFEEPOSTING);
    addAccountEntryDetails(loanTrxn.getMiscFeeAmount(), finActionMiscFee, getGLcode(finActionMiscFee.getApplicableDebitCharts()), FinancialConstants.DEBIT);
    addAccountEntryDetails(loanTrxn.getMiscFeeAmount(), finActionMiscFee, getGLcode(finActionMiscFee.getApplicableCreditCharts()), FinancialConstants.CREDIT);
}
Also used : FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) LoanTrxnDetailEntity(org.mifos.accounts.loan.business.LoanTrxnDetailEntity) FeesTrxnDetailEntity(org.mifos.accounts.business.FeesTrxnDetailEntity)

Example 9 with FeesTrxnDetailEntity

use of org.mifos.accounts.business.FeesTrxnDetailEntity in project head by mifos.

the class CustomerTrxnDetailEntity method generateReverseTrxn.

@Override
protected AccountTrxnEntity generateReverseTrxn(final PersonnelBO loggedInUser, final String adjustmentComment) throws AccountException {
    logger.debug("Inside generate reverse transaction method of loan trxn detail");
    String comment = null;
    if (null == adjustmentComment) {
        comment = getComments();
    } else {
        comment = adjustmentComment;
    }
    CustomerTrxnDetailEntity reverseAccntTrxn;
    reverseAccntTrxn = new CustomerTrxnDetailEntity(getAccountPayment(), AccountActionTypes.CUSTOMER_ADJUSTMENT, getInstallmentId(), getDueDate(), loggedInUser, getActionDate(), getAmount().negate(), comment, this, getMiscFeeAmount().negate(), getMiscPenaltyAmount().negate());
    if (null != getFeesTrxnDetails() && getFeesTrxnDetails().size() > 0) {
        logger.debug("Before generating reverse entries for fees");
        for (FeesTrxnDetailEntity feeTrxnDetail : getFeesTrxnDetails()) {
            reverseAccntTrxn.addFeesTrxnDetail(feeTrxnDetail.generateReverseTrxn(reverseAccntTrxn));
        }
        logger.debug("after generating reverse entries for fees");
    }
    return reverseAccntTrxn;
}
Also used : FeesTrxnDetailEntity(org.mifos.accounts.business.FeesTrxnDetailEntity)

Example 10 with FeesTrxnDetailEntity

use of org.mifos.accounts.business.FeesTrxnDetailEntity in project head by mifos.

the class FinancialBusinessServiceIntegrationTest method getAccountTrxnObj.

private AccountTrxnEntity getAccountTrxnObj(AccountPaymentEntity accountPaymentEntity) throws Exception {
    Date currentDate = new Date(System.currentTimeMillis());
    LoanScheduleEntity accountAction = (LoanScheduleEntity) loan.getAccountActionDate(Short.valueOf("1"));
    LoanTrxnDetailEntity accountTrxnEntity = new LoanTrxnDetailEntity(accountPaymentEntity, AccountActionTypes.LOAN_ADJUSTMENT, Short.valueOf("1"), accountAction.getActionDate(), TestObjectFactory.getPersonnel(PersonnelConstants.SYSTEM_USER), currentDate, TestUtils.createMoney(630), "test for loan adjustment", null, TestUtils.createMoney(200), TestUtils.createMoney(300), TestUtils.createMoney(), TestUtils.createMoney(10), TestUtils.createMoney(20), null, null);
    for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : accountAction.getAccountFeesActionDetails()) {
        LoanBOTestUtils.setFeeAmountPaid(accountFeesActionDetailEntity, TestUtils.createMoney(100));
        FeesTrxnDetailEntity feeTrxn = new FeesTrxnDetailEntity(accountTrxnEntity, accountFeesActionDetailEntity.getAccountFee(), accountFeesActionDetailEntity.getFeeAmount());
        accountTrxnEntity.addFeesTrxnDetail(feeTrxn);
    }
    return accountTrxnEntity;
}
Also used : LoanScheduleEntity(org.mifos.accounts.loan.business.LoanScheduleEntity) AccountFeesActionDetailEntity(org.mifos.accounts.business.AccountFeesActionDetailEntity) LoanTrxnDetailEntity(org.mifos.accounts.loan.business.LoanTrxnDetailEntity) Date(java.sql.Date) FeesTrxnDetailEntity(org.mifos.accounts.business.FeesTrxnDetailEntity)

Aggregations

FeesTrxnDetailEntity (org.mifos.accounts.business.FeesTrxnDetailEntity)16 Date (java.sql.Date)6 AccountFeesActionDetailEntity (org.mifos.accounts.business.AccountFeesActionDetailEntity)6 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)6 AccountTrxnEntity (org.mifos.accounts.business.AccountTrxnEntity)5 FinancialActionTypeEntity (org.mifos.accounts.financial.business.FinancialActionTypeEntity)4 LoanTrxnDetailEntity (org.mifos.accounts.loan.business.LoanTrxnDetailEntity)4 Money (org.mifos.framework.util.helpers.Money)4 Test (org.junit.Test)3 AccountException (org.mifos.accounts.exceptions.AccountException)3 PaymentTypeEntity (org.mifos.application.master.business.PaymentTypeEntity)3 CustomerTrxnDetailEntity (org.mifos.customers.business.CustomerTrxnDetailEntity)3 PaymentData (org.mifos.accounts.util.helpers.PaymentData)2 ApplicationException (org.mifos.framework.exceptions.ApplicationException)2 SystemException (org.mifos.framework.exceptions.SystemException)2 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LocalDate (org.joda.time.LocalDate)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1