Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca01e9b65b | ||
|
|
a4e0a22205 | ||
|
|
5ab4e9eaf0 | ||
|
|
4fc6784695 |
@@ -353,12 +353,7 @@
|
|||||||
<div class="gl-fgroup">
|
<div class="gl-fgroup">
|
||||||
<label class="gl-flabel"><fa-icon icon="calendar-check"></fa-icon> Submitted From</label>
|
<label class="gl-flabel"><fa-icon icon="calendar-check"></fa-icon> Submitted From</label>
|
||||||
<mat-form-field appearance="outline" class="gl-ffield">
|
<mat-form-field appearance="outline" class="gl-ffield">
|
||||||
<input
|
<input matInput [matDatepicker]="dpSubFrom" [min]="minDate" [formControl]="submittedOnDateFrom" />
|
||||||
matInput
|
|
||||||
[matDatepicker]="dpSubFrom"
|
|
||||||
[min]="minDate"
|
|
||||||
[formControl]="submittedOnDateFrom"
|
|
||||||
/>
|
|
||||||
<mat-datepicker-toggle matSuffix [for]="dpSubFrom"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="dpSubFrom"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #dpSubFrom></mat-datepicker>
|
<mat-datepicker #dpSubFrom></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|||||||
@@ -36,7 +36,15 @@ export class CacheInterceptor implements HttpInterceptor {
|
|||||||
'/rbireserveconfig',
|
'/rbireserveconfig',
|
||||||
'/tdsconfig',
|
'/tdsconfig',
|
||||||
'/tds/deposit-interest',
|
'/tds/deposit-interest',
|
||||||
'/savingsinterestpostingreports'
|
'/savingsinterestpostingreports',
|
||||||
|
// Cash in vaults and drawers changes with every transaction; a cached teller list or position
|
||||||
|
// kept showing a branch's old tellers and figures at day close.
|
||||||
|
'/tellers',
|
||||||
|
'/cashreports',
|
||||||
|
'/cashreconciliation',
|
||||||
|
'/cashsettlement',
|
||||||
|
'/cashtransfer',
|
||||||
|
'/branchday'
|
||||||
];
|
];
|
||||||
|
|
||||||
private isCacheable(url: string): boolean {
|
private isCacheable(url: string): boolean {
|
||||||
|
|||||||
@@ -22,9 +22,134 @@
|
|||||||
<input type="date" [(ngModel)]="postingDate" (change)="load()" />
|
<input type="date" [(ngModel)]="postingDate" (change)="load()" />
|
||||||
</label>
|
</label>
|
||||||
<button class="ipr-btn" (click)="load()" [disabled]="loading"><fa-icon icon="undo"></fa-icon> Reload</button>
|
<button class="ipr-btn" (click)="load()" [disabled]="loading"><fa-icon icon="undo"></fa-icon> Reload</button>
|
||||||
|
<button class="ipr-btn ipr-btn--primary" (click)="openPreview()" [disabled]="previewLoading">
|
||||||
|
<fa-icon icon="eye"></fa-icon> Preview interest (today)
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (isHeadOffice) {
|
||||||
|
<div class="ipr-tabs">
|
||||||
|
<button class="ipr-tab" [class.is-active]="tab === 'own'" (click)="switchTab('own')">
|
||||||
|
<fa-icon icon="building"></fa-icon> My branch{{ myBranch ? ' — ' + myBranch : '' }}
|
||||||
|
</button>
|
||||||
|
<button class="ipr-tab" [class.is-active]="tab === 'others'" (click)="switchTab('others')">
|
||||||
|
<fa-icon icon="sitemap"></fa-icon> Other branches
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
@if (tab === 'others') {
|
||||||
|
<div class="ipr-alert ipr-alert--info">
|
||||||
|
<fa-icon icon="info-circle"></fa-icon>
|
||||||
|
<div>
|
||||||
|
Each branch generates and approves its own reports. The head office can act here only for a branch that has
|
||||||
|
not opened the day, and only once every other open branch has closed. Anything it approves is marked (HO).
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (showPreview) {
|
||||||
|
<div class="ipr-card">
|
||||||
|
<div class="ipr-detail-head">
|
||||||
|
<div>
|
||||||
|
<h3>Interest preview — earned up to {{ previewAsOf }}</h3>
|
||||||
|
<div class="muted">
|
||||||
|
What each account would be paid if interest were posted today. View only — nothing is saved, approved or
|
||||||
|
posted.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ipr-total">
|
||||||
|
<span>Total so far</span>
|
||||||
|
<strong>₹{{ previewTotal | number: '1.2-2' }}</strong>
|
||||||
|
<span class="muted">{{ previewRows.length }} account(s)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ipr-preview-actions">
|
||||||
|
<button class="ipr-btn ipr-btn--slim" (click)="openPreview()" [disabled]="previewLoading">
|
||||||
|
<fa-icon icon="undo"></fa-icon> Refresh
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="ipr-btn ipr-btn--slim"
|
||||||
|
(click)="exportPreview()"
|
||||||
|
[disabled]="previewLoading || previewRows.length === 0"
|
||||||
|
>
|
||||||
|
<fa-icon icon="file-excel"></fa-icon> Export Excel
|
||||||
|
</button>
|
||||||
|
<button class="ipr-btn ipr-btn--slim" (click)="closePreview()"><fa-icon icon="times"></fa-icon> Close</button>
|
||||||
|
</div>
|
||||||
|
@if (previewLoading) {
|
||||||
|
<div class="ipr-empty">Calculating interest up to today…</div>
|
||||||
|
} @else {
|
||||||
|
<table class="ipr-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Branch</th>
|
||||||
|
<th>Product</th>
|
||||||
|
<th>Posting date</th>
|
||||||
|
<th class="num">Accounts</th>
|
||||||
|
<th class="num">Interest so far</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (g of previewGroups; track g.officeName + g.productName) {
|
||||||
|
<tr>
|
||||||
|
<td>{{ g.officeName }}</td>
|
||||||
|
<td>
|
||||||
|
<strong>{{ g.productName }}</strong>
|
||||||
|
</td>
|
||||||
|
<td>{{ g.postingDate }}</td>
|
||||||
|
<td class="num">{{ g.accounts }}</td>
|
||||||
|
<td class="num">₹{{ g.interest | number: '1.2-2' }}</td>
|
||||||
|
</tr>
|
||||||
|
} @empty {
|
||||||
|
<tr>
|
||||||
|
<td colspan="5" class="ipr-empty">No savings account has interest accrued in its current cycle.</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@if (previewRows.length > 0) {
|
||||||
|
<table class="ipr-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Branch</th>
|
||||||
|
<th>Product</th>
|
||||||
|
<th>Account no</th>
|
||||||
|
<th>Account holder</th>
|
||||||
|
<th class="num">Balance</th>
|
||||||
|
<th class="num">Rate %</th>
|
||||||
|
<th>Cycle</th>
|
||||||
|
<th class="num">Interest so far</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (r of previewRows; track r.savingsAccountId) {
|
||||||
|
<tr>
|
||||||
|
<td>{{ r.officeName }}</td>
|
||||||
|
<td>{{ r.productName }}</td>
|
||||||
|
<td>{{ r.accountNo }}</td>
|
||||||
|
<td>{{ r.clientName }}</td>
|
||||||
|
<td class="num">₹{{ r.balance | number: '1.2-2' }}</td>
|
||||||
|
<td class="num">{{ r.rate | number: '1.2-2' }}</td>
|
||||||
|
<td class="muted">{{ r.cycleStart }} → {{ r.postingDate }}</td>
|
||||||
|
<td class="num">₹{{ r.interest | number: '1.2-2' }}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="7"><strong>Total</strong></td>
|
||||||
|
<td class="num">
|
||||||
|
<strong>₹{{ previewTotal | number: '1.2-2' }}</strong>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
@if (errorMessage) {
|
@if (errorMessage) {
|
||||||
<div class="ipr-alert ipr-alert--error">
|
<div class="ipr-alert ipr-alert--error">
|
||||||
<fa-icon icon="exclamation-triangle"></fa-icon>
|
<fa-icon icon="exclamation-triangle"></fa-icon>
|
||||||
@@ -52,9 +177,13 @@
|
|||||||
@for (d of due; track d.productId + '-' + d.officeId) {
|
@for (d of due; track d.productId + '-' + d.officeId) {
|
||||||
<div class="ipr-due-row">
|
<div class="ipr-due-row">
|
||||||
<strong>{{ d.productName }}</strong> <span>· {{ d.officeName }} · {{ d.postingDate }}</span>
|
<strong>{{ d.productName }}</strong> <span>· {{ d.officeName }} · {{ d.postingDate }}</span>
|
||||||
<button class="ipr-btn ipr-btn--primary ipr-btn--slim" (click)="generate(d)" [disabled]="busy">
|
@if (d.canAct) {
|
||||||
<fa-icon icon="sync"></fa-icon> Generate report
|
<button class="ipr-btn ipr-btn--primary ipr-btn--slim" (click)="generate(d)" [disabled]="busy">
|
||||||
</button>
|
<fa-icon icon="sync"></fa-icon> {{ tab === 'others' ? 'Generate on behalf' : 'Generate report' }}
|
||||||
|
</button>
|
||||||
|
} @else if (d.blockedReason) {
|
||||||
|
<span class="ipr-blocked">{{ d.blockedReason }}</span>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -114,9 +243,12 @@
|
|||||||
}
|
}
|
||||||
@if (canApprove(r)) {
|
@if (canApprove(r)) {
|
||||||
<button class="ipr-btn ipr-btn--primary ipr-btn--slim" (click)="approve(r)" [disabled]="busy">
|
<button class="ipr-btn ipr-btn--primary ipr-btn--slim" (click)="approve(r)" [disabled]="busy">
|
||||||
<fa-icon icon="check"></fa-icon> Approve
|
<fa-icon icon="check"></fa-icon> {{ tab === 'others' ? 'Approve on behalf' : 'Approve' }}
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
@if (!r.canAct && r.blockedReason && (r.status === 'GENERATED' || r.status === 'APPROVED')) {
|
||||||
|
<span class="ipr-blocked">{{ r.blockedReason }}</span>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
} @empty {
|
} @empty {
|
||||||
|
|||||||
@@ -274,3 +274,54 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--i-amber);
|
color: var(--i-amber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Preview: refresh / export / close, above the totals.
|
||||||
|
.ipr-preview-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding: 0 16px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipr-tabs {
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
border-bottom: 1px solid var(--i-g200);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipr-tab {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 8px 14px;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--i-g500);
|
||||||
|
cursor: pointer;
|
||||||
|
background: transparent;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 6px 6px 0 0;
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
color: var(--i-navy);
|
||||||
|
background: #fff;
|
||||||
|
border-color: var(--i-g200);
|
||||||
|
border-bottom-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipr-alert--info {
|
||||||
|
background: var(--i-blue-l);
|
||||||
|
color: var(--i-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipr-blocked {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 320px;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.35;
|
||||||
|
color: var(--i-g500);
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ import { FormsModule } from '@angular/forms';
|
|||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
import { exportWorkbook } from '../cashier/cashier-export';
|
||||||
import {
|
import {
|
||||||
InterestPostingDue,
|
InterestPostingDue,
|
||||||
InterestPostingReport,
|
InterestPostingReport,
|
||||||
InterestPostingReportDetail,
|
InterestPostingReportDetail,
|
||||||
InterestPostingReportService
|
InterestPostingReportService,
|
||||||
|
InterestPreviewRow,
|
||||||
|
ReportScope
|
||||||
} from './interest-posting-report.service';
|
} from './interest-posting-report.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,15 +54,48 @@ export class InterestPostingReportComponent implements OnInit {
|
|||||||
/** Products with interest due and no report yet — the noon job ran before they had anything due, or failed. */
|
/** Products with interest due and no report yet — the noon job ran before they had anything due, or failed. */
|
||||||
due: InterestPostingDue[] = [];
|
due: InterestPostingDue[] = [];
|
||||||
|
|
||||||
|
/** 'own' — the user's own branch; 'others' — every other branch, a head-office-only tab. */
|
||||||
|
tab: ReportScope = 'own';
|
||||||
|
isHeadOffice = false;
|
||||||
|
myBranch = '';
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.postingDate = this.businessDateIso();
|
this.postingDate = this.businessDateIso();
|
||||||
|
this.reportService.context().subscribe({
|
||||||
|
next: (ctx) => {
|
||||||
|
this.isHeadOffice = !!ctx?.headOffice;
|
||||||
|
this.myBranch = ctx?.officeName ?? '';
|
||||||
|
},
|
||||||
|
error: () => (this.isHeadOffice = false)
|
||||||
|
});
|
||||||
this.load();
|
this.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switchTab(tab: ReportScope): void {
|
||||||
|
if (this.tab === tab) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.tab = tab;
|
||||||
|
this.selected = null;
|
||||||
|
this.notice = '';
|
||||||
|
this.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Acting for another branch is the head office's exception, so it is spelt out before it happens. */
|
||||||
|
private confirmOnBehalf(officeName: string, action: string): boolean {
|
||||||
|
if (this.tab !== 'others') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return confirm(
|
||||||
|
`${officeName} has not opened today. You are about to ${action} its interest posting report on its behalf, ` +
|
||||||
|
'from the head office. Continue?'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
load(): void {
|
load(): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.errorMessage = '';
|
this.errorMessage = '';
|
||||||
this.reportService.list(this.postingDate || undefined).subscribe({
|
this.reportService.list(this.postingDate || undefined, undefined, undefined, this.tab).subscribe({
|
||||||
next: (reports) => {
|
next: (reports) => {
|
||||||
this.reports = reports ?? [];
|
this.reports = reports ?? [];
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@@ -75,13 +111,16 @@ export class InterestPostingReportComponent implements OnInit {
|
|||||||
this.errorMessage = this.messageOf(err, 'Could not load the interest posting reports.');
|
this.errorMessage = this.messageOf(err, 'Could not load the interest posting reports.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.reportService.dueWithoutReport(this.postingDate || undefined).subscribe({
|
this.reportService.dueWithoutReport(this.postingDate || undefined, this.tab).subscribe({
|
||||||
next: (due) => (this.due = due ?? []),
|
next: (due) => (this.due = due ?? []),
|
||||||
error: () => (this.due = [])
|
error: () => (this.due = [])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
generate(item: InterestPostingDue): void {
|
generate(item: InterestPostingDue): void {
|
||||||
|
if (!this.confirmOnBehalf(item.officeName, 'generate')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.busy = true;
|
this.busy = true;
|
||||||
this.notice = '';
|
this.notice = '';
|
||||||
this.errorMessage = '';
|
this.errorMessage = '';
|
||||||
@@ -111,7 +150,8 @@ export class InterestPostingReportComponent implements OnInit {
|
|||||||
if (
|
if (
|
||||||
!confirm(
|
!confirm(
|
||||||
`Regenerate the interest posting report for ${report.productName} — ${report.officeName}? It will need approving again.`
|
`Regenerate the interest posting report for ${report.productName} — ${report.officeName}? It will need approving again.`
|
||||||
)
|
) ||
|
||||||
|
!this.confirmOnBehalf(report.officeName, 'regenerate')
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -138,7 +178,8 @@ export class InterestPostingReportComponent implements OnInit {
|
|||||||
!confirm(
|
!confirm(
|
||||||
`Approve interest of ₹${report.totalInterest} across ${report.accountCount} account(s) for ${report.productName}? ` +
|
`Approve interest of ₹${report.totalInterest} across ${report.accountCount} account(s) for ${report.productName}? ` +
|
||||||
'It will be posted when the branch closes the day.'
|
'It will be posted when the branch closes the day.'
|
||||||
)
|
) ||
|
||||||
|
!this.confirmOnBehalf(report.officeName, 'approve')
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -177,8 +218,165 @@ export class InterestPostingReportComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Pending reports that block this user's own day close; another branch's pending reports block only that branch. */
|
||||||
get pendingCount(): number {
|
get pendingCount(): number {
|
||||||
return this.reports.filter((r) => r.status === 'GENERATED').length;
|
return this.tab === 'own' ? this.reports.filter((r) => r.status === 'GENERATED').length : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Preview: what each account has earned so far, as if posted today. View only. ──
|
||||||
|
|
||||||
|
showPreview = false;
|
||||||
|
previewLoading = false;
|
||||||
|
previewRows: InterestPreviewRow[] = [];
|
||||||
|
previewAsOf = '';
|
||||||
|
|
||||||
|
openPreview(): void {
|
||||||
|
this.showPreview = true;
|
||||||
|
this.previewLoading = true;
|
||||||
|
this.errorMessage = '';
|
||||||
|
this.reportService.preview().subscribe({
|
||||||
|
next: (rows) => {
|
||||||
|
this.previewRows = rows ?? [];
|
||||||
|
this.previewAsOf = this.previewRows[0]?.asOf ?? this.businessDateIso();
|
||||||
|
this.previewLoading = false;
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
this.previewLoading = false;
|
||||||
|
this.previewRows = [];
|
||||||
|
this.errorMessage = this.messageOf(err, 'Could not load the interest preview.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
closePreview(): void {
|
||||||
|
this.showPreview = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
get previewTotal(): number {
|
||||||
|
return this.previewRows.reduce((sum, r) => sum + Number(r.interest || 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Totals by branch and product, for the summary above the account list and the export. */
|
||||||
|
get previewGroups(): {
|
||||||
|
officeName: string;
|
||||||
|
productName: string;
|
||||||
|
postingDate: string;
|
||||||
|
accounts: number;
|
||||||
|
interest: number;
|
||||||
|
}[] {
|
||||||
|
const map = new Map<
|
||||||
|
string,
|
||||||
|
{ officeName: string; productName: string; postingDate: string; accounts: number; interest: number }
|
||||||
|
>();
|
||||||
|
this.previewRows.forEach((r) => {
|
||||||
|
const key = `${r.officeName}|${r.productName}`;
|
||||||
|
const g = map.get(key) ?? {
|
||||||
|
officeName: r.officeName,
|
||||||
|
productName: r.productName,
|
||||||
|
postingDate: r.postingDate,
|
||||||
|
accounts: 0,
|
||||||
|
interest: 0
|
||||||
|
};
|
||||||
|
g.accounts += 1;
|
||||||
|
g.interest += Number(r.interest || 0);
|
||||||
|
map.set(key, g);
|
||||||
|
});
|
||||||
|
return [...map.values()];
|
||||||
|
}
|
||||||
|
|
||||||
|
exportPreview(): void {
|
||||||
|
const stamp = `Interest earned to ${this.previewAsOf} — preview, not posted`;
|
||||||
|
exportWorkbook(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
sheetName: 'By account',
|
||||||
|
title: 'Savings Interest Preview',
|
||||||
|
subtitle: stamp,
|
||||||
|
headers: [
|
||||||
|
'Branch',
|
||||||
|
'Product',
|
||||||
|
'Account No',
|
||||||
|
'Customer',
|
||||||
|
'Balance',
|
||||||
|
'Rate %',
|
||||||
|
'Cycle Start',
|
||||||
|
'Posting Date',
|
||||||
|
'Interest So Far'
|
||||||
|
],
|
||||||
|
widths: [
|
||||||
|
18,
|
||||||
|
22,
|
||||||
|
20,
|
||||||
|
26,
|
||||||
|
16,
|
||||||
|
8,
|
||||||
|
12,
|
||||||
|
12,
|
||||||
|
16
|
||||||
|
],
|
||||||
|
rows: [
|
||||||
|
...this.previewRows.map((r) => [
|
||||||
|
r.officeName,
|
||||||
|
r.productName,
|
||||||
|
r.accountNo,
|
||||||
|
r.clientName,
|
||||||
|
Number(r.balance || 0),
|
||||||
|
Number(r.rate || 0),
|
||||||
|
r.cycleStart,
|
||||||
|
r.postingDate,
|
||||||
|
Number(r.interest || 0)
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'TOTAL',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
this.previewTotal
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sheetName: 'By branch & product',
|
||||||
|
title: 'Savings Interest Preview — Totals',
|
||||||
|
subtitle: stamp,
|
||||||
|
headers: [
|
||||||
|
'Branch',
|
||||||
|
'Product',
|
||||||
|
'Posting Date',
|
||||||
|
'Accounts',
|
||||||
|
'Interest So Far'
|
||||||
|
],
|
||||||
|
widths: [
|
||||||
|
18,
|
||||||
|
22,
|
||||||
|
12,
|
||||||
|
10,
|
||||||
|
16
|
||||||
|
],
|
||||||
|
rows: [
|
||||||
|
...this.previewGroups.map((g) => [
|
||||||
|
g.officeName,
|
||||||
|
g.productName,
|
||||||
|
g.postingDate,
|
||||||
|
g.accounts,
|
||||||
|
g.interest
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'TOTAL',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
this.previewRows.length,
|
||||||
|
this.previewTotal
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
`savings-interest-preview-${this.previewAsOf}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private businessDateIso(): string {
|
private businessDateIso(): string {
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import { Observable } from 'rxjs';
|
|||||||
|
|
||||||
export type InterestPostingReportStatus = 'GENERATED' | 'APPROVED' | 'POSTED' | 'SUPERSEDED';
|
export type InterestPostingReportStatus = 'GENERATED' | 'APPROVED' | 'POSTED' | 'SUPERSEDED';
|
||||||
|
|
||||||
|
/** Which branches a list covers: the user's own, or (head office only) every other branch. */
|
||||||
|
export type ReportScope = 'own' | 'others';
|
||||||
|
|
||||||
export interface InterestPostingReport {
|
export interface InterestPostingReport {
|
||||||
id: number;
|
id: number;
|
||||||
productId: number;
|
productId: number;
|
||||||
@@ -32,6 +35,8 @@ export interface InterestPostingReport {
|
|||||||
failureReason: string | null;
|
failureReason: string | null;
|
||||||
/** Whether the signed-in user may regenerate or approve it: their own branch, or the head office for a branch that did not open. */
|
/** Whether the signed-in user may regenerate or approve it: their own branch, or the head office for a branch that did not open. */
|
||||||
canAct: boolean;
|
canAct: boolean;
|
||||||
|
/** Why not, where canAct is false. */
|
||||||
|
blockedReason: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InterestPostingReportLine {
|
export interface InterestPostingReportLine {
|
||||||
@@ -60,6 +65,8 @@ export interface InterestPostingDue {
|
|||||||
officeId: number;
|
officeId: number;
|
||||||
officeName: string;
|
officeName: string;
|
||||||
postingDate: string;
|
postingDate: string;
|
||||||
|
canAct: boolean;
|
||||||
|
blockedReason: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InterestPostingSummaryRow {
|
export interface InterestPostingSummaryRow {
|
||||||
@@ -78,6 +85,22 @@ export interface InterestPostingSummaryRow {
|
|||||||
postedAt: string | null;
|
postedAt: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface InterestPreviewRow {
|
||||||
|
officeId: number;
|
||||||
|
officeName: string;
|
||||||
|
productId: number;
|
||||||
|
productName: string;
|
||||||
|
savingsAccountId: number;
|
||||||
|
accountNo: string;
|
||||||
|
clientName: string;
|
||||||
|
balance: number;
|
||||||
|
rate: number;
|
||||||
|
cycleStart: string;
|
||||||
|
postingDate: string;
|
||||||
|
asOf: string;
|
||||||
|
interest: number;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The savings interest posting reports, one per branch and product: generated at noon on a posting
|
* The savings interest posting reports, one per branch and product: generated at noon on a posting
|
||||||
* date, approved by the branch, posted when the branch closes the day.
|
* date, approved by the branch, posted when the branch closes the day.
|
||||||
@@ -87,8 +110,15 @@ export class InterestPostingReportService {
|
|||||||
private http = inject(HttpClient);
|
private http = inject(HttpClient);
|
||||||
private readonly base = '/savingsinterestpostingreports';
|
private readonly base = '/savingsinterestpostingreports';
|
||||||
|
|
||||||
list(postingDate?: string, status?: string, officeId?: number): Observable<InterestPostingReport[]> {
|
/** scope 'own' is the user's own branch; 'others' (head office only) every other branch. */
|
||||||
|
list(
|
||||||
|
postingDate?: string,
|
||||||
|
status?: string,
|
||||||
|
officeId?: number,
|
||||||
|
scope?: ReportScope
|
||||||
|
): Observable<InterestPostingReport[]> {
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
if (scope) params = params.set('scope', scope);
|
||||||
if (postingDate) params = params.set('postingDate', postingDate);
|
if (postingDate) params = params.set('postingDate', postingDate);
|
||||||
if (status) params = params.set('status', status);
|
if (status) params = params.set('status', status);
|
||||||
if (officeId) params = params.set('officeId', String(officeId));
|
if (officeId) params = params.set('officeId', String(officeId));
|
||||||
@@ -96,12 +126,18 @@ export class InterestPostingReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Branch and product pairs with interest due by the date and no report yet, that this user may generate. */
|
/** Branch and product pairs with interest due by the date and no report yet, that this user may generate. */
|
||||||
dueWithoutReport(postingDate?: string): Observable<InterestPostingDue[]> {
|
dueWithoutReport(postingDate?: string, scope?: ReportScope): Observable<InterestPostingDue[]> {
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
if (scope) params = params.set('scope', scope);
|
||||||
if (postingDate) params = params.set('postingDate', postingDate);
|
if (postingDate) params = params.set('postingDate', postingDate);
|
||||||
return this.http.get<InterestPostingDue[]>(`${this.base}/due-without-report`, { params });
|
return this.http.get<InterestPostingDue[]>(`${this.base}/due-without-report`, { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The signed-in user's branch, and whether it is the head office. */
|
||||||
|
context(): Observable<{ officeId: number; officeName: string; headOffice: boolean }> {
|
||||||
|
return this.http.get<{ officeId: number; officeName: string; headOffice: boolean }>(`${this.base}/context`);
|
||||||
|
}
|
||||||
|
|
||||||
detail(reportId: number): Observable<InterestPostingReportDetail> {
|
detail(reportId: number): Observable<InterestPostingReportDetail> {
|
||||||
return this.http.get<InterestPostingReportDetail>(`${this.base}/${reportId}`);
|
return this.http.get<InterestPostingReportDetail>(`${this.base}/${reportId}`);
|
||||||
}
|
}
|
||||||
@@ -126,6 +162,13 @@ export class InterestPostingReportService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Interest each account has earned so far this cycle, as if posted today. View only. */
|
||||||
|
preview(officeId?: number): Observable<InterestPreviewRow[]> {
|
||||||
|
let params = new HttpParams();
|
||||||
|
if (officeId) params = params.set('officeId', String(officeId));
|
||||||
|
return this.http.get<InterestPreviewRow[]>(`${this.base}/preview`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
/** The head office's branch-wise view over a date range. */
|
/** The head office's branch-wise view over a date range. */
|
||||||
summary(fromDate?: string, toDate?: string, productId?: number): Observable<InterestPostingSummaryRow[]> {
|
summary(fromDate?: string, toDate?: string, productId?: number): Observable<InterestPostingSummaryRow[]> {
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|||||||
@@ -176,8 +176,9 @@
|
|||||||
<!-- ===================== 01 PURCHASE ENTRY ===================== -->
|
<!-- ===================== 01 PURCHASE ENTRY ===================== -->
|
||||||
@if (activeTab === 'purchase') {
|
@if (activeTab === 'purchase') {
|
||||||
<div class="pg-card">
|
<div class="pg-card">
|
||||||
|
<!-- 1. Deal details — the only fields the dealer has to fill -->
|
||||||
<div class="pos-section-label">
|
<div class="pos-section-label">
|
||||||
Investment - Govt.Security/Bond Entry ({{ instrumentLabel(purchaseForm.bondType) }})
|
Purchase Entry — {{ instrumentLabel(purchaseForm.bondType) }} (fields marked * are mandatory)
|
||||||
</div>
|
</div>
|
||||||
<div class="inv-form-grid">
|
<div class="inv-form-grid">
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
@@ -188,17 +189,6 @@
|
|||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Deal No</span><input type="text" [(ngModel)]="purchaseForm.dealNo" readonly
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>* Deal Date</span><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.dealDate"></mifosx-date-ddmmyyyy
|
|
||||||
></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>* Deal Time (24 hr, HH:mm:ss)</span
|
|
||||||
><input type="text" [(ngModel)]="purchaseForm.dealTime" placeholder="HH:mm:ss"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"><span>* ISIN</span><input type="text" [(ngModel)]="purchaseForm.isin" /></label>
|
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>* Script Code</span>
|
<span>* Script Code</span>
|
||||||
<select [(ngModel)]="purchaseForm.scriptCode" (ngModelChange)="onScriptChange()">
|
<select [(ngModel)]="purchaseForm.scriptCode" (ngModelChange)="onScriptChange()">
|
||||||
@@ -208,167 +198,46 @@
|
|||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>* Cert No</span><input type="text" [(ngModel)]="purchaseForm.certNo"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Settlement Type</span>
|
<span>* Party Code</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.partyCode">
|
||||||
|
<option value="">-- Select --</option>
|
||||||
|
@for (p of activePartyOptions; track p.partyCode) {
|
||||||
|
<option [value]="p.partyCode">{{ p.partyCode }} — {{ p.partyName }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>* Deal Date</span
|
||||||
|
><mifosx-date-ddmmyyyy
|
||||||
|
[(ngModel)]="purchaseForm.dealDate"
|
||||||
|
(ngModelChange)="onDealDateChange()"
|
||||||
|
></mifosx-date-ddmmyyyy
|
||||||
|
></label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>* Settlement Type</span>
|
||||||
<select [(ngModel)]="purchaseForm.settlementType">
|
<select [(ngModel)]="purchaseForm.settlementType">
|
||||||
<option value="T+0">T+0</option>
|
<option value="T+0">T+0</option>
|
||||||
<option value="T+1">T+1</option>
|
<option value="T+1">T+1</option>
|
||||||
<option value="T+2">T+2</option>
|
<option value="T+2">T+2</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Settlement Dt</span
|
|
||||||
><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.settlementDt"></mifosx-date-ddmmyyyy
|
|
||||||
></label>
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>* Party Code</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.partyCode">
|
|
||||||
<option value="">-- Select --</option>
|
|
||||||
@for (p of partyOptions; track p.partyCode) {
|
|
||||||
<option [value]="p.partyName">{{ p.partyName }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>Sub Type</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.subType">
|
|
||||||
@for (s of subTypeOptions; track s.subTypeCode + s.subTypeName) {
|
|
||||||
<option [value]="s.subTypeName">{{ s.subTypeName }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
@if (isMutualFund) {
|
@if (isMutualFund) {
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>* Product Name</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.productName">
|
|
||||||
<option value="">-- Select --</option>
|
|
||||||
@for (p of mfProductOptions; track p.productCode) {
|
|
||||||
<option [value]="p.productName">{{ p.productName }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Holding Days</span><input type="number" [(ngModel)]="purchaseForm.holdingDays" min="0"
|
><span>* Consider Amt (₹)</span><input type="number" [(ngModel)]="purchaseForm.considerAmt" min="0"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>* Consider Amt</span><input type="number" [(ngModel)]="purchaseForm.considerAmt" min="0"
|
><span>* NAV</span><input type="number" [(ngModel)]="purchaseForm.nav" min="0" step="0.0001"
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Trade Amt</span><input type="number" [(ngModel)]="purchaseForm.tradeAmt" min="0"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>NAV</span><input type="number" [(ngModel)]="purchaseForm.nav" min="0" step="0.0001"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Stamp Duty</span><input type="number" [(ngModel)]="purchaseForm.stampDuty" min="0"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>StampDuty A/c</span><input type="text" [(ngModel)]="purchaseForm.stampDutyAc"
|
|
||||||
/></label>
|
/></label>
|
||||||
} @else {
|
} @else {
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Face Value</span><input type="number" [(ngModel)]="purchaseForm.faceValue" min="0"
|
><span>* Face Value (₹)</span><input type="number" [(ngModel)]="purchaseForm.faceValue" min="0"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Purchase Rate (per 100)</span
|
><span>* Purchase Rate (per ₹100)</span
|
||||||
><input type="number" [(ngModel)]="purchaseForm.purchaseRate" min="0" step="0.0001"
|
><input type="number" [(ngModel)]="purchaseForm.purchaseRate" min="0" step="0.0001"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Unit Val</span><input type="text" [value]="purchaseUnitVal" readonly
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Book Value</span><input type="text" [value]="purchaseBookValue | number: '1.2-2'" readonly
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Premium Amt.</span><input type="number" [(ngModel)]="purchaseForm.premiumAmt"
|
|
||||||
/></label>
|
|
||||||
}
|
}
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>* No Unit</span><input type="text" [value]="purchaseUnits" readonly
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>* CR. To A/c</span><input type="text" [(ngModel)]="purchaseForm.crToAc"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>TBill GL.A/C.</span><input type="text" [(ngModel)]="purchaseForm.tbillGlAc"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Brokerage</span><input type="number" [(ngModel)]="purchaseForm.brokerage" min="0"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>Broker Nm.</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.brokerName">
|
|
||||||
<option value="">-- Select --</option>
|
|
||||||
@for (b of brokerOptions; track b.brokerCode) {
|
|
||||||
<option [value]="b.brokerCode">{{ b.brokerCode }} — {{ b.brokerName }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Trade No.</span><input type="text" [(ngModel)]="purchaseForm.tradeNo"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Order No.</span><input type="text" [(ngModel)]="purchaseForm.orderNo"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>Recomm. Authority</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.recommAuthority">
|
|
||||||
<option value="">-- Select --</option>
|
|
||||||
@for (a of authorityOptions; track a) {
|
|
||||||
<option [value]="a">{{ a }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>Sanction Authority</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.sanctionAuthority">
|
|
||||||
<option value="">-- Select --</option>
|
|
||||||
@for (a of authorityOptions; track a) {
|
|
||||||
<option [value]="a">{{ a }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>* Issue Date</span><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.issueDate"></mifosx-date-ddmmyyyy
|
|
||||||
></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Period(Year)</span><input type="number" [(ngModel)]="purchaseForm.periodYear" min="0"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Period(Month)</span><input type="number" [(ngModel)]="purchaseForm.periodMonth" min="0" max="11"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Period(Days)</span><input type="number" [(ngModel)]="purchaseForm.periodDays" min="0"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Desc Inv</span><input type="text" [(ngModel)]="purchaseForm.descInv"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Folio No</span><input type="text" [(ngModel)]="purchaseForm.folioNo"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Call Option</span><input type="text" [(ngModel)]="purchaseForm.callOption"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Meet Dt</span><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.meetDt"></mifosx-date-ddmmyyyy
|
|
||||||
></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Reso No</span><input type="text" [(ngModel)]="purchaseForm.resoNo"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>From Dist</span><input type="text" [(ngModel)]="purchaseForm.fromDist"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>To Dist</span><input type="text" [(ngModel)]="purchaseForm.toDist"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Redum/Mat Dt</span
|
|
||||||
><input type="text" [(ngModel)]="purchaseForm.redumMatDt" placeholder="DD-MM-YYYY (blank = use period)"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>* Category</span>
|
<span>* Category</span>
|
||||||
<select [(ngModel)]="purchaseForm.category">
|
<select [(ngModel)]="purchaseForm.category">
|
||||||
@@ -380,32 +249,211 @@
|
|||||||
</label>
|
</label>
|
||||||
@if (!isMutualFund) {
|
@if (!isMutualFund) {
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Int Rate</span><input type="number" [(ngModel)]="purchaseForm.intRate" min="0" step="0.01"
|
><span>* Last Interest Date</span
|
||||||
|
><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.lastIntDt"></mifosx-date-ddmmyyyy
|
||||||
|
></label>
|
||||||
|
}
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>* CR. To A/c (Paid From)</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.crToAc">
|
||||||
|
@for (g of settlementBankOptions; track g.glCode) {
|
||||||
|
<option [value]="g.glCode">{{ g.glCode }} — {{ g.glName }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 2. Calculated — filled by the system, read-only -->
|
||||||
|
<div class="pos-section-label">Calculated by System</div>
|
||||||
|
<div class="inv-form-grid">
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Deal No</span><input type="text" [value]="purchaseForm.dealNo" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Cert No</span><input type="text" [value]="purchaseForm.certNo" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Settlement Date</span><input type="text" [value]="purchaseSettlementDate" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>ISIN</span><input type="text" [value]="purchaseForm.isin || '—'" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Sub Type</span><input type="text" [value]="purchaseForm.subType || '—'" readonly
|
||||||
|
/></label>
|
||||||
|
@if (!isMutualFund) {
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Int Rate %</span><input type="text" [value]="purchaseForm.intRate ?? '—'" readonly
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>YTM (computed)</span><input type="text" [value]="purchaseYtm" readonly
|
><span>Issue Date</span><input type="text" [value]="purchaseForm.issueDate || '—'" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Maturity Date</span><input type="text" [value]="purchaseMaturityDate || '—'" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Period (Y / M / D)</span
|
||||||
|
><input
|
||||||
|
type="text"
|
||||||
|
[value]="purchaseForm.periodYear + ' / ' + purchaseForm.periodMonth + ' / ' + purchaseForm.periodDays"
|
||||||
|
readonly
|
||||||
|
/></label>
|
||||||
|
}
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>No. of Units</span><input type="text" [value]="purchaseUnits | number: '1.0-4'" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Book Value</span><input type="text" [value]="'₹' + (purchaseBookValue | number: '1.2-2')" readonly
|
||||||
|
/></label>
|
||||||
|
@if (!isMutualFund) {
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Premium (+) / Discount (−)</span
|
||||||
|
><input type="text" [value]="'₹' + (purchasePremiumDiscount | number: '1.0-0')" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Accrued Interest ({{ purchaseAccruedDays }} days)</span
|
||||||
|
><input type="text" [value]="'₹' + (purchaseAccruedInterest | number: '1.2-2')" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"><span>YTM %</span><input type="text" [value]="purchaseYtm" readonly /></label>
|
||||||
|
}
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Total Settlement Amount</span
|
||||||
|
><input type="text" [value]="'₹' + (purchaseSettlementAmount | number: '1.2-2')" readonly
|
||||||
|
/></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 3. Accounting preview -->
|
||||||
|
<div class="pos-section-label">Accounting Preview (posted after checker approval)</div>
|
||||||
|
@if (purchaseAccountingPreview.length) {
|
||||||
|
<table class="pg-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Dr / Cr</th>
|
||||||
|
<th>GL Code</th>
|
||||||
|
<th>GL Name</th>
|
||||||
|
<th class="num">Amount</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (l of purchaseAccountingPreview; track l.side + l.glCode) {
|
||||||
|
<tr>
|
||||||
|
<td>{{ l.side }}</td>
|
||||||
|
<td>{{ l.glCode }}</td>
|
||||||
|
<td>{{ l.glName || '—' }}</td>
|
||||||
|
<td class="num">₹{{ l.amount | number: '1.2-2' }}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
} @else {
|
||||||
|
<p class="pg-sub">Select a script, enter the amount and CR. To A/c to see the entry.</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- 4. More details — optional, collapsed by default -->
|
||||||
|
<div class="inv-form-actions">
|
||||||
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="showMoreDetails = !showMoreDetails">
|
||||||
|
{{ showMoreDetails ? '▾ Hide More Details' : '▸ More Details (optional)' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
@if (showMoreDetails) {
|
||||||
|
<div class="pos-section-label">More Details (optional)</div>
|
||||||
|
<div class="inv-form-grid">
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Deal Time (HH:mm:ss)</span
|
||||||
|
><input type="text" [(ngModel)]="purchaseForm.dealTime" placeholder="HH:mm:ss"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Int Type</span>
|
<span>Sub Type</span>
|
||||||
<select [(ngModel)]="purchaseForm.intType">
|
<select [(ngModel)]="purchaseForm.subType">
|
||||||
@for (i of intTypeOptions; track i.value) {
|
@for (s of subTypeOptions; track s.subTypeCode + s.subTypeName) {
|
||||||
<option [value]="i.value">{{ i.label }}</option>
|
<option [value]="s.subTypeName">{{ s.subTypeName }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
@if (isMutualFund) {
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Trade Amt</span><input type="number" [(ngModel)]="purchaseForm.tradeAmt" min="0"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Stamp Duty</span><input type="number" [(ngModel)]="purchaseForm.stampDuty" min="0"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Stamp Duty A/c</span><input type="text" [(ngModel)]="purchaseForm.stampDutyAc"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Holding Days</span><input type="number" [(ngModel)]="purchaseForm.holdingDays" min="0"
|
||||||
|
/></label>
|
||||||
|
} @else {
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Int Type</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.intType">
|
||||||
|
@for (i of intTypeOptions; track i.value) {
|
||||||
|
<option [value]="i.value">{{ i.label }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Bond Rating</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.bondRating">
|
||||||
|
@for (r of bondRatingOptions; track r) {
|
||||||
|
<option [value]="r">{{ r }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>SGL with Bank</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.sglWithBank">
|
||||||
|
<option value="">-- Select --</option>
|
||||||
|
@for (s of sglBankOptions; track s.sglCode) {
|
||||||
|
<option [value]="s.bankName">{{ s.bankName }} — {{ s.branch }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>TBill GL A/c</span><input type="text" [(ngModel)]="purchaseForm.tbillGlAc"
|
||||||
|
/></label>
|
||||||
|
}
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Brokerage (₹)</span><input type="number" [(ngModel)]="purchaseForm.brokerage" min="0"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Broker</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.brokerName">
|
||||||
|
<option value="">-- Select --</option>
|
||||||
|
@for (b of brokerOptions; track b.brokerCode) {
|
||||||
|
<option [value]="b.brokerCode">{{ b.brokerCode }} — {{ b.brokerName }}</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Int Date</span><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.intDate"></mifosx-date-ddmmyyyy
|
><span>Trade No.</span><input type="text" [(ngModel)]="purchaseForm.tradeNo"
|
||||||
></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>* Last Int.dt</span><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.lastIntDt"></mifosx-date-ddmmyyyy
|
|
||||||
></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Accrued Interest (computed)</span
|
|
||||||
><input type="text" [value]="purchaseAccruedInterest | number: '1.2-2'" readonly
|
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Settlement Amt of Pur. (computed)</span
|
><span>Order No.</span><input type="text" [(ngModel)]="purchaseForm.orderNo"
|
||||||
><input type="text" [value]="purchaseSettlementAmount | number: '1.4-4'" readonly
|
/></label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Recomm. Authority</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.recommAuthority">
|
||||||
|
<option value="">-- Select --</option>
|
||||||
|
@for (a of authorityOptions; track a) {
|
||||||
|
<option [value]="a">{{ a }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Sanction Authority</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.sanctionAuthority">
|
||||||
|
<option value="">-- Select --</option>
|
||||||
|
@for (a of authorityOptions; track a) {
|
||||||
|
<option [value]="a">{{ a }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Meet Date</span><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.meetDt"></mifosx-date-ddmmyyyy
|
||||||
|
></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Reso No</span><input type="text" [(ngModel)]="purchaseForm.resoNo"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Deal Type</span>
|
<span>Deal Type</span>
|
||||||
@@ -423,6 +471,80 @@
|
|||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Payment Mode</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.paymentMode">
|
||||||
|
<option value="">-- Select --</option>
|
||||||
|
@for (p of paymentModeOptions; track p) {
|
||||||
|
<option [value]="p">{{ p }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Delivery Mode</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.deliveryMode">
|
||||||
|
<option value="">-- Select --</option>
|
||||||
|
@for (d of deliveryModeOptions; track d) {
|
||||||
|
<option [value]="d">{{ d }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>LIEN</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.lien">
|
||||||
|
<option value="NO">NO</option>
|
||||||
|
<option value="YES">YES</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
@if (purchaseForm.lien === 'YES') {
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>LIEN Amount</span><input type="number" [(ngModel)]="purchaseForm.lienAmount"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>LIEN Reason</span>
|
||||||
|
<select [(ngModel)]="purchaseForm.lienReason">
|
||||||
|
<option value="">-- Select --</option>
|
||||||
|
@for (l of lienReasonOptions; track l.reasonCode) {
|
||||||
|
<option [value]="l.reasonDescription">{{ l.reasonDescription }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
}
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Folio No</span><input type="text" [(ngModel)]="purchaseForm.folioNo"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Call Option</span><input type="text" [(ngModel)]="purchaseForm.callOption"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Register Address</span><input type="text" [(ngModel)]="purchaseForm.registerAdd"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Register City</span><input type="text" [(ngModel)]="purchaseForm.regiCity"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Register Pin</span><input type="text" [(ngModel)]="purchaseForm.regiPin"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Issue Date (override)</span
|
||||||
|
><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.issueDate"></mifosx-date-ddmmyyyy
|
||||||
|
></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Redum / Mat Date (override)</span
|
||||||
|
><input type="text" [(ngModel)]="purchaseForm.redumMatDt" placeholder="DD-MM-YYYY"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Int Date</span><mifosx-date-ddmmyyyy [(ngModel)]="purchaseForm.intDate"></mifosx-date-ddmmyyyy
|
||||||
|
></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Desc Inv</span><input type="text" [(ngModel)]="purchaseForm.descInv"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>From Dist</span><input type="text" [(ngModel)]="purchaseForm.fromDist"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>To Dist</span><input type="text" [(ngModel)]="purchaseForm.toDist"
|
||||||
|
/></label>
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Mark CBLO</span>
|
<span>Mark CBLO</span>
|
||||||
<select [(ngModel)]="purchaseForm.markCblo">
|
<select [(ngModel)]="purchaseForm.markCblo">
|
||||||
@@ -433,14 +555,6 @@
|
|||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Amortize Amt.</span><input type="number" [(ngModel)]="purchaseForm.amortizeAmt"
|
><span>Amortize Amt.</span><input type="number" [(ngModel)]="purchaseForm.amortizeAmt"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>Bond Rating</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.bondRating">
|
|
||||||
@for (r of bondRatingOptions; track r) {
|
|
||||||
<option [value]="r">{{ r }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Corp. Bond</span>
|
<span>Corp. Bond</span>
|
||||||
<select [(ngModel)]="purchaseForm.corpBond">
|
<select [(ngModel)]="purchaseForm.corpBond">
|
||||||
@@ -448,76 +562,19 @@
|
|||||||
<option value="YES">YES</option>
|
<option value="YES">YES</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>SGL with Bank</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.sglWithBank">
|
|
||||||
<option value="">-- Select --</option>
|
|
||||||
@for (s of sglBankOptions; track s.sglCode) {
|
|
||||||
<option [value]="s.bankName">{{ s.bankName }} — {{ s.branch }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Register Add</span><input type="text" [(ngModel)]="purchaseForm.registerAdd"
|
><span>Remarks</span><input type="text" [(ngModel)]="purchaseForm.remarks"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Regi City</span><input type="text" [(ngModel)]="purchaseForm.regiCity"
|
><span>Description</span><input type="text" [(ngModel)]="purchaseForm.description"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="inv-form-field"
|
</div>
|
||||||
><span>Regi Pin</span><input type="text" [(ngModel)]="purchaseForm.regiPin"
|
}
|
||||||
/></label>
|
|
||||||
}
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>LIEN</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.lien">
|
|
||||||
<option value="NO">NO</option>
|
|
||||||
<option value="YES">YES</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
@if (purchaseForm.lien === 'YES') {
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>LIEN Amount</span><input type="number" [(ngModel)]="purchaseForm.lienAmount"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>LIEN Reason</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.lienReason">
|
|
||||||
<option value="">-- Select --</option>
|
|
||||||
@for (l of lienReasonOptions; track l.reasonCode) {
|
|
||||||
<option [value]="l.reasonDescription">{{ l.reasonDescription }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
}
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>Payment Mode</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.paymentMode">
|
|
||||||
<option value="">--Select--</option>
|
|
||||||
@for (p of paymentModeOptions; track p) {
|
|
||||||
<option [value]="p">{{ p }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field">
|
|
||||||
<span>Delivery Mode</span>
|
|
||||||
<select [(ngModel)]="purchaseForm.deliveryMode">
|
|
||||||
<option value="">--Select--</option>
|
|
||||||
@for (d of deliveryModeOptions; track d) {
|
|
||||||
<option [value]="d">{{ d }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Remarks</span><input type="text" [(ngModel)]="purchaseForm.remarks"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Description</span><input type="text" [(ngModel)]="purchaseForm.description"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Maturity / Redemption Value (computed)</span
|
|
||||||
><input type="text" [value]="'₹' + (purchaseMaturityAmount | number: '1.2-2')" readonly
|
|
||||||
/></label>
|
|
||||||
</div>
|
|
||||||
<div class="inv-form-actions">
|
<div class="inv-form-actions">
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Retrieve Cert No</span><input type="text" placeholder="e.g. 30" [(ngModel)]="retrieveCertNo"
|
||||||
|
/></label>
|
||||||
<button type="button" class="pg-btn pg-btn--primary" (click)="savePurchase()">Save</button>
|
<button type="button" class="pg-btn pg-btn--primary" (click)="savePurchase()">Save</button>
|
||||||
<button type="button" class="pg-btn pg-btn--ghost" (click)="retrievePurchase()">Retrieve</button>
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="retrievePurchase()">Retrieve</button>
|
||||||
<button type="button" class="pg-btn pg-btn--ghost" (click)="dropPurchase()">Drop</button>
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="dropPurchase()">Drop</button>
|
||||||
@@ -569,20 +626,14 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<!-- ===================== 03 INTEREST ENTRY / CALCULATION ===================== -->
|
<!-- ===================== 03 INTEREST ENTRY ===================== -->
|
||||||
@if (activeTab === 'interest') {
|
@if (activeTab === 'interest') {
|
||||||
<div class="pg-card">
|
<div class="pg-card">
|
||||||
<div class="pos-section-label">Investment - Govt./Bond Interest calculation</div>
|
<div class="pos-section-label">Interest Entry — coupon and 31 Mar / 30 Sep provision schedule</div>
|
||||||
<div class="inv-form-grid">
|
<div class="inv-form-grid">
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>From Date</span><mifosx-date-ddmmyyyy [(ngModel)]="intCalcFromDate"></mifosx-date-ddmmyyyy
|
|
||||||
></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>To Date</span><mifosx-date-ddmmyyyy [(ngModel)]="intCalcToDate"></mifosx-date-ddmmyyyy
|
|
||||||
></label>
|
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Type</span>
|
<span>Type</span>
|
||||||
<select [(ngModel)]="intCalcType" (ngModelChange)="onIntCalcTypeChange()">
|
<select [(ngModel)]="intType" (ngModelChange)="onIntFilterChange()">
|
||||||
<option value="">-- All Types --</option>
|
<option value="">-- All Types --</option>
|
||||||
@for (o of bondTypeOptions; track o.value) {
|
@for (o of bondTypeOptions; track o.value) {
|
||||||
<option [value]="o.value">{{ o.label }}</option>
|
<option [value]="o.value">{{ o.label }}</option>
|
||||||
@@ -591,67 +642,149 @@
|
|||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Script</span>
|
<span>Script</span>
|
||||||
<select [(ngModel)]="intCalcScript">
|
<select [(ngModel)]="intScript" (ngModelChange)="onIntFilterChange()">
|
||||||
<option value="">-- All Scripts --</option>
|
<option value="">-- All Scripts --</option>
|
||||||
@for (s of scriptOptions; track s.scriptCode) {
|
@for (s of intScriptOptions; track s.scriptCode) {
|
||||||
<option [value]="s.scriptCode">{{ s.scriptCode }} — {{ s.scriptName }}</option>
|
<option [value]="s.scriptCode">{{ s.scriptCode }} — {{ s.scriptName }}</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field"><span>Deal No</span><input type="text" [(ngModel)]="intCalcDealNo" /></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>ALL</span><input type="checkbox" [(ngModel)]="intCalcAll" style="height: 18px; width: 18px"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Post To (Interest Income GL)</span>
|
<span>* Deal No</span>
|
||||||
<select [(ngModel)]="intCalcGlCode">
|
<select [(ngModel)]="intPurchaseId" (ngModelChange)="intSchedule = null">
|
||||||
@for (g of interestIncomeGlOptions; track g.glCode) {
|
<option [ngValue]="null">-- Select --</option>
|
||||||
<option [value]="g.glCode">{{ g.glCode }} — {{ g.glName }}</option>
|
@for (h of intDealOptions; track h.id) {
|
||||||
|
<option [ngValue]="h.id">{{ h.dealNo }} — {{ h.scriptCode }} (Cert {{ h.certNo }})</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>As On Date</span><mifosx-date-ddmmyyyy [(ngModel)]="intAsOnDate"></mifosx-date-ddmmyyyy
|
||||||
|
></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="inv-form-actions">
|
<div class="inv-form-actions">
|
||||||
<button type="button" class="pg-btn pg-btn--primary" (click)="processInterest()">Process</button>
|
<button
|
||||||
|
type="button"
|
||||||
|
class="pg-btn pg-btn--primary"
|
||||||
|
[disabled]="intLoading"
|
||||||
|
(click)="retrieveInterestSchedule()"
|
||||||
|
>
|
||||||
|
{{ intLoading ? 'Retrieving…' : 'Retrieve' }}
|
||||||
|
</button>
|
||||||
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
|
||||||
</div>
|
</div>
|
||||||
@if (intCalcExcludedNpi.length > 0) {
|
|
||||||
|
@if (intSchedule; as sc) {
|
||||||
|
<div class="pos-section-label">Purchase Details</div>
|
||||||
|
<div class="inv-form-grid">
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Deal No / Cert No</span><input type="text" [value]="sc.dealNo + ' / ' + sc.certNo" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Script</span><input type="text" [value]="sc.scriptCode + ' — ' + sc.scriptDesc" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Face Value Held</span><input type="text" [value]="'₹' + (sc.faceValue | number: '1.2-2')" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Interest Rate</span><input type="text" [value]="sc.intRate + '%'" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Coupon per Half-Year</span
|
||||||
|
><input type="text" [value]="'₹' + (sc.couponPerHalfYear | number: '1.2-2')" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Deal Date</span><input type="text" [value]="sc.dealDate" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Last Interest Date</span><input type="text" [value]="sc.lastIntDate" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Maturity Date</span><input type="text" [value]="sc.maturityDate" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Accrued Interest Paid at Purchase</span
|
||||||
|
><input type="text" [value]="'₹' + (sc.purchasedAccruedInterest | number: '1.2-2')" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Book Value</span><input type="text" [value]="'₹' + (sc.bookValue | number: '1.2-2')" readonly
|
||||||
|
/></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pos-section-label">
|
||||||
|
Interest Schedule ({{ sc.rows.length }} lines) — due up to {{ sc.asOnDate }}: ₹{{
|
||||||
|
intDueTotal | number: '1.2-2'
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
<p class="pg-sub" style="padding: 0 16px">
|
||||||
|
Days are 30/360. A provision books the interest earned since the last coupon; the coupon then clears what is
|
||||||
|
already booked. Display only — nothing is posted to GL yet.
|
||||||
|
</p>
|
||||||
|
<table class="pg-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Int Date</th>
|
||||||
|
<th>From</th>
|
||||||
|
<th>To</th>
|
||||||
|
<th class="num">Days</th>
|
||||||
|
<th class="num">Int %</th>
|
||||||
|
<th class="num">Gross Interest</th>
|
||||||
|
<th class="num">Already Booked</th>
|
||||||
|
<th class="num col-in">Amount</th>
|
||||||
|
<th>Accounting</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (r of sc.rows; track r.intDate) {
|
||||||
|
<tr [style.opacity]="r.due ? 1 : 0.6">
|
||||||
|
<td>
|
||||||
|
<span class="pg-chip">{{ r.type === 'COUPON' ? 'Coupon' : 'Provision' }}</span>
|
||||||
|
@if (r.due) {
|
||||||
|
<span class="pg-chip">Due</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td>{{ r.intDate }}</td>
|
||||||
|
<td>{{ r.fromDate }}</td>
|
||||||
|
<td>{{ r.toDate }}</td>
|
||||||
|
<td class="num">{{ r.days }}</td>
|
||||||
|
<td class="num">{{ sc.intRate }}</td>
|
||||||
|
<td class="num">₹{{ r.grossInterest | number: '1.2-2' }}</td>
|
||||||
|
<td class="num">₹{{ r.alreadyBooked | number: '1.2-2' }}</td>
|
||||||
|
<td class="num col-in">₹{{ r.amount | number: '1.2-2' }}</td>
|
||||||
|
<td style="white-space: nowrap; font-size: 12px">
|
||||||
|
@if (r.type === 'COUPON') {
|
||||||
|
<div>Dr Bank ₹{{ r.grossInterest | number: '1.0-0' }}</div>
|
||||||
|
@if (r.alreadyBooked > 0) {
|
||||||
|
<div>
|
||||||
|
Cr {{ interestReceivableGl.glCode }} Int. Receivable ₹{{ r.alreadyBooked | number: '1.0-0' }}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div>Cr {{ sc.interestGlCode }} Int. Income ₹{{ r.amount | number: '1.0-0' }}</div>
|
||||||
|
} @else {
|
||||||
|
<div>Dr {{ interestReceivableGl.glCode }} Int. Receivable ₹{{ r.amount | number: '1.0-0' }}</div>
|
||||||
|
<div>Cr {{ sc.interestGlCode }} Int. Income ₹{{ r.amount | number: '1.0-0' }}</div>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
} @empty {
|
||||||
|
<tr>
|
||||||
|
<td colspan="10" class="pg-empty">
|
||||||
|
No interest lines — check the rate, last interest date and maturity date.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p class="pg-sub" style="padding: 8px 16px 12px">
|
||||||
|
Interest income GL: {{ sc.interestGlCode }} — {{ sc.interestGlName }}. Posting to GL will be enabled after
|
||||||
|
approval.
|
||||||
|
</p>
|
||||||
|
} @else {
|
||||||
<p class="pg-sub" style="padding: 0 16px 12px">
|
<p class="pg-sub" style="padding: 0 16px 12px">
|
||||||
{{ intCalcExcludedNpi.length }} holding(s) excluded — classified Non-Performing, interest is not posted on
|
Select a Deal No and press Retrieve to see its interest schedule.
|
||||||
accrual basis (collectible on cash basis only, via Interest Receive in the Investment Interest module).
|
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
<div class="pos-section-label">Holdings matching the filter ({{ intCalcTargets.length }})</div>
|
|
||||||
<table class="pg-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Cert No</th>
|
|
||||||
<th>Script</th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th class="num">Rate</th>
|
|
||||||
<th>Frequency</th>
|
|
||||||
<th class="num col-in">Interest to Post</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@for (h of intCalcTargets; track h.certNo) {
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span class="pg-chip">{{ h.certNo }}</span>
|
|
||||||
</td>
|
|
||||||
<td>{{ h.scriptName }}</td>
|
|
||||||
<td>{{ instrumentLabel(h.instrumentType) }}</td>
|
|
||||||
<td class="num">{{ h.interestRate }}%</td>
|
|
||||||
<td>{{ h.interestFreq }}</td>
|
|
||||||
<td class="num col-in">₹{{ interestAccrued(h) | number: '1.2-2' }}</td>
|
|
||||||
</tr>
|
|
||||||
} @empty {
|
|
||||||
<tr>
|
|
||||||
<td colspan="6" class="pg-empty">No holdings match the selected filters.</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,11 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { DateDdmmyyyyPickerComponent } from '../date-ddmmyyyy-picker/date-ddmmyyyy-picker.component';
|
import { DateDdmmyyyyPickerComponent } from '../date-ddmmyyyy-picker/date-ddmmyyyy-picker.component';
|
||||||
import {
|
import {
|
||||||
GOVT_SECURITY_HOLDINGS,
|
|
||||||
NON_SLR_HOLDINGS,
|
|
||||||
BOND_HOLDINGS,
|
|
||||||
MUTUAL_FUND_HOLDINGS,
|
|
||||||
ALL_TXNS,
|
|
||||||
SCRIPT_MASTER,
|
SCRIPT_MASTER,
|
||||||
PARTY_MASTER,
|
PARTY_MASTER,
|
||||||
SUBTYPE_MASTER,
|
SUBTYPE_MASTER,
|
||||||
@@ -31,16 +26,20 @@ import {
|
|||||||
BOND_RATING_OPTIONS,
|
BOND_RATING_OPTIONS,
|
||||||
INT_TYPE_OPTIONS,
|
INT_TYPE_OPTIONS,
|
||||||
AUTHORITY_OPTIONS,
|
AUTHORITY_OPTIONS,
|
||||||
INTEREST_INCOME_GL_MASTER,
|
INVESTMENT_GL_BY_TYPE,
|
||||||
INTEREST_INCOME_GL_BY_TYPE,
|
INVESTMENT_GL_LOOKUP,
|
||||||
|
INTEREST_RECEIVABLE_GL,
|
||||||
|
SETTLEMENT_BANK_GL_OPTIONS,
|
||||||
|
periodBetween,
|
||||||
|
parseDDMMYYYY,
|
||||||
|
days360,
|
||||||
|
lastHalfYearlyCouponDate,
|
||||||
InvestmentHolding,
|
InvestmentHolding,
|
||||||
InvestmentTxn,
|
InvestmentTxn,
|
||||||
InstrumentType,
|
InstrumentType,
|
||||||
InterestFreq,
|
InterestFreq,
|
||||||
INSTRUMENT_LABELS,
|
INSTRUMENT_LABELS,
|
||||||
accruedInterest,
|
accruedInterest,
|
||||||
accruedInterestBetween,
|
|
||||||
canAccrueInterest,
|
|
||||||
daysToMaturity,
|
daysToMaturity,
|
||||||
maturityAmount,
|
maturityAmount,
|
||||||
addPeriod,
|
addPeriod,
|
||||||
@@ -49,6 +48,13 @@ import {
|
|||||||
todayDDMMYYYY
|
todayDDMMYYYY
|
||||||
} from '../investment-data';
|
} from '../investment-data';
|
||||||
import { exportWorkbook } from '../investment-export';
|
import { exportWorkbook } from '../investment-export';
|
||||||
|
import {
|
||||||
|
InvestmentInterestScheduleDto,
|
||||||
|
InvestmentPurchaseDto,
|
||||||
|
InvestmentService,
|
||||||
|
apiErrorMessage,
|
||||||
|
toHolding
|
||||||
|
} from '../investment.service';
|
||||||
|
|
||||||
type BondType = 'GOVT_SECURITY' | 'NON_SLR' | 'BOND' | 'MUTUAL_FUND';
|
type BondType = 'GOVT_SECURITY' | 'NON_SLR' | 'BOND' | 'MUTUAL_FUND';
|
||||||
type BondTab =
|
type BondTab =
|
||||||
@@ -131,6 +137,13 @@ interface BondPurchaseForm {
|
|||||||
stampDutyAc: string;
|
stampDutyAc: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface AccountingPreviewLine {
|
||||||
|
side: 'Dr' | 'Cr';
|
||||||
|
glCode: string;
|
||||||
|
glName: string;
|
||||||
|
amount: number;
|
||||||
|
}
|
||||||
|
|
||||||
interface BondSellForm {
|
interface BondSellForm {
|
||||||
/** Legacy screen has SELL / REDEEM / MUTUAL FUND SELL radio at the top. */
|
/** Legacy screen has SELL / REDEEM / MUTUAL FUND SELL radio at the top. */
|
||||||
mode: 'SELL' | 'REDEEM' | 'MUTUAL_FUND_SELL';
|
mode: 'SELL' | 'REDEEM' | 'MUTUAL_FUND_SELL';
|
||||||
@@ -182,23 +195,67 @@ interface BondSellForm {
|
|||||||
DateDdmmyyyyPickerComponent
|
DateDdmmyyyyPickerComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class BondInvestmentComponent {
|
export class BondInvestmentComponent implements OnInit {
|
||||||
|
private readonly investmentService = inject(InvestmentService);
|
||||||
|
|
||||||
|
/** Script and party dropdowns offer the masters saved in the backend. */
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.investmentService.syncSharedMasters().subscribe({
|
||||||
|
error: (err) => this.toast(`Could not load Script / Party masters: ${apiErrorMessage(err)}`)
|
||||||
|
});
|
||||||
|
this.investmentService.getAssetGlAccounts().subscribe({
|
||||||
|
next: (gls) =>
|
||||||
|
(this.glIdByCode = new Map(
|
||||||
|
gls.map((g) => [
|
||||||
|
g.glCode,
|
||||||
|
g.id
|
||||||
|
])
|
||||||
|
)),
|
||||||
|
error: (err) => this.toast(`Could not load GL accounts: ${apiErrorMessage(err)}`)
|
||||||
|
});
|
||||||
|
this.loadPurchases();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** GL id for a GL code — the purchase API takes ids, the form works with codes. */
|
||||||
|
private glIdByCode = new Map<string, number>();
|
||||||
|
|
||||||
|
/** The Holdings register and transaction log are the purchases saved in the backend. */
|
||||||
|
private loadPurchases(): void {
|
||||||
|
this.investmentService.getPurchases().subscribe({
|
||||||
|
next: (purchases) => {
|
||||||
|
this.holdings = purchases.map(toHolding);
|
||||||
|
this.txns = purchases.map((d) => this.purchaseTxn(d));
|
||||||
|
this.purchaseForm = this.blankPurchaseForm();
|
||||||
|
},
|
||||||
|
error: (err) => this.toast(`Could not load purchases: ${apiErrorMessage(err)}`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private purchaseTxn(d: InvestmentPurchaseDto): InvestmentTxn {
|
||||||
|
return {
|
||||||
|
certNo: d.certNo,
|
||||||
|
instrumentType: d.bondType,
|
||||||
|
txnType: 'PURCHASE',
|
||||||
|
voucherNo: `INV/PUR/${d.dealNo}`,
|
||||||
|
txnDate: d.dealDate,
|
||||||
|
amount: d.settlementAmount,
|
||||||
|
particulars: `Purchase Deal ${d.dealNo} - ${d.scriptDesc} - ${d.partyName} [${d.category}]`,
|
||||||
|
glCode: d.investmentGlCode,
|
||||||
|
glName: d.investmentGlName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
activeTab: BondTab = 'holdings';
|
activeTab: BondTab = 'holdings';
|
||||||
|
/** Purchase Entry shows only the mandatory fields; the rest sit under "More Details". */
|
||||||
|
showMoreDetails = false;
|
||||||
|
/** Cert No typed in the Retrieve box (Cert No itself is system-generated and read-only). */
|
||||||
|
retrieveCertNo = '';
|
||||||
bondType: BondType = 'GOVT_SECURITY';
|
bondType: BondType = 'GOVT_SECURITY';
|
||||||
asOnDate = todayDDMMYYYY();
|
asOnDate = todayDDMMYYYY();
|
||||||
|
|
||||||
holdings: InvestmentHolding[] = [
|
/** Loaded from the backend (saved purchases) in ngOnInit. */
|
||||||
...GOVT_SECURITY_HOLDINGS,
|
holdings: InvestmentHolding[] = [];
|
||||||
...NON_SLR_HOLDINGS,
|
txns: InvestmentTxn[] = [];
|
||||||
...BOND_HOLDINGS,
|
|
||||||
...MUTUAL_FUND_HOLDINGS
|
|
||||||
];
|
|
||||||
txns: InvestmentTxn[] = ALL_TXNS.filter((t) => ([
|
|
||||||
'GOVT_SECURITY',
|
|
||||||
'NON_SLR',
|
|
||||||
'BOND',
|
|
||||||
'MUTUAL_FUND'
|
|
||||||
] as InstrumentType[]).includes(t.instrumentType));
|
|
||||||
|
|
||||||
// Master-driven dropdown sources
|
// Master-driven dropdown sources
|
||||||
readonly scriptOptions = SCRIPT_MASTER;
|
readonly scriptOptions = SCRIPT_MASTER;
|
||||||
@@ -224,23 +281,23 @@ export class BondInvestmentComponent {
|
|||||||
|
|
||||||
purchaseForm: BondPurchaseForm = this.blankPurchaseForm();
|
purchaseForm: BondPurchaseForm = this.blankPurchaseForm();
|
||||||
sellForm: BondSellForm = this.blankSellForm();
|
sellForm: BondSellForm = this.blankSellForm();
|
||||||
|
readonly settlementBankOptions = SETTLEMENT_BANK_GL_OPTIONS;
|
||||||
|
|
||||||
// Redemption Entry
|
// Redemption Entry
|
||||||
redeemCertNo = '';
|
redeemCertNo = '';
|
||||||
redeemDate = this.asOnDate;
|
redeemDate = this.asOnDate;
|
||||||
redeemRemarks = '';
|
redeemRemarks = '';
|
||||||
|
|
||||||
// Interest Calculation (legacy: From/To Date / Type / Script / Deal No / ALL + Process) —
|
// 03 Interest Entry (legacy: Type / Script / Deal No + Retrieve) — the backend works out every
|
||||||
// posts interest accrued strictly within [intCalcFromDate, intCalcToDate], same period-based
|
// half-yearly coupon and 31 Mar / 30 Sep closing provision of the holding. Display only:
|
||||||
// basis as the Investment Interest module's Govt./Bond Interest Calculation.
|
// nothing is posted to GL until the posting rules are approved.
|
||||||
intCalcFromDate = addPeriod(this.asOnDate, 0, -3);
|
intType: BondType | '' = '';
|
||||||
intCalcToDate = this.asOnDate;
|
intScript = '';
|
||||||
intCalcType: BondType | '' = '';
|
intPurchaseId: number | null = null;
|
||||||
intCalcScript = '';
|
intAsOnDate = this.asOnDate;
|
||||||
intCalcDealNo = '';
|
intSchedule: InvestmentInterestScheduleDto | null = null;
|
||||||
intCalcAll = false;
|
intLoading = false;
|
||||||
intCalcGlCode = INTEREST_INCOME_GL_BY_TYPE.GOVT_SECURITY;
|
readonly interestReceivableGl = INTEREST_RECEIVABLE_GL;
|
||||||
readonly interestIncomeGlOptions = INTEREST_INCOME_GL_MASTER;
|
|
||||||
|
|
||||||
// Write-off
|
// Write-off
|
||||||
writeoffCertNo = '';
|
writeoffCertNo = '';
|
||||||
@@ -305,20 +362,37 @@ export class BondInvestmentComponent {
|
|||||||
return INSTRUMENT_LABELS[type];
|
return INSTRUMENT_LABELS[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Preview of the deal number the backend will assign: FY prefix (e.g. 202627) + running number. */
|
||||||
private nextDealNo(): string {
|
private nextDealNo(): string {
|
||||||
return `2026${String(27000039 + this.holdings.length).padStart(9, '0')}`;
|
const d = parseDDMMYYYY(this.asOnDate);
|
||||||
|
const fyStart = d.getMonth() >= 3 ? d.getFullYear() : d.getFullYear() - 1;
|
||||||
|
const prefix = `${fyStart}${String((fyStart + 1) % 100).padStart(2, '0')}`;
|
||||||
|
const nums = (this.holdings ?? [])
|
||||||
|
.map((h) => h.dealNo)
|
||||||
|
.filter((n): n is string => !!n && n.startsWith(prefix))
|
||||||
|
.map((n) => parseInt(n.slice(prefix.length), 10));
|
||||||
|
return `${prefix}${String((nums.length ? Math.max(...nums) : 0) + 1).padStart(6, '0')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Certificate No is system-generated, as in the existing CBS (greyed there). */
|
||||||
|
/** Preview of the certificate number the backend will assign (running number). */
|
||||||
|
private nextCertNo(): string {
|
||||||
|
const nums = (this.holdings ?? []).map((h) => parseInt(h.certNo, 10)).filter((n) => !isNaN(n));
|
||||||
|
return String((nums.length ? Math.max(...nums) : 0) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private blankPurchaseForm(): BondPurchaseForm {
|
private blankPurchaseForm(): BondPurchaseForm {
|
||||||
const type = this.bondType ?? 'GOVT_SECURITY';
|
const type = this.bondType ?? 'GOVT_SECURITY';
|
||||||
|
this.showMoreDetails = false;
|
||||||
|
this.retrieveCertNo = '';
|
||||||
return {
|
return {
|
||||||
bondType: type,
|
bondType: type,
|
||||||
dealNo: this.nextDealNo(),
|
dealNo: this.nextDealNo(),
|
||||||
dealDate: this.asOnDate,
|
dealDate: this.asOnDate,
|
||||||
dealTime: '',
|
dealTime: new Date().toTimeString().slice(0, 8),
|
||||||
isin: '',
|
isin: '',
|
||||||
scriptCode: '',
|
scriptCode: '',
|
||||||
certNo: '',
|
certNo: this.nextCertNo(),
|
||||||
settlementType: 'T+0',
|
settlementType: 'T+0',
|
||||||
settlementDt: this.asOnDate,
|
settlementDt: this.asOnDate,
|
||||||
faceValue: null,
|
faceValue: null,
|
||||||
@@ -326,7 +400,7 @@ export class BondInvestmentComponent {
|
|||||||
partyCode: '',
|
partyCode: '',
|
||||||
subType: type === 'GOVT_SECURITY' ? 'SLR' : type === 'NON_SLR' ? 'NON SLR' : 'CORPORATE BOND',
|
subType: type === 'GOVT_SECURITY' ? 'SLR' : type === 'NON_SLR' ? 'NON SLR' : 'CORPORATE BOND',
|
||||||
tbillGlAc: '',
|
tbillGlAc: '',
|
||||||
crToAc: '310070',
|
crToAc: SETTLEMENT_BANK_GL_OPTIONS[0]?.glCode ?? '',
|
||||||
premiumAmt: null,
|
premiumAmt: null,
|
||||||
brokerage: null,
|
brokerage: null,
|
||||||
brokerName: '',
|
brokerName: '',
|
||||||
@@ -463,13 +537,41 @@ export class BondInvestmentComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Accrued Interest at purchase — interest earned by the seller since the last coupon date. */
|
/** Accrued Interest at purchase — interest earned by the seller since the last coupon date. */
|
||||||
|
/** Interest owed to the seller from the last coupon date up to the deal date, on a 30/360 basis —
|
||||||
|
* interest is counted to the event date, not the date the money moves (Jitendra Sir). */
|
||||||
get purchaseAccruedInterest(): number {
|
get purchaseAccruedInterest(): number {
|
||||||
const f = this.purchaseForm;
|
const f = this.purchaseForm;
|
||||||
if (!f.intRate || !f.lastIntDt || !f.dealDate) {
|
if (!f.intRate || !f.lastIntDt || !f.dealDate) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const yrs = Math.max(0, yearsBetween(f.lastIntDt, f.dealDate));
|
return Math.round((this.purchaseBaseAmount * (f.intRate / 100) * days360(f.lastIntDt, f.dealDate)) / 360);
|
||||||
return Math.round(this.purchaseBaseAmount * (f.intRate / 100) * yrs);
|
}
|
||||||
|
|
||||||
|
get purchaseAccruedDays(): number {
|
||||||
|
const f = this.purchaseForm;
|
||||||
|
return f.lastIntDt && f.dealDate ? days360(f.lastIntDt, f.dealDate) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Premium (+) or discount (−) paid over face value. */
|
||||||
|
get purchasePremiumDiscount(): number {
|
||||||
|
const f = this.purchaseForm;
|
||||||
|
if (this.isMutualFund || !f.faceValue || !f.purchaseRate) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Math.round((f.faceValue * (f.purchaseRate - 100)) / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Re-suggests the last coupon date when the deal date changes. */
|
||||||
|
onDealDateChange(): void {
|
||||||
|
this.suggestLastIntDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private suggestLastIntDate(): void {
|
||||||
|
const f = this.purchaseForm;
|
||||||
|
const s = this.purchaseScript;
|
||||||
|
if (!this.isMutualFund && s?.maturityDate && f.dealDate) {
|
||||||
|
f.lastIntDt = lastHalfYearlyCouponDate(s.maturityDate, f.dealDate) || f.lastIntDt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Settlement Amt of Purchase — book value plus accrued interest payable to the seller. */
|
/** Settlement Amt of Purchase — book value plus accrued interest payable to the seller. */
|
||||||
@@ -504,69 +606,196 @@ export class BondInvestmentComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Fills ISIN + interest rate when a script is picked, mirroring the legacy form's lookup. */
|
get purchaseScript(): (typeof SCRIPT_MASTER)[number] | undefined {
|
||||||
|
return this.scriptOptions.find((x) => x.scriptCode === this.purchaseForm.scriptCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Picking a script pulls its master details into the deal, as the existing CBS does. */
|
||||||
onScriptChange(): void {
|
onScriptChange(): void {
|
||||||
const s = this.scriptOptions.find((x) => x.scriptCode === this.purchaseForm.scriptCode);
|
const s = this.purchaseScript;
|
||||||
if (s) {
|
if (!s) {
|
||||||
this.purchaseForm.isin = s.isin;
|
return;
|
||||||
}
|
}
|
||||||
|
const f = this.purchaseForm;
|
||||||
|
f.isin = s.isin;
|
||||||
|
if (s.couponRate != null) {
|
||||||
|
f.intRate = s.couponRate;
|
||||||
|
}
|
||||||
|
if (s.issueDate) {
|
||||||
|
f.issueDate = s.issueDate;
|
||||||
|
}
|
||||||
|
if (s.maturityDate) {
|
||||||
|
f.redumMatDt = s.maturityDate;
|
||||||
|
const p = periodBetween(s.issueDate, s.maturityDate);
|
||||||
|
f.periodYear = p.years;
|
||||||
|
f.periodMonth = p.months;
|
||||||
|
f.periodDays = p.days;
|
||||||
|
}
|
||||||
|
if (s.slrType) {
|
||||||
|
f.subType = s.slrType === 'NON_SLR' ? 'NON SLR' : 'SLR';
|
||||||
|
}
|
||||||
|
if (this.isMutualFund) {
|
||||||
|
f.productName = s.scriptName;
|
||||||
|
}
|
||||||
|
this.suggestLastIntDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Settlement Date = Deal Date + T+n days (greyed / auto in the existing CBS). */
|
||||||
|
get purchaseSettlementDate(): string {
|
||||||
|
const f = this.purchaseForm;
|
||||||
|
if (!f.dealDate) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const n = parseInt(f.settlementType.replace('T+', ''), 10) || 0;
|
||||||
|
return addPeriod(f.dealDate, 0, 0, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Parties offered for a new deal — inactive parties are hidden. */
|
||||||
|
get activePartyOptions(): typeof PARTY_MASTER {
|
||||||
|
return this.partyOptions.filter((p) => p.status !== 'INACTIVE');
|
||||||
|
}
|
||||||
|
|
||||||
|
get purchaseInvestmentGlCode(): string {
|
||||||
|
return this.purchaseScript?.glCode || INVESTMENT_GL_BY_TYPE[this.purchaseForm.bondType];
|
||||||
|
}
|
||||||
|
|
||||||
|
glNameOf(glCode: string): string {
|
||||||
|
return INVESTMENT_GL_LOOKUP.find((g) => g.glCode === glCode)?.glName ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The journal entry this purchase will post once the checker approves it. */
|
||||||
|
get purchaseAccountingPreview(): AccountingPreviewLine[] {
|
||||||
|
const book = this.purchaseBookValue;
|
||||||
|
const accrued = this.purchaseAccruedInterest;
|
||||||
|
const total = this.purchaseSettlementAmount;
|
||||||
|
const crGl = this.purchaseForm.crToAc;
|
||||||
|
if (!book || !crGl) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const invGl = this.purchaseInvestmentGlCode;
|
||||||
|
const lines: AccountingPreviewLine[] = [
|
||||||
|
{ side: 'Dr', glCode: invGl, glName: this.glNameOf(invGl), amount: book }];
|
||||||
|
if (accrued > 0) {
|
||||||
|
lines.push({
|
||||||
|
side: 'Dr',
|
||||||
|
glCode: INTEREST_RECEIVABLE_GL.glCode,
|
||||||
|
glName: INTEREST_RECEIVABLE_GL.glName,
|
||||||
|
amount: accrued
|
||||||
|
});
|
||||||
|
}
|
||||||
|
lines.push({ side: 'Cr', glCode: crGl, glName: this.glNameOf(crGl), amount: total });
|
||||||
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
savePurchase(): void {
|
savePurchase(): void {
|
||||||
const f = this.purchaseForm;
|
const f = this.purchaseForm;
|
||||||
if (!f.certNo || !this.purchaseBaseAmount || !f.partyCode) {
|
const missing: string[] = [];
|
||||||
this.toast('Please fill Cert No, Face Value / Consider Amt and Party Code.');
|
if (!f.scriptCode) missing.push('Script Code');
|
||||||
|
if (!f.partyCode) missing.push('Party Code');
|
||||||
|
if (!f.dealDate) missing.push('Deal Date');
|
||||||
|
if (this.isMutualFund) {
|
||||||
|
if (!f.considerAmt) missing.push('Consider Amt');
|
||||||
|
if (!f.nav) missing.push('NAV');
|
||||||
|
} else {
|
||||||
|
if (!f.faceValue) missing.push('Face Value');
|
||||||
|
if (!f.purchaseRate) missing.push('Purchase Rate');
|
||||||
|
if (!f.lastIntDt) missing.push('Last Interest Date');
|
||||||
|
}
|
||||||
|
if (!f.category) missing.push('Category');
|
||||||
|
if (!f.crToAc) missing.push('CR. To A/c');
|
||||||
|
if (missing.length) {
|
||||||
|
this.toast(`Please fill: ${missing.join(', ')}.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const holding: InvestmentHolding = {
|
const script = this.purchaseScript;
|
||||||
certNo: f.certNo,
|
const party = this.partyOptions.find((p) => p.partyCode === f.partyCode);
|
||||||
instrumentType: f.bondType,
|
const crGlAccountId = this.glIdByCode.get(f.crToAc);
|
||||||
scriptCode: f.scriptCode || f.isin || f.productName,
|
if (!script?.id || !party?.id) {
|
||||||
scriptName: this.isMutualFund
|
this.toast('Script and Party must be saved in Investment Masters first.');
|
||||||
? f.productName
|
return;
|
||||||
: this.scriptOptions.find((s) => s.scriptCode === f.scriptCode)?.scriptName || f.scriptCode || f.isin,
|
}
|
||||||
party: f.partyCode,
|
if (!crGlAccountId) {
|
||||||
subType: f.subType,
|
this.toast(`GL ${f.crToAc} was not found in the chart of accounts.`);
|
||||||
faceValue: this.purchaseBaseAmount,
|
return;
|
||||||
purchaseRate: this.isMutualFund ? f.nav || 0 : f.purchaseRate || 100,
|
}
|
||||||
units: this.purchaseUnits,
|
const body = {
|
||||||
purchaseDate: f.issueDate,
|
bondType: f.bondType,
|
||||||
maturityDate: this.purchaseMaturityDate || f.issueDate,
|
scriptId: script.id,
|
||||||
interestRate: f.intRate || 0,
|
partyId: party.id,
|
||||||
interestFreq: this.isMutualFund ? 'CUMULATIVE' : f.intType,
|
dealDate: f.dealDate,
|
||||||
glCode:
|
dealTime: f.dealTime || '',
|
||||||
'31' +
|
settlementType: f.settlementType,
|
||||||
(f.bondType === 'GOVT_SECURITY'
|
...(this.isMutualFund
|
||||||
? '0020'
|
? { considerAmt: f.considerAmt, nav: f.nav, stampDuty: f.stampDuty ?? null }
|
||||||
: f.bondType === 'NON_SLR'
|
: { faceValue: f.faceValue, purchaseRate: f.purchaseRate, lastIntDate: f.lastIntDt }),
|
||||||
? '0030'
|
brokerage: f.brokerage ?? null,
|
||||||
: f.bondType === 'BOND'
|
category: f.category,
|
||||||
? '0040'
|
crGlAccountId,
|
||||||
: '0050'),
|
subType: f.subType || '',
|
||||||
glName: `INVESTMENT IN ${INSTRUMENT_LABELS[f.bondType].toUpperCase()}`,
|
otherDetails: this.purchaseOtherDetails(),
|
||||||
crToAc: f.crToAc,
|
dateFormat: 'dd-MM-yyyy',
|
||||||
brokerCode: f.brokerName,
|
locale: 'en'
|
||||||
status: 'ACTIVE'
|
|
||||||
};
|
};
|
||||||
this.holdings = [
|
this.investmentService.createPurchase(body).subscribe({
|
||||||
holding,
|
next: (res) => {
|
||||||
...this.holdings
|
this.toast(`Deal ${res.resourceIdentifier} saved. GL posting will follow once accounting is approved.`);
|
||||||
];
|
this.activeTab = 'holdings';
|
||||||
this.txns = [
|
this.loadPurchases();
|
||||||
{
|
|
||||||
certNo: holding.certNo,
|
|
||||||
instrumentType: f.bondType,
|
|
||||||
txnType: 'PURCHASE',
|
|
||||||
voucherNo: `INV/PUR/${f.dealNo}`,
|
|
||||||
txnDate: f.dealDate,
|
|
||||||
amount: this.purchaseSettlementAmount,
|
|
||||||
particulars: `Purchase Deal ${f.dealNo} - ${holding.scriptName} - ${holding.party}${f.category ? ' [' + f.category + ']' : ''}`
|
|
||||||
},
|
},
|
||||||
...this.txns
|
error: (err) => this.toast(apiErrorMessage(err))
|
||||||
];
|
});
|
||||||
this.toast(`${INSTRUMENT_LABELS[f.bondType]} Certificate ${holding.certNo} saved successfully.`);
|
}
|
||||||
this.purchaseForm = this.blankPurchaseForm();
|
|
||||||
this.activeTab = 'holdings';
|
/** The optional "More Details" fields, kept with the deal as they were entered. */
|
||||||
|
private purchaseOtherDetails(): Record<string, string | number> {
|
||||||
|
const f = this.purchaseForm;
|
||||||
|
const fields: Record<string, string | number | null> = {
|
||||||
|
tradeNo: f.tradeNo,
|
||||||
|
orderNo: f.orderNo,
|
||||||
|
brokerCode: f.brokerName,
|
||||||
|
recommAuthority: f.recommAuthority,
|
||||||
|
sanctionAuthority: f.sanctionAuthority,
|
||||||
|
meetDate: f.meetDt,
|
||||||
|
resoNo: f.resoNo,
|
||||||
|
dealType: f.dealType,
|
||||||
|
market: f.market,
|
||||||
|
markCblo: f.markCblo,
|
||||||
|
paymentMode: f.paymentMode,
|
||||||
|
deliveryMode: f.deliveryMode,
|
||||||
|
lien: f.lien,
|
||||||
|
lienAmount: f.lienAmount,
|
||||||
|
lienReason: f.lienReason,
|
||||||
|
bondRating: f.bondRating,
|
||||||
|
corpBond: f.corpBond,
|
||||||
|
sglWithBank: f.sglWithBank,
|
||||||
|
tbillGlAc: f.tbillGlAc,
|
||||||
|
intType: f.intType,
|
||||||
|
intDate: f.intDate,
|
||||||
|
folioNo: f.folioNo,
|
||||||
|
callOption: f.callOption,
|
||||||
|
descInv: f.descInv,
|
||||||
|
fromDist: f.fromDist,
|
||||||
|
toDist: f.toDist,
|
||||||
|
amortizeAmt: f.amortizeAmt,
|
||||||
|
registerAddress: f.registerAdd,
|
||||||
|
registerCity: f.regiCity,
|
||||||
|
registerPin: f.regiPin,
|
||||||
|
remarks: f.remarks,
|
||||||
|
description: f.description,
|
||||||
|
tradeAmt: f.tradeAmt,
|
||||||
|
holdingDays: f.holdingDays,
|
||||||
|
stampDutyAc: f.stampDutyAc
|
||||||
|
};
|
||||||
|
const out: Record<string, string | number> = {};
|
||||||
|
for (const [
|
||||||
|
k,
|
||||||
|
v
|
||||||
|
] of Object.entries(fields)) {
|
||||||
|
if (v !== null && v !== undefined && v !== '') {
|
||||||
|
out[k] = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelPurchase(): void {
|
cancelPurchase(): void {
|
||||||
@@ -576,9 +805,10 @@ export class BondInvestmentComponent {
|
|||||||
|
|
||||||
/** Legacy "Retrieve" button — loads an existing deal back into the form by Cert No. */
|
/** Legacy "Retrieve" button — loads an existing deal back into the form by Cert No. */
|
||||||
retrievePurchase(): void {
|
retrievePurchase(): void {
|
||||||
const h = this.holdings.find((x) => x.certNo === this.purchaseForm.certNo.trim());
|
const certNo = this.retrieveCertNo.trim();
|
||||||
|
const h = this.holdings.find((x) => x.certNo === certNo);
|
||||||
if (!h) {
|
if (!h) {
|
||||||
this.toast(`Cert No ${this.purchaseForm.certNo} not found.`);
|
this.toast(`Cert No ${certNo || '(blank)'} not found.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.purchaseForm = {
|
this.purchaseForm = {
|
||||||
@@ -587,7 +817,8 @@ export class BondInvestmentComponent {
|
|||||||
certNo: h.certNo,
|
certNo: h.certNo,
|
||||||
scriptCode: h.scriptCode,
|
scriptCode: h.scriptCode,
|
||||||
isin: this.scriptOptions.find((s) => s.scriptCode === h.scriptCode)?.isin || '',
|
isin: this.scriptOptions.find((s) => s.scriptCode === h.scriptCode)?.isin || '',
|
||||||
partyCode: h.party,
|
dealNo: h.dealNo ?? '',
|
||||||
|
partyCode: h.partyCode ?? '',
|
||||||
subType: h.subType,
|
subType: h.subType,
|
||||||
faceValue: h.faceValue,
|
faceValue: h.faceValue,
|
||||||
considerAmt: h.faceValue,
|
considerAmt: h.faceValue,
|
||||||
@@ -599,22 +830,26 @@ export class BondInvestmentComponent {
|
|||||||
intType: h.interestFreq,
|
intType: h.interestFreq,
|
||||||
brokerName: h.brokerCode,
|
brokerName: h.brokerCode,
|
||||||
crToAc: h.crToAc,
|
crToAc: h.crToAc,
|
||||||
productName: h.scriptName
|
productName: h.scriptName,
|
||||||
|
category: h.category ?? ''
|
||||||
};
|
};
|
||||||
this.bondType = h.instrumentType as BondType;
|
this.bondType = h.instrumentType as BondType;
|
||||||
this.toast(`Deal for Cert No ${h.certNo} retrieved.`);
|
this.toast(`Deal for Cert No ${h.certNo} retrieved.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
dropPurchase(): void {
|
dropPurchase(): void {
|
||||||
const certNo = this.purchaseForm.certNo;
|
const h = this.holdings.find((x) => x.certNo === this.purchaseForm.certNo);
|
||||||
if (!this.holdings.some((h) => h.certNo === certNo)) {
|
if (!h?.id) {
|
||||||
this.toast('Nothing to drop — this deal is not yet saved.');
|
this.toast('Retrieve a saved deal first, then Drop.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.holdings = this.holdings.filter((h) => h.certNo !== certNo);
|
this.investmentService.deletePurchase(h.id).subscribe({
|
||||||
this.txns = this.txns.filter((t) => t.certNo !== certNo);
|
next: () => {
|
||||||
this.purchaseForm = this.blankPurchaseForm();
|
this.toast(`Deal ${h.dealNo} (Cert No ${h.certNo}) dropped.`);
|
||||||
this.toast(`Cert No ${certNo} dropped.`);
|
this.loadPurchases();
|
||||||
|
},
|
||||||
|
error: (err) => this.toast(apiErrorMessage(err))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
exitPurchase(): void {
|
exitPurchase(): void {
|
||||||
@@ -658,78 +893,53 @@ export class BondInvestmentComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------- Interest calculation --------------------
|
// -------------------- Interest calculation --------------------
|
||||||
/** Holdings the Interest Calculation "Process" run would cover, given the filters. A
|
/** Saved holdings for the Deal No dropdown, narrowed by Type and Script. */
|
||||||
* Non-Performing holding is always excluded — same accrual-basis rule as the Investment
|
get intDealOptions(): InvestmentHolding[] {
|
||||||
* Interest module (it's still collectible on cash basis via Interest Receive there). */
|
return this.holdings.filter(
|
||||||
get intCalcTargets(): InvestmentHolding[] {
|
(h) =>
|
||||||
const base = this.holdings.filter((h) => h.status === 'ACTIVE' && canAccrueInterest(h));
|
h.id != null &&
|
||||||
if (this.intCalcAll) {
|
h.status === 'ACTIVE' &&
|
||||||
return base;
|
(!this.intType || h.instrumentType === this.intType) &&
|
||||||
|
(!this.intScript || h.scriptCode === this.intScript)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
get intScriptOptions(): typeof SCRIPT_MASTER {
|
||||||
|
return this.scriptOptions.filter((s) => !this.intType || s.instrumentType === this.intType);
|
||||||
|
}
|
||||||
|
|
||||||
|
onIntFilterChange(): void {
|
||||||
|
if (this.intScript && !this.intScriptOptions.some((s) => s.scriptCode === this.intScript)) {
|
||||||
|
this.intScript = '';
|
||||||
}
|
}
|
||||||
return base.filter((h) => {
|
if (this.intPurchaseId != null && !this.intDealOptions.some((h) => h.id === this.intPurchaseId)) {
|
||||||
if (this.intCalcType && h.instrumentType !== this.intCalcType) return false;
|
this.intPurchaseId = null;
|
||||||
if (this.intCalcScript && h.scriptCode !== this.intCalcScript) return false;
|
|
||||||
if (this.intCalcDealNo && h.certNo !== this.intCalcDealNo.trim()) return false;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
get intCalcExcludedNpi(): InvestmentHolding[] {
|
|
||||||
return this.holdings.filter((h) => h.status === 'ACTIVE' && !canAccrueInterest(h));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Re-suggests the Interest Income GL when the Type filter changes — still overridable. */
|
|
||||||
onIntCalcTypeChange(): void {
|
|
||||||
if (this.intCalcType) {
|
|
||||||
this.intCalcGlCode = INTEREST_INCOME_GL_BY_TYPE[this.intCalcType];
|
|
||||||
}
|
}
|
||||||
|
this.intSchedule = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
glName(glCode: string): string {
|
retrieveInterestSchedule(): void {
|
||||||
return this.interestIncomeGlOptions.find((g) => g.glCode === glCode)?.glName ?? glCode;
|
if (this.intPurchaseId == null) {
|
||||||
}
|
this.toast('Select a Deal No first.');
|
||||||
|
|
||||||
/** Interest accrued strictly within [intCalcFromDate, intCalcToDate] — a period-based
|
|
||||||
* Interest Calculation & Post run, same basis as the Investment Interest module. */
|
|
||||||
interestAccrued(h: InvestmentHolding): number {
|
|
||||||
return accruedInterestBetween(h, this.intCalcFromDate || h.purchaseDate, this.intCalcToDate || this.asOnDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
processInterest(): void {
|
|
||||||
const targets = this.intCalcTargets.filter((h) => this.interestAccrued(h) > 0);
|
|
||||||
if (targets.length === 0) {
|
|
||||||
this.toast('No holdings have interest due to be posted for this period.');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const toDate = this.intCalcToDate || this.asOnDate;
|
this.intLoading = true;
|
||||||
const fromDate = this.intCalcFromDate || toDate;
|
this.investmentService.getInterestSchedule(this.intPurchaseId, this.intAsOnDate || undefined).subscribe({
|
||||||
const glCode = this.intCalcGlCode;
|
next: (schedule) => {
|
||||||
const glName = this.glName(glCode);
|
this.intSchedule = schedule;
|
||||||
const newTxns: InvestmentTxn[] = targets.map((h, i) => {
|
this.intLoading = false;
|
||||||
const amt = this.interestAccrued(h);
|
},
|
||||||
h.interestPosted = (h.interestPosted ?? 0) + amt;
|
error: (err) => {
|
||||||
h.interestPostedTillDate = toDate;
|
this.intSchedule = null;
|
||||||
return {
|
this.intLoading = false;
|
||||||
certNo: h.certNo,
|
this.toast(apiErrorMessage(err));
|
||||||
instrumentType: h.instrumentType,
|
}
|
||||||
txnType: 'INTEREST',
|
|
||||||
voucherNo: `INV/INT/${h.certNo}-${this.txns.length + i + 1}`,
|
|
||||||
txnDate: toDate,
|
|
||||||
amount: amt,
|
|
||||||
particulars: `Interest calculated (accrual) for period ${fromDate} to ${toDate} - ${h.scriptName}`,
|
|
||||||
glCode,
|
|
||||||
glName
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
this.txns = [
|
}
|
||||||
...newTxns,
|
|
||||||
...this.txns
|
/** Total of the lines falling due up to the as-on date. */
|
||||||
];
|
get intDueTotal(): number {
|
||||||
this.intCalcFromDate = toDate;
|
return (this.intSchedule?.rows ?? []).filter((r) => r.due).reduce((sum, r) => sum + r.amount, 0);
|
||||||
const total = newTxns.reduce((s, t) => s + t.amount, 0);
|
|
||||||
this.toast(
|
|
||||||
`Interest processed for ${targets.length} holding(s) to ${glCode} - ${glName}. Total ₹${total.toLocaleString('en-IN')}.`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------- Sell / Redeem Entry --------------------
|
// -------------------- Sell / Redeem Entry --------------------
|
||||||
|
|||||||
@@ -123,6 +123,16 @@ export interface InvestmentHolding {
|
|||||||
* never re-counts days up to this date, so re-running a Calculation & Post for an overlapping
|
* never re-counts days up to this date, so re-running a Calculation & Post for an overlapping
|
||||||
* or repeated period always yields 0 instead of double-posting the same interest. */
|
* or repeated period always yields 0 instead of double-posting the same interest. */
|
||||||
interestPostedTillDate?: string;
|
interestPostedTillDate?: string;
|
||||||
|
/** RBI investment category chosen at purchase — HTM / AFS / HFT. */
|
||||||
|
category?: string;
|
||||||
|
/** SGL / CSGL account the security is held in (custody, not an accounting GL). */
|
||||||
|
sglAccountNo?: string;
|
||||||
|
/** Backend id / deal number / party code once the purchase is saved (absent on sample rows). */
|
||||||
|
id?: number;
|
||||||
|
dealNo?: string;
|
||||||
|
partyCode?: string;
|
||||||
|
bookValue?: number;
|
||||||
|
settlementAmount?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InvestmentTxn {
|
export interface InvestmentTxn {
|
||||||
@@ -248,6 +258,51 @@ export function accruedInterestBetween(h: InvestmentHolding, fromStr: string, to
|
|||||||
return Math.round(h.faceValue * (h.interestRate / 100) * (days / 365.25));
|
return Math.round(h.faceValue * (h.interestRate / 100) * (days / 365.25));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Days between two DD-MM-YYYY dates on a 30/360 basis (every month 30 days), as the bank's existing
|
||||||
|
* CBS counts them — e.g. 10-08 → 30-09 = 50 days, 10-08 → 07-10 = 57 days. */
|
||||||
|
export function days360(fromStr: string, toStr: string): number {
|
||||||
|
const a = parseDDMMYYYY(fromStr);
|
||||||
|
const b = parseDDMMYYYY(toStr);
|
||||||
|
if (isNaN(a.getTime()) || isNaN(b.getTime()) || b <= a) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const d1 = Math.min(a.getDate(), 30);
|
||||||
|
const d2 = Math.min(b.getDate(), 30);
|
||||||
|
return (b.getFullYear() - a.getFullYear()) * 360 + (b.getMonth() - a.getMonth()) * 30 + (d2 - d1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Most recent half-yearly coupon date on or before `onStr`, derived from the maturity date (coupons
|
||||||
|
* fall on the maturity day/month and six months either side of it). */
|
||||||
|
export function lastHalfYearlyCouponDate(maturityStr: string, onStr: string): string {
|
||||||
|
const mat = parseDDMMYYYY(maturityStr);
|
||||||
|
const on = parseDDMMYYYY(onStr);
|
||||||
|
if (isNaN(mat.getTime()) || isNaN(on.getTime())) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const day = mat.getDate();
|
||||||
|
const couponOn = (year: number, month: number): Date => {
|
||||||
|
const lastDay = new Date(year, month + 1, 0).getDate();
|
||||||
|
return new Date(year, month, Math.min(day, lastDay));
|
||||||
|
};
|
||||||
|
const months = [
|
||||||
|
mat.getMonth() % 6,
|
||||||
|
(mat.getMonth() % 6) + 6
|
||||||
|
];
|
||||||
|
let best: Date | undefined;
|
||||||
|
for (const year of [
|
||||||
|
on.getFullYear() - 1,
|
||||||
|
on.getFullYear()
|
||||||
|
]) {
|
||||||
|
for (const m of months) {
|
||||||
|
const c = couponOn(year, m);
|
||||||
|
if (c <= on && (!best || c > best)) {
|
||||||
|
best = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return best ? formatDDMMYYYY(best) : '';
|
||||||
|
}
|
||||||
|
|
||||||
export function formatDDMMYYYY(d: Date): string {
|
export function formatDDMMYYYY(d: Date): string {
|
||||||
return `${String(d.getDate()).padStart(2, '0')}-${String(d.getMonth() + 1).padStart(2, '0')}-${d.getFullYear()}`;
|
return `${String(d.getDate()).padStart(2, '0')}-${String(d.getMonth() + 1).padStart(2, '0')}-${d.getFullYear()}`;
|
||||||
}
|
}
|
||||||
@@ -1404,99 +1459,319 @@ export const CASH_BANK_GL_MASTER: InvestmentGlOption[] = [
|
|||||||
{ glCode: '110030', glName: 'HDFC BANK CURRENT ACCOUNT' }
|
{ glCode: '110030', glName: 'HDFC BANK CURRENT ACCOUNT' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** Investment GLs a script / party can be mapped to. PROPOSED codes awaiting approval — the
|
||||||
|
* backend will take these from the chart of accounts, never hard-coded. */
|
||||||
|
export const INVESTMENT_GL_OPTIONS: InvestmentGlOption[] = [
|
||||||
|
{ glCode: '100701', glName: 'INVESTMENT IN CENTRAL GOVT SECURITIES' },
|
||||||
|
{ glCode: '100702', glName: 'INVESTMENT IN STATE GOVT SECURITIES' },
|
||||||
|
{ glCode: '100703', glName: 'INVESTMENT IN BONDS / DEBENTURES' },
|
||||||
|
{ glCode: '100704', glName: 'FIXED DEPOSITS WITH OTHER BANKS' },
|
||||||
|
{ glCode: '100705', glName: 'INVESTMENT IN MUTUAL FUNDS' },
|
||||||
|
{ glCode: '100706', glName: 'INVESTMENT IN SHARES' }
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Fallback investment GL when a script has none mapped. */
|
||||||
|
export const INVESTMENT_GL_BY_TYPE: Record<InstrumentType, string> = {
|
||||||
|
GOVT_SECURITY: '100701',
|
||||||
|
NON_SLR: '100703',
|
||||||
|
BOND: '100703',
|
||||||
|
FD: '100704',
|
||||||
|
MUTUAL_FUND: '100705',
|
||||||
|
SHARE: '100706'
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Interest receivable (the senior's "Provision A/c") — debited for interest bought from the seller. */
|
||||||
|
export const INTEREST_RECEIVABLE_GL: InvestmentGlOption = {
|
||||||
|
glCode: '100603',
|
||||||
|
glName: 'INTEREST RECEIVABLE ON INVESTMENTS (PROVISION)'
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Bank accounts a purchase can be paid from — these GLs already exist in the chart of accounts. */
|
||||||
|
export const SETTLEMENT_BANK_GL_OPTIONS: InvestmentGlOption[] = [
|
||||||
|
{ glCode: '100201', glName: 'IDBI BANK' },
|
||||||
|
{ glCode: '100202', glName: 'YES BANK' }
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Every GL the Investment screens can show by name. */
|
||||||
|
export const INVESTMENT_GL_LOOKUP: InvestmentGlOption[] = [
|
||||||
|
...INVESTMENT_GL_OPTIONS,
|
||||||
|
INTEREST_RECEIVABLE_GL,
|
||||||
|
...SETTLEMENT_BANK_GL_OPTIONS
|
||||||
|
];
|
||||||
|
|
||||||
|
/** SLR classification on the Script Master, as in the bank's existing CBS ("GOI" = Central Govt). */
|
||||||
|
export type SlrType = 'GOI' | 'STATE_GOVT' | 'TREASURY' | 'NON_SLR';
|
||||||
|
|
||||||
|
export const SLR_TYPE_OPTIONS: Array<{ value: SlrType; label: string }> = [
|
||||||
|
{ value: 'GOI', label: 'GOI' },
|
||||||
|
{ value: 'STATE_GOVT', label: 'STATE GOVT' },
|
||||||
|
{ value: 'TREASURY', label: 'TREASURY' },
|
||||||
|
{ value: 'NON_SLR', label: 'NON SLR' }
|
||||||
|
];
|
||||||
|
|
||||||
export interface ScriptMaster {
|
export interface ScriptMaster {
|
||||||
|
/** Backend id once the script is saved (absent on the sample rows). */
|
||||||
|
id?: number;
|
||||||
scriptCode: string;
|
scriptCode: string;
|
||||||
scriptName: string;
|
scriptName: string;
|
||||||
instrumentType: InstrumentType;
|
instrumentType: InstrumentType;
|
||||||
isin: string;
|
isin: string;
|
||||||
faceValuePerUnit: number;
|
faceValuePerUnit: number;
|
||||||
|
// Fields below follow the bank's existing CBS Script Master; a purchase picks them up instead
|
||||||
|
// of the dealer re-typing them on every deal.
|
||||||
|
slrType?: SlrType;
|
||||||
|
/** Investment GL this script is booked to. */
|
||||||
|
glAccountId?: number;
|
||||||
|
glCode?: string;
|
||||||
|
glName?: string;
|
||||||
|
active?: boolean;
|
||||||
|
/** Interest (coupon) rate % per annum. */
|
||||||
|
couponRate?: number;
|
||||||
|
issueDate?: string;
|
||||||
|
maturityDate?: string;
|
||||||
|
// Issuer details — used for Bond / Mutual Fund scripts.
|
||||||
|
companyName?: string;
|
||||||
|
address1?: string;
|
||||||
|
address2?: string;
|
||||||
|
address3?: string;
|
||||||
|
city?: string;
|
||||||
|
pincode?: string;
|
||||||
|
phone?: string;
|
||||||
|
fax?: string;
|
||||||
|
corpCode?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Period between two DD-MM-YYYY dates as years / months / days, as shown on the Script Master. */
|
||||||
|
export function periodBetween(fromStr?: string, toStr?: string): { years: number; months: number; days: number } {
|
||||||
|
const none = { years: 0, months: 0, days: 0 };
|
||||||
|
if (!fromStr || !toStr) {
|
||||||
|
return none;
|
||||||
|
}
|
||||||
|
const from = parseDDMMYYYY(fromStr);
|
||||||
|
const to = parseDDMMYYYY(toStr);
|
||||||
|
if (isNaN(from.getTime()) || isNaN(to.getTime()) || to < from) {
|
||||||
|
return none;
|
||||||
|
}
|
||||||
|
let years = to.getFullYear() - from.getFullYear();
|
||||||
|
let months = to.getMonth() - from.getMonth();
|
||||||
|
let days = to.getDate() - from.getDate();
|
||||||
|
if (days < 0) {
|
||||||
|
months -= 1;
|
||||||
|
days += new Date(to.getFullYear(), to.getMonth(), 0).getDate();
|
||||||
|
}
|
||||||
|
if (months < 0) {
|
||||||
|
years -= 1;
|
||||||
|
months += 12;
|
||||||
|
}
|
||||||
|
return { years, months, days };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SCRIPT_MASTER: ScriptMaster[] = [
|
export const SCRIPT_MASTER: ScriptMaster[] = [
|
||||||
{ scriptCode: 'FD-CUM', scriptName: 'Cumulative Fixed Deposit', instrumentType: 'FD', isin: '', faceValuePerUnit: 1 },
|
{
|
||||||
|
scriptCode: 'FD-CUM',
|
||||||
|
scriptName: 'Cumulative Fixed Deposit',
|
||||||
|
instrumentType: 'FD',
|
||||||
|
isin: '',
|
||||||
|
faceValuePerUnit: 1,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100704'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'FD-MIP',
|
scriptCode: 'FD-MIP',
|
||||||
scriptName: 'Monthly Interest Payout FD',
|
scriptName: 'Monthly Interest Payout FD',
|
||||||
instrumentType: 'FD',
|
instrumentType: 'FD',
|
||||||
isin: '',
|
isin: '',
|
||||||
faceValuePerUnit: 1
|
faceValuePerUnit: 1,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100704'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'IN0020230012',
|
scriptCode: 'IN0020230012',
|
||||||
scriptName: '7.26% GOI 2033',
|
scriptName: '7.26% GOI 2033',
|
||||||
instrumentType: 'GOVT_SECURITY',
|
instrumentType: 'GOVT_SECURITY',
|
||||||
isin: 'IN0020230012',
|
isin: 'IN0020230012',
|
||||||
faceValuePerUnit: 100
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'GOI',
|
||||||
|
glCode: '100701',
|
||||||
|
couponRate: 7.26,
|
||||||
|
issueDate: '15-01-2023',
|
||||||
|
maturityDate: '15-01-2033'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'IN0020220089',
|
scriptCode: 'IN0020220089',
|
||||||
scriptName: '7.10% GOI 2029',
|
scriptName: '7.10% GOI 2029',
|
||||||
instrumentType: 'GOVT_SECURITY',
|
instrumentType: 'GOVT_SECURITY',
|
||||||
isin: 'IN0020220089',
|
isin: 'IN0020220089',
|
||||||
faceValuePerUnit: 100
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'GOI',
|
||||||
|
glCode: '100701',
|
||||||
|
couponRate: 7.1,
|
||||||
|
issueDate: '10-03-2022',
|
||||||
|
maturityDate: '10-03-2029'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scriptCode: 'IN0020210056',
|
||||||
|
scriptName: '6.79% GOI 2027',
|
||||||
|
instrumentType: 'GOVT_SECURITY',
|
||||||
|
isin: 'IN0020210056',
|
||||||
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'GOI',
|
||||||
|
glCode: '100701',
|
||||||
|
couponRate: 6.79,
|
||||||
|
issueDate: '05-06-2021',
|
||||||
|
maturityDate: '05-06-2027'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scriptCode: 'IN0020240034',
|
||||||
|
scriptName: '7.18% GOI 2037',
|
||||||
|
instrumentType: 'GOVT_SECURITY',
|
||||||
|
isin: 'IN0020240034',
|
||||||
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'GOI',
|
||||||
|
glCode: '100701',
|
||||||
|
couponRate: 7.18,
|
||||||
|
issueDate: '22-04-2024',
|
||||||
|
maturityDate: '22-04-2037'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scriptCode: 'MH-SDL-2031',
|
||||||
|
scriptName: '8.05% Maharashtra SDL 2031',
|
||||||
|
instrumentType: 'GOVT_SECURITY',
|
||||||
|
isin: '',
|
||||||
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'STATE_GOVT',
|
||||||
|
glCode: '100702',
|
||||||
|
couponRate: 8.05,
|
||||||
|
issueDate: '15-02-2021',
|
||||||
|
maturityDate: '15-02-2031'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scriptCode: 'GJ-SDL-2026',
|
||||||
|
scriptName: '7.85% Gujarat SDL 2026',
|
||||||
|
instrumentType: 'GOVT_SECURITY',
|
||||||
|
isin: '',
|
||||||
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'STATE_GOVT',
|
||||||
|
glCode: '100702',
|
||||||
|
couponRate: 7.85,
|
||||||
|
issueDate: '18-09-2016',
|
||||||
|
maturityDate: '18-09-2026'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'TBILL-364D',
|
scriptCode: 'TBILL-364D',
|
||||||
scriptName: '364 Days Treasury Bill',
|
scriptName: '364 Days Treasury Bill',
|
||||||
instrumentType: 'GOVT_SECURITY',
|
instrumentType: 'GOVT_SECURITY',
|
||||||
isin: '',
|
isin: '',
|
||||||
faceValuePerUnit: 100
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'TREASURY',
|
||||||
|
glCode: '100701',
|
||||||
|
couponRate: 0,
|
||||||
|
issueDate: '02-07-2026',
|
||||||
|
maturityDate: '02-07-2027'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scriptCode: 'TBILL-91D',
|
||||||
|
scriptName: '91 Days Treasury Bill',
|
||||||
|
instrumentType: 'GOVT_SECURITY',
|
||||||
|
isin: '',
|
||||||
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'TREASURY',
|
||||||
|
glCode: '100701',
|
||||||
|
couponRate: 0,
|
||||||
|
issueDate: '15-05-2026',
|
||||||
|
maturityDate: '13-08-2026'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'REC-7.5-2031',
|
scriptCode: 'REC-7.5-2031',
|
||||||
scriptName: 'REC Ltd Bond 7.50% 2031',
|
scriptName: 'REC Ltd Bond 7.50% 2031',
|
||||||
instrumentType: 'NON_SLR',
|
instrumentType: 'NON_SLR',
|
||||||
isin: 'INE020B08JN0',
|
isin: 'INE020B08JN0',
|
||||||
faceValuePerUnit: 100
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100703',
|
||||||
|
couponRate: 7.5,
|
||||||
|
issueDate: '11-08-2021',
|
||||||
|
maturityDate: '11-08-2031',
|
||||||
|
companyName: 'REC Limited',
|
||||||
|
city: 'New Delhi'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'NABARD-7.35-2030',
|
scriptCode: 'NABARD-7.35-2030',
|
||||||
scriptName: 'NABARD Bond 7.35% 2030',
|
scriptName: 'NABARD Bond 7.35% 2030',
|
||||||
instrumentType: 'NON_SLR',
|
instrumentType: 'NON_SLR',
|
||||||
isin: 'INE261F09EU1',
|
isin: 'INE261F09EU1',
|
||||||
faceValuePerUnit: 100
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100703',
|
||||||
|
couponRate: 7.35,
|
||||||
|
issueDate: '20-09-2020',
|
||||||
|
maturityDate: '20-09-2030',
|
||||||
|
companyName: 'NABARD',
|
||||||
|
city: 'Mumbai'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'LTF-8.1-2028',
|
scriptCode: 'LTF-8.1-2028',
|
||||||
scriptName: 'L&T Finance NCD 8.10% 2028',
|
scriptName: 'L&T Finance NCD 8.10% 2028',
|
||||||
instrumentType: 'BOND',
|
instrumentType: 'BOND',
|
||||||
isin: 'INE027E07BR5',
|
isin: 'INE027E07BR5',
|
||||||
faceValuePerUnit: 100
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100703',
|
||||||
|
couponRate: 8.1,
|
||||||
|
companyName: 'L&T Finance Ltd',
|
||||||
|
city: 'Mumbai'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'BAF-7.95-2027',
|
scriptCode: 'BAF-7.95-2027',
|
||||||
scriptName: 'Bajaj Finance NCD 7.95% 2027',
|
scriptName: 'Bajaj Finance NCD 7.95% 2027',
|
||||||
instrumentType: 'BOND',
|
instrumentType: 'BOND',
|
||||||
isin: 'INE296A07SP0',
|
isin: 'INE296A07SP0',
|
||||||
faceValuePerUnit: 100
|
faceValuePerUnit: 100,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100703',
|
||||||
|
couponRate: 7.95,
|
||||||
|
companyName: 'Bajaj Finance Ltd',
|
||||||
|
city: 'Pune'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'SBI-OVN',
|
scriptCode: 'SBI-OVN',
|
||||||
scriptName: 'SBI Overnight Fund',
|
scriptName: 'SBI Overnight Fund',
|
||||||
instrumentType: 'MUTUAL_FUND',
|
instrumentType: 'MUTUAL_FUND',
|
||||||
isin: 'INF200KA1Q40',
|
isin: 'INF200KA1Q40',
|
||||||
faceValuePerUnit: 1000
|
faceValuePerUnit: 1000,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100705',
|
||||||
|
companyName: 'SBI Mutual Fund',
|
||||||
|
city: 'Mumbai'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'HDFC-LIQ',
|
scriptCode: 'HDFC-LIQ',
|
||||||
scriptName: 'HDFC Liquid Fund',
|
scriptName: 'HDFC Liquid Fund',
|
||||||
instrumentType: 'MUTUAL_FUND',
|
instrumentType: 'MUTUAL_FUND',
|
||||||
isin: 'INF179KA1WR9',
|
isin: 'INF179KA1WR9',
|
||||||
faceValuePerUnit: 1000
|
faceValuePerUnit: 1000,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100705',
|
||||||
|
companyName: 'HDFC Mutual Fund',
|
||||||
|
city: 'Mumbai'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'SBIN',
|
scriptCode: 'SBIN',
|
||||||
scriptName: 'State Bank of India',
|
scriptName: 'State Bank of India',
|
||||||
instrumentType: 'SHARE',
|
instrumentType: 'SHARE',
|
||||||
isin: 'INE062A01020',
|
isin: 'INE062A01020',
|
||||||
faceValuePerUnit: 1
|
faceValuePerUnit: 1,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100706'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scriptCode: 'HDFCBANK',
|
scriptCode: 'HDFCBANK',
|
||||||
scriptName: 'HDFC Bank Ltd',
|
scriptName: 'HDFC Bank Ltd',
|
||||||
instrumentType: 'SHARE',
|
instrumentType: 'SHARE',
|
||||||
isin: 'INE040A01034',
|
isin: 'INE040A01034',
|
||||||
faceValuePerUnit: 1
|
faceValuePerUnit: 1,
|
||||||
|
slrType: 'NON_SLR',
|
||||||
|
glCode: '100706'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -1561,23 +1836,150 @@ export const BROKER_MASTER: BrokerMaster[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export interface PartyMaster {
|
export interface PartyMaster {
|
||||||
|
/** Backend id once the party is saved (absent on the sample rows). */
|
||||||
|
id?: number;
|
||||||
partyCode: string;
|
partyCode: string;
|
||||||
partyName: string;
|
partyName: string;
|
||||||
partyType: 'BANK' | 'CORPORATE' | 'GOVT' | 'AMC' | 'EXCHANGE' | 'COOP_SOCIETY';
|
partyType: 'BANK' | 'CORPORATE' | 'GOVT' | 'AMC' | 'EXCHANGE' | 'COOP_SOCIETY';
|
||||||
panNo: string;
|
panNo?: string;
|
||||||
|
// Fields below follow the bank's existing CBS Bank / Party Master.
|
||||||
|
bondType?: InstrumentType;
|
||||||
|
address1?: string;
|
||||||
|
address2?: string;
|
||||||
|
address3?: string;
|
||||||
|
city?: string;
|
||||||
|
pincode?: string;
|
||||||
|
phone?: string;
|
||||||
|
fax?: string;
|
||||||
|
bankType?: string;
|
||||||
|
/** GL this party is mapped to. */
|
||||||
|
glAccountId?: number;
|
||||||
|
glCode?: string;
|
||||||
|
glName?: string;
|
||||||
|
rbiCode?: string;
|
||||||
|
/** Exposure limit for this party (₹). */
|
||||||
|
limit?: number | null;
|
||||||
|
leiNo?: string;
|
||||||
|
// Counterparty's bank details
|
||||||
|
cpBankName?: string;
|
||||||
|
cpBranchName?: string;
|
||||||
|
cpAccountNo?: string;
|
||||||
|
cpIfsc?: string;
|
||||||
|
/** Absent means ACTIVE. An INACTIVE party is not offered for new deals. */
|
||||||
|
status?: 'ACTIVE' | 'INACTIVE';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sample Bank Type options until the bank confirms its list. */
|
||||||
|
export const BANK_TYPE_OPTIONS = [
|
||||||
|
'SCHEDULED COMMERCIAL BANK',
|
||||||
|
'STATE CO-OPERATIVE BANK',
|
||||||
|
'DISTRICT CENTRAL CO-OPERATIVE BANK',
|
||||||
|
'URBAN CO-OPERATIVE BANK',
|
||||||
|
'RBI / GOVERNMENT',
|
||||||
|
'OTHER'
|
||||||
|
];
|
||||||
|
|
||||||
export const PARTY_MASTER: PartyMaster[] = [
|
export const PARTY_MASTER: PartyMaster[] = [
|
||||||
{ partyCode: 'PTY-001', partyName: 'Jila Sahakari Kendriya Bank', partyType: 'BANK', panNo: 'AABCJ1234K' },
|
{
|
||||||
{ partyCode: 'PTY-002', partyName: 'State Cooperative Bank Ltd', partyType: 'BANK', panNo: 'AABCS5678L' },
|
partyCode: 'PTY-001',
|
||||||
{ partyCode: 'PTY-003', partyName: 'RBI - SGL', partyType: 'GOVT', panNo: 'AAACR4849R' },
|
partyName: 'Jila Sahakari Kendriya Bank',
|
||||||
{ partyCode: 'PTY-004', partyName: 'REC Limited', partyType: 'CORPORATE', panNo: 'AAACR0641G' },
|
partyType: 'BANK',
|
||||||
{ partyCode: 'PTY-005', partyName: 'NABARD', partyType: 'CORPORATE', panNo: 'AAACN0272B' },
|
bondType: 'FD',
|
||||||
{ partyCode: 'PTY-006', partyName: 'L&T Finance Ltd', partyType: 'CORPORATE', panNo: 'AAACL0140P' },
|
glCode: '100704',
|
||||||
{ partyCode: 'PTY-007', partyName: 'SBI Mutual Fund', partyType: 'AMC', panNo: 'AAATS4325L' },
|
city: 'Vidisha',
|
||||||
{ partyCode: 'PTY-008', partyName: 'HDFC Mutual Fund', partyType: 'AMC', panNo: 'AAATH1234M' },
|
bankType: 'DISTRICT CENTRAL CO-OPERATIVE BANK',
|
||||||
{ partyCode: 'PTY-009', partyName: 'NSE/BSE', partyType: 'EXCHANGE', panNo: 'AAACN0028G' },
|
status: 'ACTIVE'
|
||||||
{ partyCode: 'PTY-010', partyName: 'District Cooperative Bank', partyType: 'COOP_SOCIETY', panNo: 'AABCD9988K' }
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-002',
|
||||||
|
partyName: 'State Cooperative Bank Ltd',
|
||||||
|
partyType: 'BANK',
|
||||||
|
bondType: 'FD',
|
||||||
|
glCode: '100704',
|
||||||
|
city: 'Bhopal',
|
||||||
|
bankType: 'STATE CO-OPERATIVE BANK',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-003',
|
||||||
|
partyName: 'RBI - SGL',
|
||||||
|
partyType: 'GOVT',
|
||||||
|
bondType: 'GOVT_SECURITY',
|
||||||
|
glCode: '100701',
|
||||||
|
city: 'Mumbai',
|
||||||
|
bankType: 'RBI / GOVERNMENT',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-004',
|
||||||
|
partyName: 'REC Limited',
|
||||||
|
partyType: 'CORPORATE',
|
||||||
|
bondType: 'NON_SLR',
|
||||||
|
glCode: '100703',
|
||||||
|
city: 'New Delhi',
|
||||||
|
bankType: 'OTHER',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-005',
|
||||||
|
partyName: 'NABARD',
|
||||||
|
partyType: 'CORPORATE',
|
||||||
|
bondType: 'NON_SLR',
|
||||||
|
glCode: '100703',
|
||||||
|
city: 'Mumbai',
|
||||||
|
bankType: 'OTHER',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-006',
|
||||||
|
partyName: 'L&T Finance Ltd',
|
||||||
|
partyType: 'CORPORATE',
|
||||||
|
bondType: 'BOND',
|
||||||
|
glCode: '100703',
|
||||||
|
city: 'Mumbai',
|
||||||
|
bankType: 'OTHER',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-007',
|
||||||
|
partyName: 'SBI Mutual Fund',
|
||||||
|
partyType: 'AMC',
|
||||||
|
bondType: 'MUTUAL_FUND',
|
||||||
|
glCode: '100705',
|
||||||
|
city: 'Mumbai',
|
||||||
|
bankType: 'OTHER',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-008',
|
||||||
|
partyName: 'HDFC Mutual Fund',
|
||||||
|
partyType: 'AMC',
|
||||||
|
bondType: 'MUTUAL_FUND',
|
||||||
|
glCode: '100705',
|
||||||
|
city: 'Mumbai',
|
||||||
|
bankType: 'OTHER',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-009',
|
||||||
|
partyName: 'NSE/BSE',
|
||||||
|
partyType: 'EXCHANGE',
|
||||||
|
bondType: 'SHARE',
|
||||||
|
glCode: '100706',
|
||||||
|
city: 'Mumbai',
|
||||||
|
bankType: 'OTHER',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partyCode: 'PTY-010',
|
||||||
|
partyName: 'District Cooperative Bank',
|
||||||
|
partyType: 'COOP_SOCIETY',
|
||||||
|
bondType: 'SHARE',
|
||||||
|
glCode: '100706',
|
||||||
|
city: 'Vidisha',
|
||||||
|
bankType: 'DISTRICT CENTRAL CO-OPERATIVE BANK',
|
||||||
|
status: 'ACTIVE'
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export interface SubTypeMaster {
|
export interface SubTypeMaster {
|
||||||
|
|||||||
@@ -106,38 +106,112 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- PARTY MASTER -->
|
<!-- PARTY MASTER (layout follows the bank's existing CBS Bank / Party Master) -->
|
||||||
@if (activeTab === 'party') {
|
@if (activeTab === 'party') {
|
||||||
<div class="pg-card">
|
<div class="pg-card">
|
||||||
<div class="pos-section-label">Add Bank / Party</div>
|
<div class="pos-section-label">Bank / Party Master — Entry</div>
|
||||||
<div class="inv-form-grid">
|
<div class="inv-form-grid">
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Party Name *</span><input type="text" [(ngModel)]="newParty.partyName"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Party Type *</span>
|
<span>* Bond Type</span>
|
||||||
<select [(ngModel)]="newParty.partyType">
|
<select [(ngModel)]="partyForm.bondType">
|
||||||
<option [ngValue]="undefined">-- Select --</option>
|
<option [ngValue]="undefined">-- Select --</option>
|
||||||
<option value="BANK">BANK</option>
|
@for (t of instrumentTypes; track t) {
|
||||||
<option value="CORPORATE">CORPORATE</option>
|
<option [value]="t">{{ t }}</option>
|
||||||
<option value="GOVT">GOVT</option>
|
}
|
||||||
<option value="AMC">AMC</option>
|
|
||||||
<option value="EXCHANGE">EXCHANGE</option>
|
|
||||||
<option value="COOP_SOCIETY">COOP SOCIETY</option>
|
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field"><span>PAN No</span><input type="text" [(ngModel)]="newParty.panNo" /></label>
|
<label class="inv-form-field"
|
||||||
|
><span>* Party Code</span><input type="text" [value]="partyForm.partyCode || nextPartyCode" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>* Party Name</span><input type="text" [(ngModel)]="partyForm.partyName"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Address Line 1 (Building / Flat No.)</span
|
||||||
|
><input type="text" placeholder="e.g. Shop No. 12, Shanti Complex" [(ngModel)]="partyForm.address1"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Address Line 2 (Street / Area)</span
|
||||||
|
><input type="text" placeholder="e.g. MG Road, Near Bus Stand" [(ngModel)]="partyForm.address2"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Address Line 3 (Locality / Landmark)</span
|
||||||
|
><input type="text" placeholder="e.g. Arera Colony" [(ngModel)]="partyForm.address3"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"><span>City</span><input type="text" [(ngModel)]="partyForm.city" /></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Pincode</span><input type="text" maxlength="6" [(ngModel)]="partyForm.pincode"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"><span>Phone</span><input type="text" [(ngModel)]="partyForm.phone" /></label>
|
||||||
|
<label class="inv-form-field"><span>Fax</span><input type="text" [(ngModel)]="partyForm.fax" /></label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Bank Type</span>
|
||||||
|
<select [(ngModel)]="partyForm.bankType">
|
||||||
|
<option [ngValue]="undefined">-- Select --</option>
|
||||||
|
@for (b of bankTypeOptions; track b) {
|
||||||
|
<option [value]="b">{{ b }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>* GL A/c No.</span>
|
||||||
|
<select [(ngModel)]="partyForm.glAccountId">
|
||||||
|
<option [ngValue]="undefined">-- Select --</option>
|
||||||
|
@for (g of investmentGlOptions; track g.id) {
|
||||||
|
<option [ngValue]="g.id">{{ g.glCode }} — {{ g.name }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field"><span>RBI Code</span><input type="text" [(ngModel)]="partyForm.rbiCode" /></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Limit (₹)</span><input type="number" min="0" [(ngModel)]="partyForm.limit"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"><span>LEI No</span><input type="text" [(ngModel)]="partyForm.leiNo" /></label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>Status</span>
|
||||||
|
<select [(ngModel)]="partyForm.status">
|
||||||
|
<option [ngValue]="undefined">ACTIVE</option>
|
||||||
|
<option value="INACTIVE">INACTIVE</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="pos-section-label">Counterparty's Bank Details</div>
|
||||||
|
<div class="inv-form-grid">
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Name of Bank</span><input type="text" [(ngModel)]="partyForm.cpBankName"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Name of Branch</span><input type="text" [(ngModel)]="partyForm.cpBranchName"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Account No.</span><input type="text" [(ngModel)]="partyForm.cpAccountNo"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>IFSC</span><input type="text" maxlength="11" [(ngModel)]="partyForm.cpIfsc"
|
||||||
|
/></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="inv-form-actions">
|
<div class="inv-form-actions">
|
||||||
<button type="button" class="pg-btn pg-btn--primary" (click)="addParty()">Save</button>
|
<label class="inv-form-field"
|
||||||
|
><span>Search Party Code</span><input type="text" placeholder="e.g. PTY-001" [(ngModel)]="partySearchCode"
|
||||||
|
/></label>
|
||||||
|
<button type="button" class="pg-btn pg-btn--primary" [disabled]="saving" (click)="saveParty()">Save</button>
|
||||||
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="searchParty()">Search</button>
|
||||||
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="cancelParty()">Cancel</button>
|
||||||
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="dropParty()">Drop</button>
|
||||||
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="cancelParty()">Exit</button>
|
||||||
</div>
|
</div>
|
||||||
<table class="pg-table">
|
<table class="pg-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Party Code</th>
|
<th>Party Code</th>
|
||||||
|
<th>Bond Type</th>
|
||||||
<th>Party Name</th>
|
<th>Party Name</th>
|
||||||
<th>Type</th>
|
<th>City</th>
|
||||||
<th>PAN No</th>
|
<th>Bank Type</th>
|
||||||
|
<th>GL A/c</th>
|
||||||
|
<th class="num">Limit</th>
|
||||||
|
<th>Counterparty Bank / IFSC</th>
|
||||||
|
<th>Status</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -146,9 +220,14 @@
|
|||||||
<td>
|
<td>
|
||||||
<span class="pg-chip">{{ p.partyCode }}</span>
|
<span class="pg-chip">{{ p.partyCode }}</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{ p.bondType || '—' }}</td>
|
||||||
<td>{{ p.partyName }}</td>
|
<td>{{ p.partyName }}</td>
|
||||||
<td>{{ p.partyType }}</td>
|
<td>{{ p.city || '—' }}</td>
|
||||||
<td>{{ p.panNo }}</td>
|
<td>{{ p.bankType || '—' }}</td>
|
||||||
|
<td>{{ p.glCode ? p.glCode + ' — ' + glName(p.glCode) : '—' }}</td>
|
||||||
|
<td class="num">{{ p.limit != null ? '₹' + (p.limit | number: '1.0-0') : '—' }}</td>
|
||||||
|
<td>{{ p.cpBankName ? p.cpBankName + (p.cpIfsc ? ' / ' + p.cpIfsc : '') : '—' }}</td>
|
||||||
|
<td>{{ p.status ?? 'ACTIVE' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -156,42 +235,118 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<!-- SCRIPT MASTER -->
|
<!-- SCRIPT MASTER (layout follows the bank's existing CBS Script Master) -->
|
||||||
@if (activeTab === 'script') {
|
@if (activeTab === 'script') {
|
||||||
<div class="pg-card">
|
<div class="pg-card">
|
||||||
<div class="pos-section-label">Add Script</div>
|
<div class="pos-section-label">Script Master — Entry</div>
|
||||||
<div class="inv-form-grid">
|
<div class="inv-form-grid">
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Script Code</span><input type="text" [(ngModel)]="newScript.scriptCode"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field"
|
|
||||||
><span>Script Name *</span><input type="text" [(ngModel)]="newScript.scriptName"
|
|
||||||
/></label>
|
|
||||||
<label class="inv-form-field">
|
<label class="inv-form-field">
|
||||||
<span>Instrument Type *</span>
|
<span>* Bond Type</span>
|
||||||
<select [(ngModel)]="newScript.instrumentType">
|
<select [(ngModel)]="scriptForm.instrumentType" [disabled]="!!scriptForm.scriptCode">
|
||||||
<option [ngValue]="undefined">-- Select --</option>
|
<option [ngValue]="undefined">-- Select --</option>
|
||||||
@for (t of instrumentTypes; track t) {
|
@for (t of instrumentTypes; track t) {
|
||||||
<option [value]="t">{{ t }}</option>
|
<option [value]="t">{{ t }}</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="inv-form-field"><span>ISIN</span><input type="text" [(ngModel)]="newScript.isin" /></label>
|
<label class="inv-form-field">
|
||||||
|
<span>SLR</span>
|
||||||
|
<select [(ngModel)]="scriptForm.slrType">
|
||||||
|
<option [ngValue]="undefined">-- Select --</option>
|
||||||
|
@for (o of slrTypeOptions; track o.value) {
|
||||||
|
<option [value]="o.value">{{ o.label }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
<label class="inv-form-field"
|
<label class="inv-form-field"
|
||||||
><span>Face Value / Unit</span><input type="number" [(ngModel)]="newScript.faceValuePerUnit"
|
><span>* Script Code</span><input type="text" [value]="scriptForm.scriptCode || nextScriptCode" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>* Script Desc</span
|
||||||
|
><input type="text" placeholder="e.g. 7.50%GOI2034" [(ngModel)]="scriptForm.scriptName"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field">
|
||||||
|
<span>* GL A/c No.</span>
|
||||||
|
<select [(ngModel)]="scriptForm.glAccountId">
|
||||||
|
<option [ngValue]="undefined">-- Select --</option>
|
||||||
|
@for (g of investmentGlOptions; track g.id) {
|
||||||
|
<option [ngValue]="g.id">{{ g.glCode }} — {{ g.name }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>{{ scriptIsDebtSecurity ? '* ' : '' }}ISIN</span><input type="text" [(ngModel)]="scriptForm.isin"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>{{ scriptIsDebtSecurity ? '* ' : '' }}Int Rate %</span
|
||||||
|
><input type="number" step="0.01" min="0" [(ngModel)]="scriptForm.couponRate"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>{{ scriptIsDebtSecurity ? '* ' : '' }}Issue Date</span
|
||||||
|
><mifosx-date-ddmmyyyy [(ngModel)]="scriptForm.issueDate"></mifosx-date-ddmmyyyy
|
||||||
|
></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Redum / Mat Date</span
|
||||||
|
><mifosx-date-ddmmyyyy [(ngModel)]="scriptForm.maturityDate"></mifosx-date-ddmmyyyy
|
||||||
|
></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Period (Year)</span><input type="text" [value]="scriptPeriod.years" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Period (Month)</span><input type="text" [value]="scriptPeriod.months" readonly
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Period (Days)</span><input type="text" [value]="scriptPeriod.days" readonly
|
||||||
|
/></label>
|
||||||
|
</div>
|
||||||
|
<div class="pos-section-label">Company Details (Bond / Mutual Fund)</div>
|
||||||
|
<div class="inv-form-grid">
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Company Name</span><input type="text" [(ngModel)]="scriptForm.companyName"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Address Line 1 (Building / Flat No.)</span
|
||||||
|
><input type="text" placeholder="e.g. Shop No. 12, Shanti Complex" [(ngModel)]="scriptForm.address1"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Address Line 2 (Street / Area)</span
|
||||||
|
><input type="text" placeholder="e.g. MG Road, Near Bus Stand" [(ngModel)]="scriptForm.address2"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Address Line 3 (Locality / Landmark)</span
|
||||||
|
><input type="text" placeholder="e.g. Arera Colony" [(ngModel)]="scriptForm.address3"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"><span>City</span><input type="text" [(ngModel)]="scriptForm.city" /></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Pincode</span><input type="text" maxlength="6" [(ngModel)]="scriptForm.pincode"
|
||||||
|
/></label>
|
||||||
|
<label class="inv-form-field"><span>Phone</span><input type="text" [(ngModel)]="scriptForm.phone" /></label>
|
||||||
|
<label class="inv-form-field"><span>Fax</span><input type="text" [(ngModel)]="scriptForm.fax" /></label>
|
||||||
|
<label class="inv-form-field"
|
||||||
|
><span>Corp. Code</span><input type="text" [(ngModel)]="scriptForm.corpCode"
|
||||||
/></label>
|
/></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="inv-form-actions">
|
<div class="inv-form-actions">
|
||||||
<button type="button" class="pg-btn pg-btn--primary" (click)="addScript()">Save</button>
|
<label class="inv-form-field"
|
||||||
|
><span>Search Script Code</span><input type="text" placeholder="e.g. G00001" [(ngModel)]="scriptSearchCode"
|
||||||
|
/></label>
|
||||||
|
<button type="button" class="pg-btn pg-btn--primary" [disabled]="saving" (click)="saveScript()">Save</button>
|
||||||
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="searchScript()">Search</button>
|
||||||
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="cancelScript()">Cancel</button>
|
||||||
|
<button type="button" class="pg-btn pg-btn--ghost" (click)="cancelScript()">Exit</button>
|
||||||
</div>
|
</div>
|
||||||
<table class="pg-table">
|
<table class="pg-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Script Code</th>
|
<th>Script Code</th>
|
||||||
<th>Script Name</th>
|
<th>Bond Type</th>
|
||||||
<th>Instrument</th>
|
<th>SLR</th>
|
||||||
|
<th>Script Desc</th>
|
||||||
|
<th>GL A/c</th>
|
||||||
<th>ISIN</th>
|
<th>ISIN</th>
|
||||||
<th class="num">Face Value/Unit</th>
|
<th class="num">Int Rate %</th>
|
||||||
|
<th>Issue Date</th>
|
||||||
|
<th>Maturity</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -200,10 +355,14 @@
|
|||||||
<td>
|
<td>
|
||||||
<span class="pg-chip">{{ s.scriptCode }}</span>
|
<span class="pg-chip">{{ s.scriptCode }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ s.scriptName }}</td>
|
|
||||||
<td>{{ s.instrumentType }}</td>
|
<td>{{ s.instrumentType }}</td>
|
||||||
|
<td>{{ s.slrType || '—' }}</td>
|
||||||
|
<td>{{ s.scriptName }}</td>
|
||||||
|
<td>{{ s.glCode || '—' }}</td>
|
||||||
<td>{{ s.isin || '—' }}</td>
|
<td>{{ s.isin || '—' }}</td>
|
||||||
<td class="num">{{ s.faceValuePerUnit }}</td>
|
<td class="num">{{ s.couponRate ?? '—' }}</td>
|
||||||
|
<td>{{ s.issueDate || '—' }}</td>
|
||||||
|
<td>{{ s.maturityDate || '—' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -6,14 +6,12 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { DateDdmmyyyyPickerComponent } from '../date-ddmmyyyy-picker/date-ddmmyyyy-picker.component';
|
import { DateDdmmyyyyPickerComponent } from '../date-ddmmyyyy-picker/date-ddmmyyyy-picker.component';
|
||||||
import {
|
import {
|
||||||
SCRIPT_MASTER,
|
|
||||||
BROKER_MASTER,
|
BROKER_MASTER,
|
||||||
PARTY_MASTER,
|
|
||||||
SUBTYPE_MASTER,
|
SUBTYPE_MASTER,
|
||||||
CONTROL_PARAMETERS,
|
CONTROL_PARAMETERS,
|
||||||
MUTUAL_FUND_PRODUCTS,
|
MUTUAL_FUND_PRODUCTS,
|
||||||
@@ -31,9 +29,14 @@ import {
|
|||||||
ScriptMarketDetail,
|
ScriptMarketDetail,
|
||||||
DailyScriptRate,
|
DailyScriptRate,
|
||||||
LienReason,
|
LienReason,
|
||||||
InstrumentType
|
InstrumentType,
|
||||||
|
BANK_TYPE_OPTIONS,
|
||||||
|
SLR_TYPE_OPTIONS,
|
||||||
|
INVESTMENT_GL_LOOKUP,
|
||||||
|
periodBetween
|
||||||
} from '../investment-data';
|
} from '../investment-data';
|
||||||
import { exportWorkbook, ExportSheetSpec } from '../investment-export';
|
import { exportWorkbook, ExportSheetSpec } from '../investment-export';
|
||||||
|
import { InvestmentGlAccount, InvestmentService, apiErrorMessage } from '../investment.service';
|
||||||
|
|
||||||
type MasterTab =
|
type MasterTab =
|
||||||
| 'party'
|
| 'party'
|
||||||
@@ -65,12 +68,12 @@ type MasterTab =
|
|||||||
DateDdmmyyyyPickerComponent
|
DateDdmmyyyyPickerComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class InvestmentMastersComponent {
|
export class InvestmentMastersComponent implements OnInit {
|
||||||
activeTab: MasterTab = 'party';
|
activeTab: MasterTab = 'party';
|
||||||
|
|
||||||
scripts: ScriptMaster[] = [...SCRIPT_MASTER];
|
scripts: ScriptMaster[] = [];
|
||||||
brokers: BrokerMaster[] = [...BROKER_MASTER];
|
brokers: BrokerMaster[] = [...BROKER_MASTER];
|
||||||
parties: PartyMaster[] = [...PARTY_MASTER];
|
parties: PartyMaster[] = [];
|
||||||
subTypes: SubTypeMaster[] = [...SUBTYPE_MASTER];
|
subTypes: SubTypeMaster[] = [...SUBTYPE_MASTER];
|
||||||
controlParams: ControlParameter[] = [...CONTROL_PARAMETERS];
|
controlParams: ControlParameter[] = [...CONTROL_PARAMETERS];
|
||||||
mfProducts: MutualFundProductMaster[] = [...MUTUAL_FUND_PRODUCTS];
|
mfProducts: MutualFundProductMaster[] = [...MUTUAL_FUND_PRODUCTS];
|
||||||
@@ -106,8 +109,19 @@ export class InvestmentMastersComponent {
|
|||||||
toastVisible = false;
|
toastVisible = false;
|
||||||
private toastTimer: ReturnType<typeof setTimeout> | undefined;
|
private toastTimer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
|
||||||
newParty: Partial<PartyMaster> = {};
|
// Bank / Party Master and Script Master follow the bank's existing CBS screens (one entry form
|
||||||
newScript: Partial<ScriptMaster> = {};
|
// with Save / Search / Cancel / Drop / Exit) and are stored in the backend through
|
||||||
|
// InvestmentService; the other master tabs are still sample data.
|
||||||
|
private readonly investmentService = inject(InvestmentService);
|
||||||
|
partyForm: Partial<PartyMaster> = {};
|
||||||
|
partySearchCode = '';
|
||||||
|
scriptForm: Partial<ScriptMaster> = {};
|
||||||
|
scriptSearchCode = '';
|
||||||
|
saving = false;
|
||||||
|
readonly bankTypeOptions = BANK_TYPE_OPTIONS;
|
||||||
|
readonly slrTypeOptions = SLR_TYPE_OPTIONS;
|
||||||
|
/** Enabled ASSET detail GLs from the chart of accounts. */
|
||||||
|
investmentGlOptions: InvestmentGlAccount[] = [];
|
||||||
newSubType: Partial<SubTypeMaster> = {};
|
newSubType: Partial<SubTypeMaster> = {};
|
||||||
newBroker: Partial<BrokerMaster> = {};
|
newBroker: Partial<BrokerMaster> = {};
|
||||||
newControlParam: Partial<ControlParameter> = {};
|
newControlParam: Partial<ControlParameter> = {};
|
||||||
@@ -116,43 +130,216 @@ export class InvestmentMastersComponent {
|
|||||||
newSglBank: Partial<SglBankMaster> = {};
|
newSglBank: Partial<SglBankMaster> = {};
|
||||||
newDailyRate: Partial<DailyScriptRate> = {};
|
newDailyRate: Partial<DailyScriptRate> = {};
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.investmentService.getAssetGlAccounts().subscribe({
|
||||||
|
next: (gls) => (this.investmentGlOptions = gls),
|
||||||
|
error: (err) => this.toast(`Could not load GL accounts: ${apiErrorMessage(err)}`)
|
||||||
|
});
|
||||||
|
this.reloadMasters();
|
||||||
|
}
|
||||||
|
|
||||||
setTab(tab: MasterTab): void {
|
setTab(tab: MasterTab): void {
|
||||||
this.activeTab = tab;
|
this.activeTab = tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
addParty(): void {
|
/** Re-reads both masters from the backend (also refreshes the lists the Purchase screen uses). */
|
||||||
if (!this.newParty.partyName || !this.newParty.partyType) {
|
private reloadMasters(): void {
|
||||||
this.toast('Enter Party Name and Type.');
|
this.investmentService.syncSharedMasters().subscribe({
|
||||||
return;
|
next: ({ parties, scripts }) => {
|
||||||
}
|
this.parties = parties;
|
||||||
this.parties = [
|
this.scripts = scripts;
|
||||||
{
|
},
|
||||||
partyCode: `PTY-${String(this.parties.length + 1).padStart(3, '0')}`,
|
error: (err) => this.toast(`Could not load masters: ${apiErrorMessage(err)}`)
|
||||||
panNo: '',
|
});
|
||||||
...this.newParty
|
|
||||||
} as PartyMaster,
|
|
||||||
...this.parties
|
|
||||||
];
|
|
||||||
this.newParty = {};
|
|
||||||
this.toast('Party/Bank master added.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addScript(): void {
|
glName(glCode?: string): string {
|
||||||
if (!this.newScript.scriptName || !this.newScript.instrumentType) {
|
return (
|
||||||
this.toast('Enter Script Name and Instrument Type.');
|
this.investmentGlOptions.find((g) => g.glCode === glCode)?.name ??
|
||||||
|
INVESTMENT_GL_LOOKUP.find((g) => g.glCode === glCode)?.glName ??
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Bank / Party Master --------------------
|
||||||
|
/** Preview of the code the backend will assign; the saved code always comes from the backend. */
|
||||||
|
get nextPartyCode(): string {
|
||||||
|
const nums = this.parties.map((p) => parseInt(p.partyCode.replace(/\D/g, ''), 10)).filter((n) => !isNaN(n));
|
||||||
|
return `PTY-${String((nums.length ? Math.max(...nums) : 0) + 1).padStart(3, '0')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
saveParty(): void {
|
||||||
|
const f = this.partyForm;
|
||||||
|
if (!f.bondType || !f.partyName || !f.glAccountId) {
|
||||||
|
this.toast('Enter Bond Type, Party Name and GL A/c No.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.scripts = [
|
const body = {
|
||||||
{
|
bondType: f.bondType,
|
||||||
scriptCode: this.newScript.scriptCode || `SCR-${this.scripts.length + 1}`,
|
partyName: f.partyName,
|
||||||
isin: '',
|
address1: f.address1 ?? '',
|
||||||
faceValuePerUnit: 100,
|
address2: f.address2 ?? '',
|
||||||
...this.newScript
|
address3: f.address3 ?? '',
|
||||||
} as ScriptMaster,
|
city: f.city ?? '',
|
||||||
...this.scripts
|
pincode: f.pincode ?? '',
|
||||||
];
|
phone: f.phone ?? '',
|
||||||
this.newScript = {};
|
fax: f.fax ?? '',
|
||||||
this.toast('Script master added.');
|
bankType: f.bankType ?? '',
|
||||||
|
glAccountId: Number(f.glAccountId),
|
||||||
|
rbiCode: f.rbiCode ?? '',
|
||||||
|
limit: f.limit ?? null,
|
||||||
|
leiNo: f.leiNo ?? '',
|
||||||
|
cpBankName: f.cpBankName ?? '',
|
||||||
|
cpBranchName: f.cpBranchName ?? '',
|
||||||
|
cpAccountNo: f.cpAccountNo ?? '',
|
||||||
|
cpIfsc: f.cpIfsc ?? '',
|
||||||
|
active: f.status !== 'INACTIVE',
|
||||||
|
locale: 'en'
|
||||||
|
};
|
||||||
|
const request = f.id ? this.investmentService.updateParty(f.id, body) : this.investmentService.createParty(body);
|
||||||
|
this.saving = true;
|
||||||
|
request.subscribe({
|
||||||
|
next: (res) => {
|
||||||
|
this.saving = false;
|
||||||
|
this.toast(`Party ${res.resourceIdentifier ?? f.partyCode} ${f.id ? 'updated' : 'saved'}.`);
|
||||||
|
this.partyForm = {};
|
||||||
|
this.reloadMasters();
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
this.saving = false;
|
||||||
|
this.toast(apiErrorMessage(err));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
searchParty(): void {
|
||||||
|
const p = this.parties.find((x) => x.partyCode.toUpperCase() === this.partySearchCode.trim().toUpperCase());
|
||||||
|
if (!p) {
|
||||||
|
this.toast(`Party Code ${this.partySearchCode} not found.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.partyForm = { ...p };
|
||||||
|
this.toast(`Party ${p.partyCode} loaded.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelParty(): void {
|
||||||
|
this.partyForm = {};
|
||||||
|
this.partySearchCode = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
dropParty(): void {
|
||||||
|
const f = this.partyForm;
|
||||||
|
if (!f.id) {
|
||||||
|
this.toast('Search a saved party first, then Drop.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.investmentService.deleteParty(f.id).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.toast(`Party ${f.partyCode} dropped.`);
|
||||||
|
this.partyForm = {};
|
||||||
|
this.reloadMasters();
|
||||||
|
},
|
||||||
|
error: (err) => this.toast(apiErrorMessage(err))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Script Master --------------------
|
||||||
|
/** Coupon / maturity terms only apply to debt securities. */
|
||||||
|
get scriptIsDebtSecurity(): boolean {
|
||||||
|
return [
|
||||||
|
'GOVT_SECURITY',
|
||||||
|
'NON_SLR',
|
||||||
|
'BOND'
|
||||||
|
].includes(this.scriptForm.instrumentType ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Preview of the code the backend will assign — a type letter + running number, e.g. G00001. */
|
||||||
|
get nextScriptCode(): string {
|
||||||
|
const prefixByType: Record<InstrumentType, string> = {
|
||||||
|
GOVT_SECURITY: 'G',
|
||||||
|
NON_SLR: 'N',
|
||||||
|
BOND: 'B',
|
||||||
|
MUTUAL_FUND: 'M',
|
||||||
|
FD: 'F',
|
||||||
|
SHARE: 'S'
|
||||||
|
};
|
||||||
|
const type = this.scriptForm.instrumentType;
|
||||||
|
if (!type) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const prefix = prefixByType[type];
|
||||||
|
const pattern = new RegExp(`^${prefix}(\\d{5})$`);
|
||||||
|
const nums = this.scripts
|
||||||
|
.map((s) => pattern.exec(s.scriptCode)?.[1])
|
||||||
|
.filter((n): n is string => !!n)
|
||||||
|
.map((n) => parseInt(n, 10));
|
||||||
|
return `${prefix}${String((nums.length ? Math.max(...nums) : 0) + 1).padStart(5, '0')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
get scriptPeriod(): { years: number; months: number; days: number } {
|
||||||
|
return periodBetween(this.scriptForm.issueDate, this.scriptForm.maturityDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
saveScript(): void {
|
||||||
|
const f = this.scriptForm;
|
||||||
|
if (!f.instrumentType || !f.scriptName || !f.glAccountId) {
|
||||||
|
this.toast('Enter Bond Type, Script Desc and GL A/c No.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.scriptIsDebtSecurity && (!f.isin || f.couponRate == null || !f.issueDate)) {
|
||||||
|
this.toast('Enter ISIN, Int Rate and Issue Date for this security.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const body = {
|
||||||
|
bondType: f.instrumentType,
|
||||||
|
slrType: f.slrType ?? '',
|
||||||
|
scriptDesc: f.scriptName,
|
||||||
|
glAccountId: Number(f.glAccountId),
|
||||||
|
isin: f.isin ?? '',
|
||||||
|
intRate: f.couponRate ?? null,
|
||||||
|
issueDate: f.issueDate ?? '',
|
||||||
|
maturityDate: f.maturityDate ?? '',
|
||||||
|
companyName: f.companyName ?? '',
|
||||||
|
address1: f.address1 ?? '',
|
||||||
|
address2: f.address2 ?? '',
|
||||||
|
address3: f.address3 ?? '',
|
||||||
|
city: f.city ?? '',
|
||||||
|
pincode: f.pincode ?? '',
|
||||||
|
phone: f.phone ?? '',
|
||||||
|
fax: f.fax ?? '',
|
||||||
|
corpCode: f.corpCode ?? '',
|
||||||
|
dateFormat: 'dd-MM-yyyy',
|
||||||
|
locale: 'en'
|
||||||
|
};
|
||||||
|
const request = f.id ? this.investmentService.updateScript(f.id, body) : this.investmentService.createScript(body);
|
||||||
|
this.saving = true;
|
||||||
|
request.subscribe({
|
||||||
|
next: (res) => {
|
||||||
|
this.saving = false;
|
||||||
|
this.toast(`Script ${res.resourceIdentifier ?? f.scriptCode} ${f.id ? 'updated' : 'saved'}.`);
|
||||||
|
this.scriptForm = {};
|
||||||
|
this.reloadMasters();
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
this.saving = false;
|
||||||
|
this.toast(apiErrorMessage(err));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
searchScript(): void {
|
||||||
|
const s = this.scripts.find((x) => x.scriptCode.toUpperCase() === this.scriptSearchCode.trim().toUpperCase());
|
||||||
|
if (!s) {
|
||||||
|
this.toast(`Script Code ${this.scriptSearchCode} not found.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.scriptForm = { ...s };
|
||||||
|
this.toast(`Script ${s.scriptCode} loaded.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelScript(): void {
|
||||||
|
this.scriptForm = {};
|
||||||
|
this.scriptSearchCode = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
addSubType(): void {
|
addSubType(): void {
|
||||||
@@ -279,46 +466,121 @@ export class InvestmentMastersComponent {
|
|||||||
return one(
|
return one(
|
||||||
[
|
[
|
||||||
'Party Code',
|
'Party Code',
|
||||||
|
'Bond Type',
|
||||||
'Party Name',
|
'Party Name',
|
||||||
'Type',
|
'Address',
|
||||||
'PAN No'
|
'City',
|
||||||
|
'Pincode',
|
||||||
|
'Phone',
|
||||||
|
'Fax',
|
||||||
|
'Bank Type',
|
||||||
|
'GL A/c No',
|
||||||
|
'RBI Code',
|
||||||
|
'Limit',
|
||||||
|
'LEI No',
|
||||||
|
'Counterparty Bank',
|
||||||
|
'Branch',
|
||||||
|
'Account No',
|
||||||
|
'IFSC',
|
||||||
|
'Status'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
12,
|
12,
|
||||||
|
14,
|
||||||
30,
|
30,
|
||||||
16,
|
36,
|
||||||
14
|
14,
|
||||||
|
10,
|
||||||
|
14,
|
||||||
|
14,
|
||||||
|
24,
|
||||||
|
12,
|
||||||
|
12,
|
||||||
|
14,
|
||||||
|
22,
|
||||||
|
24,
|
||||||
|
20,
|
||||||
|
18,
|
||||||
|
14,
|
||||||
|
10
|
||||||
],
|
],
|
||||||
this.parties.map((p) => [
|
this.parties.map((p) => [
|
||||||
p.partyCode,
|
p.partyCode,
|
||||||
|
p.bondType ?? '',
|
||||||
p.partyName,
|
p.partyName,
|
||||||
p.partyType,
|
[
|
||||||
p.panNo
|
p.address1,
|
||||||
|
p.address2,
|
||||||
|
p.address3
|
||||||
|
]
|
||||||
|
.filter((x) => !!x)
|
||||||
|
.join(', '),
|
||||||
|
p.city ?? '',
|
||||||
|
p.pincode ?? '',
|
||||||
|
p.phone ?? '',
|
||||||
|
p.fax ?? '',
|
||||||
|
p.bankType ?? '',
|
||||||
|
p.glCode ?? '',
|
||||||
|
p.rbiCode ?? '',
|
||||||
|
p.limit ?? null,
|
||||||
|
p.leiNo ?? '',
|
||||||
|
p.cpBankName ?? '',
|
||||||
|
p.cpBranchName ?? '',
|
||||||
|
p.cpAccountNo ?? '',
|
||||||
|
p.cpIfsc ?? '',
|
||||||
|
p.status ?? 'ACTIVE'
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
case 'script':
|
case 'script':
|
||||||
return one(
|
return one(
|
||||||
[
|
[
|
||||||
'Script Code',
|
'Script Code',
|
||||||
'Script Name',
|
'Bond Type',
|
||||||
'Instrument',
|
'SLR',
|
||||||
|
'Script Desc',
|
||||||
|
'GL A/c No',
|
||||||
'ISIN',
|
'ISIN',
|
||||||
'Face Value/Unit'
|
'Int Rate %',
|
||||||
|
'Issue Date',
|
||||||
|
'Maturity Date',
|
||||||
|
'Period (Y/M/D)',
|
||||||
|
'Face Value/Unit',
|
||||||
|
'Company Name',
|
||||||
|
'Corp Code'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
14,
|
||||||
16,
|
16,
|
||||||
|
12,
|
||||||
30,
|
30,
|
||||||
|
12,
|
||||||
16,
|
16,
|
||||||
16,
|
10,
|
||||||
16
|
14,
|
||||||
|
14,
|
||||||
|
14,
|
||||||
|
14,
|
||||||
|
24,
|
||||||
|
12
|
||||||
],
|
],
|
||||||
this.scripts.map((s) => [
|
this.scripts.map((s) => {
|
||||||
s.scriptCode,
|
const p = periodBetween(s.issueDate, s.maturityDate);
|
||||||
s.scriptName,
|
return [
|
||||||
s.instrumentType,
|
s.scriptCode,
|
||||||
s.isin,
|
s.instrumentType,
|
||||||
s.faceValuePerUnit
|
s.slrType ?? '',
|
||||||
])
|
s.scriptName,
|
||||||
|
s.glCode ?? '',
|
||||||
|
s.isin,
|
||||||
|
s.couponRate ?? null,
|
||||||
|
s.issueDate ?? '',
|
||||||
|
s.maturityDate ?? '',
|
||||||
|
s.issueDate && s.maturityDate ? `${p.years}/${p.months}/${p.days}` : '',
|
||||||
|
s.faceValuePerUnit,
|
||||||
|
s.companyName ?? '',
|
||||||
|
s.corpCode ?? ''
|
||||||
|
];
|
||||||
|
})
|
||||||
);
|
);
|
||||||
case 'subtype':
|
case 'subtype':
|
||||||
return one(
|
return one(
|
||||||
|
|||||||
@@ -0,0 +1,344 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Injectable, inject } from '@angular/core';
|
||||||
|
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
||||||
|
import { Observable, forkJoin } from 'rxjs';
|
||||||
|
import { map, tap } from 'rxjs/operators';
|
||||||
|
import {
|
||||||
|
InstrumentType,
|
||||||
|
InvestmentHolding,
|
||||||
|
PARTY_MASTER,
|
||||||
|
PartyMaster,
|
||||||
|
SCRIPT_MASTER,
|
||||||
|
ScriptMaster,
|
||||||
|
SlrType
|
||||||
|
} from './investment-data';
|
||||||
|
|
||||||
|
/** Investment party as returned by /investment/parties. */
|
||||||
|
export interface InvestmentPartyDto {
|
||||||
|
id: number;
|
||||||
|
partyCode: string;
|
||||||
|
bondType: InstrumentType;
|
||||||
|
partyName: string;
|
||||||
|
address1?: string;
|
||||||
|
address2?: string;
|
||||||
|
address3?: string;
|
||||||
|
city?: string;
|
||||||
|
pincode?: string;
|
||||||
|
phone?: string;
|
||||||
|
fax?: string;
|
||||||
|
bankType?: string;
|
||||||
|
glAccountId: number;
|
||||||
|
glCode: string;
|
||||||
|
glName: string;
|
||||||
|
rbiCode?: string;
|
||||||
|
limit?: number;
|
||||||
|
leiNo?: string;
|
||||||
|
cpBankName?: string;
|
||||||
|
cpBranchName?: string;
|
||||||
|
cpAccountNo?: string;
|
||||||
|
cpIfsc?: string;
|
||||||
|
active: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Investment script as returned by /investment/scripts (dates are DD-MM-YYYY). */
|
||||||
|
export interface InvestmentScriptDto {
|
||||||
|
id: number;
|
||||||
|
scriptCode: string;
|
||||||
|
bondType: InstrumentType;
|
||||||
|
slrType?: SlrType;
|
||||||
|
scriptDesc: string;
|
||||||
|
glAccountId: number;
|
||||||
|
glCode: string;
|
||||||
|
glName: string;
|
||||||
|
isin?: string;
|
||||||
|
faceValuePerUnit: number;
|
||||||
|
intRate?: number;
|
||||||
|
issueDate?: string;
|
||||||
|
maturityDate?: string;
|
||||||
|
companyName?: string;
|
||||||
|
address1?: string;
|
||||||
|
address2?: string;
|
||||||
|
address3?: string;
|
||||||
|
city?: string;
|
||||||
|
pincode?: string;
|
||||||
|
phone?: string;
|
||||||
|
fax?: string;
|
||||||
|
corpCode?: string;
|
||||||
|
active: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Purchase entry (holding) as returned by /investment/purchases (dates are DD-MM-YYYY). */
|
||||||
|
export interface InvestmentPurchaseDto {
|
||||||
|
id: number;
|
||||||
|
dealNo: string;
|
||||||
|
certNo: string;
|
||||||
|
bondType: InstrumentType;
|
||||||
|
scriptId: number;
|
||||||
|
scriptCode: string;
|
||||||
|
scriptDesc: string;
|
||||||
|
isin?: string;
|
||||||
|
partyId: number;
|
||||||
|
partyCode: string;
|
||||||
|
partyName: string;
|
||||||
|
dealDate: string;
|
||||||
|
dealTime?: string;
|
||||||
|
settlementType: string;
|
||||||
|
settlementDate: string;
|
||||||
|
faceValue: number;
|
||||||
|
purchaseRate: number;
|
||||||
|
units: number;
|
||||||
|
balanceUnits: number;
|
||||||
|
brokerage?: number;
|
||||||
|
stampDuty?: number;
|
||||||
|
bookValue: number;
|
||||||
|
premiumDiscount?: number;
|
||||||
|
intRate?: number;
|
||||||
|
issueDate?: string;
|
||||||
|
maturityDate?: string;
|
||||||
|
lastIntDate?: string;
|
||||||
|
accruedDays?: number;
|
||||||
|
accruedInterest?: number;
|
||||||
|
settlementAmount: number;
|
||||||
|
ytm?: number;
|
||||||
|
category: string;
|
||||||
|
subType?: string;
|
||||||
|
investmentGlAccountId: number;
|
||||||
|
investmentGlCode: string;
|
||||||
|
investmentGlName: string;
|
||||||
|
crGlAccountId: number;
|
||||||
|
crGlCode: string;
|
||||||
|
crGlName: string;
|
||||||
|
otherDetails?: string;
|
||||||
|
status: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InvestmentGlAccount {
|
||||||
|
id: number;
|
||||||
|
glCode: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backend calls for the Investment masters (Bank / Party Master and Script Master). Results are also copied into the
|
||||||
|
* shared PARTY_MASTER / SCRIPT_MASTER lists so screens that still read those lists (Purchase Entry) offer the saved
|
||||||
|
* masters.
|
||||||
|
*/
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class InvestmentService {
|
||||||
|
private http = inject(HttpClient);
|
||||||
|
|
||||||
|
// -------------------- Bank / Party Master --------------------
|
||||||
|
getParties(): Observable<InvestmentPartyDto[]> {
|
||||||
|
return this.http.get<InvestmentPartyDto[]>('/investment/parties');
|
||||||
|
}
|
||||||
|
|
||||||
|
createParty(body: object): Observable<{ resourceId: number; resourceIdentifier: string }> {
|
||||||
|
return this.http.post<{ resourceId: number; resourceIdentifier: string }>('/investment/parties', body);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateParty(id: number, body: object): Observable<{ resourceId: number; resourceIdentifier: string }> {
|
||||||
|
return this.http.put<{ resourceId: number; resourceIdentifier: string }>(`/investment/parties/${id}`, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteParty(id: number): Observable<unknown> {
|
||||||
|
return this.http.delete(`/investment/parties/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Script Master --------------------
|
||||||
|
getScripts(): Observable<InvestmentScriptDto[]> {
|
||||||
|
return this.http.get<InvestmentScriptDto[]>('/investment/scripts');
|
||||||
|
}
|
||||||
|
|
||||||
|
createScript(body: object): Observable<{ resourceId: number; resourceIdentifier: string }> {
|
||||||
|
return this.http.post<{ resourceId: number; resourceIdentifier: string }>('/investment/scripts', body);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateScript(id: number, body: object): Observable<{ resourceId: number; resourceIdentifier: string }> {
|
||||||
|
return this.http.put<{ resourceId: number; resourceIdentifier: string }>(`/investment/scripts/${id}`, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Purchase Entry --------------------
|
||||||
|
getPurchases(): Observable<InvestmentPurchaseDto[]> {
|
||||||
|
return this.http.get<InvestmentPurchaseDto[]>('/investment/purchases');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Coupon and 31 Mar / 30 Sep provision lines of a holding up to maturity (calculated, not posted). */
|
||||||
|
getInterestSchedule(purchaseId: number, asOnDate?: string): Observable<InvestmentInterestScheduleDto> {
|
||||||
|
const params = asOnDate ? `?asOnDate=${encodeURIComponent(asOnDate)}` : '';
|
||||||
|
return this.http.get<InvestmentInterestScheduleDto>(
|
||||||
|
`/investment/purchases/${purchaseId}/interest-schedule${params}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
createPurchase(body: object): Observable<{ resourceId: number; resourceIdentifier: string }> {
|
||||||
|
return this.http.post<{ resourceId: number; resourceIdentifier: string }>('/investment/purchases', body);
|
||||||
|
}
|
||||||
|
|
||||||
|
deletePurchase(id: number): Observable<unknown> {
|
||||||
|
return this.http.delete(`/investment/purchases/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- GL accounts --------------------
|
||||||
|
/** Enabled ASSET detail GLs — the only kind an investment party / script can be booked to. */
|
||||||
|
getAssetGlAccounts(): Observable<InvestmentGlAccount[]> {
|
||||||
|
return this.http
|
||||||
|
.get<
|
||||||
|
Array<{ id: number; glCode: string; name: string; disabled: boolean }>
|
||||||
|
>('/glaccounts', { params: { type: '1', usage: '1', disabled: 'false' } })
|
||||||
|
.pipe(
|
||||||
|
map((list) =>
|
||||||
|
list
|
||||||
|
.map((g) => ({ id: g.id, glCode: g.glCode, name: g.name }))
|
||||||
|
.sort((a, b) => a.glCode.localeCompare(b.glCode))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Loads both masters from the backend and refreshes the shared lists other screens read. */
|
||||||
|
syncSharedMasters(): Observable<{ parties: PartyMaster[]; scripts: ScriptMaster[] }> {
|
||||||
|
return forkJoin({ parties: this.getParties(), scripts: this.getScripts() }).pipe(
|
||||||
|
map(({ parties, scripts }) => ({ parties: parties.map(toPartyMaster), scripts: scripts.map(toScriptMaster) })),
|
||||||
|
tap(({ parties, scripts }) => {
|
||||||
|
PARTY_MASTER.splice(0, PARTY_MASTER.length, ...parties);
|
||||||
|
SCRIPT_MASTER.splice(0, SCRIPT_MASTER.length, ...scripts);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toPartyMaster(p: InvestmentPartyDto): PartyMaster {
|
||||||
|
return {
|
||||||
|
id: p.id,
|
||||||
|
partyCode: p.partyCode,
|
||||||
|
partyName: p.partyName,
|
||||||
|
partyType: 'BANK',
|
||||||
|
bondType: p.bondType,
|
||||||
|
address1: p.address1,
|
||||||
|
address2: p.address2,
|
||||||
|
address3: p.address3,
|
||||||
|
city: p.city,
|
||||||
|
pincode: p.pincode,
|
||||||
|
phone: p.phone,
|
||||||
|
fax: p.fax,
|
||||||
|
bankType: p.bankType,
|
||||||
|
glAccountId: p.glAccountId,
|
||||||
|
glCode: p.glCode,
|
||||||
|
glName: p.glName,
|
||||||
|
rbiCode: p.rbiCode,
|
||||||
|
limit: p.limit ?? null,
|
||||||
|
leiNo: p.leiNo,
|
||||||
|
cpBankName: p.cpBankName,
|
||||||
|
cpBranchName: p.cpBranchName,
|
||||||
|
cpAccountNo: p.cpAccountNo,
|
||||||
|
cpIfsc: p.cpIfsc,
|
||||||
|
status: p.active ? 'ACTIVE' : 'INACTIVE'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toScriptMaster(s: InvestmentScriptDto): ScriptMaster {
|
||||||
|
return {
|
||||||
|
id: s.id,
|
||||||
|
scriptCode: s.scriptCode,
|
||||||
|
scriptName: s.scriptDesc,
|
||||||
|
instrumentType: s.bondType,
|
||||||
|
isin: s.isin ?? '',
|
||||||
|
faceValuePerUnit: s.faceValuePerUnit,
|
||||||
|
slrType: s.slrType,
|
||||||
|
glAccountId: s.glAccountId,
|
||||||
|
glCode: s.glCode,
|
||||||
|
glName: s.glName,
|
||||||
|
couponRate: s.intRate,
|
||||||
|
issueDate: s.issueDate,
|
||||||
|
maturityDate: s.maturityDate,
|
||||||
|
companyName: s.companyName,
|
||||||
|
address1: s.address1,
|
||||||
|
address2: s.address2,
|
||||||
|
address3: s.address3,
|
||||||
|
city: s.city,
|
||||||
|
pincode: s.pincode,
|
||||||
|
phone: s.phone,
|
||||||
|
fax: s.fax,
|
||||||
|
corpCode: s.corpCode,
|
||||||
|
active: s.active
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A saved purchase as a row of the Holdings register. */
|
||||||
|
export function toHolding(p: InvestmentPurchaseDto): InvestmentHolding {
|
||||||
|
return {
|
||||||
|
id: p.id,
|
||||||
|
dealNo: p.dealNo,
|
||||||
|
certNo: p.certNo,
|
||||||
|
instrumentType: p.bondType,
|
||||||
|
scriptCode: p.scriptCode,
|
||||||
|
scriptName: p.scriptDesc,
|
||||||
|
party: p.partyName,
|
||||||
|
partyCode: p.partyCode,
|
||||||
|
subType: p.subType ?? '',
|
||||||
|
faceValue: p.faceValue,
|
||||||
|
purchaseRate: p.purchaseRate,
|
||||||
|
units: p.balanceUnits,
|
||||||
|
purchaseDate: p.settlementDate,
|
||||||
|
maturityDate: p.maturityDate || p.dealDate,
|
||||||
|
interestRate: p.intRate ?? 0,
|
||||||
|
interestFreq: p.bondType === 'MUTUAL_FUND' ? 'CUMULATIVE' : 'HALF_YEARLY',
|
||||||
|
glCode: p.investmentGlCode,
|
||||||
|
glName: p.investmentGlName,
|
||||||
|
crToAc: p.crGlCode,
|
||||||
|
brokerCode: '',
|
||||||
|
status: 'ACTIVE',
|
||||||
|
category: p.category,
|
||||||
|
bookValue: p.bookValue,
|
||||||
|
settlementAmount: p.settlementAmount
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** One line of a holding's interest schedule (see InvestmentInterestScheduleData in the backend). */
|
||||||
|
export interface InvestmentInterestRowDto {
|
||||||
|
type: 'COUPON' | 'PROVISION';
|
||||||
|
intDate: string;
|
||||||
|
fromDate: string;
|
||||||
|
toDate: string;
|
||||||
|
days: number;
|
||||||
|
grossInterest: number;
|
||||||
|
alreadyBooked: number;
|
||||||
|
amount: number;
|
||||||
|
due: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InvestmentInterestScheduleDto {
|
||||||
|
purchaseId: number;
|
||||||
|
dealNo: string;
|
||||||
|
certNo: string;
|
||||||
|
scriptCode: string;
|
||||||
|
scriptDesc: string;
|
||||||
|
faceValue: number;
|
||||||
|
unitValue: number;
|
||||||
|
balanceUnits: number;
|
||||||
|
purchaseRate: number;
|
||||||
|
bookValue: number;
|
||||||
|
intRate: number;
|
||||||
|
dealDate: string;
|
||||||
|
lastIntDate: string;
|
||||||
|
maturityDate: string;
|
||||||
|
purchasedAccruedInterest: number;
|
||||||
|
couponPerHalfYear: number;
|
||||||
|
asOnDate: string;
|
||||||
|
interestGlCode: string;
|
||||||
|
interestGlName: string;
|
||||||
|
rows: InvestmentInterestRowDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The first validation / domain-rule message from a Fineract error response, for a toast. */
|
||||||
|
export function apiErrorMessage(err: unknown): string {
|
||||||
|
const e = err as HttpErrorResponse;
|
||||||
|
const body = e?.error;
|
||||||
|
return body?.errors?.[0]?.defaultUserMessage || body?.defaultUserMessage || e?.message || 'Request failed.';
|
||||||
|
}
|
||||||
@@ -13,15 +13,21 @@
|
|||||||
<div>
|
<div>
|
||||||
<h2 class="tdsr__title">Deposit Interest & TDS</h2>
|
<h2 class="tdsr__title">Deposit Interest & TDS</h2>
|
||||||
<div class="tdsr__sub">
|
<div class="tdsr__sub">
|
||||||
Quarter-wise and yearly interest on time deposits, with tax deductible under {{ statute.section }} ·
|
Interest each customer earned this year, and whether TDS has to be deducted on it ·
|
||||||
{{ scopeLabel }}
|
<strong>Showing: {{ scopeLabel }}</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="tdsr__btn" (click)="exportWorkbook()" [disabled]="exporting">
|
<div class="tdsr__head-r">
|
||||||
<fa-icon icon="download"></fa-icon>
|
<button type="button" class="tdsr__btn" (click)="showHelp = !showHelp">
|
||||||
{{ exporting ? 'Preparing…' : 'Export' }}
|
<fa-icon icon="question-circle"></fa-icon>
|
||||||
</button>
|
{{ showHelp ? 'Hide help' : 'How to read this page' }}
|
||||||
|
</button>
|
||||||
|
<button type="button" class="tdsr__btn" (click)="exportWorkbook()" [disabled]="exporting">
|
||||||
|
<fa-icon icon="download"></fa-icon>
|
||||||
|
{{ exporting ? 'Preparing…' : 'Export' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (loadError) {
|
@if (loadError) {
|
||||||
@@ -31,57 +37,87 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<!-- Help -->
|
||||||
|
@if (showHelp) {
|
||||||
|
<div class="tdsr__help">
|
||||||
|
<div class="tdsr__help-title"><fa-icon icon="info-circle"></fa-icon> How to read this page</div>
|
||||||
|
<ol class="tdsr__help-list">
|
||||||
|
<li>
|
||||||
|
Every customer with an account is listed. Each account is either
|
||||||
|
<span class="tdsr__pill tdsr__pill--ok">Tracked</span> — its interest counts toward the TDS limit — or
|
||||||
|
<span class="tdsr__pill">Not tracked</span>. Open a row (<fa-icon icon="chevron-down"></fa-icon>) to see which
|
||||||
|
account is which, and why.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Only <strong>fixed and recurring deposits</strong> are tracked. Savings interest is shown for information but
|
||||||
|
never attracts TDS.
|
||||||
|
</li>
|
||||||
|
@if (rules) {
|
||||||
|
<li>
|
||||||
|
A customer's tracked interest for the whole year, across every branch, is checked against the limit:
|
||||||
|
<strong>₹{{ rules.general | number: '1.0-0' }}</strong
|
||||||
|
>, or <strong>₹{{ rules.senior | number: '1.0-0' }}</strong> for a senior citizen (60+).
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Once over the limit, TDS is <strong>{{ rules.rate | number: '1.0-2' }}%</strong> of the
|
||||||
|
<em>whole</em> year's interest — <strong>{{ rules.rateNoPan | number: '1.0-2' }}%</strong> if no PAN is on
|
||||||
|
record.
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
<li>A customer who has submitted Form 15G/15H is not deducted, even over the limit.</li>
|
||||||
|
<li>
|
||||||
|
The TDS figures here are <strong>worked out by this report</strong> from the interest actually posted. They
|
||||||
|
are not debited from the customer's account automatically.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<!-- Summary -->
|
<!-- Summary -->
|
||||||
<div class="tdsr__kpis">
|
<div class="tdsr__kpis">
|
||||||
<div class="tdsr__kpi">
|
<div class="tdsr__kpi">
|
||||||
<div class="tdsr__kpi-n">{{ summary.deductees | number }}</div>
|
<div class="tdsr__kpi-n">{{ summary.deductees | number }}</div>
|
||||||
<div class="tdsr__kpi-l">Deductees</div>
|
<div class="tdsr__kpi-l">Customers · {{ summary.trackedCustomers | number }} with an FD/RD being tracked</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tdsr__kpi">
|
<div class="tdsr__kpi">
|
||||||
<div class="tdsr__kpi-n">₹{{ summary.applicableInterest | number: '1.0-0' }}</div>
|
<div class="tdsr__kpi-n">₹{{ summary.applicableInterest | number: '1.0-0' }}</div>
|
||||||
<div class="tdsr__kpi-l">Interest on FD / RD</div>
|
<div class="tdsr__kpi-l">FD / RD interest — counts toward the limit</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tdsr__kpi tdsr__kpi--muted">
|
<div class="tdsr__kpi tdsr__kpi--muted">
|
||||||
<div class="tdsr__kpi-n">₹{{ summary.exemptInterest | number: '1.0-0' }}</div>
|
<div class="tdsr__kpi-n">₹{{ summary.exemptInterest | number: '1.0-0' }}</div>
|
||||||
<div class="tdsr__kpi-l">Savings interest — outside the charge</div>
|
<div class="tdsr__kpi-l">Savings interest — shown only, no TDS</div>
|
||||||
</div>
|
|
||||||
<div class="tdsr__kpi tdsr__kpi--warn">
|
|
||||||
<div class="tdsr__kpi-n">₹{{ summary.totalTds | number: '1.0-0' }}</div>
|
|
||||||
<div class="tdsr__kpi-l">TDS payable</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="tdsr__kpi tdsr__kpi--warn">
|
<div class="tdsr__kpi tdsr__kpi--warn">
|
||||||
<div class="tdsr__kpi-n">{{ summary.crossed | number }}</div>
|
<div class="tdsr__kpi-n">{{ summary.crossed | number }}</div>
|
||||||
<div class="tdsr__kpi-l">Crossed the threshold</div>
|
<div class="tdsr__kpi-l">Customers over the limit</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="tdsr__kpi tdsr__kpi--action" (click)="showNearThreshold()">
|
<div class="tdsr__kpi tdsr__kpi--warn">
|
||||||
<div class="tdsr__kpi-n">{{ summary.nearThreshold | number }}</div>
|
<div class="tdsr__kpi-n">₹{{ summary.totalTds | number: '1.0-0' }}</div>
|
||||||
<div class="tdsr__kpi-l">Within ₹{{ nearBand | number: '1.0-0' }} of it — chase a declaration</div>
|
<div class="tdsr__kpi-l">TDS to be deducted</div>
|
||||||
</button>
|
|
||||||
<div class="tdsr__kpi tdsr__kpi--ok">
|
|
||||||
<div class="tdsr__kpi-n">₹{{ summary.tdsSaved | number: '1.0-0' }}</div>
|
|
||||||
<div class="tdsr__kpi-l">Saved by {{ summary.declarations | number }} declarations</div>
|
|
||||||
</div>
|
</div>
|
||||||
@if (summary.noPan > 0) {
|
|
||||||
<div class="tdsr__kpi tdsr__kpi--warn">
|
|
||||||
<div class="tdsr__kpi-n">{{ summary.noPan | number }}</div>
|
|
||||||
<div class="tdsr__kpi-l">No PAN — deducted at 20%</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Quarter strip -->
|
<!-- Things worth acting on, only when there are any -->
|
||||||
<div class="tdsr__card">
|
@if (summary.nearThreshold || summary.declarations || summary.noPan) {
|
||||||
<div class="tdsr__card-head"><fa-icon icon="calendar"></fa-icon> Quarter by quarter</div>
|
<div class="tdsr__chips">
|
||||||
<div class="tdsr__qstrip">
|
@if (summary.nearThreshold) {
|
||||||
@for (q of summary.byQuarter; track q.quarter) {
|
<button type="button" class="tdsr__chip tdsr__chip--near" (click)="showNearThreshold()">
|
||||||
<div class="tdsr__qcell">
|
{{ summary.nearThreshold | number }} near the limit (within ₹{{ nearBand | number: '1.0-0' }}) — ask for
|
||||||
<div class="tdsr__qcell-l">{{ quarterLabel[q.quarter] }}</div>
|
15G/15H
|
||||||
<div class="tdsr__qcell-n">₹{{ q.interest | number: '1.0-0' }}</div>
|
</button>
|
||||||
<div class="tdsr__qcell-s">TDS ₹{{ q.tds | number: '1.0-0' }}</div>
|
}
|
||||||
</div>
|
@if (summary.declarations) {
|
||||||
|
<span class="tdsr__chip tdsr__chip--ok">
|
||||||
|
{{ summary.declarations | number }} with 15G/15H — ₹{{ summary.tdsSaved | number: '1.0-0' }} not deducted
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
@if (summary.noPan) {
|
||||||
|
<span class="tdsr__chip tdsr__chip--warn">
|
||||||
|
{{ summary.noPan | number }} FD/RD customers without PAN — higher rate applies
|
||||||
|
</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
|
|
||||||
<!-- Filters -->
|
<!-- Filters -->
|
||||||
<div class="tdsr__filters">
|
<div class="tdsr__filters">
|
||||||
@@ -99,8 +135,8 @@
|
|||||||
<span>Branch</span>
|
<span>Branch</span>
|
||||||
<select [(ngModel)]="filter.branchCode" (ngModelChange)="onFilterChanged()">
|
<select [(ngModel)]="filter.branchCode" (ngModelChange)="onFilterChanged()">
|
||||||
<option value="">All branches</option>
|
<option value="">All branches</option>
|
||||||
@for (b of branches; track b.code) {
|
@for (b of branches; track b) {
|
||||||
<option [value]="b.code">{{ b.name }}</option>
|
<option [value]="b">{{ b }}</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
@@ -117,32 +153,32 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="tdsr__filter">
|
<label class="tdsr__filter">
|
||||||
<span>Threshold band</span>
|
<span>Age group</span>
|
||||||
<select [(ngModel)]="filter.band" (ngModelChange)="onFilterChanged()">
|
<select [(ngModel)]="filter.band" (ngModelChange)="onFilterChanged()">
|
||||||
<option value="">Both bands</option>
|
<option value="">Everyone</option>
|
||||||
<option value="GENERAL">General (below 60)</option>
|
<option value="GENERAL">Below 60</option>
|
||||||
<option value="SENIOR">Senior citizen (60+)</option>
|
<option value="SENIOR">Senior citizen (60+)</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="tdsr__filter tdsr__filter--wide">
|
<label class="tdsr__filter tdsr__filter--wide">
|
||||||
<span>Customer / CIF / PAN</span>
|
<span>Search customer</span>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
[(ngModel)]="filter.search"
|
[(ngModel)]="filter.search"
|
||||||
(ngModelChange)="onFilterChanged()"
|
(ngModelChange)="onFilterChanged()"
|
||||||
placeholder="name, CIF or PAN"
|
placeholder="Name, customer ID or PAN"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="tdsr__check">
|
<label class="tdsr__check">
|
||||||
<input type="checkbox" [(ngModel)]="filter.crossedOnly" (ngModelChange)="onFilterChanged()" />
|
<input type="checkbox" [(ngModel)]="filter.crossedOnly" (ngModelChange)="onFilterChanged()" />
|
||||||
<span>Threshold crossed only</span>
|
<span>Over the limit only</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="tdsr__check">
|
<label class="tdsr__check">
|
||||||
<input type="checkbox" [(ngModel)]="filter.nearThresholdOnly" (ngModelChange)="onFilterChanged()" />
|
<input type="checkbox" [(ngModel)]="filter.nearThresholdOnly" (ngModelChange)="onFilterChanged()" />
|
||||||
<span>Near threshold only</span>
|
<span>Near the limit only</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@if (hasFilters) {
|
@if (hasFilters) {
|
||||||
@@ -150,7 +186,7 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tabs Selector -->
|
<!-- Tabs -->
|
||||||
<div class="tdsr__tabs">
|
<div class="tdsr__tabs">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -158,7 +194,7 @@
|
|||||||
[class.tdsr__tab--active]="selectedTab === 'paying'"
|
[class.tdsr__tab--active]="selectedTab === 'paying'"
|
||||||
(click)="selectTab('paying')"
|
(click)="selectTab('paying')"
|
||||||
>
|
>
|
||||||
Paying TDS ({{ payingRows.length }})
|
TDS to deduct ({{ payingRows.length }})
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -166,7 +202,7 @@
|
|||||||
[class.tdsr__tab--active]="selectedTab === 'not-paying'"
|
[class.tdsr__tab--active]="selectedTab === 'not-paying'"
|
||||||
(click)="selectTab('not-paying')"
|
(click)="selectTab('not-paying')"
|
||||||
>
|
>
|
||||||
Not Paying TDS ({{ notPayingRows.length }})
|
No TDS ({{ notPayingRows.length }})
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -176,87 +212,76 @@
|
|||||||
<table class="tdsr__table">
|
<table class="tdsr__table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Customer · PAN</th>
|
<th>Customer</th>
|
||||||
<th>Branch</th>
|
<th>Branch</th>
|
||||||
<th>Form · Band</th>
|
<th>Accounts</th>
|
||||||
<th class="num">Q1</th>
|
<th class="num">FD / RD interest this year</th>
|
||||||
<th class="num">Q2</th>
|
<th class="num">Limit</th>
|
||||||
<th class="num">Q3</th>
|
<th>Status</th>
|
||||||
<th class="num">Q4</th>
|
|
||||||
<th class="num">Year total</th>
|
|
||||||
<th class="num">Threshold</th>
|
|
||||||
<th>Crossed</th>
|
|
||||||
<th class="num">TDS</th>
|
<th class="num">TDS</th>
|
||||||
<th class="num">Saved</th>
|
|
||||||
<th class="col-actions"></th>
|
<th class="col-actions"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@for (row of pagedRows; track trackRow($index, row)) {
|
@for (row of pagedRows; track trackRow($index, row)) {
|
||||||
<tr [class.tdsr__row--warn]="!row.panOnRecord" [class.tdsr__row--near]="row.nearThreshold">
|
<tr class="tdsr__row--click" [class.tdsr__row--near]="row.nearThreshold" (click)="toggleExpanded(row)">
|
||||||
<td>
|
<td>
|
||||||
<div class="tdsr__name">{{ row.deductee.name }}</div>
|
<div class="tdsr__name">{{ row.deductee.name }}</div>
|
||||||
<div class="mono small muted">
|
<div class="mono small muted">
|
||||||
{{ row.deductee.customerId }} ·
|
ID {{ row.deductee.customerId }} ·
|
||||||
@if (row.panOnRecord) {
|
@if (row.panOnRecord) {
|
||||||
{{ row.deductee.pan }}
|
PAN {{ row.deductee.pan }}
|
||||||
} @else {
|
} @else {
|
||||||
<span class="tdsr__pill tdsr__pill--warn">no PAN</span>
|
<span class="tdsr__pill tdsr__pill--warn">no PAN</span>
|
||||||
}
|
}
|
||||||
|
@if (row.band === 'SENIOR') {
|
||||||
|
<span class="tdsr__pill">Senior 60+</span>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="small">{{ branchName(row.branchCode) }}</td>
|
<td class="small">{{ row.branchCode || '—' }}</td>
|
||||||
<td>
|
<td class="small">
|
||||||
<span class="tdsr__pill" [class.tdsr__pill--ok]="row.hasDeclaration">
|
@if (row.trackedAccounts) {
|
||||||
{{ row.form === '121' ? '121' : row.form }}
|
<span class="tdsr__pill tdsr__pill--ok">{{ row.trackedAccounts }} tracked</span>
|
||||||
</span>
|
}
|
||||||
<div class="small muted">{{ row.band === 'SENIOR' ? 'Senior' : 'General' }}</div>
|
@if (untrackedOf(row).length) {
|
||||||
@if (row.hasDeclaration) {
|
<span class="tdsr__pill">{{ untrackedOf(row).length }} not tracked</span>
|
||||||
<div class="mono small muted">{{ row.declarationUin }}</div>
|
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
@for (q of quarters; track q) {
|
|
||||||
<td class="num small">
|
|
||||||
@if (row.quarters[q]) {
|
|
||||||
₹{{ row.quarters[q] | number: '1.0-0' }}
|
|
||||||
} @else {
|
|
||||||
<span class="muted">—</span>
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
}
|
|
||||||
<td class="num">
|
<td class="num">
|
||||||
<strong>₹{{ row.tdsApplicableInterest | number: '1.0-0' }}</strong>
|
<strong>₹{{ row.tdsApplicableInterest | number: '1.0-0' }}</strong>
|
||||||
@if (row.exemptInterest) {
|
@if (row.exemptInterest) {
|
||||||
<div class="small muted">+₹{{ row.exemptInterest | number: '1.0-0' }} SB (exempt)</div>
|
<div class="small muted">+ ₹{{ row.exemptInterest | number: '1.0-0' }} savings (no TDS)</div>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td class="num small muted">₹{{ row.threshold | number: '1.0-0' }}</td>
|
<td class="num small muted">₹{{ row.threshold | number: '1.0-0' }}</td>
|
||||||
<td class="small">
|
<td class="small">
|
||||||
@if (row.crossedInQuarter) {
|
<span
|
||||||
<span class="tdsr__pill tdsr__pill--warn">Q{{ row.crossedInQuarter }}</span>
|
class="tdsr__pill"
|
||||||
} @else if (row.nearThreshold) {
|
[class.tdsr__pill--warn]="statusOf(row).tone === 'warn'"
|
||||||
<span class="tdsr__pill tdsr__pill--near"> ₹{{ row.headroom | number: '1.0-0' }} left </span>
|
[class.tdsr__pill--near]="statusOf(row).tone === 'near'"
|
||||||
} @else {
|
[class.tdsr__pill--ok]="statusOf(row).tone === 'ok'"
|
||||||
<span class="muted">—</span>
|
>
|
||||||
}
|
{{ statusOf(row).label }}
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="num">
|
<td class="num">
|
||||||
@if (row.schedule.totalTds) {
|
@if (row.schedule.totalTds) {
|
||||||
<strong>₹{{ row.schedule.totalTds | number: '1.0-0' }}</strong>
|
<strong>₹{{ row.schedule.totalTds | number: '1.0-0' }}</strong>
|
||||||
<div class="small muted">@ {{ row.rateApplied * 100 | number: '1.0-0' }}%</div>
|
<div class="small muted">@ {{ row.rateApplied * 100 | number: '1.0-0' }}%</div>
|
||||||
} @else {
|
} @else if (row.tdsSaved) {
|
||||||
<span class="muted">—</span>
|
<span class="small tdsr__ok">₹{{ row.tdsSaved | number: '1.0-0' }} saved</span>
|
||||||
}
|
|
||||||
</td>
|
|
||||||
<td class="num">
|
|
||||||
@if (row.tdsSaved) {
|
|
||||||
<strong class="tdsr__ok">₹{{ row.tdsSaved | number: '1.0-0' }}</strong>
|
|
||||||
} @else {
|
} @else {
|
||||||
<span class="muted">—</span>
|
<span class="muted">—</span>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td class="col-actions">
|
<td class="col-actions">
|
||||||
<button type="button" class="tdsr__icon-btn" (click)="toggleExpanded(row)">
|
<button
|
||||||
|
type="button"
|
||||||
|
class="tdsr__icon-btn"
|
||||||
|
[attr.aria-label]="isExpanded(row) ? 'Hide details' : 'Show details'"
|
||||||
|
(click)="$event.stopPropagation(); toggleExpanded(row)"
|
||||||
|
>
|
||||||
<fa-icon [icon]="isExpanded(row) ? 'chevron-up' : 'chevron-down'"></fa-icon>
|
<fa-icon [icon]="isExpanded(row) ? 'chevron-up' : 'chevron-down'"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -264,89 +289,138 @@
|
|||||||
|
|
||||||
@if (isExpanded(row)) {
|
@if (isExpanded(row)) {
|
||||||
<tr class="tdsr__row--detail">
|
<tr class="tdsr__row--detail">
|
||||||
<td colspan="13">
|
<td colspan="8">
|
||||||
@for (note of row.schedule.notes; track note) {
|
<!-- 1. Which accounts are tracked -->
|
||||||
<div class="tdsr__note">
|
<div class="tdsr__detail-h">Accounts of {{ row.deductee.name }}</div>
|
||||||
<fa-icon icon="info-circle"></fa-icon>
|
|
||||||
<div>{{ note }}</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (row.jointHeldInterest) {
|
|
||||||
<div class="tdsr__note">
|
|
||||||
<fa-icon icon="info-circle"></fa-icon>
|
|
||||||
<div>
|
|
||||||
₹{{ row.jointHeldInterest | number: '1.0-0' }} of interest sits on deposits where this customer
|
|
||||||
is a joint holder but not the first-named one. Tax there is deducted against the first-named
|
|
||||||
holder, so it is excluded from the figures above.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<table class="tdsr__table tdsr__table--inner">
|
<table class="tdsr__table tdsr__table--inner">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Quarter</th>
|
<th>Account no.</th>
|
||||||
<th class="num">Interest</th>
|
<th>Type</th>
|
||||||
<th class="num">Cumulative</th>
|
<th>Tracked for TDS?</th>
|
||||||
<th class="num">Liability to date</th>
|
<th class="num">Interest this year</th>
|
||||||
<th class="num">TDS this quarter</th>
|
<th class="num">Postings</th>
|
||||||
<th>Return due</th>
|
<th>Last posted</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@for (line of row.schedule.lines; track line.quarter) {
|
@for (a of row.accounts; track a.accountNo) {
|
||||||
<tr [class.tdsr__row--warn]="line.thresholdCrossedHere">
|
<tr>
|
||||||
|
<td class="mono small">{{ a.accountNo }}</td>
|
||||||
|
<td class="small">{{ accountTypeLabel[a.type] }}</td>
|
||||||
<td class="small">
|
<td class="small">
|
||||||
{{ line.label }}
|
@if (a.tracked) {
|
||||||
@if (line.thresholdCrossedHere) {
|
<span class="tdsr__pill tdsr__pill--ok"><fa-icon icon="check"></fa-icon> Yes</span>
|
||||||
<span class="tdsr__pill tdsr__pill--warn">crossed here</span>
|
|
||||||
}
|
|
||||||
@if (line.declarationActive) {
|
|
||||||
<span class="tdsr__pill tdsr__pill--ok">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 {
|
} @else {
|
||||||
<span class="muted">—</span>
|
<span class="tdsr__pill">No</span>
|
||||||
}
|
}
|
||||||
|
<span class="muted"> {{ a.reason }}</span>
|
||||||
|
</td>
|
||||||
|
<td class="num">₹{{ a.interest | number: '1.2-2' }}</td>
|
||||||
|
<td class="num small">{{ a.postings }}</td>
|
||||||
|
<td class="small muted">
|
||||||
|
{{ a.lastPostedOn ? (a.lastPostedOn | date: 'd MMM y') : 'No interest posted yet' }}
|
||||||
</td>
|
</td>
|
||||||
<td class="small muted">{{ line.dueDate }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="tdsr__meta">
|
<!-- 2. How the TDS was worked out -->
|
||||||
<span
|
@if (row.trackedAccounts) {
|
||||||
>Settlement: <strong>{{ row.mode === 'QUARTERLY' ? 'Quarterly' : 'Year end' }}</strong> (set by
|
<div class="tdsr__detail-h">How the TDS is worked out, quarter by quarter</div>
|
||||||
the deposit product)</span
|
@for (note of row.schedule.notes; track note) {
|
||||||
>
|
<div class="tdsr__note">
|
||||||
@if (row.declarationAcceptedOn) {
|
<fa-icon icon="info-circle"></fa-icon>
|
||||||
<span
|
<div>{{ note }}</div>
|
||||||
>Declaration accepted: <strong>{{ row.declarationAcceptedOn | date: 'd MMM y' }}</strong></span
|
</div>
|
||||||
>
|
}
|
||||||
|
@if (row.schedule.lines.length) {
|
||||||
|
<table class="tdsr__table tdsr__table--inner">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Quarter</th>
|
||||||
|
<th class="num">Interest in quarter</th>
|
||||||
|
<th class="num">Total so far</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.tdsr__row--warn]="line.thresholdCrossedHere">
|
||||||
|
<td class="small">
|
||||||
|
{{ line.label }}
|
||||||
|
@if (line.thresholdCrossedHere) {
|
||||||
|
<span class="tdsr__pill tdsr__pill--warn">limit crossed here</span>
|
||||||
|
}
|
||||||
|
@if (line.declarationActive) {
|
||||||
|
<span class="tdsr__pill tdsr__pill--ok">15G/15H active</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="num">₹{{ line.interest | number: '1.0-0' }}</td>
|
||||||
|
<td class="num">
|
||||||
|
₹{{ line.cumInterest | number: '1.0-0' }}
|
||||||
|
<span class="small muted">of ₹{{ row.threshold | number: '1.0-0' }}</span>
|
||||||
|
</td>
|
||||||
|
<td class="num">
|
||||||
|
@if (line.tds !== 0) {
|
||||||
|
<strong>₹{{ line.tds | number: '1.0-0' }}</strong>
|
||||||
|
} @else {
|
||||||
|
<span class="muted">—</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="small muted">{{ line.dueDate }}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
} @else {
|
||||||
|
<div class="small muted">No interest has been posted on the tracked deposits this year yet.</div>
|
||||||
}
|
}
|
||||||
@if (row.paidWithoutDeduction) {
|
@if (row.paidWithoutDeduction) {
|
||||||
<span>
|
<div class="tdsr__meta">
|
||||||
Paid without deduction:
|
<span>
|
||||||
<strong>₹{{ row.paidWithoutDeduction | number: '1.0-0' }}</strong> — reportable in
|
Paid without deduction because of 15G/15H:
|
||||||
{{ statute.statement }}
|
<strong>₹{{ row.paidWithoutDeduction | number: '1.0-0' }}</strong> — still reported in
|
||||||
</span>
|
{{ statute.statement }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
} @else {
|
||||||
|
<div class="tdsr__note">
|
||||||
|
<fa-icon icon="info-circle"></fa-icon>
|
||||||
|
<div>
|
||||||
|
This customer has no fixed or recurring deposit, so nothing here counts toward TDS. Savings
|
||||||
|
interest is shown for information only.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (row.jointHeldInterest) {
|
||||||
|
<div class="tdsr__note">
|
||||||
|
<fa-icon icon="info-circle"></fa-icon>
|
||||||
|
<div>
|
||||||
|
₹{{ row.jointHeldInterest | number: '1.0-0' }} of interest is on joint deposits where this
|
||||||
|
customer is not the first-named holder, so it is counted under that holder instead.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@if (visibleRows.length === 0) {
|
@if (visibleRows.length === 0) {
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="13" class="tdsr__empty">
|
<td colspan="8" class="tdsr__empty">
|
||||||
<fa-icon icon="info-circle"></fa-icon> No customers in this section match the filters.
|
<fa-icon icon="info-circle"></fa-icon>
|
||||||
|
@if (loading) {
|
||||||
|
Loading…
|
||||||
|
} @else if (selectedTab === 'paying') {
|
||||||
|
No customer needs TDS deducted for these filters. Check the "No TDS" tab.
|
||||||
|
} @else {
|
||||||
|
No customers match these filters.
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@@ -359,8 +433,7 @@
|
|||||||
<div class="tdsr__pager-l">
|
<div class="tdsr__pager-l">
|
||||||
<span>
|
<span>
|
||||||
Showing <strong>{{ rangeStart | number }}–{{ rangeEnd | number }}</strong> of
|
Showing <strong>{{ rangeStart | number }}–{{ rangeEnd | number }}</strong> of
|
||||||
<strong>{{ visibleRows.length | number }}</strong>
|
<strong>{{ visibleRows.length | number }}</strong> customers
|
||||||
{{ selectedTab === 'paying' ? 'deductees paying TDS' : 'deductees not paying TDS' }}
|
|
||||||
</span>
|
</span>
|
||||||
<label class="tdsr__pager-sizel">
|
<label class="tdsr__pager-sizel">
|
||||||
Rows
|
Rows
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
import * as ExcelJS from 'exceljs';
|
import * as ExcelJS from 'exceljs';
|
||||||
|
|
||||||
import { BranchScopeService } from '../core/branch-scope.service';
|
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 { FY_TAX_CONFIG, Quarter, QUARTER_LABEL } from '../letter-mgmt/certificates/form-15gh/tds-15gh.compute';
|
||||||
import { setTdsDeductees, tdsFys } from './tds-reports-data';
|
import { TdsDeductee, setTdsDeductees, tdsFys } from './tds-reports-data';
|
||||||
import { TdsReportsService } from './tds-reports.service';
|
import { TdsReportsService } from './tds-reports.service';
|
||||||
import {
|
import {
|
||||||
NEAR_THRESHOLD_BAND,
|
NEAR_THRESHOLD_BAND,
|
||||||
|
TdsAccountLine,
|
||||||
TdsInterestRow,
|
TdsInterestRow,
|
||||||
TdsInterestSummary,
|
TdsInterestSummary,
|
||||||
TdsReportFilter,
|
TdsReportFilter,
|
||||||
@@ -40,7 +40,12 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
private scope = inject(BranchScopeService);
|
private scope = inject(BranchScopeService);
|
||||||
private tdsService = inject(TdsReportsService);
|
private tdsService = inject(TdsReportsService);
|
||||||
|
|
||||||
readonly branches = GL_BRANCHES.filter((b) => b.code !== 'HO');
|
/**
|
||||||
|
* Office names the loaded customers belong to, for Head Office's branch selector. Read off the
|
||||||
|
* data rather than a fixed list, which named branches this bank does not have and left out the
|
||||||
|
* ones it does.
|
||||||
|
*/
|
||||||
|
branches: string[] = [];
|
||||||
/** Filled by the route resolver from Organization › TDS Configuration. */
|
/** Filled by the route resolver from Organization › TDS Configuration. */
|
||||||
readonly financialYears = tdsFys();
|
readonly financialYears = tdsFys();
|
||||||
readonly quarterLabel = QUARTER_LABEL;
|
readonly quarterLabel = QUARTER_LABEL;
|
||||||
@@ -92,16 +97,26 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
loadError = '';
|
loadError = '';
|
||||||
|
/** The "how to read this page" panel. */
|
||||||
|
showHelp = true;
|
||||||
|
|
||||||
|
readonly accountTypeLabel: Record<TdsAccountLine['type'], string> = {
|
||||||
|
FD: 'Fixed deposit',
|
||||||
|
RD: 'Recurring deposit',
|
||||||
|
SB: 'Savings',
|
||||||
|
OTHER: 'Other'
|
||||||
|
};
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
if (!this.financialYears.length) {
|
if (!this.financialYears.length) {
|
||||||
this.loadError = 'No financial year is configured for TDS. Set one up under Organization › TDS Configuration.';
|
this.loadError = 'No financial year is configured for TDS. Set one up under Organization › TDS Configuration.';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// A branch login sees only its own book and cannot widen the scope.
|
// A branch login sees only its own book and cannot widen the scope. The platform labels each
|
||||||
const own = this.scope.ownBranchCode;
|
// customer with their office's name, so the login's office name is the filter — the GL branch
|
||||||
if (own) {
|
// code list does not know every office and turned a branch login into an empty report.
|
||||||
this.filter.branchCode = own;
|
if (!this.scope.isHeadOffice) {
|
||||||
|
this.filter.branchCode = this.scope.officeName;
|
||||||
}
|
}
|
||||||
this.loadDeductees();
|
this.loadDeductees();
|
||||||
}
|
}
|
||||||
@@ -121,6 +136,7 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
next: (deductees) => {
|
next: (deductees) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
setTdsDeductees(deductees);
|
setTdsDeductees(deductees);
|
||||||
|
this.branches = this.branchesOf(deductees);
|
||||||
this.invalidateCaches();
|
this.invalidateCaches();
|
||||||
},
|
},
|
||||||
error: (err: any) => {
|
error: (err: any) => {
|
||||||
@@ -138,6 +154,11 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
* only the summary left the KPIs counting the new data while the tables kept the empty list
|
* 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.
|
* cached on the first render, before the load returned.
|
||||||
*/
|
*/
|
||||||
|
private branchesOf(deductees: TdsDeductee[]): string[] {
|
||||||
|
const names = new Set(deductees.map((d) => d.branchCode).filter((n) => !!n));
|
||||||
|
return [...names].sort((a, b) => a.localeCompare(b));
|
||||||
|
}
|
||||||
|
|
||||||
private invalidateCaches(): void {
|
private invalidateCaches(): void {
|
||||||
this.rowsCacheKey = '';
|
this.rowsCacheKey = '';
|
||||||
this.summaryCacheKey = '';
|
this.summaryCacheKey = '';
|
||||||
@@ -168,12 +189,54 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The limits and rates for the selected year, for the help panel. */
|
||||||
|
get rules(): { general: number; senior: number; rate: number; rateNoPan: number } | null {
|
||||||
|
const cfg = FY_TAX_CONFIG[this.filter.fy];
|
||||||
|
if (!cfg) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
general: cfg.thresholdGeneral,
|
||||||
|
senior: cfg.thresholdSenior,
|
||||||
|
rate: cfg.rate * 100,
|
||||||
|
rateNoPan: cfg.rateNoPan * 100
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
get canSelectBranch(): boolean {
|
get canSelectBranch(): boolean {
|
||||||
return this.scope.canSelectBranch;
|
return this.scope.canSelectBranch;
|
||||||
}
|
}
|
||||||
|
|
||||||
get scopeLabel(): string {
|
get scopeLabel(): string {
|
||||||
return this.filter.branchCode ? glBranchName(this.filter.branchCode) : 'All branches';
|
return this.filter.branchCode ? `${this.filter.branchCode} branch` : 'All branches';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One plain-language status per customer, so a reader does not have to work it out from the
|
||||||
|
* threshold, crossed and saved columns together.
|
||||||
|
*/
|
||||||
|
statusOf(row: TdsInterestRow): { label: string; tone: 'muted' | 'warn' | 'near' | 'ok' } {
|
||||||
|
if (!row.trackedAccounts) {
|
||||||
|
return { label: 'Not tracked — no FD/RD', tone: 'muted' };
|
||||||
|
}
|
||||||
|
if (row.schedule.totalTds > 0) {
|
||||||
|
return { label: 'Over the limit — TDS due', tone: 'warn' };
|
||||||
|
}
|
||||||
|
if (row.hasDeclaration && row.crossed) {
|
||||||
|
return { label: 'Over the limit — 15G/15H, no TDS', tone: 'ok' };
|
||||||
|
}
|
||||||
|
if (row.nearThreshold) {
|
||||||
|
return { label: `Near the limit — ₹${Math.round(row.headroom).toLocaleString('en-IN')} left`, tone: 'near' };
|
||||||
|
}
|
||||||
|
return { label: 'Below the limit', tone: 'ok' };
|
||||||
|
}
|
||||||
|
|
||||||
|
trackedOf(row: TdsInterestRow): TdsAccountLine[] {
|
||||||
|
return row.accounts.filter((a) => a.tracked);
|
||||||
|
}
|
||||||
|
|
||||||
|
untrackedOf(row: TdsInterestRow): TdsAccountLine[] {
|
||||||
|
return row.accounts.filter((a) => !a.tracked);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Recomputes the book only when the filter actually changed. Side-effect free. */
|
/** Recomputes the book only when the filter actually changed. Side-effect free. */
|
||||||
@@ -315,10 +378,6 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
return this.expandedId === row.deductee.customerId;
|
return this.expandedId === row.deductee.customerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
branchName(code: string): string {
|
|
||||||
return glBranchName(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
trackRow(_: number, row: TdsInterestRow): string {
|
trackRow(_: number, row: TdsInterestRow): string {
|
||||||
return row.deductee.customerId;
|
return row.deductee.customerId;
|
||||||
}
|
}
|
||||||
@@ -337,6 +396,9 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
'CIF',
|
'CIF',
|
||||||
'PAN',
|
'PAN',
|
||||||
'Branch',
|
'Branch',
|
||||||
|
'Accounts tracked for TDS',
|
||||||
|
'Accounts not tracked',
|
||||||
|
'Status',
|
||||||
'Form',
|
'Form',
|
||||||
'Band',
|
'Band',
|
||||||
'Age',
|
'Age',
|
||||||
@@ -361,7 +423,14 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
r.deductee.name,
|
r.deductee.name,
|
||||||
r.deductee.customerId,
|
r.deductee.customerId,
|
||||||
r.deductee.pan || 'NOT ON RECORD',
|
r.deductee.pan || 'NOT ON RECORD',
|
||||||
this.branchName(r.branchCode),
|
r.branchCode,
|
||||||
|
this.trackedOf(r)
|
||||||
|
.map((a) => `${a.accountNo} (${a.type})`)
|
||||||
|
.join(', '),
|
||||||
|
this.untrackedOf(r)
|
||||||
|
.map((a) => `${a.accountNo} (${a.type})`)
|
||||||
|
.join(', '),
|
||||||
|
this.statusOf(r).label,
|
||||||
r.form === '121' ? 'Form 121' : `Form ${r.form}`,
|
r.form === '121' ? 'Form 121' : `Form ${r.form}`,
|
||||||
r.band === 'SENIOR' ? 'Senior citizen' : 'General',
|
r.band === 'SENIOR' ? 'Senior citizen' : 'General',
|
||||||
r.age,
|
r.age,
|
||||||
@@ -389,6 +458,9 @@ export class TdsInterestReportComponent implements OnInit {
|
|||||||
`${s.deductees} deductees`,
|
`${s.deductees} deductees`,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
|
`${s.trackedCustomers} tracked`,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
|
|||||||
@@ -56,6 +56,25 @@ export interface TdsReportFilter {
|
|||||||
nearThresholdOnly: boolean;
|
nearThresholdOnly: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One of the customer's accounts as the report sees it: whether its interest is being counted
|
||||||
|
* toward the deduction, and if not, why not. A customer can hold savings, fixed and recurring
|
||||||
|
* accounts together, and the branch has to see which of them the deduction is actually watching.
|
||||||
|
*/
|
||||||
|
export interface TdsAccountLine {
|
||||||
|
accountNo: string;
|
||||||
|
type: 'FD' | 'RD' | 'SB' | 'OTHER';
|
||||||
|
/** True when the account's interest counts toward this customer's threshold. */
|
||||||
|
tracked: boolean;
|
||||||
|
/** Plain-language reason, shown beside the account. */
|
||||||
|
reason: string;
|
||||||
|
/** Interest credited in the year. */
|
||||||
|
interest: number;
|
||||||
|
/** How many interest postings made up that figure. */
|
||||||
|
postings: number;
|
||||||
|
lastPostedOn: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
/** How close to the trigger counts as "worth chasing a declaration for". */
|
/** How close to the trigger counts as "worth chasing a declaration for". */
|
||||||
export const NEAR_THRESHOLD_BAND = 6_000;
|
export const NEAR_THRESHOLD_BAND = 6_000;
|
||||||
|
|
||||||
@@ -101,6 +120,10 @@ export interface TdsInterestRow {
|
|||||||
paidWithoutDeduction: number;
|
paidWithoutDeduction: number;
|
||||||
panOnRecord: boolean;
|
panOnRecord: boolean;
|
||||||
rateApplied: number;
|
rateApplied: number;
|
||||||
|
/** Every account the customer holds, tracked or not. */
|
||||||
|
accounts: TdsAccountLine[];
|
||||||
|
/** How many of them count toward the deduction. */
|
||||||
|
trackedAccounts: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
function emptyQuarters(): Record<Quarter, number> {
|
function emptyQuarters(): Record<Quarter, number> {
|
||||||
@@ -154,14 +177,35 @@ export function tdsInterestRowsForFy(fy: string): TdsInterestRow[] {
|
|||||||
|
|
||||||
let exemptInterest = 0;
|
let exemptInterest = 0;
|
||||||
let jointHeldInterest = 0;
|
let jointHeldInterest = 0;
|
||||||
|
const accountLines: TdsAccountLine[] = [];
|
||||||
for (const account of deductee.accounts) {
|
for (const account of deductee.accounts) {
|
||||||
const inYear = account.credits.filter((c) => fyOf(c.date) === fy).reduce((s, c) => s + c.amount, 0);
|
const yearCredits = account.credits.filter((c) => fyOf(c.date) === fy);
|
||||||
|
const inYear = yearCredits.reduce((s, c) => s + c.amount, 0);
|
||||||
|
const type = accountTypeOf(account.depositTypeCode);
|
||||||
|
let tracked = false;
|
||||||
|
let reason: string;
|
||||||
if (!isTdsApplicable(account)) {
|
if (!isTdsApplicable(account)) {
|
||||||
exemptInterest += inYear;
|
exemptInterest += inYear;
|
||||||
|
reason = type === 'SB' ? 'Savings account — no TDS on savings interest' : 'Not a time deposit — no TDS';
|
||||||
} else if (tdsDeducteeOf(account) !== deductee.clientId) {
|
} else if (tdsDeducteeOf(account) !== deductee.clientId) {
|
||||||
jointHeldInterest += inYear;
|
jointHeldInterest += inYear;
|
||||||
|
reason = 'Joint deposit — counted under the first-named holder';
|
||||||
|
} else {
|
||||||
|
tracked = true;
|
||||||
|
reason = 'Counted toward the TDS limit';
|
||||||
}
|
}
|
||||||
|
accountLines.push({
|
||||||
|
accountNo: account.accountNo || '',
|
||||||
|
type,
|
||||||
|
tracked,
|
||||||
|
reason,
|
||||||
|
interest: inYear,
|
||||||
|
postings: yearCredits.length,
|
||||||
|
lastPostedOn: yearCredits.reduce<string | null>((last, c) => (!last || c.date > last ? c.date : last), null)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
// Tracked accounts first, so the deposits that drive the figure lead the list.
|
||||||
|
accountLines.sort((a, b) => Number(b.tracked) - Number(a.tracked));
|
||||||
|
|
||||||
const crossedLine = schedule.lines.find((l) => l.thresholdCrossedHere);
|
const crossedLine = schedule.lines.find((l) => l.thresholdCrossedHere);
|
||||||
const headroom = Math.max(0, schedule.threshold - schedule.totalInterest);
|
const headroom = Math.max(0, schedule.threshold - schedule.totalInterest);
|
||||||
@@ -190,7 +234,9 @@ export function tdsInterestRowsForFy(fy: string): TdsInterestRow[] {
|
|||||||
tdsSaved: declaration ? Math.max(0, withoutDeclaration.totalTds - schedule.totalTds) : 0,
|
tdsSaved: declaration ? Math.max(0, withoutDeclaration.totalTds - schedule.totalTds) : 0,
|
||||||
paidWithoutDeduction: schedule.shieldedInterest,
|
paidWithoutDeduction: schedule.shieldedInterest,
|
||||||
panOnRecord: isWellFormedPan(deductee.pan),
|
panOnRecord: isWellFormedPan(deductee.pan),
|
||||||
rateApplied: schedule.rateApplied
|
rateApplied: schedule.rateApplied,
|
||||||
|
accounts: accountLines,
|
||||||
|
trackedAccounts: accountLines.filter((a) => a.tracked).length
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,10 +256,29 @@ function overallModeFor(deductee: TdsDeductee): TdsMode {
|
|||||||
return applicable.some((a) => tdsModeFor(a) === 'QUARTERLY') ? 'QUARTERLY' : 'ANNUAL';
|
return applicable.some((a) => tdsModeFor(a) === 'QUARTERLY') ? 'QUARTERLY' : 'ANNUAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function accountTypeOf(code: string | undefined): TdsAccountLine['type'] {
|
||||||
|
const c = (code || '').toLowerCase();
|
||||||
|
if (c.includes('fixeddeposit')) {
|
||||||
|
return 'FD';
|
||||||
|
}
|
||||||
|
if (c.includes('recurringdeposit')) {
|
||||||
|
return 'RD';
|
||||||
|
}
|
||||||
|
if (c.includes('savings')) {
|
||||||
|
return 'SB';
|
||||||
|
}
|
||||||
|
return 'OTHER';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Branches are compared by office name, case and spacing aside — the platform and the session both carry the name. */
|
||||||
|
function sameBranch(a: string, b: string): boolean {
|
||||||
|
return (a || '').trim().toLowerCase() === (b || '').trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
export function tdsInterestRows(filter: TdsReportFilter): TdsInterestRow[] {
|
export function tdsInterestRows(filter: TdsReportFilter): TdsInterestRow[] {
|
||||||
const needle = filter.search.trim().toLowerCase();
|
const needle = filter.search.trim().toLowerCase();
|
||||||
return tdsInterestRowsForFy(filter.fy).filter((row) => {
|
return tdsInterestRowsForFy(filter.fy).filter((row) => {
|
||||||
if (filter.branchCode && row.branchCode !== filter.branchCode) {
|
if (filter.branchCode && !sameBranch(row.branchCode, filter.branchCode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (filter.band && row.band !== filter.band) {
|
if (filter.band && row.band !== filter.band) {
|
||||||
@@ -254,6 +319,8 @@ export interface TdsInterestSummary {
|
|||||||
tdsSaved: number;
|
tdsSaved: number;
|
||||||
paidWithoutDeduction: number;
|
paidWithoutDeduction: number;
|
||||||
noPan: number;
|
noPan: number;
|
||||||
|
/** Customers holding at least one account whose interest counts toward the deduction. */
|
||||||
|
trackedCustomers: number;
|
||||||
byQuarter: { quarter: Quarter; interest: number; tds: number }[];
|
byQuarter: { quarter: Quarter; interest: number; tds: number }[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +347,10 @@ export function tdsInterestSummary(filter: TdsReportFilter): TdsInterestSummary
|
|||||||
declarations: rows.filter((r) => r.hasDeclaration).length,
|
declarations: rows.filter((r) => r.hasDeclaration).length,
|
||||||
tdsSaved: rows.reduce((s, r) => s + r.tdsSaved, 0),
|
tdsSaved: rows.reduce((s, r) => s + r.tdsSaved, 0),
|
||||||
paidWithoutDeduction: rows.reduce((s, r) => s + r.paidWithoutDeduction, 0),
|
paidWithoutDeduction: rows.reduce((s, r) => s + r.paidWithoutDeduction, 0),
|
||||||
noPan: rows.filter((r) => !r.panOnRecord).length,
|
// Only customers with a deposit the deduction watches: a savings-only customer without a PAN
|
||||||
|
// is never deducted at the higher rate, so counting them overstated the problem.
|
||||||
|
noPan: rows.filter((r) => !r.panOnRecord && r.trackedAccounts > 0).length,
|
||||||
|
trackedCustomers: rows.filter((r) => r.trackedAccounts > 0).length,
|
||||||
byQuarter
|
byQuarter
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -647,3 +647,82 @@
|
|||||||
color: var(--tdsr-ink);
|
color: var(--tdsr-ink);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Help panel (interest report) ── */
|
||||||
|
.tdsr__help {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
padding: 14px 18px;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--tdsr-blue) 25%, transparent);
|
||||||
|
border-radius: 10px;
|
||||||
|
background: color-mix(in srgb, var(--tdsr-blue) 5%, transparent);
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdsr__help-title {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--tdsr-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdsr__help-list {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 20px;
|
||||||
|
|
||||||
|
li + li {
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Action chips under the summary ── */
|
||||||
|
.tdsr__chips {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
margin: -6px 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdsr__chip {
|
||||||
|
padding: 5px 12px;
|
||||||
|
border: 1px solid var(--tdsr-line);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--tdsr-bg);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
&--near {
|
||||||
|
border-color: color-mix(in srgb, var(--tdsr-blue) 30%, transparent);
|
||||||
|
color: var(--tdsr-blue);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--ok {
|
||||||
|
border-color: color-mix(in srgb, var(--tdsr-green) 35%, transparent);
|
||||||
|
color: var(--tdsr-green);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--warn {
|
||||||
|
border-color: color-mix(in srgb, var(--tdsr-amber) 35%, transparent);
|
||||||
|
color: var(--tdsr-amber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdsr__row--click {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover > td {
|
||||||
|
background: var(--tdsr-bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdsr__detail-h {
|
||||||
|
margin: 4px 0 8px;
|
||||||
|
font-weight: 700;
|
||||||
|
|
||||||
|
.tdsr__table--inner + & {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
export default {
|
export default {
|
||||||
'mifos_x': {
|
'mifos_x': {
|
||||||
'version': '261001',
|
'version': '261005',
|
||||||
'hash': '1ffac4b1'
|
'hash': '1ffac4b1'
|
||||||
},
|
},
|
||||||
'allow_switching_backend_instance': true
|
'allow_switching_backend_instance': true
|
||||||
|
|||||||
Reference in New Issue
Block a user