feat: cashier denomination-wise opening & closing balance panels in all deposit/withdrawal forms

OVERVIEW
--------
Added real-time cashier cash position display inside the denomination breakdown
panel of all 4 transaction entry screens: Savings, Current Account, Recurring
Deposit, and Fixed Deposit. Shows opening balance at the top and projected
closing balance at the bottom after factoring in the current transaction.

BACKEND INTEGRATION
-------------------
- New CashierService (src/app/cashier/cashier.service.ts)
  getCashierPositionForMe(asOfDate?) calls GET /cashreports/cashier-position/me
  Returns denomination-wise opening cash position for the logged-in cashier user.
  Non-cashier users receive empty denominations array; UI hides panels silently.

OPENING BALANCE CARD (top of denomination panel)
-------------------------------------------------
- Loaded on ngOnInit() via loadOpeningPosition() in all 4 component .ts files
- Notes and Coins displayed in separate labeled pill sections
- Each pill shows: Rs{value} x{count} format
- Card is hidden entirely if the logged-in user is not a cashier

CLOSING BALANCE CARD (below tally / Apply button)
--------------------------------------------------
- Computed getter closingDenoms() merges opening position with entered denominations
  deposit:    closingCount = openCount + enteredCount
  withdrawal: closingCount = openCount - enteredCount
- Notes and Coins in separate labeled pill sections (identical format to opening)
- Entered/changed denominations (delta != 0): full opacity + bold font weight
- Untouched denominations (delta = 0): 38% opacity, clearly dimmed, no borders
- closingTotal = openingTotal +/- denominationTotal shown in card header
- Card turns green for positive closing balance, red for negative

COMPONENTS UPDATED
------------------
- savings-account-transactions       (.ts / .html / .scss)
- current-account-transactions       (.ts / .html / .scss)
- deposit-recurring-deposits-account (.ts / .html / .scss)
- fixed-deposits-cash-transaction    (.ts / .html / .scss)

