From adc99d2decf404a9a060f439664c94a8c34507a2 Mon Sep 17 00:00:00 2001 From: Pramod Nuthakki Date: Wed, 1 Oct 2014 14:26:41 +0530 Subject: [PATCH] MIFOSX-1557 : added check for disbursement fee --- ...ccrualBasedAccountingProcessorForLoan.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java index 67a30545b..d02661ed4 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java @@ -189,21 +189,27 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess if (feesAmount != null && !(feesAmount.compareTo(BigDecimal.ZERO) == 0)) { totalDebitAmount = totalDebitAmount.add(feesAmount); - ACCRUAL_ACCOUNTS_FOR_LOAN feeAccountToCredit = ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE; - if (isIncomeFromFee) { - feeAccountToCredit = ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES; + this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode, + ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, + feesAmount, isReversal, loanTransactionDTO.getFeePayments()); + } else { + this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE, + loanProductId, paymentTypeId, loanId, transactionId, transactionDate, feesAmount, isReversal); } - - this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, feeAccountToCredit, loanProductId, paymentTypeId, - loanId, transactionId, transactionDate, feesAmount, isReversal); } // handle penalties payment of writeOff (and reversals) if (penaltiesAmount != null && !(penaltiesAmount.compareTo(BigDecimal.ZERO) == 0)) { totalDebitAmount = totalDebitAmount.add(penaltiesAmount); - this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE, - loanProductId, paymentTypeId, loanId, transactionId, transactionDate, penaltiesAmount, isReversal); + if (isIncomeFromFee) { + this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode, + ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate, + penaltiesAmount, isReversal, loanTransactionDTO.getPenaltyPayments()); + } else { + this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE, + loanProductId, paymentTypeId, loanId, transactionId, transactionDate, penaltiesAmount, isReversal); + } } /**