print bills with titles from main billing interface
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Dec 2007 21:24:11 +0000 (21:24 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Dec 2007 21:24:11 +0000 (21:24 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8193 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/server/patron/bills.js
Open-ILS/xul/staff_client/server/patron/bills.xul
Open-ILS/xul/staff_client/server/patron/bills_overlay.xul

index f4ece92..c6e1159 100644 (file)
@@ -304,7 +304,13 @@ OpenILS.data.prototype = {
                                        'header' : 'Welcome to %LIBRARY%!<br/>You have the following bills:<hr/><ol>',
                                        'line_item' : '<dt><b>Bill #%id%</b></dt> <dd> <table> <tr valign="top"><td>Date:</td><td>%xact_start%</td></tr> <tr valign="top"><td>Type:</td><td>%xact_type%</td></tr> <tr valign="top"><td>Last Billing:</td><td>%last_billing_type%<br/>%last_billing_note%</td></tr> <tr valign="top"><td>Total Billed:</td><td>$%total_owed%</td></tr> <tr valign="top"><td>Last Payment:</td><td>%last_payment_type%<br/>%last_payment_note%</td></tr> <tr valign="top"><td>Total Paid:</td><td>$%total_paid%</td></tr> <tr valign="top"><td><b>Balance:</b></td><td><b>$%balance_owed%</b></td></tr> </table><br/>',
                                        'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
-                               }, 
+                               },
+                               'bills_main_view' : {
+                                       'type' : 'bills',
+                                       'header' : 'Welcome to %LIBRARY%!<br/>You have the following bills:<hr/><ol>',
+                                       'line_item' : '<dt><b>Bill #%id%</b> %title%</dt> <dd> <table width="100%"> <tr valign="top"><td>Date:</td><td>%xact_start%</td></tr> <tr valign="top"><td>Type:</td><td>%xact_type%</td></tr> <tr valign="top"><td>Last Billing:</td><td>%last_billing_type%<br/>%last_billing_note%</td></tr> <tr valign="top"><td>Total Billed:</td><td>$%total_owed%</td></tr> <tr valign="top"><td>Last Payment:</td><td>%last_payment_type%<br/>%last_payment_note%</td></tr> <tr valign="top"><td>Total Paid:</td><td>$%total_paid%</td></tr> <tr valign="top"><td><b>Balance:</b></td><td><b>$%balance_owed%</b></td></tr> </table><br/>',
+                                       'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
+                               },
                                'offline_checkin' : {
                                        'type' : 'offline_checkin',
                                        'header' : 'You checked in the following items:<hr/><ol>',
index a2be8ef..b94b1cb 100644 (file)
@@ -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 {
index 2608e78..98545c3 100644 (file)
@@ -76,6 +76,7 @@
                <command id="cmd_change_to_credit" />
                <command id="cmd_uncheck_all" />
                <command id="cmd_check_all" />
+               <command id="cmd_print_bills" />
                <command id="cmd_alternate_view" />
        </commandset>
 
index ce6c427..459faca 100644 (file)
@@ -23,6 +23,7 @@
                <button command="cmd_uncheck_all" label="Uncheck All"/>
                <button command="cmd_check_all" label="Check All"/>
                <spacer flex="1"/>
+               <button command="cmd_print_bills" label="Print Bills" />
                <button command="cmd_alternate_view" label="Alternate View" accesskey="V"/>
        </hbox>
 </box>