From 1464659cfa43039e2180e774fcff44a6b59e5791 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 9 Mar 2021 10:59:11 -0500 Subject: [PATCH] LP1904036 current bills receipt Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/app/staff/circ/patron/bills.component.html | 4 ++ .../src/app/staff/circ/patron/bills.component.ts | 12 ++++ .../sql/Pg/upgrade/XXXX.data.angular-patron.sql | 79 ++++++++++++++++++++-- 3 files changed, 88 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html index 1db92a88f3..a64d1bf2dd 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html @@ -149,6 +149,10 @@ [sortable]="true" [useLocalSort]="true" [cellTextGenerator]="cellTextGenerator"> + + + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts index 5b4a7e0c2f..a894aa79f1 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts @@ -15,6 +15,7 @@ import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/ import {GridComponent} from '@eg/share/grid/grid.component'; import {Pager} from '@eg/share/util/pager'; import {CircService, CircDisplayInfo} from '@eg/staff/share/circ/circ.service'; +import {PrintService} from '@eg/share/print/print.service'; import {PromptDialogComponent} from '@eg/share/dialog/prompt.component'; import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; @@ -70,6 +71,7 @@ export class BillsComponent implements OnInit, AfterViewInit { private net: NetService, private pcrud: PcrudService, private auth: AuthService, + private printer: PrintService, private serverStore: ServerStoreService, private circ: CircService, private billing: BillingService, @@ -419,5 +421,15 @@ export class BillsComponent implements OnInit, AfterViewInit { } }); } + + printBills(rows: BillGridEntry[]) { + if (rows.length === 0) { return; } + + this.printer.print({ + templateName: 'bills_current', + contextData: {xacts: rows.map(r => r.xact)}, + printContext: 'default' + }); + } } diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql index 4a713c3e45..79130f9f3b 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql @@ -21,19 +21,16 @@ eg.grid.circ.patron.holds holds_for_patron print template items out print template -*/ -- insert then update for easier iterative development tweaks -/* INSERT INTO config.print_template (name, label, owner, active, locale, content_type, template) VALUES ('items_out', 'Patron Items Out', 1, TRUE, 'en-US', 'text/html', ''); -*/ UPDATE config.print_template SET template = $TEMPLATE$ [% - USE date; - circulations = template_data.circulations; + USE date; + circulations = template_data.circulations; %]
Welcome to [% staff_org.name %]
@@ -44,8 +41,8 @@ UPDATE config.print_template SET template = $TEMPLATE$
  • [% checkout.title %]
    - [% IF checkout.copy %]Barcode: [% checkout.copy.barcode %][% END %] - Due: [% date.format(helpers.format_date(checkout.dueDate, staff_org_timezone), '%x %r') %] + [% IF checkout.copy %]Barcode: [% checkout.copy.barcode %][% END %] + Due: [% date.format(helpers.format_date(checkout.dueDate, staff_org_timezone), '%x %r') %]
  • [% END %] @@ -59,6 +56,74 @@ $TEMPLATE$ WHERE name = 'items_out'; UPDATE config.print_template SET active = TRUE WHERE name = 'patron_address'; +-- insert then update for easier iterative development tweaks +INSERT INTO config.print_template + (name, label, owner, active, locale, content_type, template) +VALUES ('bills_current', 'Bills Current', 1, TRUE, 'en-US', 'text/html', ''); +*/ + +UPDATE config.print_template SET template = $TEMPLATE$ +[% + USE date; + USE money = format('$%.2f'); + xacts = template_data.xacts; +%] +
    + +
    Welcome to [% staff_org.name %]
    +
    You have the following bills:
    +
    +
      + [% FOR xact IN xacts %] +
    1. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Bill #:[% xact.id %]
      Date:[% date.format(helpers.format_date( + xact.xact_start, staff_org_timezone), '%x %r') %] +
      Last Billing:[% xact.summary.last_billing_type %]
      Total Billed:[% money(xact.summary.total_owed) %]
      Last Payment: + [% xact.summary.last_payment_type %] + [% IF xact.summary.last_payment_ts %] + at [% date.format(helpers.format_date( + xact.summary.last_payment_ts, staff_org_timezone), '%x %r') %] + [% END %] +
      Total Paid:[% money(xact.summary.total_paid) %]
      Balance:[% money(xact.summary.balance_owed) %]
      +
    2. + [% END %] +
    +
    +
    [% staff_org.name %] [% date.format(date.now, '%x %r') %]
    +
    You were helped by [% staff.first_given_name %]
    +
    +
    +$TEMPLATE$ WHERE name = 'bills_current'; + COMMIT; -- 2.11.0