i18n-label label="Print Bills" (onClick)="printBills($event)">
</eg-grid-toolbar-action>
- <eg-grid-column path="summary.balance_owed"></eg-grid-column>
+ <eg-grid-toolbar-action
+ i18n-label label="Full Details" (onClick)="showStatement($event)">
+ </eg-grid-toolbar-action>
+
+ <eg-grid-column name="balance_owed" [required]="true" path="summary.balance_owed"></eg-grid-column>
<eg-grid-column path="id" [index]="true" i18n-label label="Bill #" [required]="true"></eg-grid-column>
<eg-grid-column path="xact_finish" i18n-label label="Finish"
datatype="timestamp" [datePlusTime]="true"></eg-grid-column>
<eg-grid-column path="xact_start" i18n-label label="Start"
datatype="timestamp" [datePlusTime]="true"></eg-grid-column>
- <eg-grid-column path="summary.total_owed" i18n-label label="Total Billed"></eg-grid-column>
- <eg-grid-column path="summary.total_paid" i18n-label label="Total Paid"></eg-grid-column>
+ <eg-grid-column name="total_owed" [required]="true"
+ path="summary.total_owed" i18n-label label="Total Billed"></eg-grid-column>
+ <eg-grid-column name="total_paid" [required]="true"
+ path="summary.total_paid" i18n-label label="Total Paid"></eg-grid-column>
<eg-grid-column path="summary.xact_type" i18n-label label="Type"></eg-grid-column>
- <eg-grid-column path="summary.last_payment_ts" datatype="timestamp"
- [required]="true" [hidden]="true"></eg-grid-column>
+ <eg-grid-column name="last_payment_ts" path="summary.last_payment_ts"
+ datatype="timestamp" [required]="true" [hidden]="true"></eg-grid-column>
<eg-grid-column i18n-label label="Title" name="title"
[cellTemplate]="titleTemplate"
[reloadOnColumnChange]="true"
[dataSource]="paymentsDataSource" [sortable]="true">
+ <eg-grid-toolbar-action
+ i18n-label label="Full Details" (onClick)="showStatement($event, true)">
+ </eg-grid-toolbar-action>
+
<eg-grid-column path="amount" i18n-label label="Amount"></eg-grid-column>
<eg-grid-column path="id" [index]="true" i18n-label label="Payment ID" [required]="true"></eg-grid-column>
<eg-grid-column path="payment_ts" i18n-label label="Payment Time" [datePlusTime]="true"></eg-grid-column>
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}}
]
};
}
}
- 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']);
this.printer.print({
templateName: 'bills_historical',
- contextData: {xacts: rows.map(r => r.xact)},
+ contextData: {xacts: rows},
printContext: 'default'
});
}
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;
(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$
[%
</div>
$TEMPLATE$ WHERE name = 'bills_current';
-/*
-
INSERT INTO config.print_template
(name, label, owner, active, locale, content_type, 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;
+%]
+<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.last_billing_type %]</td>
+ </tr>
+ <tr>
+ <td>Total Billed:</td>
+ <td>[% money(xact.total_owed) %]</td>
+ </tr>
+ <tr>
+ <td>Last Payment:</td>
+ <td>
+ [% 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 %]
+ </td>
+ </tr>
+ <tr>
+ <td>Total Paid:</td>
+ <td>[% money(xact.total_paid) %]</td>
+ </tr>
+ <tr>
+ <td>Balance:</td>
+ <td>[% money(xact.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_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;
+%]
+<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.last_billing_type %]</td>
+ </tr>
+ <tr>
+ <td>Total Billed:</td>
+ <td>[% money(xact.total_owed) %]</td>
+ </tr>
+ <tr>
+ <td>Last Payment:</td>
+ <td>
+ [% 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 %]
+ </td>
+ </tr>
+ <tr>
+ <td>Total Paid:</td>
+ <td>[% money(xact.total_paid) %]</td>
+ </tr>
+ <tr>
+ <td>Balance:</td>
+ <td>[% money(xact.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_historical';
+
*/
COMMIT;