From 466946e488d78c9d9f6202ff7c2eb53a29cbb6b9 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 12 Mar 2021 13:32:38 -0500 Subject: [PATCH] LP1904036 billing statement Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../circ/patron/bill-statement.component.html | 82 +++++++++++++++++++ .../staff/circ/patron/bill-statement.component.ts | 95 ++++++++++++++++++++++ .../src/app/staff/circ/patron/bills.component.html | 2 +- .../src/app/staff/circ/patron/bills.component.ts | 49 ++--------- .../app/staff/circ/patron/patron.component.html | 8 +- .../src/app/staff/circ/patron/patron.component.ts | 4 +- .../eg2/src/app/staff/circ/patron/patron.module.ts | 4 +- .../src/app/staff/circ/patron/patron.service.ts | 38 +++++++++ .../src/app/staff/circ/patron/routing.module.ts | 4 + Open-ILS/src/eg2/src/styles.css | 9 +- 10 files changed, 249 insertions(+), 46 deletions(-) create mode 100644 Open-ILS/src/eg2/src/app/staff/circ/patron/bill-statement.component.html create mode 100644 Open-ILS/src/eg2/src/app/staff/circ/patron/bill-statement.component.ts diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bill-statement.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/bill-statement.component.html new file mode 100644 index 0000000000..a6e807f3fc --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bill-statement.component.html @@ -0,0 +1,82 @@ + +

Transaction: #{{xactId}}

