You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "adamsaghy (via GitHub)" <gi...@apache.org> on 2024/12/04 12:46:50 UTC
Re: [PR] FINERACT-1806: Advanced Charge-off Expense Accounting - "Advanced Accounting Rule" takes priority (if configured) [fineract]
adamsaghy commented on code in PR #4190:
URL: https://github.com/apache/fineract/pull/4190#discussion_r1869430047
##########
fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java:
##########
@@ -229,14 +230,27 @@ private void createJournalEntriesForChargeOff(LoanDTO loanDTO, LoanTransactionDT
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
final boolean isReversal = loanTransactionDTO.isReversed();
GLAccountBalanceHolder glAccountBalanceHolder = new GLAccountBalanceHolder();
- // principal payment
- if (principalAmount != null && principalAmount.compareTo(BigDecimal.ZERO) > 0) {
- if (isMarkedFraud) {
- populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(),
- AccrualAccountsForLoan.CHARGE_OFF_FRAUD_EXPENSE.getValue(), glAccountBalanceHolder);
- } else {
- populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(),
- AccrualAccountsForLoan.CHARGE_OFF_EXPENSE.getValue(), glAccountBalanceHolder);
+
+ // need to fetch if there are account mappings (always one)
+ Integer chargeOffReasonCode = loanDTO.getChargeOffReasonCode();
Review Comment:
This is not a code, it is a code value
##########
fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java:
##########
@@ -229,14 +230,27 @@ private void createJournalEntriesForChargeOff(LoanDTO loanDTO, LoanTransactionDT
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
final boolean isReversal = loanTransactionDTO.isReversed();
GLAccountBalanceHolder glAccountBalanceHolder = new GLAccountBalanceHolder();
- // principal payment
- if (principalAmount != null && principalAmount.compareTo(BigDecimal.ZERO) > 0) {
- if (isMarkedFraud) {
- populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(),
- AccrualAccountsForLoan.CHARGE_OFF_FRAUD_EXPENSE.getValue(), glAccountBalanceHolder);
- } else {
- populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(),
- AccrualAccountsForLoan.CHARGE_OFF_EXPENSE.getValue(), glAccountBalanceHolder);
+
+ // need to fetch if there are account mappings (always one)
+ Integer chargeOffReasonCode = loanDTO.getChargeOffReasonCode();
+
+ ProductToGLAccountMapping mapping = helper.getChargeOffMappingByCode(chargeOffReasonCode);
+ if (mapping != null) {
+ GLAccount accountCredit = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
+ AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(), paymentTypeId);
+ glAccountBalanceHolder.addToCredit(accountCredit, principalAmount);
+ // Resolve Debit
Review Comment:
No need for this comment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org