Search in sources :

Example 1 with PenaltiesTrxnDetailEntity

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

the class PenaltyAccountingEntry method applySpecificAccountActionEntry.

@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
    if (financialActivity.getAccountTrxn() instanceof LoanTrxnDetailEntity) {
        LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
        Set<PenaltiesTrxnDetailEntity> penaltiesTrxn = loanTrxn.getPenaltiesTrxnDetails();
        Iterator<PenaltiesTrxnDetailEntity> iterPenalties = penaltiesTrxn.iterator();
        FinancialActionTypeEntity finActionPenalty = getFinancialAction(FinancialActionConstants.PENALTYPOSTING);
        while (iterPenalties.hasNext()) {
            PenaltiesTrxnDetailEntity penaltyTrxn = iterPenalties.next();
            addAccountEntryDetails(penaltyTrxn.getPenaltyAmount(), finActionPenalty, penaltyTrxn.getAccountPenalties().getPenalty().getGlCode(), FinancialConstants.CREDIT);
            addAccountEntryDetails(penaltyTrxn.getPenaltyAmount(), finActionPenalty, getGLcode(finActionPenalty.getApplicableDebitCharts()), FinancialConstants.DEBIT);
        }
        FinancialActionTypeEntity finActionMiscPenalty = FinancialActionCache.getFinancialAction(FinancialActionConstants.MISCPENALTYPOSTING);
        addAccountEntryDetails(loanTrxn.getMiscPenaltyAmount(), finActionMiscPenalty, getGLcode(finActionMiscPenalty.getApplicableDebitCharts()), FinancialConstants.DEBIT);
        addAccountEntryDetails(loanTrxn.getMiscPenaltyAmount(), finActionMiscPenalty, getGLcode(finActionMiscPenalty.getApplicableCreditCharts()), FinancialConstants.CREDIT);
    } else {
        Money amount = financialActivity.getMiscPenaltyAmount();
        FinancialActionTypeEntity finActionMiscPenalty = FinancialActionCache.getFinancialAction(FinancialActionConstants.MISCPENALTYPOSTING);
        addAccountEntryDetails(amount, finActionMiscPenalty, getGLcode(finActionMiscPenalty.getApplicableDebitCharts()), FinancialConstants.DEBIT);
        addAccountEntryDetails(amount, finActionMiscPenalty, getGLcode(finActionMiscPenalty.getApplicableCreditCharts()), FinancialConstants.CREDIT);
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) LoanTrxnDetailEntity(org.mifos.accounts.loan.business.LoanTrxnDetailEntity) PenaltiesTrxnDetailEntity(org.mifos.accounts.business.PenaltiesTrxnDetailEntity)

Example 2 with PenaltiesTrxnDetailEntity

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

the class LoanBO method addPenaltyTransactions.

private void addPenaltyTransactions(LoanTrxnDetailEntity loanTrxnDetailEntity, Set<LoanPenaltyScheduleEntity> loanPenaltyScheduleEntities) {
    for (LoanPenaltyScheduleEntity loanPenaltyScheduleEntity : loanPenaltyScheduleEntities) {
        if (loanPenaltyScheduleEntity.getPenaltyDue().isGreaterThanZero()) {
            PenaltiesTrxnDetailEntity penaltiesTrxnDetailEntity = new PenaltiesTrxnDetailEntity(loanTrxnDetailEntity, loanPenaltyScheduleEntity.getAccountPenalty(), loanPenaltyScheduleEntity.getPenaltyDue());
            loanTrxnDetailEntity.addPenaltiesTrxnDetail(penaltiesTrxnDetailEntity);
        }
    }
}
Also used : PenaltiesTrxnDetailEntity(org.mifos.accounts.business.PenaltiesTrxnDetailEntity)

Example 3 with PenaltiesTrxnDetailEntity

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

the class LoanTrxnDetailEntity method generateReverseTrxn.

@Override
protected AccountTrxnEntity generateReverseTrxn(PersonnelBO loggedInUser, 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;
    }
    LoanTrxnDetailEntity reverseAccntTrxn;
    reverseAccntTrxn = new LoanTrxnDetailEntity(getAccountPayment(), getReverseTransctionActionType(), getInstallmentId(), getDueDate(), loggedInUser, getActionDate(), getAmount().negate(), comment, this, getPrincipalAmount().negate(), getInterestAmount().negate(), getPenaltyAmount().negate(), getMiscFeeAmount().negate(), getMiscPenaltyAmount().negate(), null, null);
    reverseAccntTrxn.setCalculatedInterestOnPayment(this.getCalculatedInterestOnPayment());
    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");
    }
    if (null != getPenaltiesTrxnDetails() && getPenaltiesTrxnDetails().size() > 0) {
        logger.debug("Before generating reverse entries for penalties");
        for (PenaltiesTrxnDetailEntity penaltyTrxnDetail : getPenaltiesTrxnDetails()) {
            reverseAccntTrxn.addPenaltiesTrxnDetail(penaltyTrxnDetail.generateReverseTrxn(reverseAccntTrxn));
        }
        logger.debug("after generating reverse entries for penalties");
    }
    return reverseAccntTrxn;
}
Also used : PenaltiesTrxnDetailEntity(org.mifos.accounts.business.PenaltiesTrxnDetailEntity) FeesTrxnDetailEntity(org.mifos.accounts.business.FeesTrxnDetailEntity)

Aggregations

PenaltiesTrxnDetailEntity (org.mifos.accounts.business.PenaltiesTrxnDetailEntity)3 FeesTrxnDetailEntity (org.mifos.accounts.business.FeesTrxnDetailEntity)1 FinancialActionTypeEntity (org.mifos.accounts.financial.business.FinancialActionTypeEntity)1 LoanTrxnDetailEntity (org.mifos.accounts.loan.business.LoanTrxnDetailEntity)1 Money (org.mifos.framework.util.helpers.Money)1