feat(cashier,organization): denomination-aware vault UI, Bank/Branch Profile screens, popup disbursement review
Branch Day open/close now captures a denomination-wise count (carried forward automatically to the next day), and shows an auto-fetched EOD summary at close time -- vault + every cashier's position, a branch-total reconciliation against the book figure, and each cashier's reconciliation/settlement status and transaction count -- so closing the day no longer means separately checking Vault Position and every cashier's own screen by hand. New Vault Position screen (branch-ops menu) mirrors Cashier Position for the teller/vault. Cash Transfer now shows the vault's live per-denomination availability while counting a handout, with a client-side warning before it can be over-counted. New Organization screens for Bank Profile, Branch Profile and Clearing GL Configuration, wired into the Organization landing page and the previously-dead "Bank Profile" admin menu button. Cashier Transaction Entry: TYPE is now Receipt/Payment only (cash-only TXN TP.) on the cashier side, with no change to the clerk dashboard's own Withdrawal Slip/Cheque/Disbursement/Enter Bank Transfer/DD flow beyond adding a new Fund Transfer type alongside Disbursement for a GL credit that isn't a loan payout. Neither TYPE nor TXN TP. offers a blank placeholder option anymore -- a new row starts on a real default instead. Footer no longer polls the business-date config for cashier/clerk roles, who never have permission to read it. Disbursement & Transfer Requests: "Review" now opens the review screen as a popup instead of navigating to a separate route, refreshing the list on close; the review screen recognises the new Fund Transfer request type too, and its non-functional "+ Disbursement Review" tab-styled label is now a plain heading. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -794,6 +794,11 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
paymentTypesForRow(row: TxnRow): any[] {
|
||||
const tellerFacing = this.paymentTypes.filter((pt: any) => !pt.isSystemDefined);
|
||||
if (!this.isClerk) {
|
||||
// Cashier counter takes cash only — cheque/transfer/DD instruments go through their own
|
||||
// clerk/back-office approval flows, never straight through the cash drawer.
|
||||
return tellerFacing.filter((pt: any) => !!pt.isCashPayment);
|
||||
}
|
||||
if (row.acTyp === 'SHR') {
|
||||
return tellerFacing.filter((pt: any) => !pt.isCashPayment);
|
||||
}
|
||||
@@ -914,6 +919,34 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
'T'
|
||||
];
|
||||
|
||||
private readonly clerkTypOptions: { value: string; label: string }[] = [
|
||||
{ value: 'Withdrawal Slip', label: 'Withdrawal Slip' },
|
||||
{ value: 'Cheque', label: 'Cheque' },
|
||||
{ value: 'Disbursement', label: 'Disbursement' },
|
||||
// Mechanically identical to Disbursement (1 GL debit -> N account credits, same maker-checker
|
||||
// double-entry flow) but labelled separately: "Disbursement" reads as a loan payout, which is
|
||||
// wrong for crediting a GL amount into a savings/current account for any other reason (e.g.
|
||||
// funding a newly-activated account's opening balance from a GL source).
|
||||
{ value: 'Fund Transfer', label: 'Fund Transfer' },
|
||||
// NOTE: the exact same TxnRow.typ string is used at every dispatch/default-setting site below —
|
||||
// search for 'Disbursement' whenever this needs to change again, since 'Fund Transfer' always
|
||||
// rides alongside it in every one of those checks rather than having its own separate case.
|
||||
{ value: 'Enter Bank Transfer', label: 'Enter Bank Transfer' },
|
||||
{ value: 'DD', label: 'DD (Demand Draft)' }
|
||||
];
|
||||
|
||||
/** A cashier only ever takes cash in (Receipt) or pays cash out (Payment) — Cheque, DD,
|
||||
* Disbursement and Bank Transfer are clerk/back-office instruments with their own approval
|
||||
* flows and never appear at the cashier counter. */
|
||||
private readonly cashierTypOptions: { value: string; label: string }[] = [
|
||||
{ value: 'Receipt', label: 'Receipt' },
|
||||
{ value: 'Payment', label: 'Payment' }
|
||||
];
|
||||
|
||||
get typOptions(): { value: string; label: string }[] {
|
||||
return this.isClerk ? this.clerkTypOptions : this.cashierTypOptions;
|
||||
}
|
||||
|
||||
// ── Denomination ──────────────────────────────────────────────────────────
|
||||
notes: Denomination[] = [];
|
||||
coins: Denomination[] = [];
|
||||
@@ -943,7 +976,22 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
this.cashierService
|
||||
.getPaymentTypes()
|
||||
.pipe(catchError(() => of([])))
|
||||
.subscribe((types: any[]) => (this.paymentTypes = types ?? []));
|
||||
.subscribe((types: any[]) => {
|
||||
this.paymentTypes = types ?? [];
|
||||
// addRow() ran before this resolved, so the very first row's default TXN TP. (Cash, for
|
||||
// Withdrawal Slip / Receipt / Payment) couldn't be looked up yet — backfill it now that
|
||||
// the payment types are actually loaded. Only ever touches a row still sitting on the
|
||||
// null it was created with, so this never overwrites anything already picked on screen.
|
||||
for (const row of this.rows) {
|
||||
if (!row.paymentTypeId && [
|
||||
'Withdrawal Slip',
|
||||
'Receipt',
|
||||
'Payment'
|
||||
].includes(row.typ)) {
|
||||
row.paymentTypeId = this.findCashPaymentTypeId();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.acNoInput$
|
||||
.pipe(
|
||||
@@ -1234,8 +1282,11 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
|
||||
addRow(): void {
|
||||
const active = this.selectedRow;
|
||||
// Disbursement/Bank Transfer: auto-add mirror CR row when active row is DR
|
||||
if ((active?.typ === 'Disbursement' || active?.typ === 'Enter Bank Transfer') && active.dbCr === 'Dr') {
|
||||
// Disbursement/Fund Transfer/Bank Transfer: auto-add mirror CR row when active row is DR
|
||||
if (
|
||||
(active?.typ === 'Disbursement' || active?.typ === 'Fund Transfer' || active?.typ === 'Enter Bank Transfer') &&
|
||||
active.dbCr === 'Dr'
|
||||
) {
|
||||
const mirror: TxnRow = {
|
||||
typ: active.typ,
|
||||
br: active.br ?? 1,
|
||||
@@ -1261,20 +1312,26 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Neither TYPE nor TXN TP. ever offers a blank/placeholder option any more, so a fresh row
|
||||
// can't start in an unselected state either — it needs a real, valid TYPE from the moment it
|
||||
// exists. Cashier: Receipt (money in) is the far more common starting point than Payment
|
||||
// (money out, which needs an approved token first). Clerk: Withdrawal Slip, the plainest of
|
||||
// the five original types — same TYPE the old blank-then-choose flow most often ended on
|
||||
// anyway, just without the extra click to get there.
|
||||
const row: TxnRow = {
|
||||
typ: '~',
|
||||
typ: this.isClerk ? 'Withdrawal Slip' : 'Receipt',
|
||||
br: 1,
|
||||
trTp: '',
|
||||
acTyp: 'SD',
|
||||
acNo: '',
|
||||
ecsAcNo: '',
|
||||
dbCr: '',
|
||||
dbCr: this.isClerk ? 'Dr' : 'Cr',
|
||||
chequeNo: '',
|
||||
cheqDate: '',
|
||||
amount: null,
|
||||
description: '',
|
||||
tokNo: '',
|
||||
paymentTypeId: null,
|
||||
paymentTypeId: this.findCashPaymentTypeId(),
|
||||
bankName: '',
|
||||
routingCode: '',
|
||||
ddCharges: null
|
||||
@@ -1296,6 +1353,7 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
row.paymentTypeId = this.findCashPaymentTypeId();
|
||||
break;
|
||||
case 'Disbursement':
|
||||
case 'Fund Transfer':
|
||||
if (!row.dbCr) row.dbCr = 'Dr';
|
||||
row.paymentTypeId = this.findTransferPaymentTypeId();
|
||||
break;
|
||||
@@ -1303,6 +1361,21 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
if (!row.dbCr) row.dbCr = 'Dr';
|
||||
row.paymentTypeId = this.findTransferPaymentTypeId();
|
||||
break;
|
||||
// Cashier-only: Receipt = cash coming in (Cr), Payment = cash going out (Dr). The cashier
|
||||
// TXN TP. dropdown only ever offers Cash (see paymentTypesForRow()), so that's the only
|
||||
// sensible default here.
|
||||
case 'Receipt':
|
||||
row.dbCr = 'Cr';
|
||||
row.paymentTypeId = this.findCashPaymentTypeId();
|
||||
row.chequeNo = '';
|
||||
row.cheqDate = '';
|
||||
break;
|
||||
case 'Payment':
|
||||
row.dbCr = 'Dr';
|
||||
row.paymentTypeId = this.findCashPaymentTypeId();
|
||||
row.chequeNo = '';
|
||||
row.cheqDate = '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1358,6 +1431,9 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
private submitDisbursementDoubleEntry(): void {
|
||||
const drRows = this.rows.filter((r) => r.dbCr === 'Dr');
|
||||
const crRows = this.rows.filter((r) => r.dbCr === 'Cr');
|
||||
// Captured now, not re-read from this.rows inside the async success callback below — the rows
|
||||
// array gets reset to a fresh blank row as soon as that callback runs.
|
||||
const isFundTransfer = this.rows[0]?.typ === 'Fund Transfer';
|
||||
|
||||
const isCollectionMode = drRows.every((r) => r.acTyp !== 'GL') && crRows.length === 1 && crRows[0].acTyp === 'GL';
|
||||
const isDisbursementMode = drRows.length === 1 && drRows[0].acTyp === 'GL';
|
||||
@@ -1450,7 +1526,11 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
paymentTypeId: firstRow?.paymentTypeId,
|
||||
paymentTypeName: this.paymentTypes.find((p: any) => p.id === firstRow?.paymentTypeId)?.name ?? null,
|
||||
description: firstRow?.description || null,
|
||||
creditEntries: JSON.stringify(entries)
|
||||
creditEntries: JSON.stringify(entries),
|
||||
// Without this the backend defaults every request from this screen to DISBURSEMENT — a
|
||||
// Collection or Fund Transfer submitted here was being saved (and shown in the checker's
|
||||
// inbox) as a plain Disbursement.
|
||||
requestType: isCollectionMode ? 'COLLECTION' : isFundTransfer ? 'FUND_TRANSFER' : 'DISBURSEMENT'
|
||||
};
|
||||
|
||||
this.saving = true;
|
||||
@@ -1470,7 +1550,7 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
.subscribe((res: any) => {
|
||||
this.saving = false;
|
||||
if (res) {
|
||||
const modeLabel = isCollectionMode ? 'Collection' : 'Disbursement';
|
||||
const modeLabel = isCollectionMode ? 'Collection' : isFundTransfer ? 'Fund Transfer' : 'Disbursement';
|
||||
const summaryLine = isCollectionMode
|
||||
? `DR: ${drRows.length} account(s) → CR: GL ${crRows[0].acNo}`
|
||||
: `DR: GL ${drRows[0].acNo} → CR: ${crRows.length} account(s)`;
|
||||
@@ -2953,8 +3033,14 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clerk multi-row disbursement — handle before single-row guard (selected row may be incomplete)
|
||||
if (this.isClerk && this.rows.length >= 2 && this.rows.every((r) => r.typ === 'Disbursement')) {
|
||||
// Clerk multi-row disbursement — handle before single-row guard (selected row may be incomplete).
|
||||
// Fund Transfer rides the exact same double-entry flow as Disbursement (see the TYPE options
|
||||
// comment above) — only the label differs.
|
||||
if (
|
||||
this.isClerk &&
|
||||
this.rows.length >= 2 &&
|
||||
this.rows.every((r) => r.typ === 'Disbursement' || r.typ === 'Fund Transfer')
|
||||
) {
|
||||
const drRows = this.rows.filter((r) => r.dbCr === 'Dr');
|
||||
const crRows = this.rows.filter((r) => r.dbCr === 'Cr');
|
||||
|
||||
@@ -2996,7 +3082,12 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = isCollectionMode ? 'Confirm Collection Request' : 'Confirm Disbursement Request';
|
||||
const isFundTransfer = this.rows[0]?.typ === 'Fund Transfer';
|
||||
const title = isCollectionMode
|
||||
? 'Confirm Collection Request'
|
||||
: isFundTransfer
|
||||
? 'Confirm Fund Transfer Request'
|
||||
: 'Confirm Disbursement Request';
|
||||
const confirmLines = isCollectionMode ? [
|
||||
`DR (${drRows.length} account${drRows.length !== 1 ? 's' : ''} to collect):`,
|
||||
...drRows.map(
|
||||
|
||||
Reference in New Issue
Block a user