From c42db0fde920e83706e274521df76319954dea5d Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 25 Jul 2005 13:40:51 +0000 Subject: [PATCH] first try at checkout receipt git-svn-id: svn://svn.open-ils.org/ILS/trunk@1413 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../chrome/content/evergreen/auth/auth.js | 4 ++++ .../evergreen/patron/patron_display.js | 18 ++++++++++++++-- .../chrome/content/evergreen/util/print.js | 21 +++++++++++++++---- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Evergreen/staff_client/chrome/content/evergreen/auth/auth.js b/Evergreen/staff_client/chrome/content/evergreen/auth/auth.js index 76ed2312a1..374647a918 100644 --- a/Evergreen/staff_client/chrome/content/evergreen/auth/auth.js +++ b/Evergreen/staff_client/chrome/content/evergreen/auth/auth.js @@ -36,6 +36,10 @@ G['itemsout_header'] = 'Welcome %PATRON_FIRSTNAME%, to %LIBRARY%!\r\nYou have th G['itemsout_line_item'] = '
  • %TITLE: 50%\r\nBarcode: %COPY_BARCODE% Due: %DUE_D%\r\n'; G['itemsout_footer'] = '
    %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:
      '; +G['checkout_line_item'] = '
    1. %TITLE%\r\nBarcode: %COPY_BARCODE% Due: %DUE_D%\r\n'; +G['checkout_footer'] = '

    %PINES_CODE% %TODAY%\r\nYou were helped by %STAFF_FIRSTNAME% %STAFF_LASTNAME%'; + var mw = G['main_window']; var auth_meter_incr = 10; diff --git a/Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.js b/Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.js index f01a25234e..00158c078e 100755 --- a/Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.js +++ b/Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.js @@ -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 ); diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/print.js b/Evergreen/staff_client/chrome/content/evergreen/util/print.js index 35a243548b..625ae051e0 100644 --- a/Evergreen/staff_client/chrome/content/evergreen/util/print.js +++ b/Evergreen/staff_client/chrome/content/evergreen/util/print.js @@ -5,13 +5,26 @@ var print_crlf = '
    \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); } -- 2.43.2