first try at checkout receipt
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 25 Jul 2005 13:40:51 +0000 (13:40 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 25 Jul 2005 13:40:51 +0000 (13:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1413 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/auth/auth.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.js
Evergreen/staff_client/chrome/content/evergreen/util/print.js

index 76ed231..374647a 100644 (file)
@@ -36,6 +36,10 @@ G['itemsout_header'] = 'Welcome %PATRON_FIRSTNAME%, to %LIBRARY%!\r\nYou have th
 G['itemsout_line_item'] = '<li>%TITLE: 50%\r\nBarcode: %COPY_BARCODE% Due: %DUE_D%\r\n';
 G['itemsout_footer'] = '</ol><hr />%PINES_CODE% %TODAY%\r\nYou were helped by %STAFF_FIRSTNAME% %STAFF_LASTNAME%';
 
+G['checkout_header'] = 'Welcome %PATRON_FIRSTNAME%, to %LIBRARY%!\r\nYou checked out the following items:<hr/><ol>';
+G['checkout_line_item'] = '<li>%TITLE%\r\nBarcode: %COPY_BARCODE% Due: %DUE_D%\r\n';
+G['checkout_footer'] = '</ol><hr />%PINES_CODE% %TODAY%\r\nYou were helped by %STAFF_FIRSTNAME% %STAFF_LASTNAME%';
+
 var mw = G['main_window'];
 var auth_meter_incr = 10;
 
index f01a252..00158c0 100755 (executable)
@@ -266,11 +266,25 @@ function patron_display_patron_checkout_items_init(p) {
 
        var checkouts = [];
 
+       function print_receipt() {
+               p._current_checkouts = checkouts;
+               var params = { 
+                       'au' : p._patron, 
+                       'lib' : mw.G.user_ou,
+                       'staff' : mw.G.user,
+                       'header' : mw.G.itemsout_header,
+                       'line_item' : mw.G.itemsout_line_item,
+                       'footer' : mw.G.itemsout_footer
+               };
+               mw.print_checkout_receipt( params );
+       }
+
+       p.w.document.getElementById('checkout_print').addEventListener( 'command',print_receipt, false);
+
        p.w.document.getElementById('checkout_done').addEventListener(
                'command',
                function () {
-                       // print receipt call goes here
-                       checkouts = []; p.refresh(); tb.focus();
+                       print_receipt(); checkouts = []; p.redraw(); tb.focus();
                },
                false
        );
index 35a2435..625ae05 100644 (file)
@@ -5,13 +5,26 @@ var print_crlf = '<br />\r\n';
 // Higher-level
 
 function print_itemsout_receipt(params,sample_view) {
+       print_circ_receipt('itemsout',params,sample_view);
+}
+
+function print_checkout_receipt(params,sample_view) {
+       print_circ_receipt('checkout',params,sample_view);
+}
+
+function print_circ_receipt(circ_type,params,sample_view) {
        sdump('D_PRINT',arg_dump(arguments));
        var s = ''; params.current_circ = new circ(); params.current_copy = new acp(); params.current_mvr = new mvr();
        if (params.header) { s += print_template_replace(params.header, params); }
-       for (var i = 0; i < params.au.checkouts().length; i++) {
-               params.current_circ = params.au.checkouts()[i].circ;
-               params.current_copy = params.au.checkouts()[i].copy;
-               params.current_mvr = params.au.checkouts()[i].record;
+       var circs;
+       switch(circ_type) {
+               case 'itemsout' : circs = params.au.checkouts(); break;
+               case 'checkout' : circs = params.au._current_checkouts; break;
+       }
+       for (var i = 0; i < circs.length; i++) {
+               params.current_circ = circs()[i].circ;
+               params.current_copy = circs()[i].copy;
+               params.current_mvr = circs()[i].record;
                params.current_index = i;
                s += print_template_replace(params.line_item, params); 
        }