adamsaghy commented on code in PR #5780:
URL: https://github.com/apache/fineract/pull/5780#discussion_r3205149487


##########
fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java:
##########
@@ -1715,8 +1717,21 @@ private void createJournalEntriesForLoanRepayments(final 
LoanDTO loanDTO, final
         if (MathUtil.isGreaterThanZero(feesAmount)) {
             totalDebitAmount = totalDebitAmount.add(feesAmount);
             if (isIncomeFromFee) {
-                this.helper.createCreditJournalEntryForLoanCharges(office, 
currencyCode, AccrualAccountsForLoan.INCOME_FROM_FEES.getValue(),
-                        loanProductId, loanId, transactionId, transactionDate, 
feesAmount, loanTransactionDTO.getFeePayments());
+                final List<ChargeTaxPaymentDTO> feeTaxPayments = 
loanCommonAccountingHelper.filterTaxPayments(loanTransactionDTO, false);
+                final BigDecimal feeTaxTotal = 
loanCommonAccountingHelper.sumTaxAmounts(feeTaxPayments);
+                if (feeTaxTotal.compareTo(BigDecimal.ZERO) > 0) {
+                    final BigDecimal netFees = 
feesAmount.subtract(feeTaxTotal);
+                    this.helper.createCreditJournalEntryForLoanCharges(office, 
currencyCode,
+                            
AccrualAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, 
transactionId, transactionDate,
+                            netFees,
+                            
loanCommonAccountingHelper.computeNetChargePayments(loanTransactionDTO.getFeePayments(),
 feeTaxPayments));
+                    
loanCommonAccountingHelper.createTaxLiabilityCreditEntries(office, 
currencyCode, loanId, transactionId, transactionDate,
+                            feeTaxPayments);
+                } else {
+                    this.helper.createCreditJournalEntryForLoanCharges(office, 
currencyCode,
+                            
AccrualAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, 
transactionId, transactionDate,
+                            feesAmount, loanTransactionDTO.getFeePayments());
+                }

Review Comment:
   @alberto-art3ch well?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to