From 7be2cc59c2f8f58dd95bcf769470de1e1aae9447 Mon Sep 17 00:00:00 2001 From: Dan Briem Date: Sun, 22 Jan 2023 21:19:13 -0500 Subject: [PATCH] LP#2003090 Angular Daily Cash Report Missing Print Capability Administration->Local Administration->Cash Reports Add a print button to the Desk and Staff User Payment grids to print the org, date range, totals, and full list. Signed-off-by: Dan Briem --- .../local/cash-reports/cash-reports.component.html | 155 ++++++++++++++++++++- .../local/cash-reports/cash-reports.component.ts | 31 ++++- 2 files changed, 181 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.html index 37023f2fc5..dd82912199 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.html @@ -47,7 +47,7 @@
Total Credit Card Payments
{{deskTotals.credit_card_payment | currency}}
-
+
Total Debit Card Payments
{{deskTotals.debit_card_payment | currency}}
@@ -57,6 +57,10 @@ [disablePaging]="true" [dataSource]="deskPaymentDataSource" [sortable]="false"> + + @@ -82,7 +86,7 @@
Total Work Payments
{{userTotals.work_payment | currency}}
-
+
Total Goods Payments
{{userTotals.goods_payment | currency}}
@@ -97,6 +101,10 @@ [disablePaging]="true" [dataSource]="userPaymentDataSource" [sortable]="false"> + + @@ -114,3 +122,146 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.ts index cef34be2d4..73969362f4 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.ts @@ -1,10 +1,11 @@ -import {Component, OnInit, Input, ViewChild} from '@angular/core'; +import {Component, OnInit, Input, ViewChild, TemplateRef} from '@angular/core'; import {GridComponent} from '@eg/share/grid/grid.component'; import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid'; import {IdlService} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; import {OrgService} from '@eg/core/org.service'; +import {PrintService} from '@eg/share/print/print.service'; class DeskTotals { cash_payment = 0; @@ -39,19 +40,26 @@ export class CashReportsComponent implements OnInit { disabledOrgs = []; activeTab = 'deskPayments'; cellTextGenerator: GridCellTextGenerator; - + loadedRange = { + org: this.selectedOrg?.shortname(), + start: this.startDate, + end: this.endDate + }; // Default sort field, used when no grid sorting is applied. @Input() sortField: string; @ViewChild('deskPaymentGrid') deskPaymentGrid: GridComponent; @ViewChild('userPaymentGrid') userPaymentGrid: GridComponent; @ViewChild('userGrid') userGrid: GridComponent; + @ViewChild('deskPrintTmpl') deskPrintTmpl: TemplateRef; + @ViewChild('userPrintTmpl') userPrintTmpl: TemplateRef; constructor( private idl: IdlService, private net: NetService, private org: OrgService, - private auth: AuthService) {} + private auth: AuthService, + private printer: PrintService) {} ngOnInit() { this.disabledOrgs = this.getFilteredOrgList(); @@ -91,6 +99,11 @@ export class CashReportsComponent implements OnInit { dataForTotal = this.getDeskTotal(result); } this[dataSource].data = result; + this.loadedRange = { + org: this.selectedOrg?.shortname(), + start: this.startDate, + end: this.endDate + }; this.eraseUserGrid(); }); } @@ -154,4 +167,16 @@ export class CashReportsComponent implements OnInit { this.selectedOrg = org; this.searchForData(this.startDate, this.endDate); } + + printPayments(template: TemplateRef): void { + this.printer.print({printContext: 'default', template}); + } + + printDeskPayments(): void { + this.printPayments(this.deskPrintTmpl); + } + + printUserPayments(): void { + this.printPayments(this.userPrintTmpl); + } } -- 2.11.0