feat: update TDS config, RBI reserve returns, current products, and dormancy reports
This commit is contained in:
@@ -15,7 +15,7 @@ import * as ExcelJS from 'exceljs';
|
||||
import { BranchScopeService } from '../core/branch-scope.service';
|
||||
import { GL_BRANCHES, glBranchName } from '../gl-reports/gl-reports-data';
|
||||
import { FY_TAX_CONFIG, Quarter, QUARTER_LABEL } from '../letter-mgmt/certificates/form-15gh/tds-15gh.compute';
|
||||
import { setTdsDeductees, TDS_FYS } from './tds-reports-data';
|
||||
import { setTdsDeductees, tdsFys } from './tds-reports-data';
|
||||
import { TdsReportsService } from './tds-reports.service';
|
||||
import {
|
||||
NEAR_THRESHOLD_BAND,
|
||||
@@ -41,7 +41,8 @@ export class TdsInterestReportComponent implements OnInit {
|
||||
private tdsService = inject(TdsReportsService);
|
||||
|
||||
readonly branches = GL_BRANCHES.filter((b) => b.code !== 'HO');
|
||||
readonly financialYears = TDS_FYS;
|
||||
/** Filled by the route resolver from Organization › TDS Configuration. */
|
||||
readonly financialYears = tdsFys();
|
||||
readonly quarterLabel = QUARTER_LABEL;
|
||||
readonly nearBand = NEAR_THRESHOLD_BAND;
|
||||
readonly quarters: Quarter[] = [
|
||||
@@ -52,7 +53,7 @@ export class TdsInterestReportComponent implements OnInit {
|
||||
];
|
||||
|
||||
filter: TdsReportFilter = {
|
||||
fy: TDS_FYS[0],
|
||||
fy: tdsFys()[0] ?? '',
|
||||
branchCode: '',
|
||||
quarter: 0,
|
||||
band: '',
|
||||
@@ -93,6 +94,10 @@ export class TdsInterestReportComponent implements OnInit {
|
||||
loadError = '';
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.financialYears.length) {
|
||||
this.loadError = 'No financial year is configured for TDS. Set one up under Organization › TDS Configuration.';
|
||||
return;
|
||||
}
|
||||
// A branch login sees only its own book and cannot widen the scope.
|
||||
const own = this.scope.ownBranchCode;
|
||||
if (own) {
|
||||
@@ -116,20 +121,29 @@ export class TdsInterestReportComponent implements OnInit {
|
||||
next: (deductees) => {
|
||||
this.loading = false;
|
||||
setTdsDeductees(deductees);
|
||||
this.summaryCacheKey = '';
|
||||
this.cachedSummary = null;
|
||||
this.invalidateCaches();
|
||||
},
|
||||
error: (err: any) => {
|
||||
this.loading = false;
|
||||
setTdsDeductees([]);
|
||||
this.summaryCacheKey = '';
|
||||
this.cachedSummary = null;
|
||||
this.invalidateCaches();
|
||||
this.loadError =
|
||||
err?.error?.defaultUserMessage || 'Could not load deposit interest. The figures below cannot be shown.';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Both caches are keyed on the filter alone, so a fresh load must drop them together. Clearing
|
||||
* only the summary left the KPIs counting the new data while the tables kept the empty list
|
||||
* cached on the first render, before the load returned.
|
||||
*/
|
||||
private invalidateCaches(): void {
|
||||
this.rowsCacheKey = '';
|
||||
this.summaryCacheKey = '';
|
||||
this.cachedSummary = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A different year needs a different set of interest credits, so the year re-reads from the
|
||||
* platform rather than re-filtering the set already in hand.
|
||||
|
||||
Reference in New Issue
Block a user