[aprm-windows] fixes automatic selection of lines
authorSandra Huguet <sandra.huguet@openbravo.com>
Thu, 19 Jun 2014 10:31:55 +0200
changeset 23840 6cb454446dc2
parent 23839 855e52dc0e16
child 23841 f6cffed3670c
[aprm-windows] fixes automatic selection of lines
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Thu Jun 19 10:19:19 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Thu Jun 19 10:31:55 2014 +0200
@@ -278,6 +278,7 @@
       differenceamt = BigDecimal.prototype.ZERO,
       creditamt = new BigDecimal(String(form.getItem('used_credit').getValue() || 0)),
       glitemamt = new BigDecimal(String(form.getItem('amount_gl_items').getValue() || 0)),
+      orderInvoiceData = orderInvoice.data.localData,
       total = orderInvoice.data.totalRows,
       writeoff, amt, outstandingAmount, i;
 
@@ -286,13 +287,12 @@
   // add credit amount
   amount = amount.add(creditamt);
 
-  var orderInvoiceData = orderInvoice.data.localData;
   for (i = 0; i < total; i++) {
     if (isc.isA.Object(orderInvoiceData[i]) && !isc.isA.emptyObject(orderInvoiceData[i])) {
       outstandingAmount = new BigDecimal(String(orderInvoiceData[i].outstandingAmount));
       if (outstandingAmount.signum() < 0) {
         negativeamt = negativeamt.add(new BigDecimal(Math.abs(outstandingAmount).toString()));
-      }        
+      }
     }
   }
 
@@ -301,7 +301,7 @@
   }
 
   for (i = 0; i < total; i++) {
-    if (!isc.isA.Object(orderInvoice.getEditValues(i)) || isc.isA.emptyObject(orderInvoice.getEditValues(i))) {
+    if (!isc.isA.Object(orderInvoiceData[i]) || isc.isA.emptyObject(orderInvoiceData[i])) {
       continue;
     }
     writeoff = orderInvoice.getEditValues(i).writeoff;
@@ -798,4 +798,4 @@
     selectedRecords: selectedRecords,
     finFinancialAccount: finFinancialAccount
   }, {}, callbackOnProcessActionHandler);
-};
+};
\ No newline at end of file