CASHIER MODULE (new - src/app/cashier/)
-----------------------------------------
Full cashier workspace module added to the app:
- cashier.service.ts          API calls (position, transfers, settlement, etc.)
- cashier.module.ts           Angular module declaration
- cashier-routing.module.ts   Lazy-loaded routes
- cashier-position/           Cashier cash position dashboard
- cash-exchange-entry/        Cash exchange denomination entry
- cash-history/               Transaction history per cashier
- cash-settlement/            End-of-day cash settlement
- cash-transfer/              Vault-to-cashier cash transfer
- inter-cashier-transfer/     Transfer between cashier drawers
- reconciliation/             Cash reconciliation with GL
- closing-cash-report/        Closing balance report
- currency-exchange-detail/   Currency exchange breakdown
- excess-transaction-report/  Excess/short transaction report
Module wired into app.module.ts and shell nav (shell.component.html).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jaanu423
2026-05-28 17:39:31 +05:30
co-authored by Claude Sonnet 4.6
parent 555d9fb4b7
commit 7ccaffa7f1
43 changed files with 5302 additions and 8 deletions
@@ -0,0 +1,248 @@
<!--
Copyright since 2025 Mifos Initiative
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<div class="pg">
<header class="pg-head">
<div>
<div class="pg-eyebrow">CASHIER · RECONCILIATION</div>
<h1 class="pg-title">Cash Reconciliation</h1>
<p class="pg-sub">Compare physical denomination count with system expected balance. Highlights variance.</p>
</div>
</header>
<mat-tab-group animationDuration="150ms">
<!-- ── Entry Tab ── -->
<mat-tab label="New Reconciliation">
<div class="pg-tab-body">
<div class="pg-toolbar pg-toolbar--mat">
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Teller</mat-label>
<mat-select [value]="selectedTellerId" (selectionChange)="onTellerSelect($event.value)">
@for (t of tellers; track t.id) {
<mat-option [value]="t.id">{{ t.name }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Cashier</mat-label>
<mat-select
[value]="selectedCashierId"
(selectionChange)="onCashierSelect($event.value)"
[disabled]="!selectedTellerId"
>
@for (c of cashiers; track c.id) {
<mat-option [value]="c.id">{{ c.label }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Date</mat-label>
<input
matInput
type="date"
[value]="reconDate"
(change)="reconDate = $any($event.target).value; fetchExpected()"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic" class="pg-note-field">
<mat-label>Note</mat-label>
<input
matInput
type="text"
[value]="note"
(input)="note = $any($event.target).value"
placeholder="Optional"
/>
</mat-form-field>
</div>
@if (loadingExpected) {
<div class="pg-empty">Loading expected balances…</div>
}
@if (!loadingExpected && rows.length > 0) {
<div class="pg-card">
@if (noteRows.length > 0) {
<div class="pos-section-label">Notes</div>
<table class="pg-table">
<thead>
<tr>
<th>Denomination</th>
<th style="text-align: center">Expected</th>
<th style="text-align: center">Physical</th>
<th class="num">Variance</th>
</tr>
</thead>
<tbody>
@for (row of noteRows; track row.denominationId) {
<tr [class.row-excess]="row.varianceCount > 0" [class.row-short]="row.varianceCount < 0">
<td>
<span class="pg-chip">₹{{ row.denominationValue }}</span>
</td>
<td style="text-align: center; color: #64748b; font-weight: 600">{{ row.expectedCount }}</td>
<td style="text-align: center">
<div class="pg-step" style="margin: 0 auto">
<button
type="button"
(click)="updatePhysical(row, row.physicalCount - 1)"
[disabled]="row.physicalCount === 0"
>
−
</button>
<input
type="number"
min="0"
[value]="row.physicalCount"
(input)="updatePhysical(row, $any($event.target).value)"
/>
<button type="button" (click)="updatePhysical(row, row.physicalCount + 1)">+</button>
</div>
</td>
<td
class="num"
[style.color]="
row.varianceCount > 0 ? '#16a34a' : row.varianceCount < 0 ? '#dc2626' : '#94a3b8'
"
>
{{ row.varianceCount > 0 ? '+' : '' }}{{ row.varianceCount }} (₹{{
row.varianceCount * row.denominationValue | number: '1.0-0'
}})
</td>
</tr>
}
</tbody>
</table>
}
@if (coinRows.length > 0) {
<div class="pos-section-label pos-section-label--coin">Coins</div>
<table class="pg-table">
<thead>
<tr>
<th>Denomination</th>
<th style="text-align: center">Expected</th>
<th style="text-align: center">Physical</th>
<th class="num">Variance</th>
</tr>
</thead>
<tbody>
@for (row of coinRows; track row.denominationId) {
<tr [class.row-excess]="row.varianceCount > 0" [class.row-short]="row.varianceCount < 0">
<td>
<span class="pg-chip pg-chip--coin">₹{{ row.denominationValue }}</span>
</td>
<td style="text-align: center; color: #64748b; font-weight: 600">{{ row.expectedCount }}</td>
<td style="text-align: center">
<div class="pg-step" style="margin: 0 auto">
<button
type="button"
(click)="updatePhysical(row, row.physicalCount - 1)"
[disabled]="row.physicalCount === 0"
>
−
</button>
<input
type="number"
min="0"
[value]="row.physicalCount"
(input)="updatePhysical(row, $any($event.target).value)"
/>
<button type="button" (click)="updatePhysical(row, row.physicalCount + 1)">+</button>
</div>
</td>
<td
class="num"
[style.color]="
row.varianceCount > 0 ? '#16a34a' : row.varianceCount < 0 ? '#dc2626' : '#94a3b8'
"
>
{{ row.varianceCount > 0 ? '+' : '' }}{{ row.varianceCount }} (₹{{
row.varianceCount * row.denominationValue | number: '1.0-0'
}})
</td>
</tr>
}
</tbody>
</table>
}
</div>
<div class="pg-total-bar">
<span>
Expected: <strong>₹{{ totalExpected | number: '1.2-2' }}</strong> &nbsp;|&nbsp; Physical:
<strong>₹{{ totalPhysical | number: '1.2-2' }}</strong> &nbsp;|&nbsp; Variance:
<strong [style.color]="totalVariance === 0 ? '#16a34a' : '#dc2626'">
{{ totalVariance >= 0 ? '+' : '' }}₹{{ totalVariance | number: '1.2-2' }}
</strong>
<span class="badge" [ngClass]="statusClass(statusLabel)">{{ statusLabel }}</span>
</span>
<button type="button" class="pg-btn pg-btn--primary" [disabled]="!valid || saving" (click)="submit()">
<mat-icon>save</mat-icon> Save Reconciliation
</button>
</div>
}
@if (!loadingExpected && rows.length === 0 && selectedCashierId) {
<div class="pg-empty">No balance data found for this cashier.</div>
}
@if (!selectedCashierId) {
<div class="pg-empty">Select a teller and cashier to load expected balances.</div>
}
</div>
</mat-tab>
<!-- ── History Tab ── -->
<mat-tab label="History">
<div class="pg-tab-body">
@if (loadingHistory) {
<div class="pg-empty">Loading…</div>
}
@if (!loadingHistory && history.length === 0) {
<div class="pg-empty">No reconciliation records yet.</div>
}
@if (!loadingHistory && history.length > 0) {
<div class="pg-card">
<table class="pg-table">
<thead>
<tr>
<th>Date</th>
<th>Cashier</th>
<th class="num">Expected</th>
<th class="num">Physical</th>
<th class="num">Variance</th>
<th style="text-align: center">Status</th>
<th>By</th>
</tr>
</thead>
<tbody>
@for (r of history; track r.id) {
<tr>
<td>{{ r.reconDate }}</td>
<td>{{ r.cashierName || r.cashierId }}</td>
<td class="num">₹{{ r.expectedAmount | number: '1.2-2' }}</td>
<td class="num">₹{{ r.physicalAmount | number: '1.2-2' }}</td>
<td class="num" [style.color]="r.variance > 0 ? '#16a34a' : r.variance < 0 ? '#dc2626' : '#94a3b8'">
{{ r.variance >= 0 ? '+' : '' }}₹{{ r.variance | number: '1.2-2' }}
</td>
<td style="text-align: center">
<span class="badge" [ngClass]="statusClass(r.status)">{{ r.status }}</span>
</td>
<td>{{ r.performedByUsername }}</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</mat-tab>
</mat-tab-group>
</div>