use of org.mifos.accounts.financial.business.FinancialActionTypeEntity in project head by mifos.
the class PrincipalAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
GLCodeEntity glcodeCredit = ((LoanBO) loanTrxn.getAccount()).getLoanOffering().getPrincipalGLcode();
Money principalAmountNotRounded = loanTrxn.getPrincipalAmount();
Money amountToPost = null;
if (((LoanBO) loanTrxn.getAccount()).isLastInstallment(loanTrxn.getInstallmentId())) {
amountToPost = Money.round(loanTrxn.getPrincipalAmount(), AccountingRules.getFinalRoundOffMultiple(loanTrxn.getPrincipalAmount().getCurrency()), AccountingRules.getCurrencyRoundingMode());
} else {
amountToPost = principalAmountNotRounded;
}
FinancialActionTypeEntity finActionPrincipal = FinancialActionCache.getFinancialAction(FinancialActionConstants.PRINCIPALPOSTING);
addAccountEntryDetails(amountToPost, finActionPrincipal, getGLcode(finActionPrincipal.getApplicableDebitCharts()), FinancialConstants.DEBIT);
addAccountEntryDetails(amountToPost, finActionPrincipal, glcodeCredit, FinancialConstants.CREDIT);
LoanBO loan = (LoanBO) loanTrxn.getAccount();
// interest account and not to the principal account
if (!loan.isLegacyLoan()) {
return;
}
// v1 version log the 999 account to the principal account
// check if rounding is required
FinancialActionTypeEntity finActionRounding = FinancialActionCache.getFinancialAction(FinancialActionConstants.ROUNDING);
if (amountToPost.getAmount().compareTo(principalAmountNotRounded.getAmount()) > 0) {
addAccountEntryDetails(amountToPost.subtract(principalAmountNotRounded), finActionRounding, glcodeCredit, FinancialConstants.DEBIT);
addAccountEntryDetails(amountToPost.subtract(principalAmountNotRounded), finActionRounding, getGLcode(finActionRounding.getApplicableCreditCharts()), FinancialConstants.CREDIT);
} else if (amountToPost.getAmount().compareTo(principalAmountNotRounded.getAmount()) < 0) {
addAccountEntryDetails(principalAmountNotRounded.subtract(amountToPost), finActionRounding, getGLcode(finActionRounding.getApplicableDebitCharts()), FinancialConstants.DEBIT);
addAccountEntryDetails(principalAmountNotRounded.subtract(amountToPost), finActionRounding, glcodeCredit, FinancialConstants.CREDIT);
}
}
use of org.mifos.accounts.financial.business.FinancialActionTypeEntity in project head by mifos.
the class PrincipalAdjustmentAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
GLCodeEntity glcodeCredit = ((LoanBO) loanTrxn.getAccount()).getLoanOffering().getPrincipalGLcode();
FinancialActionTypeEntity finActionPrincipal = FinancialActionCache.getFinancialAction(FinancialActionConstants.PRINCIPALPOSTING);
addAccountEntryDetails(loanTrxn.getPrincipalAmount(), finActionPrincipal, getGLcode(finActionPrincipal.getApplicableDebitCharts()), FinancialConstants.CREDIT);
addAccountEntryDetails(loanTrxn.getPrincipalAmount(), finActionPrincipal, glcodeCredit, FinancialConstants.DEBIT);
LoanBO loan = (LoanBO) loanTrxn.getAccount();
if (!loan.isLegacyLoan()) {
return;
}
// check if rounding is required
Money roundedAmount = Money.round(loanTrxn.getPrincipalAmount(), loanTrxn.getPrincipalAmount().getCurrency().getRoundingAmount(), AccountingRules.getCurrencyRoundingMode());
if (!roundedAmount.equals(loanTrxn.getPrincipalAmount())) {
FinancialActionTypeEntity finActionRounding = FinancialActionCache.getFinancialAction(FinancialActionConstants.ROUNDING);
addAccountEntryDetails(roundedAmount.subtract(loanTrxn.getPrincipalAmount()).negate(), finActionRounding, getGLcode(finActionPrincipal.getApplicableCreditCharts()), FinancialConstants.CREDIT);
addAccountEntryDetails(roundedAmount.subtract(loanTrxn.getPrincipalAmount()), finActionRounding, getGLcode(finActionRounding.getApplicableCreditCharts()), FinancialConstants.DEBIT);
}
}
use of org.mifos.accounts.financial.business.FinancialActionTypeEntity in project head by mifos.
the class RescheduleAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
FinancialActionTypeEntity finActionReschedule = FinancialActionCache.getFinancialAction(FinancialActionConstants.RESCHEDULE);
addAccountEntryDetails(loanTrxn.getPrincipalAmount(), finActionReschedule, getGLcode(finActionReschedule.getApplicableDebitCharts()), FinancialConstants.DEBIT);
GLCodeEntity glcodeCredit = ((LoanBO) loanTrxn.getAccount()).getLoanOffering().getPrincipalGLcode();
addAccountEntryDetails(loanTrxn.getPrincipalAmount(), finActionReschedule, glcodeCredit, FinancialConstants.CREDIT);
// no 999 account entries are made for close-rescheduled loans because
// if some payments have already been made
// the 999 account amount is probably very small and is ignored in 1.1
// release. In the future if we want to
// calculate the 999 amount in this case we need to store the raw amount
// for each installment.
}
use of org.mifos.accounts.financial.business.FinancialActionTypeEntity in project head by mifos.
the class SavingsAdjustmentAccountingEntry method adjustWithdrawal.
private void adjustWithdrawal(SavingsBO savings, SavingsTrxnDetailEntity savingsTrxn) throws FinancialException {
FinancialActionTypeEntity finActionWithrawal = null;
if (savings.isMandatory()) {
finActionWithrawal = getFinancialAction(FinancialActionConstants.MANDATORYWITHDRAWAL_ADJUSTMENT);
} else if (savings.isVoluntary()) {
finActionWithrawal = getFinancialAction(FinancialActionConstants.VOLUNTARYWITHDRAWAL_ADJUSTMENT);
}
addAccountEntryDetails(savingsTrxn.getWithdrawlAmount(), finActionWithrawal, savings.getSavingsOffering().getDepositGLCode(), FinancialConstants.CREDIT);
addAccountEntryDetails(savingsTrxn.getWithdrawlAmount(), finActionWithrawal, getGLcode(finActionWithrawal.getApplicableDebitCharts()), FinancialConstants.DEBIT);
}
use of org.mifos.accounts.financial.business.FinancialActionTypeEntity in project head by mifos.
the class SavingsAdjustmentAccountingEntry method adjustDeposit.
private void adjustDeposit(SavingsBO savings, SavingsTrxnDetailEntity savingsTrxn) throws FinancialException {
FinancialActionTypeEntity finActionDeposit = null;
if (savings.isMandatory()) {
finActionDeposit = getFinancialAction(FinancialActionConstants.MANDATORYDEPOSIT_ADJUSTMENT);
} else if (savings.isVoluntary()) {
finActionDeposit = getFinancialAction(FinancialActionConstants.VOLUNTARYDEPOSIT_ADJUSTMENT);
}
addAccountEntryDetails(savingsTrxn.getDepositAmount(), finActionDeposit, getGLcode(finActionDeposit.getApplicableCreditCharts()), FinancialConstants.CREDIT);
addAccountEntryDetails(savingsTrxn.getDepositAmount(), finActionDeposit, savings.getSavingsOffering().getDepositGLCode(), FinancialConstants.DEBIT);
}
Aggregations