Related to BUG-43380: Code Review changes.
authorDavid Miguelez <david.miguelez@openbravo.com>
Fri, 13 Mar 2020 09:08:23 +0100
changeset 37207 c65f62b9ff01
parent 37206 5214fb3a858d
child 37208 c82723718ce2
Related to BUG 43380: Code Review changes.

Added final modifiers to variables
src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Wed Mar 11 14:11:54 2020 +0530
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Fri Mar 13 09:08:23 2020 +0100
@@ -95,12 +95,12 @@
       return null;
     }
 
-    int noOfPaymentDetails = paymentDetails.size();
-    BigDecimal usedCredit = payment.getUsedCredit();
-    BigDecimal creditAmtToAdjust = usedCredit.divide(new BigDecimal(noOfPaymentDetails),
+    final int noOfPaymentDetails = paymentDetails.size();
+    final BigDecimal usedCredit = payment.getUsedCredit();
+    final BigDecimal creditAmtToAdjust = usedCredit.divide(new BigDecimal(noOfPaymentDetails),
         payment.getCurrency().getPricePrecision().intValue(), RoundingMode.HALF_UP);
     BigDecimal totalCreditAdjusted = BigDecimal.ZERO;
-    FieldProviderFactory[] data = new FieldProviderFactory[noOfPaymentDetails];
+    final FieldProviderFactory[] data = new FieldProviderFactory[noOfPaymentDetails];
     String psId = null;
     String pdId = null;
     BigDecimal totalAmount = BigDecimal.ZERO;
@@ -162,7 +162,7 @@
           FieldProviderFactory.setField(data[i], "Amount", totalAmount.toString());
           BigDecimal amountExcludingCredit = totalAmount.subtract(creditAmtToAdjust);
           totalCreditAdjusted = totalCreditAdjusted.add(creditAmtToAdjust);
-          if (i == noOfPaymentDetails - 1) {
+          if (i == noOfPaymentDetails - 1) { // Last Payment Detail
             amountExcludingCredit = amountExcludingCredit
                 .subtract(usedCredit.subtract(totalCreditAdjusted));
           }