fix: restore content silently dropped from the dev merge (KYC exception, TDS reports, Form 121)

The demo-backup merge's git 3-way auto-resolve dropped several hunks
without flagging conflicts, wherever demo had independently touched
adjacent lines: the KYC Exception feature (client-kyc-step, kyc-tab,
create-client, clients.service — checkbox, derivation logic, banners,
contact-log endpoints), TDS report routes/menu links (reports-routing,
shell), the Form 121 client tab (clients-routing, clients-view), the
kyc-management exceptions dashboard, and the Form 121/15G-H register's
real-data view integration. Restored by diffing demo-backup against
dev per file and re-applying each genuine gap while preserving
demo-backup's own independent work (Approval Center tab style, Loan
Origination/Investment menus, form-97-98/risk-review report routes).
This commit is contained in:
2026-08-06 15:12:06 +05:30
parent 7e69468995
commit 89bb76455e
17 changed files with 2136 additions and 316 deletions
@@ -505,3 +505,72 @@
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
color: var(--cert-g900);
}
/* Form 121 register — eligibility warnings and the quarter-wise drill-down */
/* A row the branch needs to look at: an ineligible declaration, or the quarter
in which the 194A threshold was crossed. */
.cert-row--warn > td {
background: color-mix(in srgb, var(--cert-amber) 7%, transparent);
}
.cert-row--detail > td {
background: var(--cert-g50);
padding: 16px;
}
.cert-note {
display: flex;
gap: 10px;
align-items: flex-start;
margin-bottom: 12px;
padding: 10px 12px;
border-radius: 8px;
background: color-mix(in srgb, var(--cert-blue) 6%, transparent);
border-left: 3px solid var(--cert-blue);
font-size: 12px;
color: var(--cert-g900);
line-height: 1.5;
fa-icon {
color: var(--cert-blue);
flex-shrink: 0;
margin-top: 1px;
}
ul {
margin: 6px 0 0;
padding-left: 18px;
}
li + li {
margin-top: 4px;
}
&--warn {
background: color-mix(in srgb, var(--cert-amber) 8%, transparent);
border-left-color: var(--cert-amber);
fa-icon {
color: var(--cert-amber);
}
}
}
/* The quarter table nested inside an expanded row. */
.cert-table--inner {
background: #fff;
border: 1px solid var(--cert-g200);
border-radius: 8px;
overflow: hidden;
margin-bottom: 10px;
th {
background: #fff;
border-bottom: 1px solid var(--cert-g200);
}
.cert-pill {
margin-left: 6px;
}
}
@@ -11,158 +11,347 @@
<div class="cert-head-l">
<fa-icon icon="file-signature" class="cert-head-ic"></fa-icon>
<div>
<h2 class="cert-head-t">Form 121</h2>
<div class="cert-head-s">TDS-waiver declarations for FD / RD interest income — Form 121.</div>
<h2 class="cert-head-t">{{ statute.form }}</h2>
<div class="cert-head-s">
@if (viewMode === 'demo') {
Declarations to stop tax being deducted on fixed and recurring deposit interest under
{{ statute.section }}. Reported in {{ statute.statement }}; the consolidated statement of declarations is
uploaded {{ statute.frequency }}.
} @else {
Live customer declarations, sourced from client accounts and KYC profiles.
}
</div>
</div>
</div>
<div class="cert-head-r">
@if (viewMode === 'demo') {
<button
type="button"
class="cert-cta-btn"
(click)="toggleViewMode()"
matTooltip="Use real client KYC and account data from Fineract"
>
<fa-icon icon="database"></fa-icon> Real Declarations
</button>
} @else {
<button
type="button"
class="cert-cta-btn cert-cta-btn--muted"
(click)="toggleViewMode()"
matTooltip="Back to the sample data page"
>
<fa-icon icon="table"></fa-icon> Sample Data
</button>
}
</div>
</div>
<!-- KPI strip -->
<div class="cert-kpis">
<div class="cert-kpi cert-kpi--blue">
<fa-icon icon="user" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">{{ count15G() | number }}</div>
<div class="cert-kpi-l">Form 121 (under 60)</div>
</div>
</div>
<div class="cert-kpi cert-kpi--amber">
<fa-icon icon="user-tie" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">{{ count15H() | number }}</div>
<div class="cert-kpi-l">Form 121 (60+)</div>
</div>
</div>
<div class="cert-kpi cert-kpi--green">
<fa-icon icon="check-circle" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">{{ countFiled() | number }}</div>
<div class="cert-kpi-l">Filed this FY</div>
</div>
</div>
<div class="cert-kpi cert-kpi--teal">
<fa-icon icon="coins" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">₹{{ totalInterest() | number: '1.0-0' }}</div>
<div class="cert-kpi-l">Projected Interest</div>
</div>
</div>
</div>
@if (viewMode === 'real') {
<mifosx-real-form15gh-view></mifosx-real-form15gh-view>
}
<!-- Filters -->
<div class="cert-filters">
<div class="cert-filter">
<label>Customer / Customer ID / PAN</label>
<div class="cert-input-ic">
<fa-icon icon="search"></fa-icon>
<input type="text" [(ngModel)]="search" placeholder="e.g. CUST556677 or customer name" />
@if (viewMode === 'demo') {
<!-- KPI strip -->
<div class="cert-kpis">
<div class="cert-kpi cert-kpi--blue">
<fa-icon icon="user" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">{{ countGeneralBand() | number }}</div>
<div class="cert-kpi-l">General band (under 60)</div>
</div>
</div>
<div class="cert-kpi cert-kpi--amber">
<fa-icon icon="user-tie" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">{{ countSeniorBand() | number }}</div>
<div class="cert-kpi-l">Senior citizen band (60+)</div>
</div>
</div>
<div class="cert-kpi cert-kpi--green">
<fa-icon icon="check-circle" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">{{ countFiled() | number }}</div>
<div class="cert-kpi-l">Filed this FY</div>
</div>
</div>
<div class="cert-kpi cert-kpi--teal">
<fa-icon icon="coins" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">₹{{ totalInterest() | number: '1.0-0' }}</div>
<div class="cert-kpi-l">Projected Interest</div>
</div>
</div>
<div class="cert-kpi cert-kpi--green">
<fa-icon icon="shield-alt" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">₹{{ totalTdsSaved() | number: '1.0-0' }}</div>
<div class="cert-kpi-l">TDS Saved</div>
</div>
</div>
@if (countIneligible() > 0) {
<div class="cert-kpi cert-kpi--amber">
<fa-icon icon="exclamation-triangle" class="cert-kpi-ic"></fa-icon>
<div>
<div class="cert-kpi-n">{{ countIneligible() | number }}</div>
<div class="cert-kpi-l">Not Eligible</div>
</div>
</div>
}
</div>
<div class="cert-filter">
<label>Form Type</label>
<select [(ngModel)]="kindFilter">
<option value="">All Form 121</option>
<option value="15G">Form 121 (Below 60 years)</option>
<option value="15H">Form 121 (Senior Citizen 60+)</option>
</select>
<!-- Filters -->
<div class="cert-filters">
<div class="cert-filter">
<label>Customer / Customer ID / PAN</label>
<div class="cert-input-ic">
<fa-icon icon="search"></fa-icon>
<input type="text" [(ngModel)]="search" placeholder="e.g. CUST556677 or customer name" />
</div>
</div>
<div class="cert-filter">
<label>Threshold Band</label>
<select [(ngModel)]="bandFilter">
<option value="">All bands</option>
<option value="GENERAL">General (below 60)</option>
<option value="SENIOR">Senior citizen (60+)</option>
</select>
</div>
<div class="cert-filter">
<label>Status</label>
<select [(ngModel)]="statusFilter">
<option value="">All statuses</option>
<option value="FILED">Filed</option>
<option value="PENDING">Pending</option>
</select>
</div>
<div class="cert-filter">
<label>Eligibility</label>
<select [(ngModel)]="ineligibleOnly">
<option [ngValue]="false">All customers</option>
<option [ngValue]="true">Not eligible only</option>
</select>
</div>
@if (search || bandFilter || statusFilter || ineligibleOnly) {
<button type="button" class="cert-clear" (click)="clearFilters()">
<fa-icon icon="times"></fa-icon> Clear
</button>
}
</div>
<div class="cert-filter">
<label>Status</label>
<select [(ngModel)]="statusFilter">
<option value="">All statuses</option>
<option value="FILED">Filed</option>
<option value="PENDING">Pending</option>
</select>
</div>
@if (search || kindFilter || statusFilter) {
<button type="button" class="cert-clear" (click)="clearFilters()"><fa-icon icon="times"></fa-icon> Clear</button>
}
</div>
<!-- Table -->
<div class="cert-card">
<div class="cert-table-wrap">
<table class="cert-table">
<thead>
<tr>
<th>Customer · PAN</th>
<th>Form Type</th>
<th>Age</th>
<th>Branch</th>
<th class="num">Deposit Principal</th>
<th class="num">Est. Interest ({{ records[0]?.fy }})</th>
<th>Status</th>
<th class="col-actions">Actions</th>
</tr>
</thead>
<tbody>
@for (r of filteredRecords; track r.customerId) {
<!-- Table -->
<div class="cert-card">
<div class="cert-table-wrap">
<table class="cert-table">
<thead>
<tr>
<td>
<div class="cert-cust-name">{{ r.customerName }}</div>
<div class="mono small muted">{{ r.customerId }} · PAN {{ r.customerPan }}</div>
<div class="small muted">DOB {{ r.dob | date: 'd MMM y' }}</div>
</td>
<td>
<span
class="cert-pill"
[class.cert-pill--blue]="formKind(r) === '15G'"
[class.cert-pill--amber]="formKind(r) === '15H'"
>
Form 121 ({{ formKind(r) }})
</span>
</td>
<td class="small">{{ age(r.dob) }} yrs</td>
<td class="small">{{ r.branch }}</td>
<td class="num">₹{{ r.depositPrincipal | number: '1.0-0' }}</td>
<td class="num">
<strong class="cert-interest">₹{{ r.estimatedInterest | number: '1.0-0' }}</strong>
</td>
<td>
@if (r.status === 'FILED') {
<span class="cert-pill cert-pill--green"> <fa-icon icon="check-circle"></fa-icon> Filed </span>
@if (r.filedOn) {
<div class="mono small muted">{{ r.filedOn | date: 'd MMM y' }}</div>
<th>Customer · PAN</th>
<th>Form · Band</th>
<th>Age</th>
<th>Branch</th>
<th class="num">Est. Interest</th>
<th class="num">Threshold</th>
<th class="num">TDS Payable</th>
<th class="num">TDS Saved</th>
<th>Settlement</th>
<th>Status</th>
<th class="col-actions">Actions</th>
</tr>
</thead>
<tbody>
@for (row of filteredRows; track row.record.customerId) {
<tr [class.cert-row--warn]="!row.eligibility.eligible">
<td>
<div class="cert-cust-name">{{ row.record.customerName }}</div>
<div class="mono small muted">{{ row.record.customerId }} · PAN {{ row.record.customerPan }}</div>
<div class="small muted">DOB {{ row.record.dob | date: 'd MMM y' }}</div>
</td>
<td>
<span
class="cert-pill"
[class.cert-pill--blue]="row.band === 'GENERAL'"
[class.cert-pill--amber]="row.band === 'SENIOR'"
>
{{ row.form === '121' ? 'Form 121' : 'Form ' + row.form }}
</span>
<div class="small muted">{{ row.band === 'SENIOR' ? 'Senior citizen' : 'General' }}</div>
</td>
<td class="small">{{ row.age }} yrs</td>
<td class="small">{{ row.record.branch }}</td>
<td class="num">
<strong class="cert-interest">₹{{ row.record.estimatedInterest | number: '1.0-0' }}</strong>
</td>
<td class="num small muted">₹{{ row.schedule.threshold | number: '1.0-0' }}</td>
<td class="num">
@if (row.schedule.totalTds > 0) {
<strong>₹{{ row.schedule.totalTds | number: '1.0-0' }}</strong>
<div class="small muted">@ {{ row.schedule.rateApplied * 100 | number: '1.0-0' }}%</div>
} @else {
<span class="small muted">—</span>
}
} @else {
<span class="cert-pill cert-pill--amber"> <fa-icon icon="hourglass-half"></fa-icon> Pending </span>
}
</td>
<td class="col-actions">
<div class="cert-row-actions">
<button
type="button"
class="cert-icon-btn primary"
(click)="viewCertificate(r)"
matTooltip="View / Print declaration"
>
<fa-icon icon="eye"></fa-icon>
</button>
<button
type="button"
class="cert-icon-btn"
(click)="downloadCertificate(r)"
matTooltip="Download PDF"
>
<fa-icon icon="download"></fa-icon>
</button>
</div>
</td>
</tr>
}
@if (filteredRecords.length === 0) {
<tr>
<td colspan="8" class="cert-empty">
<fa-icon icon="info-circle"></fa-icon>
No declarations match the current filters.
</td>
</tr>
}
</tbody>
</table>
</td>
<td class="num">
@if (row.tdsSaved > 0) {
<strong class="cert-interest">₹{{ row.tdsSaved | number: '1.0-0' }}</strong>
} @else {
<span class="small muted">—</span>
}
</td>
<td class="small">
<span class="cert-pill" [class.cert-pill--blue]="row.mode === 'QUARTERLY'">
{{ row.mode === 'QUARTERLY' ? 'Quarterly' : 'Year end' }}
</span>
<div class="small muted">product-driven</div>
</td>
<td>
@if (row.record.status === 'FILED') {
<span class="cert-pill cert-pill--green"> <fa-icon icon="check-circle"></fa-icon> Filed </span>
@if (row.record.filedOn) {
<div class="mono small muted">{{ row.record.filedOn | date: 'd MMM y' }}</div>
}
} @else {
<span class="cert-pill cert-pill--amber"> <fa-icon icon="hourglass-half"></fa-icon> Pending </span>
}
@if (!row.eligibility.eligible) {
<div class="cert-pill cert-pill--amber">
<fa-icon icon="exclamation-triangle"></fa-icon> Not eligible
</div>
}
</td>
<td class="col-actions">
<div class="cert-row-actions">
<button
type="button"
class="cert-icon-btn"
(click)="toggleExpanded(row)"
[matTooltip]="isExpanded(row) ? 'Hide quarter-wise' : 'Show quarter-wise'"
>
<fa-icon [icon]="isExpanded(row) ? 'chevron-up' : 'chevron-down'"></fa-icon>
</button>
<button
type="button"
class="cert-icon-btn primary"
(click)="viewCertificate(row)"
matTooltip="View / Print declaration"
>
<fa-icon icon="eye"></fa-icon>
</button>
<button
type="button"
class="cert-icon-btn"
(click)="downloadCertificate(row)"
matTooltip="Download PDF"
>
<fa-icon icon="download"></fa-icon>
</button>
</div>
</td>
</tr>
@if (isExpanded(row)) {
<tr class="cert-row--detail">
<td colspan="11">
@if (!row.eligibility.eligible) {
<div class="cert-note cert-note--warn">
<fa-icon icon="exclamation-triangle"></fa-icon>
<div>
<strong>Declaration cannot be accepted</strong>
<ul>
@for (reason of row.eligibility.reasons; track reason) {
<li>{{ reason }}</li>
}
</ul>
</div>
</div>
}
@for (note of row.eligibility.unassessed; track note) {
<div class="cert-note">
<fa-icon icon="info-circle"></fa-icon>
<div>{{ note }}</div>
</div>
}
@for (note of row.schedule.notes; track note) {
<div class="cert-note">
<fa-icon icon="info-circle"></fa-icon>
<div>{{ note }}</div>
</div>
}
<table class="cert-table cert-table--inner">
<thead>
<tr>
<th>Quarter</th>
<th class="num">Interest</th>
<th class="num">Cumulative</th>
<th class="num">Liability to date</th>
<th class="num">TDS this quarter</th>
<th>Return due</th>
</tr>
</thead>
<tbody>
@for (line of row.schedule.lines; track line.quarter) {
<tr [class.cert-row--warn]="line.thresholdCrossedHere">
<td class="small">
{{ line.label }}
@if (line.thresholdCrossedHere) {
<span class="cert-pill cert-pill--amber">threshold crossed</span>
}
@if (line.declarationActive) {
<span class="cert-pill cert-pill--green">Form 121 active</span>
}
</td>
<td class="num">₹{{ line.interest | number: '1.0-0' }}</td>
<td class="num">₹{{ line.cumInterest | number: '1.0-0' }}</td>
<td class="num">₹{{ line.cumLiability | number: '1.0-0' }}</td>
<td class="num">
@if (line.tds !== 0) {
<strong>₹{{ line.tds | number: '1.0-0' }}</strong>
} @else {
<span class="small muted">—</span>
}
</td>
<td class="small muted">{{ line.dueDate }}</td>
</tr>
}
<tr>
<td class="small"><strong>Total</strong></td>
<td class="num">
<strong>₹{{ row.schedule.totalInterest | number: '1.0-0' }}</strong>
</td>
<td></td>
<td></td>
<td class="num">
<strong>₹{{ row.schedule.totalTds | number: '1.0-0' }}</strong>
</td>
<td></td>
</tr>
</tbody>
</table>
@if (row.schedule.shieldedInterest > 0) {
<div class="small muted">
₹{{ row.schedule.shieldedInterest | number: '1.0-0' }} paid without deduction on the strength of
the declaration — reportable in the quarterly {{ statute.statement }} return.
</div>
}
</td>
</tr>
}
}
@if (filteredRows.length === 0) {
<tr>
<td colspan="11" class="cert-empty">
<fa-icon icon="info-circle"></fa-icon>
No declarations match the current filters.
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
}
</div>
@@ -21,9 +21,31 @@ import {
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadForm15ghPdf } from '../certificate-pdf';
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
import { RealForm15ghViewComponent } from './real-form15gh-view/real-form15gh-view.component';
export type Form15Kind = '15G' | '15H';
import {
Declaration,
DeclarationForm,
EligibilityResult,
FY_TAX_CONFIG,
Form15Kind,
TdsMode,
TdsSchedule,
ageInFy,
buildSchedule,
checkEligibility,
declarationFormFor,
formKindFor,
isSeniorInFy,
normaliseFy,
projectQuarterlyCredits,
tdsModeFor
} from './tds-15gh.compute';
export type { Form15Kind };
export type Form15Status = 'FILED' | 'PENDING';
/** Which deduction trigger the payee falls under. Age-based, still. */
export type ThresholdBand = 'GENERAL' | 'SENIOR';
export interface Form15ghRecord {
customerId: string;
@@ -32,18 +54,46 @@ export interface Form15ghRecord {
customerAddress: string;
dob: string;
branch: string;
/** Aggregate interest the bank will pay this FY. */
/** Aggregate interest the bank will pay this FY across the customer's time deposits. */
estimatedInterest: number;
/** Customer's total estimated income for the FY. */
/** Customer's total estimated income for the FY, as declared by them. */
estimatedIncome: number;
/** Sum of FD / RD principals tied to the declaration. */
depositPrincipal: number;
fy: string;
status: Form15Status;
filedOn?: string;
/** "Yes / No" for: has any income tax been assessed for the customer
under the IT Act in the past six years? */
/**
* "Yes / No" for: has any income tax been assessed for the customer under the
* IT Act in the past six years?
*/
assessed: boolean;
/**
* The deposit product's interest-posting frequency. Tax falls due when interest
* is credited, so this — and not any customer preference — decides whether it
* settles quarterly or at year end.
*/
interestPostingPeriodType: string;
}
/** A register row with everything the engine derived for it, computed once. */
export interface Form15ghRow {
record: Form15ghRecord;
/** The form actually in force for the record's year — '121' from FY 2026-27. */
form: DeclarationForm;
/**
* The 15G/15H label. Only a form distinction up to FY 2025-26; from FY 2026-27
* the forms merged and this reflects the threshold band alone.
*/
kind: Form15Kind;
band: ThresholdBand;
age: number;
mode: TdsMode;
/** Schedule as things stand, declaration included where one is on record. */
schedule: TdsSchedule;
/** Tax the declaration kept out of the customer's pocket this year. */
tdsSaved: number;
eligibility: EligibilityResult;
}
@Component({
@@ -55,7 +105,8 @@ export interface Form15ghRecord {
CommonModule,
FormsModule,
FaIconComponent,
MatTooltip
MatTooltip,
RealForm15ghViewComponent
]
})
export class Form15ghComponent implements OnInit {
@@ -63,40 +114,89 @@ export class Form15ghComponent implements OnInit {
private snack = inject(MatSnackBar);
private dscSign = inject(DscSignService);
/** Mode toggle: 'demo' uses mock seed data; 'real' pulls live Fineract data. */
viewMode: 'demo' | 'real' = 'demo';
// ── Filters ──
search = '';
/** Which form. Empty = both. */
kindFilter: '' | Form15Kind = '';
/** Which deduction trigger. Empty = both bands. */
bandFilter: '' | ThresholdBand = '';
statusFilter: '' | Form15Status = '';
/** Show only declarations the branch cannot lawfully accept. */
ineligibleOnly = false;
records: Form15ghRecord[] = [];
/** Which row's quarter-wise breakdown is open. */
expandedId: string | null = null;
rows: Form15ghRow[] = [];
ngOnInit(): void {
this.records = seedForm15gh();
// Derived once. The template reads these many times per change-detection
// pass, and re-running the schedules on every read is what made the other
// register screens stall.
this.rows = seedForm15gh().map((record) => this.buildRow(record));
}
/** Compute age in years from DoB. */
age(dob: string): number {
if (!dob) return 0;
const today = new Date();
const birth = new Date(dob);
let age = today.getFullYear() - birth.getFullYear();
const m = today.getMonth() - birth.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birth.getDate())) age--;
return age;
private buildRow(record: Form15ghRecord): Form15ghRow {
const ctx = {
fy: record.fy,
dateOfBirth: record.dob,
pan: record.customerPan,
resident: true
};
const declaration: Declaration | null =
record.status === 'FILED'
? {
kind: formKindFor(record.dob, record.fy),
// The register holds the filing date; a declaration operates from
// the day the branch accepted it.
acceptedOn: record.filedOn ?? `${record.fy.replace(/\D/g, '').slice(0, 4)}-04-01`,
fy: record.fy
}
: null;
const mode = tdsModeFor({ interestPostingPeriodType: record.interestPostingPeriodType });
// The register carries a projected annual figure rather than real postings,
// so spread it across the year to drive the schedule.
const credits = projectQuarterlyCredits(record.estimatedInterest, record.fy);
const schedule = buildSchedule(mode, credits, { ...ctx, declaration });
const withoutDeclaration = buildSchedule(mode, credits, { ...ctx, declaration: null });
return {
record,
form: declarationFormFor(record.fy, record.dob),
kind: formKindFor(record.dob, record.fy),
band: isSeniorInFy(record.dob, record.fy) ? 'SENIOR' : 'GENERAL',
age: ageInFy(record.dob, record.fy),
mode,
schedule,
tdsSaved: declaration ? Math.max(0, withoutDeclaration.totalTds - schedule.totalTds) : 0,
eligibility: checkEligibility(ctx, {
estimatedInterest: record.estimatedInterest,
estimatedIncome: record.estimatedIncome,
incomeOnRecord: true
})
};
}
/** 15H once 60+, 15G otherwise. */
formKind(r: Form15ghRecord): Form15Kind {
return this.age(r.dob) >= 60 ? '15H' : '15G';
}
get filteredRecords(): Form15ghRecord[] {
get filteredRows(): Form15ghRow[] {
const q = this.search.trim().toLowerCase();
return this.records.filter((r) => {
if (this.kindFilter && this.formKind(r) !== this.kindFilter) return false;
if (this.statusFilter && r.status !== this.statusFilter) return false;
if (!q) return true;
return this.rows.filter((row) => {
if (this.bandFilter && row.band !== this.bandFilter) {
return false;
}
if (this.statusFilter && row.record.status !== this.statusFilter) {
return false;
}
if (this.ineligibleOnly && row.eligibility.eligible) {
return false;
}
if (!q) {
return true;
}
const r = row.record;
return (
r.customerName.toLowerCase().includes(q) ||
r.customerId.toLowerCase().includes(q) ||
@@ -105,32 +205,67 @@ export class Form15ghComponent implements OnInit {
});
}
count15G(): number {
return this.records.filter((r) => this.formKind(r) === '15G').length;
countGeneralBand(): number {
return this.rows.filter((r) => r.band === 'GENERAL').length;
}
count15H(): number {
return this.records.filter((r) => this.formKind(r) === '15H').length;
countSeniorBand(): number {
return this.rows.filter((r) => r.band === 'SENIOR').length;
}
/**
* The declaration in force across the register, and the provision charging the
* tax. Both changed on 01 April 2026, so they are read from the config rather
* than written into the template.
*/
get statute(): { form: string; section: string; statement: string; frequency: string } {
const fy = normaliseFy(this.rows[0]?.record.fy ?? '2026-27');
const cfg = FY_TAX_CONFIG[fy];
return {
form: cfg.declarationForm === '121' ? 'Form 121' : 'Form 15G / 15H',
section: cfg.interestTdsSection,
statement: cfg.tdsStatementForm,
frequency: cfg.declarationStatementFrequency === 'MONTHLY' ? 'monthly' : 'quarterly'
};
}
countFiled(): number {
return this.records.filter((r) => r.status === 'FILED').length;
return this.rows.filter((r) => r.record.status === 'FILED').length;
}
/** Declarations on record that the branch could not lawfully have accepted. */
countIneligible(): number {
return this.rows.filter((r) => !r.eligibility.eligible).length;
}
totalInterest(): number {
return this.filteredRecords.reduce((s, r) => s + r.estimatedInterest, 0);
return this.filteredRows.reduce((s, r) => s + r.record.estimatedInterest, 0);
}
/** Tax the declarations kept out of customers' pockets, across the filter. */
totalTdsSaved(): number {
return this.filteredRows.reduce((s, r) => s + r.tdsSaved, 0);
}
clearFilters(): void {
this.search = '';
this.kindFilter = '';
this.bandFilter = '';
this.statusFilter = '';
this.ineligibleOnly = false;
}
viewCertificate(r: Form15ghRecord): void {
toggleExpanded(row: Form15ghRow): void {
this.expandedId = this.expandedId === row.record.customerId ? null : row.record.customerId;
}
isExpanded(row: Form15ghRow): boolean {
return this.expandedId === row.record.customerId;
}
viewCertificate(row: Form15ghRow): void {
const data: CertificatePreviewDialogData = {
kind: 'form15gh',
form15gh: { record: r, kind: this.formKind(r), age: this.age(r.dob) }
form15gh: { record: row.record, kind: row.kind, age: row.age }
};
this.dialog.open(CertificatePreviewDialogComponent, {
width: '880px',
@@ -142,20 +277,34 @@ export class Form15ghComponent implements OnInit {
});
}
downloadCertificate(r: Form15ghRecord): void {
const kind = this.formKind(r);
downloadCertificate(row: Form15ghRow): void {
const r = row.record;
// A declaration the branch cannot accept must not go out as a signed PDF.
if (!row.eligibility.eligible) {
this.snack.open(`Cannot issue: ${row.eligibility.reasons[0]}`, 'Dismiss', { duration: 6000 });
return;
}
this.dscSign.promptThenDownload(
{
title: `Form 121 (${kind}) Declaration`,
title: `${row.form === '121' ? 'Form 121' : `Form ${row.form}`} Declaration`,
reference: `${r.customerId} · ${r.customerName} · ${r.fy}`,
filename: `Form121-${r.customerId}-${r.fy.replace(/\s+/g, '')}.pdf`
},
(dsc) => downloadForm15ghPdf(r, kind, dsc)
(dsc) => downloadForm15ghPdf(r, row.kind, dsc)
);
}
toggleViewMode(): void {
this.viewMode = this.viewMode === 'demo' ? 'real' : 'demo';
}
}
// ───────────────────── Mock seed (top-level export) ─────────────────────
// ───────────────────────── Mock seed (top-level export) ─────────────────────
/**
* Two of these customers are deliberately ineligible — their estimated income
* leaves a tax liability, so a Form 121 declaration cannot be accepted from them.
* That gives the register's eligibility warnings something to show.
*/
export function seedForm15gh(): Form15ghRecord[] {
return [
{
@@ -165,86 +314,109 @@ export function seedForm15gh(): Form15ghRecord[] {
customerAddress: 'Flat 902, Skyline Apt, Andheri (E), Mumbai 400069',
dob: '1985-02-14',
branch: 'Mumbai — Andheri (E)',
estimatedInterest: 38500,
estimatedIncome: 850000,
depositPrincipal: 500000,
fy: 'FY 2025-26',
status: 'FILED',
filedOn: '2025-04-10',
assessed: true
estimatedInterest: 38_500,
// Over the basic exemption limit — not eligible for 15G.
estimatedIncome: 850_000,
depositPrincipal: 500_000,
fy: 'FY 2026-27',
status: 'PENDING',
assessed: true,
interestPostingPeriodType: 'savingsPostingInterestPeriodType.quarterly'
},
{
customerId: 'CUST556677',
customerName: 'Karthik Rao',
customerPan: 'PQRSR2233Z',
customerPan: 'PQRPR2233Z',
customerAddress: '24, MG Road, Bengaluru 560001',
dob: '1972-09-04',
branch: 'Bengaluru — MG Road',
estimatedInterest: 52800,
estimatedIncome: 320000,
depositPrincipal: 700000,
fy: 'FY 2025-26',
estimatedInterest: 52_800,
estimatedIncome: 320_000,
depositPrincipal: 700_000,
fy: 'FY 2026-27',
status: 'PENDING',
assessed: false
assessed: false,
interestPostingPeriodType: 'savingsPostingInterestPeriodType.quarterly'
},
{
customerId: 'CUST667788',
customerName: 'Lakshmi Naidu',
customerPan: 'XYZAN7788Q',
customerPan: 'XYZPN7788Q',
customerAddress: 'Plot 14, Road No. 3, Banjara Hills, Hyderabad 500034',
dob: '1958-06-22',
branch: 'Hyderabad — Banjara Hills',
estimatedInterest: 88200,
estimatedIncome: 410000,
depositPrincipal: 1200000,
fy: 'FY 2025-26',
estimatedInterest: 88_200,
estimatedIncome: 410_000,
depositPrincipal: 1_200_000,
fy: 'FY 2026-27',
status: 'FILED',
filedOn: '2025-04-15',
assessed: true
filedOn: '2026-04-15',
assessed: true,
interestPostingPeriodType: 'savingsPostingInterestPeriodType.quarterly'
},
{
customerId: 'CUST334455',
customerName: 'Anita Verma',
customerPan: 'EFGHV5678A',
customerPan: 'EFGPV5678A',
customerAddress: 'B-12, Connaught Pl, New Delhi 110001',
dob: '1962-11-30',
branch: 'New Delhi — Connaught Place',
estimatedInterest: 64500,
estimatedIncome: 280000,
depositPrincipal: 900000,
fy: 'FY 2025-26',
estimatedInterest: 64_500,
estimatedIncome: 280_000,
depositPrincipal: 900_000,
fy: 'FY 2026-27',
status: 'FILED',
filedOn: '2025-04-05',
assessed: false
filedOn: '2026-04-05',
assessed: false,
interestPostingPeriodType: 'savingsPostingInterestPeriodType.annual'
},
{
customerId: 'CUST990011',
customerName: 'Arjun Banerjee',
customerPan: 'TUVWB4455F',
customerPan: 'TUVPB4455F',
customerAddress: '42, Park Street, Kolkata 700016',
dob: '1991-07-19',
branch: 'Kolkata — Park Street',
estimatedInterest: 14200,
estimatedIncome: 620000,
depositPrincipal: 200000,
fy: 'FY 2025-26',
estimatedInterest: 14_200,
// Over the basic exemption limit — not eligible for 15G.
estimatedIncome: 620_000,
depositPrincipal: 200_000,
fy: 'FY 2026-27',
status: 'PENDING',
assessed: true
assessed: true,
interestPostingPeriodType: 'savingsPostingInterestPeriodType.monthly'
},
{
customerId: 'CUST330044',
customerName: 'Madhavi Singh',
customerPan: 'TUVWS3344K',
customerPan: 'TUVPS3344K',
customerAddress: 'D-5, Greater Kailash, New Delhi 110048',
dob: '1955-03-08',
branch: 'New Delhi — Connaught Place',
estimatedInterest: 145000,
estimatedIncome: 320000,
depositPrincipal: 2000000,
fy: 'FY 2025-26',
// A 15H declarant faces no ceiling on interest — only a nil liability.
estimatedInterest: 145_000,
estimatedIncome: 320_000,
depositPrincipal: 2_000_000,
fy: 'FY 2026-27',
status: 'FILED',
filedOn: '2025-04-02',
assessed: false
filedOn: '2026-04-02',
assessed: false,
interestPostingPeriodType: 'savingsPostingInterestPeriodType.quarterly'
},
{
customerId: 'CUST778899',
customerName: 'Vikram Malhotra',
customerPan: '',
customerAddress: 'Flat 405, Green Glen Layout, Outer Ring Road, Bengaluru 560103',
dob: '1980-05-15',
branch: 'Bengaluru — MG Road',
estimatedInterest: 60_000,
estimatedIncome: 350_000,
depositPrincipal: 800_000,
fy: 'FY 2026-27',
status: 'PENDING',
assessed: true,
interestPostingPeriodType: 'savingsPostingInterestPeriodType.quarterly'
}
];
}