A cash deposit posted to the wrong account is moved to the right one in four steps: unpass the voucher, a manager approves, the cashier enters the correct account, a manager approves again. Nothing changes on any account until the final approval. - Voucher Correction page with four-step strip and popups: today's vouchers to unpass (admin or clerk), the unpassed vouchers waiting for their correct account (cashier) with the wrong and correct account side by side and the balance check, and the caller's own requests. A cashier whose customer has used the money closes the request and deposits separately. - Reached from the cashier bar, the clerk bar and the Cashier menu; the manager reviews both steps under Approvals > Voucher Corrections, laid out like the other approval tabs. Routes for Cash Transfers approvals are added to the same tab bar. - A Correction column on My Vouchers, the day book and the voucher register (and in the voucher detail popup) says whether a voucher is unpassed, revoked in favour of another, a correction, or closed, with the reason. - The deposit taken off the wrong account no longer shows on its passbook or transaction list. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
/**
|
|
* 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/.
|
|
*/
|
|
|
|
/** Angular Imports */
|
|
import { Injectable, inject } from '@angular/core';
|
|
import { ActivatedRouteSnapshot } from '@angular/router';
|
|
|
|
/** rxjs Imports */
|
|
import { Observable, of } from 'rxjs';
|
|
import { catchError, map, switchMap } from 'rxjs/operators';
|
|
|
|
/** Custom Services */
|
|
import { SavingsService } from '../savings.service';
|
|
import { VoucherCorrectionService } from '../../cashier/voucher-correction.service';
|
|
|
|
/**
|
|
* Savings Account data resolver.
|
|
*/
|
|
@Injectable()
|
|
export class SavingsAccountViewResolver {
|
|
private savingsService = inject(SavingsService);
|
|
private voucherCorrectionService = inject(VoucherCorrectionService);
|
|
|
|
/**
|
|
* Returns the Savings Account data, without the deposits a completed voucher correction took off this account:
|
|
* the passbook and the transaction list read their rows from here, and a deposit that was posted to the wrong
|
|
* account and moved should not appear on it at all.
|
|
* @param {ActivatedRouteSnapshot} route Route Snapshot
|
|
* @returns {Observable<any>}
|
|
*/
|
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
|
const savingAccountId = route.paramMap.get('savingAccountId');
|
|
return this.savingsService.getSavingsAccountData(savingAccountId).pipe(
|
|
switchMap((account: any) =>
|
|
this.voucherCorrectionService.voidedTransactions(Number(savingAccountId)).pipe(
|
|
catchError(() => of([] as number[])),
|
|
map((voided: number[]) => {
|
|
if (voided.length && Array.isArray(account?.transactions)) {
|
|
account.transactions = account.transactions.filter((txn: any) => !voided.includes(txn.id));
|
|
}
|
|
return account;
|
|
})
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}
|