layout tweaks, uncheck refundable transactions by default
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Oct 2009 20:59:24 +0000 (20:59 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Oct 2009 20:59:24 +0000 (20:59 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14458 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/bill2.js
Open-ILS/xul/staff_client/server/patron/bill2.xul
Open-ILS/xul/staff_client/server/skin/circ.css

index 3871609..dfb3e21 100644 (file)
@@ -43,6 +43,7 @@ function tally_all() {
         var total_billed = 0;
         var total_paid = 0;
         var total_balance = 0;
+        var refunds_owed = 0;
 
         var retrieve_ids = g.bill_list.dump_retrieve_ids();
         for (var i = 0; i < retrieve_ids.length; i++) {
@@ -56,6 +57,7 @@ function tally_all() {
                 $('total_owed2').setAttribute('value', '???');
                 $('total_billed').setAttribute('value', '???');
                 $('total_paid').setAttribute('value', '???');
+                $('refunds_owed').setAttribute('value', '???');
                 return;
             }
             var to = util.money.dollars_float_to_cents_integer( bill.transaction.total_owed() );
@@ -64,6 +66,7 @@ function tally_all() {
             total_billed += to;
             total_paid += tp;
             total_balance += bo;
+            if ( bo < 0 ) refunds_owed += bo;
             if (g.check_map[retrieve_ids[i]]) {
                 checked_billed += to;
                 checked_paid += tp;
@@ -78,6 +81,7 @@ function tally_all() {
         $('total_paid').setAttribute('value', '$' + util.money.cents_as_dollars( total_paid ) );
         $('total_owed').setAttribute('value', '$' + util.money.cents_as_dollars( total_balance ) );
         $('total_owed2').setAttribute('value', '$' + util.money.cents_as_dollars( total_balance ) );
+        $('refunds_owed').setAttribute('value', '$' + util.money.cents_as_dollars( Math.abs( refunds_owed ) ) );
     } catch(E) {
         alert('Error in bill2.js, tally_all(): ' + E);
     }
@@ -191,12 +195,15 @@ function init_lists() {
                         row.my.circ = blob.circ;
                         row.my.acp = blob.copy;
                         row.my.mvr = blob.record;
-                        g.bill_map[ id ] = blob;
-                        g.check_map[ id ] = row.my.checked;
                         if (typeof params.on_retrieve == 'function') {
-                            if ( Number( row.my.mbts.balance_owed() ) < 0 ) params.row_node.firstChild.setAttribute('properties','refundable');
+                            if ( Number( row.my.mbts.balance_owed() ) < 0 ) {
+                                params.row_node.firstChild.setAttribute('properties','refundable');
+                                row.my.checked = false;
+                            }
                             params.on_retrieve(row);
                         };
+                        g.bill_map[ id ] = blob;
+                        g.check_map[ id ] = row.my.checked;
                         tally_selected();
                         tally_all();
                     } );
@@ -259,6 +266,25 @@ function my_init() {
         exec.on_error = function(E) { alert(E); return true; }
         exec.timer(g.funcs,100);
 
+        $('credit_forward').setAttribute('value','???');
+        if (!g.patron) {
+            g.network.simple_request(
+                'FM_AU_FLESHED_RETRIEVE_VIA_ID.authoritative',
+                [ ses(), g.patron_id ],
+                function(req) {
+                    try {
+                        g.patron = req.getResultObject();
+                        if (typeof g.patron.ilsevent != 'undefined') throw(g.patron);
+                        $('credit_forward').setAttribute('value','$' + util.money.sanitize( g.patron.credit_forward_balance() ));
+                    } catch(E) {
+                        alert('Error in bill2.js, retrieve patron callback: ' + E);
+                    }
+                }
+            );
+        } else {
+            $('credit_forward').setAttribute('value','$' + util.money.sanitize( g.patron.credit_forward_balance() ));
+        }
+
         default_focus();
 
     } catch(E) {
index e22175d..4c8ee0e 100644 (file)
         <groupbox orient="vertical" flex="1">
             <caption id="caption" label="&staff.patron.bill_interface.caption.label;"/>
             <hbox>
-                <grid>
-                    <columns>
+                <grid flex="1">
+                    <columns flex="1">
+                        <column/>
+                        <column/>
+                        <column flex="1"/>
                         <column/>
                         <column/>
                     </columns>
                     <rows>
-                        <row><label value="Total Owed:" class="big_emphasis1" /><label id="total_owed2" class="big_emphasis1"/></row>
-                        <row><label value="Total Checked:" class="big_emphasis1" /><label id="checked_owed2" class="big_emphasis1"/></row>
+                        <row>
+                            <vbox pack="center"><label value="Total Owed:" class="big_emphasis1" /></vbox><vbox pack="center"><label id="total_owed2" class="big_emphasis1"/></vbox>
+                            <spacer flex="1"/>
+                            <vbox pack="center"><label value="Refunds Available:" class="big_emphasis2"/></vbox><vbox pack="center"><label id="refunds_owed" class="big_emphasis2"/></vbox>
+                        </row>
+                        <row>
+                            <vbox pack="center"><label value="Total Checked:" class="big_emphasis1" /></vbox><vbox pack="center"><label id="checked_owed2" class="big_emphasis1"/></vbox>
+                            <spacer flex="1"/>
+                            <vbox pack="center"><label value='Credit Available:' class="big_emphasis2"/></vbox><vbox pack="center"><label id="credit_forward" class="big_emphasis2"/></vbox>
+                        </row>
                     </rows>
                 </grid>
                 <spacer flex="1"/>
                 <vbox>
                     <hbox>
                         <label value='&staff.patron.bill_interface.voided_this_session.label;' class="emphasis1"/><label id="currently_voided" value="$0.00"/>
-                        <label value='Credit Available:' class="emphasis1"/><label id="credit_forward" value="$0.00"/>
                     </hbox>
                     <hbox><label value='Change Due Upon Payment:' class="big_emphasis1"/><label id="change_due" value="$0.00" class="big_emphasis1"/></hbox>
                 </vbox>
index 2f0facc..7425cd9 100644 (file)
@@ -21,5 +21,6 @@ treechildren::-moz-tree-row(refundable) {
 #checkin_auto_print_slips_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; }
 
 .big_emphasis1 { font-weight: bold; font-size: x-large; }
+.big_emphasis2 { font-weight: bold; font-size: large; }
 .emphasis1 { font-weight: bold; }
 .emphasis2 { font-weight: normal; }