feat(investment): bucket wise report, script rating and non-SLR limits on purchase

This commit is contained in:
2026-10-23 12:38:24 +05:30
parent 7bd880387e
commit 731ab5a0e0
12 changed files with 862 additions and 14 deletions
@@ -32,6 +32,9 @@ import {
BANK_TYPE_OPTIONS,
SLR_TYPE_OPTIONS,
INVESTMENT_GL_LOOKUP,
ELIGIBLE_RATINGS,
RATING_AGENCY_OPTIONS,
RATING_OPTIONS,
periodBetween
} from '../investment-data';
import { exportWorkbook, ExportSheetSpec } from '../investment-export';
@@ -124,6 +127,8 @@ export class InvestmentMastersComponent implements OnInit {
saving = false;
readonly bankTypeOptions = BANK_TYPE_OPTIONS;
readonly slrTypeOptions = SLR_TYPE_OPTIONS;
readonly ratingOptions = RATING_OPTIONS;
readonly ratingAgencyOptions = RATING_AGENCY_OPTIONS;
/** Investment GLs (under the 100700 INVESTMENTS head) a party or script can be mapped to — not loans, banks or test GLs. */
investmentGlOptions: InvestmentGlAccount[] = [];
/** Income GLs under 400400 INCOME FROM INVESTMENTS, for an FD bank's interest. */
@@ -295,6 +300,19 @@ export class InvestmentMastersComponent implements OnInit {
].includes(this.scriptForm.instrumentType ?? '');
}
/** Corporate bonds, CPs and CDs carry a credit rating and a listed / unlisted flag (RBI non-SLR rules). */
get scriptIsRated(): boolean {
return [
'NON_SLR',
'BOND'
].includes(this.scriptForm.instrumentType ?? '');
}
/** Whether the rating entered meets the RBI minimum: "A" for bonds, "A2" for CP / CD. */
get scriptRatingEligible(): boolean {
return !!this.scriptForm.rating && ELIGIBLE_RATINGS.includes(this.scriptForm.rating);
}
/** Preview of the code the backend will assign — a type letter + running number, e.g. G00001. */
get nextScriptCode(): string {
const prefixByType: Record<InstrumentType, string> = {
@@ -332,6 +350,10 @@ export class InvestmentMastersComponent implements OnInit {
this.toast('Enter ISIN, Int Rate, Issue Date and Maturity Date for this security.');
return;
}
if (this.scriptIsRated && !f.rating) {
this.toast('Enter the credit rating of this bond / CP / CD.');
return;
}
const body = {
bondType: f.instrumentType,
slrType: f.slrType ?? '',
@@ -350,6 +372,9 @@ export class InvestmentMastersComponent implements OnInit {
phone: f.phone ?? '',
fax: f.fax ?? '',
corpCode: f.corpCode ?? '',
rating: this.scriptIsRated ? (f.rating ?? '') : '',
ratingAgency: this.scriptIsRated ? (f.ratingAgency ?? '') : '',
listed: !this.scriptIsRated || f.listed !== false,
active: f.active !== false,
dateFormat: 'dd-MM-yyyy',
locale: 'en'