KMAIN-1917 Patron payments print selected items
authorNick Duncan <nDuncan@catalystitservices.com>
Wed, 30 Dec 2015 18:07:38 +0000 (13:07 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
You can now print selected line items from the Payments window

Signed-off-by: Nick Duncan <nDuncan@catalystitservices.com>
Open-ILS/xul/staff_client/server/patron/bill_history.js
Open-ILS/xul/staff_client/server/patron/bill_history.xul
Open-ILS/xul/staff_client/server/skin/print_list_templates

index d897f6f..5eaa96f 100644 (file)
@@ -200,6 +200,7 @@ function init_payments_list() {
             );
             payments_tally_selected();
             $('payments_details').disabled = g.payments_list_selection.length == 0;
+            $('print_selected').disabled = g.payments_list_selection.length == 0;
             $('copy_details_from_payments').disabled = g.payments_list_selection.length == 0;
         },
         'retrieve_row' : function(params) {
@@ -256,6 +257,12 @@ function my_init() {
             gen_handle_details('payments'),
             false
         );
+        
+        window.bill_history_event_listeners.add($('print_selected'), 
+            'command',
+            gen_handle_details('payments'),
+            false
+        );
 
         window.bill_history_event_listeners.add($('copy_details'), 
             'command',
@@ -392,6 +399,28 @@ function print_bills() {
     }
 }
 
+function print_bills_from_history()
+{
+    try
+    {        
+        var Selected_Line_Item = g.payments_list.dump_selected_with_keys(0);
+        
+        var params =
+        {
+            'list': Selected_Line_Item,
+            'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),g.patron_id),
+            'printer_context' : 'receipt',
+            'template' : 'bill_payment_basic'
+        };
+        
+        g.payments_list.print(params);
+    }
+    catch(E)
+    {
+        alert("Caught Exception! Details: " + E.toSource());
+    }
+}
+
 function payment_history_init() {
     try {
         if (payment_history_fetched) { return; } else { payment_history_fetched = true; }
index 9671de1..aac5b35 100644 (file)
                         <hbox>
                             <hbox id="payments_list_actions" />
                             <spacer flex="1"/>
+                            <button id="print_selected" label="&staff.patron.bill_history.print.label;" accesskey="&staff.patron.bill_history.print.accesskey;" hidden="false" oncommand="print_bills_from_history();"/>
                             <button id="copy_details_from_payments" disabled="true" label="&staff.patron.items_overlay.sel_copy_details.label;" accesskey="&staff.patron.items_overlay.sel_copy_details.accesskey;" />
                             <button id="payments_details" label="&staff.patron.bill_history.full_details.label;" disabled="true" accesskey="&staff.patron.bill_history.full_details.accesskey;"/>
                         </hbox>
index b887043..8dd2e84 100644 (file)
         "inherit": null,\r
         "context": "receipt"\r
     },\r
+    "bill_payment_basic":\r
+    {\r
+        "type": "payment",\r
+        "header": "Welcome to %LIBRARY%, %PATRON_FIRSTNAME%!<br/>A receipt of your  transaction:<hr/> <p><blockquote>",\r
+        "line_item": "Invoice: %mp_id%  <br/>Title: %payments_blob_title%<br/>Status: %payments_blob_last_billing_type%<br/>Received: %mp_amount%<br />Payment Type: %mp_payment_type%<br />Timestamp: %mp_payment_ts%<br /><br/>",\r
+        "footer": "</blockquote> </p> <hr />%SHORTNAME% %TODAY_TRIM%<br/> <br/> ",\r
+        "inherit": null,\r
+        "context": "receipt"\r
+    },\r
     "bills_historical": {\r
         "type": "bills",\r
         "header": "Welcome to %LIBRARY%!<br/>You had the following bills:<hr/>\n<script>var rectest = 0</script>\n",\r