From: Bill Erickson Date: Mon, 19 Apr 2021 18:59:52 +0000 (-0400) Subject: LP1904036 more billing X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=659db2c977634a44feee5c1c3e00c283b0beed0c;p=evergreen%2Fpines.git LP1904036 more billing Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/billing-history.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/billing-history.component.html index f92b47928a..06d59b094b 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/billing-history.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/billing-history.component.html @@ -59,17 +59,23 @@ i18n-label label="Print Bills" (onClick)="printBills($event)"> - + + + + - - + + - + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/billing-history.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/billing-history.component.ts index 735eb6d640..67dcb8ef03 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/billing-history.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/billing-history.component.ts @@ -85,8 +85,8 @@ export class BillingHistoryComponent implements OnInit { usr: this.patronId, xact_start: {between: [this.xactsStart, this.xactsEnd]}, '-or': [ - {'summary.balance_owed': {'<>': 0}}, - {'summary.last_payment_ts': {'<>': null}} + {balance_owed: {'<>': 0}}, + {last_payment_ts: {'<>': null}} ] }; @@ -116,7 +116,8 @@ export class BillingHistoryComponent implements OnInit { } } - showStatement(row: any, forPayment?: boolean) { + showStatement(row: any | any[], forPayment?: boolean) { + row = [].concat(row)[0]; const id = forPayment ? row['xact.id'] : row.id; this.router.navigate(['/staff/circ/patron', this.patronId, 'bills', id, 'statement']); @@ -151,7 +152,7 @@ export class BillingHistoryComponent implements OnInit { this.printer.print({ templateName: 'bills_historical', - contextData: {xacts: rows.map(r => r.xact)}, + contextData: {xacts: rows}, printContext: 'default' }); } @@ -180,9 +181,9 @@ export class BillingHistoryComponent implements OnInit { if (!row) { return; } // Called mid-reload - info.owed += Number(row['summary.balance_owed']) * 100; - info.billed += Number(row['summary.total_owed']) * 100; - info.paid += Number(row['summary.total_paid']) * 100; + info.owed += Number(row.balance_owed) * 100; + info.billed += Number(row.total_owed) * 100; + info.paid += Number(row.total_paid) * 100; }); info.owed /= 100; 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 3562fb44e4..842855c0ea 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 @@ -44,7 +44,6 @@ 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$ [% @@ -109,8 +108,6 @@ UPDATE config.print_template SET template = $TEMPLATE$ $TEMPLATE$ WHERE name = 'bills_current'; -/* - INSERT INTO config.print_template (name, label, owner, active, locale, content_type, template) @@ -499,6 +496,143 @@ UPDATE config.print_template SET template = $TEMPLATE$ $TEMPLATE$ WHERE name = 'holds_for_patron'; + +INSERT INTO config.print_template + (name, label, owner, active, locale, content_type, template) +VALUES ('bills_historical', 'Bills, Historical', 1, TRUE, 'en-US', 'text/html', ''); + + +UPDATE config.print_template SET template = $TEMPLATE$ +[% + USE date; + USE money = format('$%.2f'); + SET 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.last_billing_type %]
    Total Billed:[% money(xact.total_owed) %]
    Last Payment: + [% xact.last_payment_type %] + [% IF xact.last_payment_ts %] + at [% date.format( + helpers.format_date( + xact.last_payment_ts, staff_org_timezone), '%x %r') %] + [% END %] +
    Total Paid:[% money(xact.total_paid) %]
    Balance:[% money(xact.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_historical'; + +INSERT INTO config.print_template + (name, label, owner, active, locale, content_type, template) +VALUES ('bills_historical', 'Bills, Historical', 1, TRUE, 'en-US', 'text/html', ''); + + +UPDATE config.print_template SET template = $TEMPLATE$ +[% + USE date; + USE money = format('$%.2f'); + SET 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.last_billing_type %]
    Total Billed:[% money(xact.total_owed) %]
    Last Payment: + [% xact.last_payment_type %] + [% IF xact.last_payment_ts %] + at [% date.format( + helpers.format_date( + xact.last_payment_ts, staff_org_timezone), '%x %r') %] + [% END %] +
    Total Paid:[% money(xact.total_paid) %]
    Balance:[% money(xact.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_historical'; + */ COMMIT;