latest bill interface, and checkin backdating
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 21 Jul 2005 16:55:07 +0000 (16:55 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 21 Jul 2005 16:55:07 +0000 (16:55 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1339 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/circ/checkin.js
Evergreen/staff_client/chrome/content/evergreen/circ/checkin_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/circ/circ_utils.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_bills.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display_overlay.xul
Evergreen/staff_client/chrome/locale/en-US/evergreen/OpenILS.properties

index 037a61f..d250ab0 100755 (executable)
@@ -45,13 +45,32 @@ function checkin_checkin_items_init(p) {
        p.checkin_items = checkin_items_init( { 'w' : p.w, 'node' : p.checkin_items_node, 'debug' : p.app } );
 
        var checkins = [];
+
+       var backdate_tb = p.checkin_items_node.getElementsByAttribute('id','checkin_effective_date_textbox')[0];
+       backdate_tb.value = formatted_date( new Date(), '%Y-%m-%d');
+       backdate_tb.addEventListener(
+               'change',
+               function () {
+                       var flag = false;
+                       var darray = backdate_tb.value.split('-');
+                       var year = darray[0]; if ( (!year) || (year.length != 4) || (!parseInt(year)) ) flag = true;
+                       var month = darray[1]; if ( (!month) || (month.length !=2) || (!parseInt(month)) ) flag = true;
+                       var day = darray[2]; if ( (!day) || (day.length !=2) || (!parseInt(day)) ) flag = true;
+                       if (flag) {
+                               snd_bad();
+                               backdate_tb.value = formatted_date( new Date(), '%Y-%m-%d');
+                       }
+               },
+               false
+       );
+
        var tb = p.checkin_items_node.getElementsByAttribute('id','checkin_barcode_entry_textbox')[0];
        var submit_button = p.checkin_items_node.getElementsByAttribute('id','checkin_submit_barcode_button')[0];
 
        p.attempt_checkin = function(barcode) {
                try {
                        //if (! is_barcode_valid(barcode) ) throw('Invalid Barcode');
-                       var check = checkin_by_copy_barcode( barcode );
+                       var check = checkin_by_copy_barcode( barcode, backdate_tb.value );
                        if (check) {
                                sdump('D_CHECKIN','check = ' + check + '\n' + pretty_print( js2JSON( check ) ) + '\n');
 
index 8042b20..a4f930d 100755 (executable)
@@ -40,6 +40,9 @@
        <label id="checkin_scan_barcode_label" value="&circ.checkin.scan_label;" accesskey="&circ.checkin.scan_label.accesskey;" control="checkin_barcode_entry_textbox"/>
         <textbox id="checkin_barcode_entry_textbox"/>
         <button id="checkin_submit_barcode_button" label="&circ.checkin.submit_label;" accesskey="&circ.checkin.submit_label.accesskey;"/>
+       <spacer flex="1"/>
+       <label value="Effective Date:" control="checkin_effective_date_textbox"/>
+       <textbox id="checkin_effective_date_textbox"/>
 </hbox>
 
 <hbox id="CheckinItems_insert2" />
index 4d8fce4..1554441 100644 (file)
@@ -71,13 +71,15 @@ function hold_capture_by_copy_barcode( barcode, retrieve_flag ) {
        }
 }
 
-function checkin_by_copy_barcode(barcode, f) {
+function checkin_by_copy_barcode(barcode, backdate, f) {
        sdump('D_CIRC_UTILS',arg_dump(arguments,{0:true}));
        try {
+               if (backdate && (backdate == formatted_date(new Date(),'%Y-%m-%d')) ) backdate = null;
+
                var check = user_request(
                        'open-ils.circ',
                        'open-ils.circ.checkin.barcode',
-                       [ mw.G.auth_ses[0], barcode ],
+                       [ mw.G.auth_ses[0], barcode, null, backdate ],
                        f
                )[0];
 
index c303c4d..6d8c45b 100644 (file)
@@ -28,6 +28,7 @@ function patron_bills_init(p) {
                        total_payment = total_applied;
                        p.control_box.bill_payment_amount.value = cents_as_dollars( total_applied );
                }
+               p.control_box.bill_payment_applied.setAttribute('value', cents_as_dollars( total_applied ));
                p.control_box.bill_payment_applied.value = cents_as_dollars( total_applied );
                p.control_box.bill_credit_amount.value = '';
                if (total_payment > total_applied ) {
@@ -126,7 +127,8 @@ function patron_bills_init(p) {
 
 function patron_bills_control_box_init( p ) {
        p.control_box = {};
-       p.control_box.node = p.node.nextSibling;
+       p.control_box.node = p.node.previousSibling;
+       p.control_box.node2 = p.node.nextSibling;
        p.control_box.bill_total_owed = p.control_box.node.getElementsByAttribute('id','bill_total_owed')[0];
        p.control_box.payment_type = p.control_box.node.getElementsByAttribute('id','payment_type_menulist')[0];
        p.control_box.bill_payment_amount = p.control_box.node.getElementsByAttribute('id','bill_payment_amount_textbox')[0];
@@ -149,9 +151,9 @@ function patron_bills_list_box_init( p ) {
                        'fm_field_render' : 'xact_dates_box($$)'
                },
                {
-                       'id' : 'notes', 'label' : getString('mbts_xact_type_label'), 'flex' : 1,
+                       'id' : 'notes', 'label' : getString('bills_information'), 'flex' : 1,
                        'primary' : false, 'hidden' : false, 'fm_class' : 'mbts',
-                       'fm_field_render' : '.xact_type()'
+                       'fm_field_render' : '.last_billing_note()'
                },
                {
                        'id' : 'money', 'label' : getString('bills_money_label'), 'flex' : 0,
@@ -167,11 +169,17 @@ function patron_bills_list_box_init( p ) {
        p.list_box = list_box_init( { 'w' : p.w, 'node' : p.node, 'cols' : p.patron_bills_cols, 'debug' : p.app } );
        p.clear_patron_bills = function () { 
                p.current_payments = []; 
+               p.control_box.bill_total_owed.setAttribute('value', 'Calculating...');
                p.control_box.bill_total_owed.value = 'Calculating...';
+               p.control_box.bill_payment_amount.setAttribute('value', '');
                p.control_box.bill_payment_amount.value = '';
+               p.control_box.bill_payment_applied.setAttribute('value', '0.00');
                p.control_box.bill_payment_applied.value = '0.00';
+               p.control_box.bill_change_amount.setAttribute('value', '0.00');
                p.control_box.bill_change_amount.value = '0.00';
+               p.control_box.bill_credit_amount.setAttribute('value', '0.00');
                p.control_box.bill_credit_amount.value = '0.00';
+               p.control_box.bill_new_balance.setAttribute('value', 'Calculating...');
                p.control_box.bill_new_balance.value = 'Calculating...';
                p.list_box.clear_rows(); 
        };
index ff18949..1a9c3b0 100755 (executable)
@@ -179,7 +179,7 @@ function patron_display_patron_items_init(p) {
                                                try {
                                                        var idx = patron_items[i].getAttribute('record_id'); 
                                                        var copy = p._patron.checkouts()[ idx ].copy;
-                                                       checkin_by_copy_barcode( copy.barcode() );
+                                                       checkin_by_copy_barcode( copy.barcode(), null );
                                                        p.refresh();
                                                } catch(E) {
                                                        alert(E);
@@ -326,7 +326,7 @@ function patron_display_patron_checkout_items_init(p) {
                                                try {
                                                        var idx = patron_checkout_items[i].getAttribute('record_id'); 
                                                        var copy = checkouts[ idx ].copy;
-                                                       var status = checkin_by_copy_barcode( copy.barcode() );
+                                                       var status = checkin_by_copy_barcode( copy.barcode(), null );
                                                        if (status == null) { // change this to whatever it takes
                                                                keep_these.push( checkouts[ idx ] );    
                                                        }
index 844fec0..99edaa8 100755 (executable)
@@ -57,9 +57,9 @@
        </groupbox>
        <groupbox id="cssdgb4">
                <caption id="cssdgb4c" label="&patron_navbar.bills;"/>
-               <box id="PatronBills_insert1" flex="0" />
+               <box name="insert1" id="PatronBills_insert1" flex="0" />
                <box id="PatronBills_main" flex="1" />
-               <box id="PatronBills_insert2" flex="0" />
+               <box name="insert2" id="PatronBills_insert2" flex="0" />
        </groupbox>
        <box id="PatronEdit_main"><label value="edit" /></box>
        <box id="PatronInfo_main"><label value="info" /></box>
        <button id="checkout_done" label="&patron_display.checkout.done_label;" accesskey="&patron_display.checkout.done_label.accesskey;"/>
 </hbox>
 
-<box id="PatronBills_insert1" orient="vertical">
+<box id="PatronBills_insert2" orient="vertical">
 </box>
 
-<box id="PatronBills_insert2" orient="vertical">
-       <label value=" "/>
+<box id="PatronBills_insert1" orient="vertical">
        <hbox>
+               <groupbox>
+                       <caption label="Summary"/>
+                       <grid>
+                               <columns><column /><column /></columns>                                 
+                               <rows>
+                                       <row>
+                                               <label value="Total Owed" />
+       
+                                               <textbox id="bill_total_owed" value="" readonly="true" />
+                                       </row>
+                                       <row>
+                                               <label value="- Payment applied" />
+                       
+                                               <textbox id="bill_payment_applied_textbox" readonly="true"/>
+                                       </row>
+                                       <row>
+                                               <label value="= New Balance" 
+                                                       style="font-family: bold" />
+       
+                                               <textbox id="bill_new_balance_textbox" readonly="true"/>
+                                       </row>
+                               </rows>
+                       </grid>
+               </groupbox>
                <spacer flex="2"/>
-               <grid style="border: solid thin black">
-                       <columns><column /><column /><column /></columns>                                 
-                       <rows>
-                               <row>
-                                       <label value="Total Owed"
-                                               style="font-family: bold" />
-
-                                       <textbox id="bill_total_owed" value="" 
-                                               style="font-family: bold" readonly="true" />
-                               </row>
-                               <row>
-                                       <label id="pbi1_l2" value="Payment Type" 
-                                               accesskey="t" control="pbi1_ml" 
-                                               style="font-family: bold" />
-                                       <menulist id="payment_type_menulist">
-                                               <menupopup id="payment_type_menupopup">
-                                                       <menuitem id="payment_type_menuitem1" label="Cash" />
-                                                       <menuitem id="payment_type_menuitem2" label="Credit Card" />
-                                                       <menuitem id="payment_type_menuitem3" label="Forward Balance" />
-                                                       <menuitem id="payment_type_menuitem4" label="Forgive" />
-                                               </menupopup>
-                                       </menulist>
-                               </row>
-                               <row>
-                                       <label value="Payment received" 
-                                               accesskey="a" control="pbi1_tb1"
-                                               style="font-family: bold" />
-               
-                                       <textbox id="bill_payment_amount_textbox" />
-                               </row>
-                               <row>
-                                       <label value="- Payment applied" 
-                                               style="font-family: bold" />
-               
-                                       <textbox id="bill_payment_applied_textbox" readonly="true"/>
-                               </row>
-                               <row>
-                                       <label value="= Change" 
-                                               control="bill_change_amount_textbox" 
-                                               style="font-family: bold" />
-
-                                       <textbox id="bill_change_amount_textbox" />
-
-                                       <button id="convert_change" label="Credit" accesskey="t"/>
-                               </row>
-                               <row><label value=" "/></row>
-                               <row>
-
-                                       <label value="New Balance" 
-                                               style="font-family: bold" />
-
-                                       <textbox id="bill_new_balance_textbox" readonly="true"/>
-
-                               </row>
-                               <row><label value=" "/></row>
-                               <row>
-
-                                       <label value="Forward Credit" 
-                                               style="font-family: bold" />
-
-                                       <textbox id="bill_credit_amount_textbox" readonly="true"/>
-
-                               </row>
-                               <row>
-                                       <spacer/>
-                                       <button id="bill_apply_payment" label="Go!" accesskey="G"/>
-                               </row>
-                       </rows>
-               </grid>
-               <spacer flex="1" />     
+               <groupbox>
+                       <caption label="Pay Bill"/>
+                       <grid>
+                               <columns><column /><column /></columns>                                 
+                               <rows>
+                                       <row>
+                                               <label value="Payment Type" 
+                                                       accesskey="t" control="payment_type_menulist" />
+                                               <menulist id="payment_type_menulist">
+                                                       <menupopup id="payment_type_menupopup">
+                                                               <menuitem id="payment_type_menuitem1" label="Cash" />
+                                                               <menuitem id="payment_type_menuitem2" label="Credit Card" />
+                                                               <menuitem id="payment_type_menuitem3" label="Patron Credit" />
+                                                               <menuitem id="payment_type_menuitem4" label="Forgive" />
+                                                       </menupopup>
+                                               </menulist>
+                                       </row>
+                                       <row>
+                                               <label value="Payment received" style="font-weight: bold"
+                                                       accesskey="a" control="bill_payment_amount_textbox" />
+                       
+                                               <textbox id="bill_payment_amount_textbox" style="border: solid thick black"/>
+                                       </row>
+                                       <row>
+                                               <label value="- Payment applied" />
+                       
+                                               <textbox id="bpato" observes="bill_payment_applied_textbox" />
+                                       </row>
+                                       <row>
+                                               <label value="= Change" control="bill_change_amount_textbox" />
+       
+                                               <hbox>
+                                                       <textbox id="bill_change_amount_textbox" />
+                                               </hbox>
+                                       </row>
+                                       <row>
+                                               <label value="or Patron Credit" 
+                                                       style="font-family: bold" />
+       
+                                               <textbox id="bill_credit_amount_textbox" readonly="true"/>
+                                       </row>
+                               </rows>
+                       </grid>
+               </groupbox>
        </hbox>
-       <spacer flex="1" />     
+       <hbox>
+               <spacer flex="2"/>
+               <button id="change_to_credit" label="Convert Change to Patron Credit"/>
+               <button id="bill_apply_payment" label="Go!" accesskey="G"/>
+       </hbox>
+       <label value=" "/>
 </box>
 
 <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
index 41b2900..8f926c9 100644 (file)
@@ -100,5 +100,5 @@ mbts_total_owed_label=Original Bill
 mbts_total_paid_label=Total Paid
 mbts_xact_finish_label=Finish
 mbts_xact_start_label=Start
-mbts_xact_type_label=Notes
+bills_information=Information