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:
Jaanu423
2026-05-31 08:54:27 +05:30
co-authored by Claude Sonnet 4.6
parent 6433ae068d
commit 51495f8eb8
14 changed files with 912 additions and 60 deletions
@@ -15,7 +15,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { MatInputModule } from '@angular/material/input';
import { MatTabsModule } from '@angular/material/tabs';
import { of } from 'rxjs';
import { forkJoin, of } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { CashierService } from '../cashier.service';
@@ -23,6 +23,7 @@ interface DenomRow {
denominationId: number;
denominationValue: number;
kind: string;
morningCount: number;
expectedCount: number;
physicalCount: number;
varianceCount: number;
@@ -75,6 +76,7 @@ export class ReconciliationComponent implements OnInit {
note = '';
varianceReason = '';
rows: DenomRow[] = [];
morningTotal = 0;
loadingExpected = false;
saving = false;
@@ -120,21 +122,33 @@ export class ReconciliationComponent implements OnInit {
fetchExpected(): void {
if (!this.selectedCashierId) return;
this.loadingExpected = true;
this.service
.getExpectedBalance(this.selectedCashierId, this.reconDate)
.pipe(catchError(() => of(null)))
.subscribe((data: any) => {
this.loadingExpected = false;
if (!data) return;
this.rows = (data.denominations || []).map((d: any) => ({
forkJoin({
expected: this.service
.getExpectedBalance(this.selectedCashierId, this.reconDate)
.pipe(catchError(() => of(null))),
morning: this.service
.getCashierMorningBalance(this.selectedCashierId, this.reconDate)
.pipe(catchError(() => of(null)))
}).subscribe(({ expected, morning }) => {
this.loadingExpected = false;
const morningMap = new Map<number, number>();
((morning?.denominations || []) as any[]).forEach((d: any) =>
morningMap.set(d.denominationId, d.morningCount ?? 0)
);
this.morningTotal = Number(morning?.totalMorning ?? 0);
if (!expected) return;
this.rows = ((expected.denominations || []) as any[])
.sort((a: any, b: any) => b.denominationValue - a.denominationValue)
.map((d: any) => ({
denominationId: d.denominationId || null,
denominationValue: d.denominationValue,
kind: d.kind || 'note',
morningCount: morningMap.get(d.denominationId) ?? 0,
expectedCount: d.expectedCount || 0,
physicalCount: d.expectedCount || 0,
varianceCount: 0
}));
});
});
}
updatePhysical(row: DenomRow, raw: any): void {
@@ -148,6 +162,12 @@ export class ReconciliationComponent implements OnInit {
get coinRows(): DenomRow[] {
return this.rows.filter((r) => r.kind === 'coin');
}
get morningNoteTotal(): number {
return this.noteRows.reduce((s, r) => s + r.morningCount * r.denominationValue, 0);
}
get morningCoinTotal(): number {
return this.coinRows.reduce((s, r) => s + r.morningCount * r.denominationValue, 0);
}
get totalExpected(): number {
return this.rows.reduce((s, r) => s + r.denominationValue * r.expectedCount, 0);