fix(cashier): My Vouchers filters, Fund Transfer GL support, and disbursement-list rename
my-work.component (My Vouchers): - The five summary tiles (Received/Payments/Journal/Entered/Approved) were bound directly to the server's day-total fields, so they stayed fixed at the combined "entered + approved" figure no matter what the Side/My part dropdowns were set to. They're now pinned to this user's own entered rows only (enteredRows), independent of both filters, so "how much did I personally put through today" reads correctly regardless of what the table below happens to be filtered to. The table and its dropdowns are unchanged and still default to showing everything. transaction-entry.component (Fund Transfer): - onSave()'s plain bank-transfer branch (SD/CA/CB only) was catching every 'Fund Transfer' row before the GL-aware Disbursement/Collection branch below it could see them, so a Fund Transfer against a GL account was always rejected with "Invalid Account Type" even though that branch already supports it under the same label. Fund Transfer rows that include a GL leg now skip the plain-transfer branch and fall through correctly. my-disbursement-requests.component (Disbursements & Transfer list): - getCreditEntries() only read the stored credit_entries JSON, which holds the full picture for Collection (its GL leg is one of the entries) but not for Disbursement/Fund Transfer, whose GL is the request's own top-level source (gl_account_no/dr_amount) and was never in that array. The DR/CR breakdown for those two types showed only the credit side, looking like half the entry was missing. The GL leg is now synthesised back in as the first row for those two types, matching what actually posted. - Renamed the clerk's "My Disbursements" / "My Disbursement Requests" screen to "Disbursements & Transfer" throughout (nav tab, dropdown menu, route title/breadcrumb, cashier counter link, page header) — the register covers Disbursement, Collection, Fund Transfer and Bank Transfer requests, and the old name read as disbursement-only. "My Requests" (Withdrawal Slip requests, a separate register) is renamed to "Withdrawal Request" for the same reason: neither name said what was actually inside.
This commit is contained in:
@@ -559,9 +559,20 @@
|
||||
</p>
|
||||
}
|
||||
|
||||
@if (isLateClose) {
|
||||
<!-- Shown for an unreconciled cashier too, not only a late close. The backend blocks a close
|
||||
over a cashier who took cash on this date and never reconciled it, and accepts a reason as
|
||||
the override — but this field only appeared for a late close, so a same-day close in that
|
||||
state had nowhere to type the reason and could not be completed at all until the date had
|
||||
passed. -->
|
||||
@if (isLateClose || hasUnreconciledOrUnsettledCashiers) {
|
||||
<label class="pg-field bd-panel__wide">
|
||||
<span>Why was this day left open? (required)</span>
|
||||
<span>
|
||||
@if (isLateClose) {
|
||||
Why was this day left open? (required)
|
||||
} @else {
|
||||
Why close over a cashier who has not reconciled? (required)
|
||||
}
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="forceReason"
|
||||
|
||||
@@ -576,14 +576,25 @@ export class BranchDayComponent implements OnInit {
|
||||
if (!this.closeTarget || !hasFigure || this.closing) return false;
|
||||
// Block while cashier/vault data is still loading — the reconciliation check can't run yet.
|
||||
if (this.eodLoading || this.previewLoading) return false;
|
||||
if (this.hasUnreconciledOrUnsettledCashiers) return false;
|
||||
return !this.isLateClose || !!this.forceReason.trim();
|
||||
// An unreconciled cashier is a reason-required condition, not an absolute block: the backend
|
||||
// accepts the close once a reason is recorded (and appends the cashiers' names to it), and
|
||||
// refusing outright left a day that could never be closed at all — a cashier who reconciled on
|
||||
// the wrong date, went on leave, or left mid-shift would strand that day and every day after it.
|
||||
if (this.isLateClose || this.hasUnreconciledOrUnsettledCashiers) {
|
||||
return !!this.forceReason.trim();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
submitClose(): void {
|
||||
// Safety: re-check reconciliation even if the button was somehow enabled.
|
||||
if (this.hasUnreconciledOrUnsettledCashiers || this.eodLoading || this.previewLoading) {
|
||||
this.errorMsg = 'Cannot close — cashiers holding cash have not been reconciled or settled.';
|
||||
if (this.eodLoading || this.previewLoading) {
|
||||
this.errorMsg = 'Still loading the cashier and vault positions — try again in a moment.';
|
||||
return;
|
||||
}
|
||||
// Safety net mirroring canSubmitClose: never send a close that the backend will refuse for a
|
||||
// missing override reason.
|
||||
if ((this.isLateClose || this.hasUnreconciledOrUnsettledCashiers) && !this.forceReason.trim()) {
|
||||
this.errorMsg = 'Record why this day is being closed before submitting.';
|
||||
return;
|
||||
}
|
||||
const day = this.closeTarget;
|
||||
@@ -598,7 +609,10 @@ export class BranchDayComponent implements OnInit {
|
||||
day.businessDate,
|
||||
Number(figure),
|
||||
this.closeRemarks.trim() || undefined,
|
||||
this.isLateClose ? this.forceReason.trim() : undefined,
|
||||
// Sent whenever one was typed, not only on a late close: it is also the override the backend
|
||||
// needs for a same-day close over an unreconciled cashier, and gating it on isLateClose
|
||||
// dropped it on exactly the request that could not succeed without it.
|
||||
this.forceReason.trim() || undefined,
|
||||
undefined,
|
||||
denominations
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ const routes: Routes = [
|
||||
import('../clerk/my-disbursement-requests/my-disbursement-requests.component').then(
|
||||
(m) => m.MyDisbursementRequestsComponent
|
||||
),
|
||||
data: { title: 'My Disbursement Requests', breadcrumb: 'My Disbursement Requests' }
|
||||
data: { title: 'Disbursements & Transfer', breadcrumb: 'Disbursements & Transfer' }
|
||||
},
|
||||
{
|
||||
path: 'share-withdrawal-request',
|
||||
|
||||
@@ -51,28 +51,29 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- The day at a glance. Received and Payment are the two sides a branch balances; Journal is
|
||||
everything that moved between accounts without cash crossing the counter. -->
|
||||
<!-- The day at a glance, read off the same rows the table below shows: narrow "My part" to
|
||||
Entered or Approved and these five follow, instead of staying pinned to the combined
|
||||
day total regardless of the filter. -->
|
||||
<div class="mw-tiles">
|
||||
<div class="mw-tile">
|
||||
<div class="mw-tile__label">Received</div>
|
||||
<div class="mw-tile__value mw-tile__value--cr">₹{{ report.receivedTotal | number: '1.2-2' }}</div>
|
||||
<div class="mw-tile__value mw-tile__value--cr">₹{{ receivedTotal | number: '1.2-2' }}</div>
|
||||
</div>
|
||||
<div class="mw-tile">
|
||||
<div class="mw-tile__label">Payments</div>
|
||||
<div class="mw-tile__value mw-tile__value--dr">₹{{ report.paymentTotal | number: '1.2-2' }}</div>
|
||||
<div class="mw-tile__value mw-tile__value--dr">₹{{ paymentTotal | number: '1.2-2' }}</div>
|
||||
</div>
|
||||
<div class="mw-tile">
|
||||
<div class="mw-tile__label">Journal</div>
|
||||
<div class="mw-tile__value">₹{{ report.journalTotal | number: '1.2-2' }}</div>
|
||||
<div class="mw-tile__value">₹{{ journalTotal | number: '1.2-2' }}</div>
|
||||
</div>
|
||||
<div class="mw-tile">
|
||||
<div class="mw-tile__label">Entered</div>
|
||||
<div class="mw-tile__value">{{ report.raisedCount }}</div>
|
||||
<div class="mw-tile__value">{{ raisedCount }}</div>
|
||||
</div>
|
||||
<div class="mw-tile">
|
||||
<div class="mw-tile__label">Approved</div>
|
||||
<div class="mw-tile__value">{{ report.verifiedCount }}</div>
|
||||
<div class="mw-tile__value">{{ verifiedCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -82,7 +82,11 @@ export class MyWorkComponent implements OnInit {
|
||||
period: 'DAY' | 'MONTH' = 'DAY';
|
||||
anchor = this.todayIso();
|
||||
|
||||
/** Narrow to one side, or to the part the user played. Both applied in the browser. */
|
||||
/**
|
||||
* Narrow to one side, or to the part the user played. Both applied in the browser, and only to
|
||||
* the table below — the five summary tiles are pinned to Entered work regardless (see
|
||||
* enteredRows), so this can default to showing everything without muddying them.
|
||||
*/
|
||||
sideFilter: '' | VoucherSide = '';
|
||||
roleFilter: '' | MyRole = '';
|
||||
|
||||
@@ -174,6 +178,44 @@ export class MyWorkComponent implements OnInit {
|
||||
return this.rows.reduce((sum, r) => sum + Number(r.amount ?? 0), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* What this person themselves put through today — never narrowed by the Side or My part
|
||||
* filters, which exist only to browse the table below.
|
||||
*
|
||||
* The five summary tiles are pinned to this set on purpose. They answer one question, "what did
|
||||
* I personally do today", and that answer cannot depend on which slice of the list a person
|
||||
* happens to have the table filtered to at the moment — a Received figure that changed whenever
|
||||
* someone picked "Approved" to go look at what they'd passed would not be their own total any
|
||||
* more, it would be whatever the table was showing.
|
||||
*/
|
||||
get enteredRows(): MyWorkRow[] {
|
||||
const all = this.report?.vouchers ?? [];
|
||||
return all.filter((r) => r.myRole === 'RAISED' || r.myRole === 'RAISED_AND_VERIFIED');
|
||||
}
|
||||
|
||||
get receivedTotal(): number {
|
||||
return this.enteredRows.filter((r) => r.side === 'CR').reduce((sum, r) => sum + Number(r.amount ?? 0), 0);
|
||||
}
|
||||
|
||||
get paymentTotal(): number {
|
||||
return this.enteredRows.filter((r) => r.side === 'DR').reduce((sum, r) => sum + Number(r.amount ?? 0), 0);
|
||||
}
|
||||
|
||||
get journalTotal(): number {
|
||||
return this.enteredRows
|
||||
.filter((r) => r.side !== 'CR' && r.side !== 'DR')
|
||||
.reduce((sum, r) => sum + Number(r.amount ?? 0), 0);
|
||||
}
|
||||
|
||||
get raisedCount(): number {
|
||||
return this.enteredRows.length;
|
||||
}
|
||||
|
||||
get verifiedCount(): number {
|
||||
const all = this.report?.vouchers ?? [];
|
||||
return all.filter((r) => r.myRole === 'VERIFIED' || r.myRole === 'RAISED_AND_VERIFIED').length;
|
||||
}
|
||||
|
||||
sideLabel(side: VoucherSide | null): string {
|
||||
if (side === 'CR') {
|
||||
return 'Received';
|
||||
|
||||
@@ -1856,9 +1856,9 @@
|
||||
class="ws-btn ws-btn--ghost"
|
||||
type="button"
|
||||
(click)="router.navigate(['/clerk/my-disbursement-requests'])"
|
||||
title="View my disbursement requests"
|
||||
title="View my fund requests — Disbursement, Collection, Fund Transfer and Bank Transfer"
|
||||
>
|
||||
My Disbursements
|
||||
Disbursements & Transfer
|
||||
</button>
|
||||
}
|
||||
@if (canShowAccountActions) {
|
||||
|
||||
@@ -2763,7 +2763,7 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
this.showAlert('success', 'Bank Transfer Submitted', [
|
||||
`Voucher No: ${res.voucherNo}`,
|
||||
`Total: ₹${totalDr.toLocaleString('en-IN', { minimumFractionDigits: 2 })} · DR: ${drRows.length} account(s) → CR: ${crRows.length} account(s)`,
|
||||
'Pending Manager approval. Track status in "My Disbursement Requests".'
|
||||
'Pending Manager approval. Track status in "Disbursements & Transfer".'
|
||||
]);
|
||||
this.rows = [];
|
||||
this.rowAccountIds = {};
|
||||
@@ -4365,10 +4365,20 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
||||
// is the same flow under a second TYPE label — onTypChange() already defaults it identically to
|
||||
// 'Enter Bank Transfer', so submission has to recognise both or a share redemption or bank
|
||||
// transfer raised under this label silently falls through to the wrong branch below.
|
||||
//
|
||||
// But 'Fund Transfer' rows that include a GL leg are NOT this flow — they are the
|
||||
// Disbursement/Collection double-entry shape (see the TYPE options comment), just under the
|
||||
// friendlier 'Fund Transfer' label so a non-loan GL movement doesn't have to be called a
|
||||
// "Disbursement". 'Enter Bank Transfer' never carries a GL leg, so it always stays in this
|
||||
// branch; only skip out to the Disbursement/Collection branch below when every row is 'Fund
|
||||
// Transfer' and at least one of them is GL.
|
||||
const fundTransferRowsHaveGl =
|
||||
this.rows.every((r) => r.typ === 'Fund Transfer') && this.rows.some((r) => r.acTyp === 'GL');
|
||||
if (
|
||||
this.isClerk &&
|
||||
this.rows.length >= 2 &&
|
||||
this.rows.every((r) => r.typ === 'Enter Bank Transfer' || r.typ === 'Fund Transfer')
|
||||
this.rows.every((r) => r.typ === 'Enter Bank Transfer' || r.typ === 'Fund Transfer') &&
|
||||
!fundTransferRowsHaveGl
|
||||
) {
|
||||
const drRows = this.rows.filter((r) => r.dbCr === 'Dr');
|
||||
const crRows = this.rows.filter((r) => r.dbCr === 'Cr');
|
||||
|
||||
@@ -12,13 +12,15 @@
|
||||
<div class="mdr-header__left">
|
||||
<mat-icon class="mdr-header__icon">swap_horiz</mat-icon>
|
||||
<div>
|
||||
<div class="mdr-header__title">My Disbursement Requests</div>
|
||||
<div class="mdr-header__sub">Track your submitted GL disbursement requests.</div>
|
||||
<div class="mdr-header__title">Disbursements & Transfer</div>
|
||||
<div class="mdr-header__sub">
|
||||
Disbursement, Collection, Fund Transfer and Bank Transfer requests you submitted.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="mdr-btn mdr-btn--new" (click)="newDisbursement()">
|
||||
<mat-icon>add</mat-icon>
|
||||
New Disbursement
|
||||
New Request
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -99,7 +101,7 @@
|
||||
<p class="mdr-empty__text">You have not submitted any disbursement requests yet.</p>
|
||||
<button type="button" class="mdr-btn mdr-btn--new" style="margin-top: 12px" (click)="newDisbursement()">
|
||||
<mat-icon>add</mat-icon>
|
||||
New Disbursement
|
||||
New Request
|
||||
</button>
|
||||
</div>
|
||||
} @else {
|
||||
|
||||
@@ -177,7 +177,29 @@ export class MyDisbursementRequestsComponent implements OnInit {
|
||||
getCreditEntries(req: any): any[] {
|
||||
try {
|
||||
const arr = typeof req.credit_entries === 'string' ? JSON.parse(req.credit_entries) : req.credit_entries;
|
||||
return Array.isArray(arr) ? arr.map((e: any) => ({ ...e, amount: parseFloat(e.amount) || 0 })) : [];
|
||||
const entries: any[] = Array.isArray(arr)
|
||||
? arr.map((e: any) => ({ ...e, amount: parseFloat(e.amount) || 0 }))
|
||||
: [];
|
||||
// Collection embeds its GL leg inside credit_entries (it can collect from several
|
||||
// accounts into the one GL, so the GL has to be one row among them). Disbursement and
|
||||
// Fund Transfer instead name their GL as the request's own top-level source — dr_amount
|
||||
// is its amount — because there is exactly one, so it never needed a row of its own. That
|
||||
// meant the DR/CR breakdown here only ever showed the credit side for those two types,
|
||||
// looking like half the slip was missing. Adding it back as the first row here, rather
|
||||
// than in credit_entries itself, keeps the stored JSON exactly what approve() posts from.
|
||||
if ((req.request_type === 'DISBURSEMENT' || req.request_type === 'FUND_TRANSFER') && req.gl_account_no) {
|
||||
return [
|
||||
{
|
||||
dbCr: 'Dr',
|
||||
accountNo: req.gl_account_no,
|
||||
accountName: req.gl_account_name,
|
||||
accountType: 'GL',
|
||||
amount: parseFloat(req.dr_amount) || 0
|
||||
},
|
||||
...entries
|
||||
];
|
||||
}
|
||||
return entries;
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<line x1="9" y1="14" x2="15" y2="14" />
|
||||
<line x1="9" y1="18" x2="13" y2="18" />
|
||||
</svg>
|
||||
My Requests
|
||||
Withdrawal Request
|
||||
</a>
|
||||
<a
|
||||
class="cashier-nav__item cashier-nav__item--sec"
|
||||
@@ -97,7 +97,7 @@
|
||||
<line x1="12" y1="1" x2="12" y2="23" />
|
||||
<path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
|
||||
</svg>
|
||||
My Disbursements
|
||||
Disbursements & Transfer
|
||||
</a>
|
||||
<a
|
||||
class="cashier-nav__item cashier-nav__item--sec"
|
||||
@@ -1120,7 +1120,7 @@
|
||||
<fa-icon icon="money-bill-wave" class="menu-item-icon"></fa-icon> My Withdrawal Requests
|
||||
</button>
|
||||
<button mat-menu-item tabindex="0" [routerLink]="['/clerk/my-disbursement-requests']">
|
||||
<fa-icon icon="exchange" class="menu-item-icon"></fa-icon> My Disbursement Requests
|
||||
<fa-icon icon="exchange" class="menu-item-icon"></fa-icon> Disbursements & Transfer
|
||||
</button>
|
||||
<button mat-menu-item tabindex="0" [routerLink]="['/clerk/dividend-dashboard']">
|
||||
<fa-icon icon="chart-pie" class="menu-item-icon"></fa-icon> Dividend Dashboard
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
/* tslint:disable */
|
||||
export default {
|
||||
'mifos_x': {
|
||||
'version': '260908',
|
||||
'hash': 'fbce73fd'
|
||||
'version': '260909',
|
||||
'hash': '03bc2ff1'
|
||||
},
|
||||
'allow_switching_backend_instance': true
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user