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';
private net: NetService,
private pcrud: PcrudService,
private auth: AuthService,
+ private printer: PrintService,
private serverStore: ServerStoreService,
private circ: CircService,
private billing: BillingService,
}
});
}
+
+ printBills(rows: BillGridEntry[]) {
+ if (rows.length === 0) { return; }
+
+ this.printer.print({
+ templateName: 'bills_current',
+ contextData: {xacts: rows.map(r => r.xact)},
+ printContext: 'default'
+ });
+ }
}
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;
%]
<div>
<div>Welcome to [% staff_org.name %]</div>
<li>
<div>[% checkout.title %]</div>
<div>
- [% 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') %]
</div>
</li>
[% END %]
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;
+%]
+<div>
+ <style>td { padding: 1px 3px 1px 3px; }</style>
+ <div>Welcome to [% staff_org.name %]</div>
+ <div>You have the following bills:</div>
+ <hr/>
+ <ol>
+ [% FOR xact IN xacts %]
+ <li>
+ <table>
+ <tr>
+ <td>Bill #:</td>
+ <td>[% xact.id %]</td>
+ </tr>
+ <tr>
+ <td>Date:</td>
+ <td>[% date.format(helpers.format_date(
+ xact.xact_start, staff_org_timezone), '%x %r') %]
+ </td>
+ </tr>
+ <tr>
+ <td>Last Billing:</td>
+ <td>[% xact.summary.last_billing_type %]</td>
+ </tr>
+ <tr>
+ <td>Total Billed:</td>
+ <td>[% money(xact.summary.total_owed) %]</td>
+ </tr>
+ <tr>
+ <td>Last Payment:</td>
+ <td>
+ [% 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 %]
+ </td>
+ </tr>
+ <tr>
+ <td>Total Paid:</td>
+ <td>[% money(xact.summary.total_paid) %]</td>
+ </tr>
+ <tr>
+ <td>Balance:</td>
+ <td>[% money(xact.summary.balance_owed) %]</td>
+ </tr>
+ </table>
+ </li>
+ [% END %]
+ </ol>
+ <hr/>
+ <div>[% staff_org.name %] [% date.format(date.now, '%x %r') %]</div>
+ <div>You were helped by [% staff.first_given_name %]</div>
+ <br/>
+</div>
+$TEMPLATE$ WHERE name = 'bills_current';
+
COMMIT;