alternate bill view
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Jun 2006 17:26:36 +0000 (17:26 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Jun 2006 17:26:36 +0000 (17:26 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4630 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/patron/bill_history.xul
Open-ILS/xul/staff_client/server/patron/bills.js

index eaeb074..084c79f 100644 (file)
@@ -90,6 +90,7 @@ const api = {
        'FM_MBTS_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billable_xact_summary.retrieve' },
        'FM_MBTS_IDS_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history' },
        'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_charge' },
+       'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance' },
        'FM_MP_RETRIEVE_VIA_MBTS_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all' },
        'FM_MG_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.create' },
        'FM_MOBTS_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance' },
index 443d253..12511af 100644 (file)
 
                }
 
-               function retrieve_all_mbts_for_list() {
-                       g.mbts_ids = g.network.simple_request('FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE',[ses(),g.patron_id]);
+               function retrieve_mbts_for_list() {
+                       var method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE';
+                       if (g.cgi.param('current')) method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE';
+                       g.mbts_ids = g.network.simple_request(method,[ses(),g.patron_id]);
                        if (g.mbts_ids.ilsevent) {
                                switch(g.mbts_ids.ilsevent) {
                                        case -1: g.error.standard_network_error_alert('Please close this window and try again.'); break;
@@ -58,6 +60,7 @@
                        } else if (g.mbts_ids == null) {
                                g.error.standard_unexpected_error_alert('Please close this window and try again.',null);
                        } else {
+                               g.mbts_ids.reverse();
                                var funcs = [];
                        
                                                function gen_func(r) {
 
                                init_lists();
 
-                               retrieve_all_mbts_for_list();
+                               retrieve_mbts_for_list();
 
                                $('details').addEventListener(
                                        'command',
                                        false
                                );
 
-                               document.title = 'Bill History';
+                               if (g.cgi.param('current')) {
+                                       $('caption').setAttribute('label','Current Bills');
+                                       document.title = 'Current Bills';
+                               } else {
+                                       $('caption').setAttribute('label','Bill History');
+                                       document.title = 'Bill History';
+                               }
 
                        } catch(E) {
                                var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
                                        'billwizard',
                                        'chrome,resizable,modal'
                                );
-                               //dump('pause\n');alert('pause');
                                g.bill_list.clear();
-                               //dump('pause\n');alert('pause');
-                               retrieve_all_mbts_for_list();
-                               //dump('pause\n');alert('pause');
+                               retrieve_mbts_for_list();
                                g.data.temp = 'refresh'; g.data.stash('temp');
-                               //dump('pause\n');alert('pause');
                        }
                }
 
                <splitter><grippy/></splitter>
 
                <groupbox orient="vertical" flex="3">
-                       <caption label="Bill History"/>
+                       <caption id="caption" label="Bill History"/>
                        <tree id="bill_tree" flex="1" enableColumnDrag="true" seltype="single"/>
                        <hbox>
                                <spacer flex="1"/>
index 675a783..5fd3d7e 100644 (file)
@@ -178,6 +178,26 @@ patron.bills.prototype = {
                                                                        }
                                                                }
                                                        ],
+                                                       'cmd_alternate_view' : [
+                                                               ['command'],
+                                                               function() { 
+                                                                       try {
+                                                                               JSAN.use('util.window');
+                                                                               var win = new util.window();
+                                                                               obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
+                                                                               var w = win.open(
+                                                                                       urls.XUL_PATRON_BILL_HISTORY
+                                                                                               + '?current=1&patron_id=' + window.escape(obj.patron_id),
+                                                                                       'billhistory',
+                                                                                       'chrome,resizable,modal'
+                                                                               );
+                                                                               obj.OpenILS.data.init({'via':'stash'}); if (obj.OpenILS.data.temp == 'refresh') { obj.refresh(); }
+                                                                       } catch(E) {
+                                                                               obj.error.standard_unexpected_error_alert('bills -> cmd_alternate_view',E);     
+                                                                       }
+                                                               }
+                                                       ],
+
 
                                                        'cmd_change_to_credit' : [
                                                                ['command'],