feat(cashier): morning opening balance panel across settlement, reconciliation, position & history
- Cash Settlement form: morning panel (denomination pills) + Morning column in denomination table - Reconciliation form: morning panel (denomination pills) + Morning column in denomination table - Cashier Position Report: Morning vs Current comparison bar + Morning column (single-cashier mode) - Cash History – Settlement detail panel: Morning Received vs Settled comparison bar + Morning column - Cash History – denomination Notes/Coins separation in detail panel for all transaction types - CashierService: added getCashierMorningBalance() calling GET /cashreports/cashier-morning - All morning data loaded via forkJoin alongside existing API calls (no extra loading states) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
6433ae068d
commit
51495f8eb8
@@ -13,7 +13,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { of } from 'rxjs';
|
||||
import { forkJoin, of } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { CashierService } from '../cashier.service';
|
||||
|
||||
@@ -21,6 +21,7 @@ interface DenomRow {
|
||||
denominationId: number;
|
||||
denominationValue: number;
|
||||
kind: string;
|
||||
morningCount: number;
|
||||
count: number;
|
||||
amount: number;
|
||||
}
|
||||
@@ -29,6 +30,7 @@ interface CashierPos {
|
||||
cashierName?: string;
|
||||
asOfDate: string;
|
||||
totalAmount: number;
|
||||
morningTotal: number;
|
||||
denominations: DenomRow[];
|
||||
}
|
||||
|
||||
@@ -91,17 +93,54 @@ export class CashierPositionComponent implements OnInit {
|
||||
this.loading = true;
|
||||
this.results = [];
|
||||
this.errorMsg = '';
|
||||
this.service
|
||||
.cashierPositionReport(this.selectedCashierId || undefined, this.asOfDate)
|
||||
.pipe(catchError(() => of(null)))
|
||||
.subscribe((data: any) => {
|
||||
|
||||
if (this.selectedCashierId) {
|
||||
forkJoin({
|
||||
position: this.service
|
||||
.cashierPositionReport(this.selectedCashierId, this.asOfDate)
|
||||
.pipe(catchError(() => of(null))),
|
||||
morning: this.service
|
||||
.getCashierMorningBalance(this.selectedCashierId, this.asOfDate)
|
||||
.pipe(catchError(() => of(null)))
|
||||
}).subscribe(({ position, morning }) => {
|
||||
this.loading = false;
|
||||
if (!data) {
|
||||
if (!position) {
|
||||
this.errorMsg = 'Failed to load position data.';
|
||||
return;
|
||||
}
|
||||
this.results = Array.isArray(data) ? data : [data];
|
||||
const morningMap = new Map<number, number>();
|
||||
((morning?.denominations || []) as any[]).forEach((d: any) =>
|
||||
morningMap.set(d.denominationId, d.morningCount ?? 0)
|
||||
);
|
||||
const morningTotal = Number(morning?.totalMorning ?? 0);
|
||||
const arr: any[] = Array.isArray(position) ? position : [position];
|
||||
this.results = arr.map((p: any) => ({
|
||||
...p,
|
||||
morningTotal,
|
||||
denominations: ((p.denominations || []) as any[]).map((d: any) => ({
|
||||
...d,
|
||||
morningCount: morningMap.get(d.denominationId) ?? 0
|
||||
}))
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
this.service
|
||||
.cashierPositionReport(undefined, this.asOfDate)
|
||||
.pipe(catchError(() => of(null)))
|
||||
.subscribe((data: any) => {
|
||||
this.loading = false;
|
||||
if (!data) {
|
||||
this.errorMsg = 'Failed to load position data.';
|
||||
return;
|
||||
}
|
||||
const arr: any[] = Array.isArray(data) ? data : [data];
|
||||
this.results = arr.map((p: any) => ({
|
||||
...p,
|
||||
morningTotal: 0,
|
||||
denominations: ((p.denominations || []) as any[]).map((d: any) => ({ ...d, morningCount: 0 }))
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
labelForCashier(id: number): string {
|
||||
|
||||
Reference in New Issue
Block a user