+<div class="d-flex">
+ <div class="flex-1"></div>
+ <div>
+ <button class="btn btn-outline-dark" (click)="printList()" i18n>Print List</button>
+ </div>
+</div>
<div id='oils-selfck-circ-table-div'>
<table id='oils-selfck-circ-table' class='oils-selfck-item-table'>
<thead>
Miscellaneous
</ng-container>
</td>
- <td>
- <ng-container *ngIf="xact.summary().xact_type() == 'circulation'" i18n>
- {{getTitle(xact)}}
- </ng-container>
- <ng-container *ngIf="xact.summary().xact_type() != 'circulation'" i18n>
- {{xact.summary().last_billing_type()}}
- </ng-container>
- </td>
+ <td>{{getDetails(xact)}}</td>
<td>{{xact.summary().total_owed() | currency}}</td>
<td>{{xact.summary().total_paid() | currency}}</td>
<td>{{xact.summary().balance_owed() | currency}}</td>
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({
private net: NetService,
private auth: AuthService,
private pcrud: PcrudService,
+ private printer: PrintService,
public scko: SckoService
) {}
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'
+ });
+ }
}
this.printer.print({
templateName: 'scko_items_out',
- contextData: {checkouts: data},
+ contextData: {
+ checkouts: data,
+ user: this.scko.patronSummary.patron
+ },
printContext: 'default'
});
}
[% END %]
</td>
</tr>
- </div>
+ </table>
</li>
[% END %]
</ol>
</div>
$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;
+-%]
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <div>[% date.format(date.now, '%x %r') %]</div>
+ <br/>
+
+ [% user.pref_family_name || user.family_name %],
+ [% user.pref_first_given_name || user.first_given_name %]
+
+ <ol>
+ [% FOR xact IN xacts %]
+ [% NEXT IF xact.balance_owed <= 0 %]
+ <li>
+ <table>
+ <tr>
+ <td>Details:</td>
+ <td>[% xact.details %]</td>
+ </tr>
+ <tr>
+ <td>Total Billed:</td>
+ <td>[% money(xact.total_owed) %]</td>
+ </tr>
+ <tr>
+ <td>Total Paid:</td>
+ <td>[% money(xact.total_paid) %]</td>
+ </tr>
+ <tr>
+ <td>Balance Owed:</td>
+ <td>[% money(xact.balance_owed) %]</td>
+ </tr>
+ </table>
+ </li>
+ [% END %]
+ </ol>
+</div>
+$TEMPLATE$ WHERE name = 'scko_fines';
+
COMMIT;