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:
@@ -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 [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user