feat(cashier): denomination overdraft validation, exchange detail fix, cash exchange in reports
- Savings/Current/FD/RD withdrawal forms: card-style overdraft warning when requested denomination count exceeds cashier stock; submit blocked on overdraft - Cash History detail view: show both RECEIVED and GIVEN denomination breakdowns for Cash Exchange (previously only RECEIVED side was displayed) - Closing Cash Report: add Cash Exchanges section (denomination-wise received/given/net) - Excess Transaction Report: include cash exchanges >= threshold with Type badge (Exchange/Txn) and ID Proof column for RBI/AML compliance - cashier-shared.scss: etr-badge and closing-exchange-head styles - Cash Exchange entry: overdraft warning redesigned to cx-overdraft-card BEM layout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
51495f8eb8
commit
f291e4da5b
@@ -30,7 +30,7 @@ interface TxnRow {
|
||||
reversedBy: number | null;
|
||||
reversedAt: string | null;
|
||||
reverseReason: string | null;
|
||||
type: 'transfer' | 'settlement' | 'inter';
|
||||
type: 'transfer' | 'settlement' | 'inter' | 'exchange';
|
||||
}
|
||||
|
||||
interface DenomDetail {
|
||||
@@ -45,6 +45,8 @@ interface DenomDetail {
|
||||
interface DetailView {
|
||||
row: TxnRow;
|
||||
denominations: DenomDetail[];
|
||||
receivedDenominations: DenomDetail[];
|
||||
givenDenominations: DenomDetail[];
|
||||
morningTotal: number;
|
||||
loading: boolean;
|
||||
}
|
||||
@@ -73,6 +75,7 @@ export class CashHistoryComponent implements OnInit {
|
||||
transfers: TxnRow[] = [];
|
||||
settlements: TxnRow[] = [];
|
||||
interCashier: TxnRow[] = [];
|
||||
exchanges: TxnRow[] = [];
|
||||
loading = false;
|
||||
|
||||
private denomKindMap = new Map<number, 'note' | 'coin'>();
|
||||
@@ -98,8 +101,9 @@ export class CashHistoryComponent implements OnInit {
|
||||
forkJoin({
|
||||
transfers: this.service.getCashTransfers().pipe(catchError(() => of([]))),
|
||||
settlements: this.service.getCashSettlements().pipe(catchError(() => of([]))),
|
||||
inter: this.service.getInterCashierTransfers().pipe(catchError(() => of([])))
|
||||
}).subscribe(({ transfers, settlements, inter }) => {
|
||||
inter: this.service.getInterCashierTransfers().pipe(catchError(() => of([]))),
|
||||
exchanges: this.service.getCashExchanges().pipe(catchError(() => of([])))
|
||||
}).subscribe(({ transfers, settlements, inter, exchanges }) => {
|
||||
this.transfers = (transfers as any[]).map((t) => ({
|
||||
id: t.id,
|
||||
date: t.transferDate,
|
||||
@@ -146,12 +150,34 @@ export class CashHistoryComponent implements OnInit {
|
||||
reverseReason: i.reverseReason ?? null,
|
||||
type: 'inter'
|
||||
}));
|
||||
this.exchanges = (exchanges as any[]).map((e) => ({
|
||||
id: e.id,
|
||||
date: e.exchangeDate,
|
||||
fromParty: e.accountNo ? `Account ${e.accountNo}` : 'Walk-in Customer',
|
||||
toParty: e.performedByUsername || '—',
|
||||
amount: e.exchangeAmount,
|
||||
note: e.note,
|
||||
isReversed: e.isReversed ?? false,
|
||||
performedByUsername: e.performedByUsername,
|
||||
createdAt: e.createdAt,
|
||||
reversedBy: e.reversedBy ?? null,
|
||||
reversedAt: e.reversedAt ?? null,
|
||||
reverseReason: e.reverseReason ?? null,
|
||||
type: 'exchange'
|
||||
}));
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
viewDetail(row: TxnRow): void {
|
||||
this.detail = { row, denominations: [], morningTotal: 0, loading: true };
|
||||
this.detail = {
|
||||
row,
|
||||
denominations: [],
|
||||
receivedDenominations: [],
|
||||
givenDenominations: [],
|
||||
morningTotal: 0,
|
||||
loading: true
|
||||
};
|
||||
|
||||
if (row.type === 'settlement' && row.fromCashierId) {
|
||||
forkJoin({
|
||||
@@ -180,18 +206,27 @@ export class CashHistoryComponent implements OnInit {
|
||||
let obs$;
|
||||
if (row.type === 'transfer') obs$ = this.service.getCashTransferById(row.id);
|
||||
else if (row.type === 'settlement') obs$ = this.service.getCashSettlementById(row.id);
|
||||
else if (row.type === 'exchange') obs$ = this.service.getCashExchange(row.id);
|
||||
else obs$ = this.service.getInterCashierById(row.id);
|
||||
|
||||
obs$.pipe(catchError(() => of(null))).subscribe((data: any) => {
|
||||
if (this.detail) {
|
||||
this.detail.denominations = ((data?.details || []) as any[]).map((d: any) => ({
|
||||
const mapDenom = (d: any): DenomDetail => ({
|
||||
denominationId: d.denominationId ?? null,
|
||||
denominationValue: d.denominationValue,
|
||||
kind: this.denomKindMap.get(d.denominationId) ?? (d.denominationValue <= 5 ? 'coin' : 'note'),
|
||||
morningCount: 0,
|
||||
count: d.count,
|
||||
totalAmount: d.totalAmount
|
||||
}));
|
||||
});
|
||||
if (row.type === 'exchange') {
|
||||
const all: any[] = data?.details || [];
|
||||
this.detail.receivedDenominations = all.filter((d: any) => d.direction === 'RECEIVED').map(mapDenom);
|
||||
this.detail.givenDenominations = all.filter((d: any) => d.direction === 'GIVEN').map(mapDenom);
|
||||
this.detail.denominations = this.detail.receivedDenominations;
|
||||
} else {
|
||||
this.detail.denominations = (data?.details || []).map(mapDenom);
|
||||
}
|
||||
this.detail.loading = false;
|
||||
}
|
||||
});
|
||||
@@ -223,6 +258,7 @@ export class CashHistoryComponent implements OnInit {
|
||||
let obs$;
|
||||
if (type === 'transfer') obs$ = this.service.reverseCashTransfer(id, reason);
|
||||
else if (type === 'settlement') obs$ = this.service.reverseCashSettlement(id, reason);
|
||||
else if (type === 'exchange') obs$ = this.service.reverseCashExchange(id, reason);
|
||||
else obs$ = this.service.reverseInterCashierTransfer(id, reason);
|
||||
|
||||
obs$.pipe(catchError(() => of(null))).subscribe((res: any) => {
|
||||
@@ -236,7 +272,10 @@ export class CashHistoryComponent implements OnInit {
|
||||
}
|
||||
|
||||
typeLabel(type: string): string {
|
||||
return type === 'transfer' ? 'Cash Transfer' : type === 'settlement' ? 'Cash Settlement' : 'Inter-Cashier Transfer';
|
||||
if (type === 'transfer') return 'Cash Transfer';
|
||||
if (type === 'settlement') return 'Cash Settlement';
|
||||
if (type === 'exchange') return 'Cash Exchange';
|
||||
return 'Inter-Cashier Transfer';
|
||||
}
|
||||
|
||||
notes(denoms: DenomDetail[]): DenomDetail[] {
|
||||
|
||||
Reference in New Issue
Block a user