[open-ils-commits] r14204 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Sep 29 11:43:20 EDT 2009


Author: phasefx
Date: 2009-09-29 11:43:17 -0400 (Tue, 29 Sep 2009)
New Revision: 14204

Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js
   trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul
Log:
tally of total owed and total paid for selected transactions in bill history / alternate view interface

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-09-29 15:09:57 UTC (rev 14203)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-09-29 15:43:17 UTC (rev 14204)
@@ -2433,6 +2433,8 @@
 <!ENTITY staff.patron.bill_history.show_in_catalog.accesskey "S">
 <!ENTITY staff.patron.bill_history.print.label "Print">
 <!ENTITY staff.patron.bill_history.print.accesskey "P">
+<!ENTITY staff.patron.bill_history.selected_billed.label "Selected Billed:">
+<!ENTITY staff.patron.bill_history.selected_paid.label "Selected Paid:">
 <!ENTITY staff.patron.bills_overlay.still_checked_out.label "Red Items are still Checked Out">
 <!ENTITY staff.patron.bills_overlay.uncheck_all.label "Uncheck All">
 <!ENTITY staff.patron.bills_overlay.check_all.label "Check All">

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js	2009-09-29 15:09:57 UTC (rev 14203)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js	2009-09-29 15:43:17 UTC (rev 14204)
@@ -1,5 +1,30 @@
 function $(id) { return document.getElementById(id); }
 
+function tally_selected() {
+    try {
+        JSAN.use('util.money');
+        var selected_billed = 0;
+        var selected_paid = 0;
+
+        for (var i = 0; i < g.bill_list_selection.length; i++) {
+            var bill = g.bill_map[g.bill_list_selection[i]];
+            if (!bill) {
+                $('billed_tally').setAttribute('value', '???');
+                $('paid_tally').setAttribute('value', '???');
+                return;
+            }
+            var to = util.money.dollars_float_to_cents_integer( bill.transaction.total_owed() );
+            var tp = util.money.dollars_float_to_cents_integer( bill.transaction.total_paid() );
+            selected_billed += to;
+            selected_paid += tp;
+        }
+        $('billed_tally').setAttribute('value', '$' + util.money.cents_as_dollars( selected_billed ) );
+        $('paid_tally').setAttribute('value', '$' + util.money.cents_as_dollars( selected_paid ) );
+    } catch(E) {
+        alert('Error in bill_history.js, tally_selected(): ' + E);
+    }
+}
+
 function retrieve_mbts_for_list() {
     //var method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE';
     var method = 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY.authoritative';
@@ -50,6 +75,9 @@
 
 function init_lists() {
     JSAN.use('util.list'); JSAN.use('circ.util'); 
+
+    g.bill_list_selection = [];
+
     g.bill_list = new util.list('bill_tree');
 
     g.bill_list.init( {
@@ -68,6 +96,7 @@
                 g.bill_list.retrieve_selection(),
                 function(o) { return o.getAttribute('retrieve_id'); }
             );
+            tally_selected();
             $('details').disabled = g.bill_list_selection.length == 0;
             $('add').disabled = g.bill_list_selection.length == 0;
             $('summary').hidden = g.bill_list_selection.length == 0;
@@ -85,9 +114,11 @@
                         row.my.circ = blob.circ;
                         row.my.acp = blob.copy;
                         row.my.mvr = blob.record;
+                        g.bill_map[ id ] = blob;
                         if (typeof params.on_retrieve == 'function') {
                             params.on_retrieve(row);
-                        }
+                        };
+                        tally_selected();
                     } );
                 }
             }
@@ -124,7 +155,7 @@
             document.title = $("patronStrings").getString('staff.patron.bill_history.my_init.bill_history');
         }
 
-        g.funcs = [];
+        g.funcs = []; g.bill_map = {};
 
         g.patron_id = xul_param('patron_id');
 

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2009-09-29 15:09:57 UTC (rev 14203)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2009-09-29 15:43:17 UTC (rev 14204)
@@ -38,6 +38,12 @@
 	<vbox flex="1" class="my_overflow">
         <groupbox orient="vertical" flex="1">
             <caption id="caption" label="&staff.patron.bill_history.caption.label;"/>
+            <hbox>
+                <label value='&staff.patron.bill_history.selected_billed.label;' style='font-weight: bold;'/>
+                <label id="billed_tally" />
+                <label value='&staff.patron.bill_history.selected_paid.label;' style='font-weight: bold;'/>
+                <label id="paid_tally" />
+            </hbox>
             <tree id="bill_tree" flex="1" enableColumnDrag="true" seltype="multiple"/>
             <hbox>
                 <hbox id="bill_list_actions" />



More information about the open-ils-commits mailing list