From: phasefx Date: Mon, 10 Dec 2007 21:15:58 +0000 (+0000) Subject: print bills with titles from main billing interface X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b8e5a1637a6760a492bf6493f5485a42f57b17d6;p=Evergreen.git print bills with titles from main billing interface git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@8191 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index f4ece92d53..6b0d6a5005 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -302,9 +302,15 @@ OpenILS.data.prototype = { 'bills_current' : { 'type' : 'bills', 'header' : 'Welcome to %LIBRARY%!
You have the following bills:
    ', - 'line_item' : '
    Bill #%id%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', + 'line_item' : '
    Bill #%id% %title%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n', - }, + }, + 'bills_main_view' : { + 'type' : 'bills', + 'header' : 'Welcome to %LIBRARY%!
You have the following bills:
    ', + 'line_item' : '
    Bill #%id% %title%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n', + }, 'offline_checkin' : { 'type' : 'offline_checkin', 'header' : 'You checked in the following items:
    ', diff --git a/Open-ILS/xul/staff_client/server/patron/bills.js b/Open-ILS/xul/staff_client/server/patron/bills.js index a2be8eff58..b94b1cb955 100644 --- a/Open-ILS/xul/staff_client/server/patron/bills.js +++ b/Open-ILS/xul/staff_client/server/patron/bills.js @@ -224,8 +224,17 @@ patron.bills.prototype = { } } ], + 'cmd_print_bills' : [ + ['command'], + function() { + try { + obj.print_bills(); + } catch(E) { + obj.error.standard_unexpected_error_alert('bills -> cmd_print_bills',E); + } - + } + ], 'cmd_change_to_credit' : [ ['command'], function() { @@ -667,6 +676,44 @@ patron.bills.prototype = { } }, + 'print_bills' : function() { + var obj = this; + try { + JSAN.use('util.functional'); JSAN.use('patron.util'); + var columns = patron.util.mbts_columns({}); + var template = 'bills_main_view'; + var params = { + 'patron' : patron.util.retrieve_au_via_id(ses(),obj.patron_id), + 'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ], + 'staff' : obj.data.list.au[0], + 'header' : obj.data.print_list_templates[template].header, + 'line_item' : obj.data.print_list_templates[template].line_item, + 'footer' : obj.data.print_list_templates[template].footer, + 'type' : obj.data.print_list_templates[template].type, + 'list' : util.functional.map_list( + obj.bills, + function(o) { + var id = o.transaction.id(); + var hash = { + 'title' : typeof obj.bill_map[ id ].title != 'undefined' ? obj.bill_map[ id ].title : '', + 'barcode' : typeof obj.bill_map[ id ].barcode != 'undefined' ? obj.bill_map[ id ].barcode : '', + }; + for (var i = 0; i < columns.length; i++) { + var v = columns[i].render( { 'mbts' : o.transaction } ); + hash[ columns[i].id ] = v == null ? '' : v; + } + return hash; + } + ) + }; + JSAN.use('util.print'); var print = new util.print(); + print.tree_list( params ); + + } catch(E) { + obj.error.standard_unexpected_error_alert('bills -> print_bills',E); + } + }, + 'xact_dates_box' : function ( mobts ) { var obj = this; try { diff --git a/Open-ILS/xul/staff_client/server/patron/bills.xul b/Open-ILS/xul/staff_client/server/patron/bills.xul index 2608e78864..98545c3eb8 100644 --- a/Open-ILS/xul/staff_client/server/patron/bills.xul +++ b/Open-ILS/xul/staff_client/server/patron/bills.xul @@ -76,6 +76,7 @@ + diff --git a/Open-ILS/xul/staff_client/server/patron/bills_overlay.xul b/Open-ILS/xul/staff_client/server/patron/bills_overlay.xul index ce6c427b34..459faca43e 100644 --- a/Open-ILS/xul/staff_client/server/patron/bills_overlay.xul +++ b/Open-ILS/xul/staff_client/server/patron/bills_overlay.xul @@ -23,6 +23,7 @@