[open-ils-commits] r14721 - trunk/Open-ILS/xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 2 14:24:44 EST 2009


Author: phasefx
Date: 2009-11-02 14:24:40 -0500 (Mon, 02 Nov 2009)
New Revision: 14721

Modified:
   trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
Log:
calculate change

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2009-11-02 16:31:50 UTC (rev 14720)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2009-11-02 19:24:40 UTC (rev 14721)
@@ -117,6 +117,27 @@
     try { $('payment').focus(); } catch(E) { alert('Error in default_focus(): ' + E); }
 }
 
+function tally_pending() {
+    try {
+        JSAN.use('util.money');
+        var tb = $('payment');
+        var payment_tendered = util.money.dollars_float_to_cents_integer( tb.value );
+        var payment_pending = 0;
+        var retrieve_ids = g.bill_list.dump_retrieve_ids();
+        for (var i = 0; i < retrieve_ids.length; i++) {
+            var row_params = g.row_map[retrieve_ids[i]];
+            if (g.check_map[retrieve_ids[i]]) { 
+                payment_pending += util.money.dollars_float_to_cents_integer( row_params.row.my.payment_pending );
+            }
+        }
+        var change_pending = payment_tendered - payment_pending;
+        $('pending_payment').value = util.money.cents_as_dollars( payment_pending );
+        $('pending_change').value = util.money.cents_as_dollars( change_pending );
+    } catch(E) {
+        alert('Error in bill2.js, tally_pending(): ' + E);
+    }
+}
+
 function tally_selected() {
     try {
         JSAN.use('util.money');
@@ -310,7 +331,7 @@
                 g.bill_list.retrieve_selection(),
                 function(o) { return o.getAttribute('retrieve_id'); }
             );
-            tally_selected();
+            //tally_selected();
             $('details').setAttribute('disabled', g.bill_list_selection.length == 0);
             $('add').setAttribute('disabled', g.bill_list_selection.length == 0);
             $('voidall').setAttribute('disabled', g.bill_list_selection.length == 0);
@@ -475,7 +496,7 @@
             }
             g.bill_list.refresh_row(row_params);
         }
-        //obj.update_payment_applied();
+        tally_pending();
     } catch(E) {
         alert('Error in bill2.js, distribute_payment(): ' + E);
     }



More information about the open-ils-commits mailing list