+ +
+
+
Billing Location
+
{{entry.billingLocation}}
+
Total Billed
+
{{entry.xact.summary().total_owed() | currency}}
+
Title
+
{{entry.title}}
+
+
+
Type
+
+ Circulation + Grocery +
+
Total Paid / Credited
+
{{entry.xact.summary().total_paid() | currency}}
+
Checked Out
+
+ + {{entry.xact.xact_start() | date:'short'}} + +
+
+
+
Started
+
{{entry.xact.xact_start() | date:'short'}}
+
Balance Due
+
{{entry.xact.summary().balance_owed() | currency}}
+
Due Date
+
+ + {{entry.xact.circulation().due_date() | date:'short'}} + +
+
+
+
Finished
+
{{entry.xact.xact_finish() | date:'short'}}
+
Renewal?
+
+ + + + +
+
Checked In
+
+ + {{entry.xact.circulation().checkin_time() | date:'short'}} + +
+
+
+ +
+ + + +
+ + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bill-statement.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/bill-statement.component.ts new file mode 100644 index 0000000000..d5e2548fa9 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bill-statement.component.ts @@ -0,0 +1,95 @@ +import {Component, Input, OnInit, AfterViewInit, ViewChild} from '@angular/core'; +import {Router, ActivatedRoute, ParamMap} from '@angular/router'; +import {from, empty, range} from 'rxjs'; +import {concatMap, tap, takeLast} from 'rxjs/operators'; +import {NgbNav, NgbNavChangeEvent} from '@ng-bootstrap/ng-bootstrap'; +import {IdlObject} from '@eg/core/idl.service'; +import {EventService} from '@eg/core/event.service'; +import {OrgService} from '@eg/core/org.service'; +import {NetService} from '@eg/core/net.service'; +import {PcrudService, PcrudContext} from '@eg/core/pcrud.service'; +import {AuthService} from '@eg/core/auth.service'; +import {ServerStoreService} from '@eg/core/server-store.service'; +import {PatronService} from '@eg/staff/share/patron/patron.service'; +import {PatronContextService, BillGridEntry} from './patron.service'; +import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/grid'; +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'; +import {CreditCardDialogComponent + } from '@eg/staff/share/billing/credit-card-dialog.component'; +import {BillingService, CreditCardPaymentParams} from '@eg/staff/share/billing/billing.service'; +import {AddBillingDialogComponent} from '@eg/staff/share/billing/billing-dialog.component'; +import {AudioService} from '@eg/share/util/audio.service'; +import {ToastService} from '@eg/share/toast/toast.service'; + +@Component({ + templateUrl: 'bill-statement.component.html', + selector: 'eg-patron-bill-statement' +}) +export class BillStatementComponent implements OnInit { + + @Input() patronId: number; + @Input() xactId: number; + entry: BillGridEntry; + summary: IdlObject; + statementTab = 'statement'; + gridDataSource: GridDataSource = new GridDataSource(); + cellTextGenerator: GridCellTextGenerator; + + //@ViewChild('grid') private billGrid: GridComponent; + + constructor( + private router: Router, + private route: ActivatedRoute, + private audio: AudioService, + private toast: ToastService, + private org: OrgService, + private evt: EventService, + private net: NetService, + private pcrud: PcrudService, + private auth: AuthService, + private printer: PrintService, + private serverStore: ServerStoreService, + private circ: CircService, + private billing: BillingService, + public patronService: PatronService, + public context: PatronContextService + ) {} + + ngOnInit() { + + this.cellTextGenerator = { + }; + + this.gridDataSource.getRows = (pager: Pager, sort: any[]) => { + return empty(); + }; + + this.summary = null; + return this.net.request( + 'open-ils.actor', + 'open-ils.actor.user.transactions.for_billing', + this.auth.token(), this.patronId, [this.xactId] + ).subscribe(resp => { + const evt = this.evt.parse(resp); + + if (evt) { + console.error(evt); + alert(evt); + return; + } + + if (!this.summary) { + this.summary = resp; + } else { + this.entry = this.context.formatXactForDisplay(resp); + } + }); + } +} + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html index c1dd868536..64fca639bd 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html @@ -174,7 +174,7 @@ - + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts index 6c5eeba44f..0e755f39da 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts @@ -5,7 +5,7 @@ import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; import {ServerStoreService} from '@eg/core/server-store.service'; import {PatronService} from '@eg/staff/share/patron/patron.service'; -import {PatronContextService} from './patron.service'; +import {PatronContextService, BillGridEntry} from './patron.service'; import {PatronSearch, PatronSearchComponent } from '@eg/staff/share/patron/search.component'; @@ -21,6 +21,7 @@ export class PatronComponent implements OnInit, AfterViewInit { patronId: number; patronTab = 'search'; altTab: string; + statementXact: number; showSummary = true; loading = true; @@ -58,6 +59,7 @@ export class PatronComponent implements OnInit, AfterViewInit { this.route.paramMap.subscribe((params: ParamMap) => { this.patronTab = params.get('tab') || 'search'; this.patronId = +params.get('id'); + this.statementXact = +params.get('xactId'); if (MAIN_TABS.includes(this.patronTab)) { this.altTab = null; diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.module.ts index 31b179fbeb..89a8473ce5 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.module.ts @@ -21,6 +21,7 @@ import {BcSearchComponent} from './bcsearch.component'; import {BarcodesModule} from '@eg/staff/share/barcodes/barcodes.module'; import {ItemsComponent} from './items.component'; import {BillsComponent} from './bills.component'; +import {BillStatementComponent} from './bill-statement.component'; @NgModule({ declarations: [ @@ -33,7 +34,8 @@ import {BillsComponent} from './bills.component'; EditToolbarComponent, BcSearchComponent, ItemsComponent, - BillsComponent + BillsComponent, + BillStatementComponent ], imports: [ StaffCommonModule, diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts index 8eb24abfbd..c9665be0f1 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts @@ -6,6 +6,13 @@ import {AuthService} from '@eg/core/auth.service'; import {PatronService} from '@eg/staff/share/patron/patron.service'; import {PatronSearch} from '@eg/staff/share/patron/search.component'; import {StoreService} from '@eg/core/store.service'; +import {CircService, CircDisplayInfo} from '@eg/staff/share/circ/circ.service'; + +export interface BillGridEntry extends CircDisplayInfo { + xact: IdlObject // mbt + billingLocation?: string; + paymentPending?: number; +} export interface CircGridEntry { title?: string; @@ -103,6 +110,7 @@ export class PatronContextService { private net: NetService, private org: OrgService, private auth: AuthService, + private circ: CircService, public patronService: PatronService ) {} @@ -220,6 +228,36 @@ export class PatronContextService { const org = this.org.get(orgId); return org ? org.shortname() : ''; } + + formatXactForDisplay(xact: IdlObject): BillGridEntry { + + const entry: BillGridEntry = { + xact: xact, + paymentPending: 0 + }; + + if (xact.summary().xact_type() !== 'circulation') { + + entry.xact.grocery().billing_location( + this.org.get(entry.xact.grocery().billing_location())); + + entry.title = xact.summary().last_billing_type(); + entry.billingLocation = + xact.grocery().billing_location().shortname(); + return entry; + } + + entry.xact.circulation().circ_lib( + this.org.get(entry.xact.circulation().circ_lib())); + + const circDisplay: CircDisplayInfo = + this.circ.getDisplayInfo(xact.circulation()); + + entry.billingLocation = + xact.circulation().circ_lib().shortname(); + + return Object.assign(entry, circDisplay); + } } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts index 06c95d8d3e..5b53fb866c 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts @@ -26,6 +26,10 @@ const routes: Routes = [{ path: ':id', redirectTo: ':id/checkout' }, { + path: ':id/:tab/:xactId/statement', + component: PatronComponent, + resolve: {resolver : PatronResolver} + }, { path: ':id/:tab', component: PatronComponent, resolve: {resolver : PatronResolver} diff --git a/Open-ILS/src/eg2/src/styles.css b/Open-ILS/src/eg2/src/styles.css index f75803fdf2..71e73821f9 100644 --- a/Open-ILS/src/eg2/src/styles.css +++ b/Open-ILS/src/eg2/src/styles.css @@ -207,12 +207,17 @@ a { font-weight: bold; } -.common-form.striped-even .row:nth-child(even) { +.common-form.striped-even .row:nth-child(even), + .striped-rows-even .row:nth-child(even) { + background-color: rgba(0,0,0,.03); border-top: 1px solid rgba(0,0,0,.125); border-bottom: 1px solid rgba(0,0,0,.125); } -.common-form.striped-odd .row:nth-child(odd) { + +.common-form.striped-odd .row:nth-child(odd), + .striped-rows-odd .row:nth-child(odd) { + background-color: rgba(0,0,0,.03); border-top: 1px solid rgba(0,0,0,.125); border-bottom: 1px solid rgba(0,0,0,.125); -- 2.11.0