From c0ccde0a9d430db6ed9458fb0d204149fef40087 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 23 Jun 2022 17:18:31 -0400 Subject: [PATCH] LP1840773 SCKO Angular Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/scko/fines.component.html | 15 ++++--- Open-ILS/src/eg2/src/app/scko/fines.component.ts | 31 ++++++++++++++ Open-ILS/src/eg2/src/app/scko/items.component.ts | 5 ++- .../src/sql/Pg/upgrade/YYYY.data.scko-angular.sql | 49 +++++++++++++++++++++- 4 files changed, 90 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/scko/fines.component.html b/Open-ILS/src/eg2/src/app/scko/fines.component.html index 9a4223c5ac..d4444c3cb1 100644 --- a/Open-ILS/src/eg2/src/app/scko/fines.component.html +++ b/Open-ILS/src/eg2/src/app/scko/fines.component.html @@ -1,3 +1,9 @@ +
+
+
+ +
+
@@ -19,14 +25,7 @@ Miscellaneous - + diff --git a/Open-ILS/src/eg2/src/app/scko/fines.component.ts b/Open-ILS/src/eg2/src/app/scko/fines.component.ts index e70b0d7448..373f41596b 100644 --- a/Open-ILS/src/eg2/src/app/scko/fines.component.ts +++ b/Open-ILS/src/eg2/src/app/scko/fines.component.ts @@ -6,6 +6,7 @@ import {PcrudService} from '@eg/core/pcrud.service'; import {NetService} from '@eg/core/net.service'; import {IdlObject} from '@eg/core/idl.service'; import {SckoService} from './scko.service'; +import {PrintService} from '@eg/share/print/print.service'; @Component({ @@ -22,6 +23,7 @@ export class SckoFinesComponent implements OnInit { private net: NetService, private auth: AuthService, private pcrud: PcrudService, + private printer: PrintService, public scko: SckoService ) {} @@ -75,5 +77,34 @@ export class SckoFinesComponent implements OnInit { return this.displayValue(xact, 'title'); } + getDetails(xact: IdlObject): string { + if (xact.summary().xact_type() == 'circulation') { + return this.getTitle(xact); + } else { + return xact.summary().last_billing_type(); + } + } + + printList() { + + const data = this.xacts.map(x => { + return { + xact: x, // full object if needed + details: this.getDetails(x), + total_owed: x.summary().total_owed(), + total_paid: x.summary().total_paid(), + balance_owed: x.summary().balance_owed(), + }; + }); + + this.printer.print({ + templateName: 'scko_fines', + contextData: { + xacts: data, + user: this.scko.patronSummary.patron + }, + printContext: 'default' + }); + } } diff --git a/Open-ILS/src/eg2/src/app/scko/items.component.ts b/Open-ILS/src/eg2/src/app/scko/items.component.ts index e9ceba159e..a4e3d8f939 100644 --- a/Open-ILS/src/eg2/src/app/scko/items.component.ts +++ b/Open-ILS/src/eg2/src/app/scko/items.component.ts @@ -103,7 +103,10 @@ export class SckoItemsComponent implements OnInit { this.printer.print({ templateName: 'scko_items_out', - contextData: {checkouts: data}, + contextData: { + checkouts: data, + user: this.scko.patronSummary.patron + }, printContext: 'default' }); } diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.data.scko-angular.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.data.scko-angular.sql index c92f1efb0c..0fc704067d 100644 --- a/Open-ILS/src/sql/Pg/upgrade/YYYY.data.scko-angular.sql +++ b/Open-ILS/src/sql/Pg/upgrade/YYYY.data.scko-angular.sql @@ -81,13 +81,60 @@ UPDATE config.print_template SET template = $TEMPLATE$ [% END %] - +
- - {{getTitle(xact)}} - - - {{xact.summary().last_billing_type()}} - - {{getDetails(xact)}} {{xact.summary().total_owed() | currency}} {{xact.summary().total_paid() | currency}} {{xact.summary().balance_owed() | currency}}
[% END %]
$TEMPLATE$ WHERE name = 'scko_holds'; +INSERT INTO config.print_template + (name, label, owner, active, locale, content_type, template) +VALUES ('scko_fines', 'Self-Checkout Fines', 1, TRUE, 'en-US', 'text/html', ''); + +UPDATE config.print_template SET template = $TEMPLATE$ +[%- + USE date; + USE money = format('$%.2f'); + SET user = template_data.user; + SET xacts = template_data.xacts; +-%] +
+ +
[% date.format(date.now, '%x %r') %]
+
+ + [% user.pref_family_name || user.family_name %], + [% user.pref_first_given_name || user.first_given_name %] + +
    + [% FOR xact IN xacts %] + [% NEXT IF xact.balance_owed <= 0 %] +
  1. + + + + + + + + + + + + + + + + + +
    Details:[% xact.details %]
    Total Billed:[% money(xact.total_owed) %]
    Total Paid:[% money(xact.total_paid) %]
    Balance Owed:[% money(xact.balance_owed) %]
    +
  2. + [% END %] +
+
+$TEMPLATE$ WHERE name = 'scko_fines'; + COMMIT; -- 2.11.0