use of org.mifos.accounts.financial.business.FinancialActionTypeEntity 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);
}
use of org.mifos.accounts.financial.business.FinancialActionTypeEntity 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);
}
use of org.mifos.accounts.financial.business.FinancialActionTypeEntity in project head by mifos.
the class InterestAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
GLCodeEntity glcodeCredit = ((LoanBO) loanTrxn.getAccount()).getLoanOffering().getInterestGLcode();
FinancialActionTypeEntity finActionInterest = FinancialActionCache.getFinancialAction(FinancialActionConstants.INTERESTPOSTING);
addAccountEntryDetails(loanTrxn.getInterestAmount(), finActionInterest, getGLcode(finActionInterest.getApplicableDebitCharts()), FinancialConstants.DEBIT);
addAccountEntryDetails(loanTrxn.getInterestAmount(), finActionInterest, glcodeCredit, FinancialConstants.CREDIT);
LoanBO loan = (LoanBO) loanTrxn.getAccount();
// interest account
if (!loan.isLegacyLoan()) {
boolean isLastPayment = ((LoanBO) loanTrxn.getAccount()).isLastInstallment(loanTrxn.getInstallmentId());
// if the final payment is made early there will be no interest
// charged so no 999 account
boolean interestIsCharged = loanTrxn.getInterestAmount().isGreaterThanZero();
if (isLastPayment && interestIsCharged) {
log999Account(loanTrxn, isLastPayment, glcodeCredit);
}
}
}
use of org.mifos.accounts.financial.business.FinancialActionTypeEntity in project head by mifos.
the class InterestAccountingEntry method log999Account.
private void log999Account(LoanTrxnDetailEntity loanTrxn, boolean isLastPayment, GLCodeEntity glcodeCredit) throws FinancialException {
Money account999 = ((LoanBO) loanTrxn.getAccount()).calculate999Account(isLastPayment);
Money zeroAmount = new Money(account999.getCurrency(), "0");
// only log if amount > or < 0
if (account999.equals(zeroAmount)) {
return;
}
FinancialActionTypeEntity finActionRounding = FinancialActionCache.getFinancialAction(FinancialActionConstants.ROUNDING);
GLCodeEntity codeToDebit = null;
GLCodeEntity codeToCredit = null;
if (account999.isGreaterThanZero()) {
// this code is defined as below in chart of account
// <GLAccount code="31401" name="Income from 999 Account" />
codeToDebit = glcodeCredit;
codeToCredit = getGLcode(finActionRounding.getApplicableCreditCharts());
} else if (account999.isLessThanZero()) {
codeToDebit = getGLcode(finActionRounding.getApplicableDebitCharts());
codeToCredit = glcodeCredit;
account999 = account999.negate();
}
addAccountEntryDetails(account999, finActionRounding, codeToDebit, FinancialConstants.DEBIT);
addAccountEntryDetails(account999, finActionRounding, codeToCredit, FinancialConstants.CREDIT);
}
use of org.mifos.accounts.financial.business.FinancialActionTypeEntity in project head by mifos.
the class FinancialActionCacheIntegrationTest method testFinancialActionCache.
@Test
public void testFinancialActionCache() throws FinancialException {
FinancialActionCache.addToCache(createFinancialAction());
FinancialActionTypeEntity principalAction = FinancialActionCache.getFinancialAction(FinancialActionConstants.PRINCIPALPOSTING);
Assert.assertEquals(principalAction.getId().shortValue(), 1);
}
Aggregations