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:
Jaanu423
2026-06-01 10:10:17 +05:30
co-authored by Claude Sonnet 4.6
parent 51495f8eb8
commit f291e4da5b
24 changed files with 1339 additions and 25 deletions
@@ -22,6 +22,49 @@
</div>
</header>
<!-- ── Customer Info Bar ── -->
<div class="cx-customer-bar">
<div
class="cx-customer-toggle"
[class.cx-customer-toggle--active]="isAccountHolder"
(click)="toggleAccountHolder()"
>
<mat-icon>{{ isAccountHolder ? 'check_box' : 'check_box_outline_blank' }}</mat-icon>
<span>Account Holder</span>
</div>
@if (isAccountHolder) {
<label class="cx-field cx-field--inline">
<span>Account No.</span>
<input
type="text"
[value]="accountNo"
(input)="accountNo = $any($event.target).value"
placeholder="e.g. 000101234567"
/>
</label>
} @else {
<span class="cx-walk-in"><mat-icon>person_outline</mat-icon> Walk-in Customer</span>
}
@if (needsIdProof) {
<div class="cx-pan-required">
<mat-icon>warning</mat-icon>
<span>Amount ≥ ₹50,000 — Customer PAN / Aadhaar required (RBI)</span>
</div>
<label class="cx-field cx-field--inline cx-field--pan">
<span>PAN / Aadhaar *</span>
<input
type="text"
[value]="customerIdProof"
(input)="customerIdProof = $any($event.target).value"
placeholder="ABCDE1234F"
maxlength="20"
/>
</label>
}
</div>
<div class="cx-cols">
<!-- RECEIVED -->
<section class="cx-col cx-col--received">
@@ -147,14 +190,42 @@
@if (receivedTotal > 0 && !matches) {
<div class="cx-warn"><mat-icon>warning</mat-icon> Received and Given totals must match (net ₹0).</div>
}
@if (hasGivenOverdraft) {
<div class="cx-overdraft-card">
<div class="cx-overdraft-card__title">
<mat-icon class="cx-overdraft-card__ico">block</mat-icon>
<span>Insufficient stock — cannot give to customer</span>
</div>
<div class="cx-overdraft-card__rows">
@for (item of givenOverdraftItems; track item.label) {
<div class="cx-overdraft-card__row">
<span class="cx-overdraft-card__chip">{{ item.label }}</span>
<span class="cx-overdraft-card__stat"
><span class="cx-overdraft-card__lbl">Need</span><strong>{{ item.requested }}</strong></span
>
<span class="cx-overdraft-card__dot">·</span>
<span class="cx-overdraft-card__stat"
><span class="cx-overdraft-card__lbl">Available</span><strong>{{ item.available }}</strong></span
>
<span class="cx-overdraft-card__short">Short: {{ item.requested - item.available }}</span>
</div>
}
</div>
</div>
}
@if (needsIdProof && !customerIdProof.trim()) {
<div class="cx-warn cx-warn--pan">
<mat-icon>badge</mat-icon> Enter customer PAN / Aadhaar to proceed (amount ≥ ₹50,000).
</div>
}
<div class="cx-actions">
<label class="cx-field cx-field--note">
<span>Note</span>
<input type="text" [value]="note" (input)="note = $any($event.target).value" placeholder="Optional" />
</label>
<button type="button" class="cx-btn cx-btn--primary" [disabled]="!matches || saving" (click)="submit()">
<mat-icon>swap_horiz</mat-icon> Confirm Exchange
<button type="button" class="cx-btn cx-btn--primary" [disabled]="!valid || saving" (click)="submit()">
<mat-icon>swap_horiz</mat-icon> {{ saving ? 'Saving…' : 'Confirm Exchange' }}
</button>
</div>
</div>
@@ -73,6 +73,208 @@
}
}
/* ── Customer info bar ── */
.cx-customer-bar {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 14px;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 10px;
flex-wrap: wrap;
}
.cx-customer-toggle {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
font-weight: 600;
color: #475569;
cursor: pointer;
user-select: none;
mat-icon {
font-size: 20px;
height: 20px;
width: 20px;
color: #94a3b8;
}
&--active {
color: #1e40af;
mat-icon {
color: #1e40af;
}
}
}
.cx-walk-in {
display: flex;
align-items: center;
gap: 4px;
font-size: 12px;
color: #64748b;
mat-icon {
font-size: 16px;
height: 16px;
width: 16px;
}
}
.cx-pan-required {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
background: #fffbeb;
border: 1px solid #fcd34d;
border-radius: 6px;
font-size: 12px;
font-weight: 600;
color: #92400e;
mat-icon {
font-size: 16px;
height: 16px;
width: 16px;
color: #d97706;
}
}
.cx-field--inline {
flex-direction: row;
align-items: center;
gap: 8px;
span {
white-space: nowrap;
}
input {
width: 180px;
}
}
.cx-field--pan input {
width: 160px;
border-color: #fcd34d;
&:focus {
outline: none;
border-color: #d97706;
}
}
.cx-warn--pan {
background: #eff6ff;
border-color: #bfdbfe;
color: #1e40af;
mat-icon {
color: #2563eb;
}
}
.cx-overdraft-card {
background: #fff5f5;
border: 1.5px solid #fca5a5;
border-left: 4px solid #ef4444;
border-radius: 10px;
overflow: hidden;
&__title {
display: flex;
align-items: center;
gap: 8px;
padding: 9px 14px;
font-size: 13px;
font-weight: 700;
color: #7f1d1d;
background: #fef2f2;
border-bottom: 1px solid #fecaca;
}
&__ico {
color: #ef4444;
font-size: 18px;
height: 18px;
width: 18px;
flex-shrink: 0;
}
&__rows {
display: flex;
flex-direction: column;
padding: 4px 0;
}
&__row {
display: flex;
align-items: center;
gap: 10px;
padding: 7px 14px;
font-size: 12.5px;
color: #7f1d1d;
&:not(:last-child) {
border-bottom: 1px dashed #fecaca;
}
}
&__chip {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 3px 10px;
background: linear-gradient(135deg, #fee2e2, #fecaca);
border: 1px solid #fca5a5;
border-radius: 6px;
font-size: 12px;
font-weight: 800;
color: #991b1b;
min-width: 52px;
letter-spacing: 0.01em;
}
&__stat {
display: flex;
align-items: center;
gap: 4px;
strong {
font-weight: 800;
font-variant-numeric: tabular-nums;
}
}
&__lbl {
font-size: 11px;
color: #b91c1c;
font-weight: 600;
}
&__dot {
color: #fca5a5;
font-weight: 700;
font-size: 14px;
}
&__short {
margin-left: auto;
padding: 2px 9px;
background: #fff;
border: 1.5px solid #f87171;
border-radius: 999px;
font-size: 11px;
font-weight: 800;
color: #b91c1c;
}
}
.cx-cols {
display: grid;
grid-template-columns: 1fr 1fr;
@@ -45,7 +45,16 @@ export class CashExchangeEntryComponent implements OnInit {
note = '';
saving = false;
/** All denominations (notes then coins) — used for totals and the submit payload. */
// ── Customer info ──
isAccountHolder = false;
accountNo = '';
customerIdProof = '';
// ── Cashier position (for denomination overdraft check) ──
private availableMap = new Map<number, number>();
positionLoaded = false;
/** All denominations (notes then coins) */
get denoms(): Denom[] {
return [
...this.notes,
@@ -58,7 +67,7 @@ export class CashExchangeEntryComponent implements OnInit {
this.exchangeDate = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
this.service.getActiveDenominations().subscribe({
next: (list) => {
const rows: Denom[] = (list || []).map((x) => ({
const rows: Denom[] = (list || []).map((x: any) => ({
id: x.id,
value: x.denomination,
kind: x.kind,
@@ -72,6 +81,18 @@ export class CashExchangeEntryComponent implements OnInit {
this.coins = [];
}
});
this.service.getCashierPositionForMe().subscribe({
next: (res: any) => {
this.availableMap.clear();
((res?.denominations || []) as any[]).forEach((d: any) => {
if (d.denominationId) this.availableMap.set(Number(d.denominationId), Number(d.count ?? 0));
});
this.positionLoaded = true;
},
error: () => {
this.positionLoaded = true;
}
});
}
countFor(side: 'r' | 'g', d: Denom): number {
@@ -107,23 +128,53 @@ export class CashExchangeEntryComponent implements OnInit {
return this.receivedTotal > 0 && this.receivedTotal === this.givenTotal;
}
/** Above ₹50,000 PAN/ID is mandatory per RBI guideline */
get needsIdProof(): boolean {
return this.receivedTotal >= 50000;
}
/** Denominations where cashier is giving more than currently available. */
get givenOverdraftItems(): Array<{ label: string; available: number; requested: number }> {
if (!this.positionLoaded) return [];
return this.denoms
.map((d) => ({ label: d.label, available: this.availableMap.get(d.id) ?? 0, requested: this.countFor('g', d) }))
.filter((item) => item.requested > 0 && item.requested > item.available);
}
get hasGivenOverdraft(): boolean {
return this.givenOverdraftItems.length > 0;
}
get valid(): boolean {
return this.matches && (!this.needsIdProof || this.customerIdProof.trim().length > 0) && !this.hasGivenOverdraft;
}
toggleAccountHolder(): void {
this.isAccountHolder = !this.isAccountHolder;
if (!this.isAccountHolder) this.accountNo = '';
}
clear(): void {
this.receivedCounts = {};
this.givenCounts = {};
this.note = '';
this.accountNo = '';
this.customerIdProof = '';
this.isAccountHolder = false;
}
submit(): void {
if (!this.matches || this.saving) {
return;
}
if (!this.valid || this.saving) return;
this.saving = true;
const build = (side: 'r' | 'g') =>
this.denoms
.filter((d) => this.countFor(side, d) > 0)
.map((d) => ({ denominationId: d.id, denominationValue: d.value, count: this.countFor(side, d) }));
const payload = {
const payload: any = {
exchangeDate: this.exchangeDate,
note: this.note || null,
customerIdProof: this.customerIdProof.trim() || null,
accountNo: this.isAccountHolder && this.accountNo.trim() ? this.accountNo.trim() : null,
received: build('r'),
given: build('g')
};
@@ -131,7 +182,6 @@ export class CashExchangeEntryComponent implements OnInit {
next: () => {
this.snackBar.open('Cash exchange recorded', 'Close', { duration: 3000 });
this.clear();
this.note = '';
this.saving = false;
},
error: () => {
@@ -52,6 +52,12 @@
<ng-container *ngTemplateOutlet="txnTable; context: { rows: interCashier }"></ng-container>
</div>
</mat-tab>
<mat-tab label="Cash Exchanges ({{ exchanges.length }})">
<div class="pg-tab-body">
<ng-container *ngTemplateOutlet="txnTable; context: { rows: exchanges }"></ng-container>
</div>
</mat-tab>
</mat-tab-group>
</div>
@@ -122,7 +128,13 @@
<!-- Header -->
<div class="detail-panel__head">
<div class="detail-panel__title">
<mat-icon>{{ detail.row.type === 'settlement' ? 'account_balance_wallet' : 'swap_horiz' }}</mat-icon>
<mat-icon>{{
detail.row.type === 'settlement'
? 'account_balance_wallet'
: detail.row.type === 'exchange'
? 'currency_exchange'
: 'swap_horiz'
}}</mat-icon>
<div>
<span class="detail-panel__type">{{ typeLabel(detail.row.type) }}</span>
<span class="detail-panel__id">#{{ detail.row.id }}</span>
@@ -241,8 +253,163 @@
@if (detail.loading) {
<div class="pg-empty" style="padding: 20px 0">Loading denomination details…</div>
} @else if (detail.denominations.length === 0) {
} @else if (
detail.row.type === 'exchange' &&
detail.receivedDenominations.length === 0 &&
detail.givenDenominations.length === 0
) {
<div class="pg-empty" style="padding: 20px 0">No denomination data recorded.</div>
} @else if (detail.row.type !== 'exchange' && detail.denominations.length === 0) {
<div class="pg-empty" style="padding: 20px 0">No denomination data recorded.</div>
} @else if (detail.row.type === 'exchange') {
<!-- RECEIVED from customer -->
<div class="cx-dir-label cx-dir-label--received"><mat-icon>south</mat-icon> Received from Customer</div>
@if (notes(detail.receivedDenominations).length > 0) {
<div class="detail-denom-kind-label">Notes</div>
<table class="pg-table detail-denom-table">
<thead>
<tr>
<th>Denomination</th>
<th style="text-align: center">Count</th>
<th class="num">Total</th>
</tr>
</thead>
<tbody>
@for (d of notes(detail.receivedDenominations); track d.denominationValue) {
<tr>
<td>
<span class="pg-chip">₹{{ d.denominationValue }}</span>
</td>
<td style="text-align: center; font-weight: 600">{{ d.count }}</td>
<td class="num">₹{{ d.totalAmount | number: '1.2-2' }}</td>
</tr>
}
</tbody>
<tfoot>
<tr class="detail-denom-total">
<td><strong>Subtotal</strong></td>
<td style="text-align: center">
<strong>{{ totalCount(notes(detail.receivedDenominations)) }}</strong>
</td>
<td class="num">
<strong>₹{{ subtotal(notes(detail.receivedDenominations)) | number: '1.2-2' }}</strong>
</td>
</tr>
</tfoot>
</table>
}
@if (coins(detail.receivedDenominations).length > 0) {
<div class="detail-denom-kind-label">Coins</div>
<table class="pg-table detail-denom-table">
<thead>
<tr>
<th>Denomination</th>
<th style="text-align: center">Count</th>
<th class="num">Total</th>
</tr>
</thead>
<tbody>
@for (d of coins(detail.receivedDenominations); track d.denominationValue) {
<tr>
<td>
<span class="pg-chip pg-chip--coin">₹{{ d.denominationValue }}</span>
</td>
<td style="text-align: center; font-weight: 600">{{ d.count }}</td>
<td class="num">₹{{ d.totalAmount | number: '1.2-2' }}</td>
</tr>
}
</tbody>
<tfoot>
<tr class="detail-denom-total">
<td><strong>Subtotal</strong></td>
<td style="text-align: center">
<strong>{{ totalCount(coins(detail.receivedDenominations)) }}</strong>
</td>
<td class="num">
<strong>₹{{ subtotal(coins(detail.receivedDenominations)) | number: '1.2-2' }}</strong>
</td>
</tr>
</tfoot>
</table>
}
<!-- GIVEN to customer -->
<div class="cx-dir-label cx-dir-label--given"><mat-icon>north</mat-icon> Given to Customer</div>
@if (notes(detail.givenDenominations).length > 0) {
<div class="detail-denom-kind-label">Notes</div>
<table class="pg-table detail-denom-table">
<thead>
<tr>
<th>Denomination</th>
<th style="text-align: center">Count</th>
<th class="num">Total</th>
</tr>
</thead>
<tbody>
@for (d of notes(detail.givenDenominations); track d.denominationValue) {
<tr>
<td>
<span class="pg-chip">₹{{ d.denominationValue }}</span>
</td>
<td style="text-align: center; font-weight: 600">{{ d.count }}</td>
<td class="num">₹{{ d.totalAmount | number: '1.2-2' }}</td>
</tr>
}
</tbody>
<tfoot>
<tr class="detail-denom-total">
<td><strong>Subtotal</strong></td>
<td style="text-align: center">
<strong>{{ totalCount(notes(detail.givenDenominations)) }}</strong>
</td>
<td class="num">
<strong>₹{{ subtotal(notes(detail.givenDenominations)) | number: '1.2-2' }}</strong>
</td>
</tr>
</tfoot>
</table>
}
@if (coins(detail.givenDenominations).length > 0) {
<div class="detail-denom-kind-label">Coins</div>
<table class="pg-table detail-denom-table">
<thead>
<tr>
<th>Denomination</th>
<th style="text-align: center">Count</th>
<th class="num">Total</th>
</tr>
</thead>
<tbody>
@for (d of coins(detail.givenDenominations); track d.denominationValue) {
<tr>
<td>
<span class="pg-chip pg-chip--coin">₹{{ d.denominationValue }}</span>
</td>
<td style="text-align: center; font-weight: 600">{{ d.count }}</td>
<td class="num">₹{{ d.totalAmount | number: '1.2-2' }}</td>
</tr>
}
</tbody>
<tfoot>
<tr class="detail-denom-total">
<td><strong>Subtotal</strong></td>
<td style="text-align: center">
<strong>{{ totalCount(coins(detail.givenDenominations)) }}</strong>
</td>
<td class="num">
<strong>₹{{ subtotal(coins(detail.givenDenominations)) | number: '1.2-2' }}</strong>
</td>
</tr>
</tfoot>
</table>
}
<!-- Grand total -->
<div class="detail-denom-grand-total">
<span>Grand Total</span>
<span>{{ totalCount(detail.receivedDenominations) }} notes/coins</span>
<span>₹{{ detail.row.amount | number: '1.2-2' }}</span>
</div>
} @else {
<!-- Notes -->
@if (notes(detail.denominations).length > 0) {
@@ -312,6 +312,38 @@
border-color: #fcd34d;
}
// Cash exchange direction labels
.cx-dir-label {
display: flex;
align-items: center;
gap: 6px;
margin: 8px 20px 4px;
padding: 6px 10px;
border-radius: 6px;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
mat-icon {
font-size: 14px;
height: 14px;
width: 14px;
}
&--received {
background: #eff6ff;
color: #1d4ed8;
border: 1px solid #bfdbfe;
}
&--given {
background: #fef3c7;
color: #92400e;
border: 1px solid #fcd34d;
}
}
.pg-btn--danger {
background: linear-gradient(135deg, #ef4444, #b91c1c);
color: #fff;
@@ -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[] {
+55
View File
@@ -373,3 +373,58 @@
font-variant-numeric: tabular-nums;
}
}
/* ── Cash Exchange section header ───────────────────────────────────── */
.closing-exchange-head {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 12px 16px 10px;
border-bottom: 1px solid #e2e8f0;
margin-bottom: 2px;
mat-icon {
color: #0f4f3c;
font-size: 22px;
height: 22px;
width: 22px;
margin-top: 2px;
flex-shrink: 0;
}
}
.closing-exchange-title {
font-size: 14px;
font-weight: 700;
color: #1a1a1a;
}
.closing-exchange-sub {
font-size: 12px;
color: #64748b;
margin-top: 2px;
}
// Excess Transaction Report — type badges
.etr-badge {
display: inline-flex;
align-items: center;
height: 22px;
padding: 0 8px;
border-radius: 5px;
font-size: 11px;
font-weight: 700;
white-space: nowrap;
&--savings {
background: #f0fdf4;
color: #15803d;
border: 1px solid #bbf7d0;
}
&--exchange {
background: #eff6ff;
color: #1d4ed8;
border: 1px solid #bfdbfe;
}
}
+3
View File
@@ -30,6 +30,9 @@ export class CashierService {
getCashExchange(id: number): Observable<any> {
return this.http.get(`/cashexchange/${id}`);
}
reverseCashExchange(id: number, reason: string): Observable<any> {
return this.http.post(`/cashexchange/${id}/reverse`, { reason });
}
// ── Tellers / Cashiers ──
getTellers(): Observable<any[]> {
@@ -133,8 +133,109 @@
</table>
}
@if (loaded && rows.length === 0) {
@if (loaded && rows.length === 0 && exchangeRows.length === 0) {
<div class="pg-empty">No cash denomination data for this date.</div>
}
</div>
<!-- Cash Exchange section — separate from deposits/withdrawals (net monetary = ₹0) -->
@if (exchangeRows.length > 0) {
<div class="pg-card">
<div class="closing-exchange-head">
<mat-icon>swap_horiz</mat-icon>
<div>
<div class="closing-exchange-title">Cash Exchanges</div>
<div class="closing-exchange-sub">Denomination swaps recorded on this date (net cash impact: ₹0.00)</div>
</div>
</div>
@if (exchangeNoteRows.length > 0) {
<div class="pos-section-label">Notes</div>
<table class="pg-table">
<thead>
<tr>
<th>Denomination</th>
<th class="num col-in">Received Pcs</th>
<th class="num col-in">Received Amt</th>
<th class="num col-out">Given Pcs</th>
<th class="num col-out">Given Amt</th>
<th class="num col-net">Net Pcs</th>
<th class="num col-net">Net Amount</th>
</tr>
</thead>
<tbody>
@for (r of exchangeNoteRows; track r.denominationId) {
<tr>
<td>
<span class="pg-chip">₹{{ r.denominationValue }}</span>
</td>
<td class="num col-in">{{ r.receivedCount }}</td>
<td class="num col-in">₹{{ r.receivedAmount | number: '1.2-2' }}</td>
<td class="num col-out">{{ r.givenCount }}</td>
<td class="num col-out">₹{{ r.givenAmount | number: '1.2-2' }}</td>
<td
class="num col-net"
[style.color]="r.netCount > 0 ? '#16a34a' : r.netCount < 0 ? '#dc2626' : '#94a3b8'"
>
{{ r.netCount > 0 ? '+' : '' }}{{ r.netCount }}
</td>
<td
class="num col-net"
[style.color]="r.netCount > 0 ? '#16a34a' : r.netCount < 0 ? '#dc2626' : '#94a3b8'"
>
{{ r.netCount >= 0 ? '' : '−' }}₹{{
(r.netAmount < 0 ? -r.netAmount : r.netAmount) | number: '1.2-2'
}}
</td>
</tr>
}
</tbody>
</table>
}
@if (exchangeCoinRows.length > 0) {
<div class="pos-section-label pos-section-label--coin">Coins</div>
<table class="pg-table">
<thead>
<tr>
<th>Denomination</th>
<th class="num col-in">Received Pcs</th>
<th class="num col-in">Received Amt</th>
<th class="num col-out">Given Pcs</th>
<th class="num col-out">Given Amt</th>
<th class="num col-net">Net Pcs</th>
<th class="num col-net">Net Amount</th>
</tr>
</thead>
<tbody>
@for (r of exchangeCoinRows; track r.denominationId) {
<tr>
<td>
<span class="pg-chip pg-chip--coin">₹{{ r.denominationValue }}</span>
</td>
<td class="num col-in">{{ r.receivedCount }}</td>
<td class="num col-in">₹{{ r.receivedAmount | number: '1.2-2' }}</td>
<td class="num col-out">{{ r.givenCount }}</td>
<td class="num col-out">₹{{ r.givenAmount | number: '1.2-2' }}</td>
<td
class="num col-net"
[style.color]="r.netCount > 0 ? '#16a34a' : r.netCount < 0 ? '#dc2626' : '#94a3b8'"
>
{{ r.netCount > 0 ? '+' : '' }}{{ r.netCount }}
</td>
<td
class="num col-net"
[style.color]="r.netCount > 0 ? '#16a34a' : r.netCount < 0 ? '#dc2626' : '#94a3b8'"
>
{{ r.netCount >= 0 ? '' : '−' }}₹{{
(r.netAmount < 0 ? -r.netAmount : r.netAmount) | number: '1.2-2'
}}
</td>
</tr>
}
</tbody>
</table>
}
</div>
}
</div>
@@ -29,6 +29,7 @@ export class ClosingCashReportComponent implements OnInit {
date = '';
rows: any[] = [];
exchangeRows: any[] = [];
depositTotal = 0;
withdrawalTotal = 0;
netTotal = 0;
@@ -41,6 +42,12 @@ export class ClosingCashReportComponent implements OnInit {
get coinRows(): any[] {
return this.rows.filter((r) => r.kind === 'coin');
}
get exchangeNoteRows(): any[] {
return this.exchangeRows.filter((r) => r.kind !== 'coin');
}
get exchangeCoinRows(): any[] {
return this.exchangeRows.filter((r) => r.kind === 'coin');
}
ngOnInit(): void {
const d = new Date();
@@ -53,6 +60,7 @@ export class ClosingCashReportComponent implements OnInit {
this.service.closingCashReport(this.date).subscribe({
next: (res: any) => {
this.rows = res?.rows || [];
this.exchangeRows = res?.exchangeRows || [];
this.depositTotal = Number(res?.depositTotal || 0);
this.withdrawalTotal = Number(res?.withdrawalTotal || 0);
this.netTotal = Number(res?.netTotal || 0);
@@ -61,6 +69,7 @@ export class ClosingCashReportComponent implements OnInit {
},
error: () => {
this.rows = [];
this.exchangeRows = [];
this.depositTotal = 0;
this.withdrawalTotal = 0;
this.netTotal = 0;
@@ -18,6 +18,10 @@
</a>
</header>
@if (loading) {
<div class="pg-empty">Loading…</div>
}
<div class="pg-card">
<table class="pg-table">
<thead>
@@ -36,26 +36,36 @@
<table class="pg-table">
<thead>
<tr>
<th>Type</th>
<th>Txn #</th>
<th>Account No</th>
<th>CIF</th>
<th>Date</th>
<th class="num">Amount</th>
<th>ID Proof</th>
</tr>
</thead>
<tbody>
@for (r of rows; track r.txnId) {
@for (r of rows; track $index) {
<tr>
<td>
@if (r.type === 'EXCHANGE') {
<span class="etr-badge etr-badge--exchange">Exchange</span>
} @else {
<span class="etr-badge etr-badge--savings">Txn</span>
}
</td>
<td>{{ r.txnId }}</td>
<td>{{ r.accountNo || '—' }}</td>
<td>{{ r.cifNo || '—' }}</td>
<td>{{ r.txnDate || '—' }}</td>
<td class="num">₹{{ r.totalAmount | number: '1.2-2' }}</td>
<td>{{ r.idProof || '—' }}</td>
</tr>
}
@if (loaded && rows.length === 0) {
<tr>
<td colspan="5" class="pg-empty">No transactions at or above ₹{{ threshold | number }}.</td>
<td colspan="7" class="pg-empty">No transactions at or above ₹{{ threshold | number }}.</td>
</tr>
}
</tbody>
@@ -326,6 +326,31 @@
Use ₹{{ denominationTotal | number: '1.2-2' }} as Transaction Amount
</button>
</div>
<!-- Denomination overdraft warning (withdrawal only) -->
@if (transactionType.withdrawal && hasWithdrawalDenomOverdraft) {
<div class="sat__denom-warn">
<div class="sat__denom-warn-title">
<fa-icon icon="exclamation-triangle" class="sat__denom-warn-ico"></fa-icon>
<span>Insufficient denomination stock — cannot proceed</span>
</div>
<div class="sat__denom-warn-rows">
@for (item of withdrawalDenomOverdraft; track item.label) {
<div class="sat__denom-warn-row">
<span class="sat__denom-warn-chip">{{ item.label }}</span>
<span class="sat__denom-warn-stat"
><span class="sat__denom-warn-lbl">Need</span><strong>{{ item.requested }}</strong></span
>
<span class="sat__denom-warn-dot">·</span>
<span class="sat__denom-warn-stat"
><span class="sat__denom-warn-lbl">Available</span><strong>{{ item.available }}</strong></span
>
<span class="sat__denom-warn-short">Short: {{ item.requested - item.available }}</span>
</div>
}
</div>
</div>
}
<!-- Closing cash position -->
@if (openingLoaded && openingDenoms.length > 0) {
<div
@@ -486,7 +511,11 @@
mat-flat-button
type="submit"
class="sat__submit"
[disabled]="!currentAccountTransactionForm.valid || (denominationTotal > 0 && !denominationMatchesForm)"
[disabled]="
!currentAccountTransactionForm.valid ||
(denominationTotal > 0 && !denominationMatchesForm) ||
hasWithdrawalDenomOverdraft
"
>
<fa-icon icon="check" class="m-r-6"></fa-icon>
{{ 'labels.buttons.Submit' | translate }}
@@ -1094,3 +1094,98 @@ $red: #b91c1c;
font-variant-numeric: tabular-nums;
color: #0d1b2a;
}
.sat__denom-warn {
margin: 8px 14px;
background: #fff5f5;
border: 1.5px solid #fca5a5;
border-left: 4px solid #ef4444;
border-radius: 10px;
overflow: hidden;
&-title {
display: flex;
align-items: center;
gap: 8px;
padding: 9px 14px;
font-size: 13px;
font-weight: 700;
color: #7f1d1d;
background: #fef2f2;
border-bottom: 1px solid #fecaca;
}
&-ico {
color: #ef4444;
font-size: 14px;
flex-shrink: 0;
}
&-rows {
display: flex;
flex-direction: column;
padding: 4px 0;
}
&-row {
display: flex;
align-items: center;
gap: 10px;
padding: 7px 14px;
font-size: 12.5px;
color: #7f1d1d;
&:not(:last-child) {
border-bottom: 1px dashed #fecaca;
}
}
&-chip {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 3px 10px;
background: linear-gradient(135deg, #fee2e2, #fecaca);
border: 1px solid #fca5a5;
border-radius: 6px;
font-size: 12px;
font-weight: 800;
color: #991b1b;
min-width: 52px;
letter-spacing: 0.01em;
}
&-stat {
display: flex;
align-items: center;
gap: 4px;
strong {
font-weight: 800;
font-variant-numeric: tabular-nums;
}
}
&-lbl {
font-size: 11px;
color: #b91c1c;
font-weight: 600;
}
&-dot {
color: #fca5a5;
font-weight: 700;
font-size: 14px;
}
&-short {
margin-left: auto;
padding: 2px 9px;
background: #fff;
border: 1.5px solid #f87171;
border-radius: 999px;
font-size: 11px;
font-weight: 800;
color: #b91c1c;
}
}
@@ -389,6 +389,24 @@ export class CurrentAccountTransactionsComponent implements OnInit {
return this.denominationTotal > 0 && formAmt === this.denominationTotal;
}
get withdrawalDenomOverdraft(): Array<{ label: string; available: number; requested: number }> {
if (!this.transactionType.withdrawal || !this.openingLoaded || this.openingDenoms.length === 0) return [];
const openMap = new Map<string, number>();
for (const d of this.openingDenoms) {
openMap.set(`${d.kind}:${d.denominationValue}`, Number(d.count ?? 0));
}
return [
...this.notes,
...this.coins
]
.map((d) => ({ label: d.label, available: openMap.get(this.denomKey(d)) ?? 0, requested: this.countFor(d) }))
.filter((item) => item.requested > 0 && item.requested > item.available);
}
get hasWithdrawalDenomOverdraft(): boolean {
return this.withdrawalDenomOverdraft.length > 0;
}
applyDenominationTotal(): void {
this.currentAccountTransactionForm.controls['transactionAmount'].setValue(this.denominationTotal);
this.currentAccountTransactionForm.controls['transactionAmount'].markAsDirty();
@@ -299,6 +299,31 @@
Use ₹{{ denominationTotal | number: '1.2-2' }} as Transaction Amount
</button>
</div>
<!-- Denomination overdraft warning (withdrawal only) -->
@if (transactionType.withdrawal && hasWithdrawalDenomOverdraft) {
<div class="sat__denom-warn">
<div class="sat__denom-warn-title">
<fa-icon icon="exclamation-triangle" class="sat__denom-warn-ico"></fa-icon>
<span>Insufficient denomination stock — cannot proceed</span>
</div>
<div class="sat__denom-warn-rows">
@for (item of withdrawalDenomOverdraft; track item.label) {
<div class="sat__denom-warn-row">
<span class="sat__denom-warn-chip">{{ item.label }}</span>
<span class="sat__denom-warn-stat"
><span class="sat__denom-warn-lbl">Need</span><strong>{{ item.requested }}</strong></span
>
<span class="sat__denom-warn-dot">·</span>
<span class="sat__denom-warn-stat"
><span class="sat__denom-warn-lbl">Available</span><strong>{{ item.available }}</strong></span
>
<span class="sat__denom-warn-short">Short: {{ item.requested - item.available }}</span>
</div>
}
</div>
</div>
}
<!-- Closing cash position -->
@if (openingLoaded && openingDenoms.length > 0) {
<div
@@ -452,7 +477,11 @@
mat-flat-button
type="submit"
class="sat__submit"
[disabled]="!accountTransactionForm.valid || (denominationTotal > 0 && !denominationMatchesForm)"
[disabled]="
!accountTransactionForm.valid ||
(denominationTotal > 0 && !denominationMatchesForm) ||
hasWithdrawalDenomOverdraft
"
>
<fa-icon icon="check" class="m-r-6"></fa-icon>
{{ 'labels.buttons.Submit' | translate }}
@@ -1006,3 +1006,98 @@ $amber-d: #b45309;
font-variant-numeric: tabular-nums;
color: #0d1b2a;
}
.sat__denom-warn {
margin: 8px 14px;
background: #fff5f5;
border: 1.5px solid #fca5a5;
border-left: 4px solid #ef4444;
border-radius: 10px;
overflow: hidden;
&-title {
display: flex;
align-items: center;
gap: 8px;
padding: 9px 14px;
font-size: 13px;
font-weight: 700;
color: #7f1d1d;
background: #fef2f2;
border-bottom: 1px solid #fecaca;
}
&-ico {
color: #ef4444;
font-size: 14px;
flex-shrink: 0;
}
&-rows {
display: flex;
flex-direction: column;
padding: 4px 0;
}
&-row {
display: flex;
align-items: center;
gap: 10px;
padding: 7px 14px;
font-size: 12.5px;
color: #7f1d1d;
&:not(:last-child) {
border-bottom: 1px dashed #fecaca;
}
}
&-chip {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 3px 10px;
background: linear-gradient(135deg, #fee2e2, #fecaca);
border: 1px solid #fca5a5;
border-radius: 6px;
font-size: 12px;
font-weight: 800;
color: #991b1b;
min-width: 52px;
letter-spacing: 0.01em;
}
&-stat {
display: flex;
align-items: center;
gap: 4px;
strong {
font-weight: 800;
font-variant-numeric: tabular-nums;
}
}
&-lbl {
font-size: 11px;
color: #b91c1c;
font-weight: 600;
}
&-dot {
color: #fca5a5;
font-weight: 700;
font-size: 14px;
}
&-short {
margin-left: auto;
padding: 2px 9px;
background: #fff;
border: 1.5px solid #f87171;
border-radius: 999px;
font-size: 11px;
font-weight: 800;
color: #b91c1c;
}
}
@@ -312,6 +312,24 @@ export class FixedDepositsCashTransactionComponent implements OnInit {
return this.denominationTotal > 0 && formAmt === this.denominationTotal;
}
get withdrawalDenomOverdraft(): Array<{ label: string; available: number; requested: number }> {
if (!this.transactionType.withdrawal || !this.openingLoaded || this.openingDenoms.length === 0) return [];
const openMap = new Map<string, number>();
for (const d of this.openingDenoms) {
openMap.set(`${d.kind}:${d.denominationValue}`, Number(d.count ?? 0));
}
return [
...this.notes,
...this.coins
]
.map((d) => ({ label: d.label, available: openMap.get(this.denomKey(d)) ?? 0, requested: this.countFor(d) }))
.filter((item) => item.requested > 0 && item.requested > item.available);
}
get hasWithdrawalDenomOverdraft(): boolean {
return this.withdrawalDenomOverdraft.length > 0;
}
applyDenominationTotal(): void {
this.accountTransactionForm.controls['transactionAmount'].setValue(this.denominationTotal);
this.accountTransactionForm.controls['transactionAmount'].markAsDirty();
@@ -299,6 +299,31 @@
Use ₹{{ denominationTotal | number: '1.2-2' }} as Transaction Amount
</button>
</div>
<!-- Denomination overdraft warning (withdrawal only) -->
@if (transactionType.withdrawal && hasWithdrawalDenomOverdraft) {
<div class="sat__denom-warn">
<div class="sat__denom-warn-title">
<fa-icon icon="exclamation-triangle" class="sat__denom-warn-ico"></fa-icon>
<span>Insufficient denomination stock — cannot proceed</span>
</div>
<div class="sat__denom-warn-rows">
@for (item of withdrawalDenomOverdraft; track item.label) {
<div class="sat__denom-warn-row">
<span class="sat__denom-warn-chip">{{ item.label }}</span>
<span class="sat__denom-warn-stat"
><span class="sat__denom-warn-lbl">Need</span><strong>{{ item.requested }}</strong></span
>
<span class="sat__denom-warn-dot">·</span>
<span class="sat__denom-warn-stat"
><span class="sat__denom-warn-lbl">Available</span><strong>{{ item.available }}</strong></span
>
<span class="sat__denom-warn-short">Short: {{ item.requested - item.available }}</span>
</div>
}
</div>
</div>
}
<!-- Closing cash position -->
@if (openingLoaded && openingDenoms.length > 0) {
<div
@@ -458,7 +483,11 @@
mat-flat-button
type="submit"
class="sat__submit"
[disabled]="!depositRecurringDepositForm.valid || (denominationTotal > 0 && !denominationMatchesForm)"
[disabled]="
!depositRecurringDepositForm.valid ||
(denominationTotal > 0 && !denominationMatchesForm) ||
hasWithdrawalDenomOverdraft
"
>
<fa-icon icon="check" class="m-r-6"></fa-icon>
{{ 'labels.buttons.Submit' | translate }}
@@ -1006,3 +1006,98 @@ $amber-d: #b45309;
font-variant-numeric: tabular-nums;
color: #0d1b2a;
}
.sat__denom-warn {
margin: 8px 14px;
background: #fff5f5;
border: 1.5px solid #fca5a5;
border-left: 4px solid #ef4444;
border-radius: 10px;
overflow: hidden;
&-title {
display: flex;
align-items: center;
gap: 8px;
padding: 9px 14px;
font-size: 13px;
font-weight: 700;
color: #7f1d1d;
background: #fef2f2;
border-bottom: 1px solid #fecaca;
}
&-ico {
color: #ef4444;
font-size: 14px;
flex-shrink: 0;
}
&-rows {
display: flex;
flex-direction: column;
padding: 4px 0;
}
&-row {
display: flex;
align-items: center;
gap: 10px;
padding: 7px 14px;
font-size: 12.5px;
color: #7f1d1d;
&:not(:last-child) {
border-bottom: 1px dashed #fecaca;
}
}
&-chip {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 3px 10px;
background: linear-gradient(135deg, #fee2e2, #fecaca);
border: 1px solid #fca5a5;
border-radius: 6px;
font-size: 12px;
font-weight: 800;
color: #991b1b;
min-width: 52px;
letter-spacing: 0.01em;
}
&-stat {
display: flex;
align-items: center;
gap: 4px;
strong {
font-weight: 800;
font-variant-numeric: tabular-nums;
}
}
&-lbl {
font-size: 11px;
color: #b91c1c;
font-weight: 600;
}
&-dot {
color: #fca5a5;
font-weight: 700;
font-size: 14px;
}
&-short {
margin-left: auto;
padding: 2px 9px;
background: #fff;
border: 1.5px solid #f87171;
border-radius: 999px;
font-size: 11px;
font-weight: 800;
color: #b91c1c;
}
}
@@ -333,6 +333,24 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
return this.denominationTotal > 0 && formAmt === this.denominationTotal;
}
get withdrawalDenomOverdraft(): Array<{ label: string; available: number; requested: number }> {
if (!this.transactionType.withdrawal || !this.openingLoaded || this.openingDenoms.length === 0) return [];
const openMap = new Map<string, number>();
for (const d of this.openingDenoms) {
openMap.set(`${d.kind}:${d.denominationValue}`, Number(d.count ?? 0));
}
return [
...this.notes,
...this.coins
]
.map((d) => ({ label: d.label, available: openMap.get(this.denomKey(d)) ?? 0, requested: this.countFor(d) }))
.filter((item) => item.requested > 0 && item.requested > item.available);
}
get hasWithdrawalDenomOverdraft(): boolean {
return this.withdrawalDenomOverdraft.length > 0;
}
applyDenominationTotal(): void {
this.depositRecurringDepositForm.controls['transactionAmount'].setValue(this.denominationTotal);
this.depositRecurringDepositForm.controls['transactionAmount'].markAsDirty();
@@ -326,6 +326,31 @@
Use ₹{{ denominationTotal | number: '1.2-2' }} as Transaction Amount
</button>
</div>
<!-- Denomination overdraft warning (withdrawal only) -->
@if (transactionType.withdrawal && hasWithdrawalDenomOverdraft) {
<div class="sat__denom-warn">
<div class="sat__denom-warn-title">
<fa-icon icon="exclamation-triangle" class="sat__denom-warn-ico"></fa-icon>
<span>Insufficient denomination stock — cannot proceed</span>
</div>
<div class="sat__denom-warn-rows">
@for (item of withdrawalDenomOverdraft; track item.label) {
<div class="sat__denom-warn-row">
<span class="sat__denom-warn-chip">{{ item.label }}</span>
<span class="sat__denom-warn-stat"
><span class="sat__denom-warn-lbl">Need</span><strong>{{ item.requested }}</strong></span
>
<span class="sat__denom-warn-dot">·</span>
<span class="sat__denom-warn-stat"
><span class="sat__denom-warn-lbl">Available</span><strong>{{ item.available }}</strong></span
>
<span class="sat__denom-warn-short">Short: {{ item.requested - item.available }}</span>
</div>
}
</div>
</div>
}
<!-- Closing cash position -->
@if (openingLoaded && openingDenoms.length > 0) {
<div
@@ -486,7 +511,11 @@
mat-flat-button
type="submit"
class="sat__submit"
[disabled]="!savingAccountTransactionForm.valid || (denominationTotal > 0 && !denominationMatchesForm)"
[disabled]="
!savingAccountTransactionForm.valid ||
(denominationTotal > 0 && !denominationMatchesForm) ||
hasWithdrawalDenomOverdraft
"
>
<fa-icon icon="check" class="m-r-6"></fa-icon>
{{ 'labels.buttons.Submit' | translate }}
@@ -827,6 +827,103 @@ $red: #b91c1c;
}
}
/* ─── Denomination overdraft warning (withdrawal) ─────────────────── */
.sat__denom-warn {
margin: 8px 14px;
background: #fff5f5;
border: 1.5px solid #fca5a5;
border-left: 4px solid #ef4444;
border-radius: 10px;
overflow: hidden;
&-title {
display: flex;
align-items: center;
gap: 8px;
padding: 9px 14px;
font-size: 13px;
font-weight: 700;
color: #7f1d1d;
background: #fef2f2;
border-bottom: 1px solid #fecaca;
}
&-ico {
color: #ef4444;
font-size: 14px;
flex-shrink: 0;
}
&-rows {
display: flex;
flex-direction: column;
padding: 4px 0;
}
&-row {
display: flex;
align-items: center;
gap: 10px;
padding: 7px 14px;
font-size: 12.5px;
color: #7f1d1d;
&:not(:last-child) {
border-bottom: 1px dashed #fecaca;
}
}
&-chip {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 3px 10px;
background: linear-gradient(135deg, #fee2e2, #fecaca);
border: 1px solid #fca5a5;
border-radius: 6px;
font-size: 12px;
font-weight: 800;
color: #991b1b;
min-width: 52px;
letter-spacing: 0.01em;
}
&-stat {
display: flex;
align-items: center;
gap: 4px;
strong {
font-weight: 800;
font-variant-numeric: tabular-nums;
}
}
&-lbl {
font-size: 11px;
color: #b91c1c;
font-weight: 600;
}
&-dot {
color: #fca5a5;
font-weight: 700;
font-size: 14px;
}
&-short {
margin-left: auto;
padding: 2px 9px;
background: #fff;
border: 1.5px solid #f87171;
border-radius: 999px;
font-size: 11px;
font-weight: 800;
color: #b91c1c;
}
}
/* ─── Opening / Closing position cards ───────────────────────────── */
.sat__pos-card {
margin: 0 14px 12px;
@@ -455,6 +455,25 @@ export class SavingsAccountTransactionsComponent implements OnInit {
this.denominationCounts = {};
}
/** Denominations where cashier is giving more than currently available (withdrawal only). */
get withdrawalDenomOverdraft(): Array<{ label: string; available: number; requested: number }> {
if (!this.transactionType.withdrawal || !this.openingLoaded || this.openingDenoms.length === 0) return [];
const openMap = new Map<string, number>();
for (const d of this.openingDenoms) {
openMap.set(`${d.kind}:${d.denominationValue}`, Number(d.count ?? 0));
}
return [
...this.notes,
...this.coins
]
.map((d) => ({ label: d.label, available: openMap.get(this.denomKey(d)) ?? 0, requested: this.countFor(d) }))
.filter((item) => item.requested > 0 && item.requested > item.available);
}
get hasWithdrawalDenomOverdraft(): boolean {
return this.withdrawalDenomOverdraft.length > 0;
}
/**
* Open the identity-verify pop-up. Only meaningful for withdrawals
* (where the cashier needs to match the customer at the counter