alberto-art3ch commented on code in PR #5780:
URL: https://github.com/apache/fineract/pull/5780#discussion_r3177102527
##########
fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -958,13 +961,29 @@ private AccountingBridgeLoanTransactionDTO
convertToAccountingBridgeTransaction(
if (!loanTransaction.getLoanChargesPaid().isEmpty()) {
List<LoanChargePaidByDTO> loanChargesPaidData = new ArrayList<>();
for (final LoanChargePaidBy chargePaidBy :
loanTransaction.getLoanChargesPaid()) {
+ final LoanCharge lc = chargePaidBy.getLoanCharge();
final LoanChargePaidByDTO loanChargePaidData = new
LoanChargePaidByDTO();
-
loanChargePaidData.setChargeId(chargePaidBy.getLoanCharge().getCharge().getId());
-
loanChargePaidData.setIsPenalty(chargePaidBy.getLoanCharge().isPenaltyCharge());
-
loanChargePaidData.setLoanChargeId(chargePaidBy.getLoanCharge().getId());
+ loanChargePaidData.setChargeId(lc.getCharge().getId());
+ loanChargePaidData.setIsPenalty(lc.isPenaltyCharge());
+ loanChargePaidData.setLoanChargeId(lc.getId());
loanChargePaidData.setAmount(chargePaidBy.getAmount());
loanChargePaidData.setInstallmentNumber(chargePaidBy.getInstallmentNumber());
+ // Pro-rate each TaxComponent's tax proportionally to the paid
amount
+ final BigDecimal chargeAmount = lc.getAmount();
+ final BigDecimal paidAmount = chargePaidBy.getAmount();
+ if (chargeAmount != null &&
chargeAmount.compareTo(BigDecimal.ZERO) > 0 && !lc.getTaxDetails().isEmpty()) {
+ final List<ChargeTaxDetailDTO> taxDetails = new
ArrayList<>();
+ for (LoanChargeTaxDetails taxDetail : lc.getTaxDetails()) {
+ if (taxDetail.getTaxComponent().getCreditAccount() !=
null) {
+ final BigDecimal proRatedTax =
taxDetail.getAmount().multiply(paidAmount).divide(chargeAmount, 6,
+ RoundingMode.HALF_EVEN);
Review Comment:
Done! updated
--
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]