feat(investment): add Treasury Investment module (FD, Govt Sec/Non-SLR/Bond/MF, Share)
Adds full frontend-only Investment module mirroring the legacy AutoBank CBS Investment menu: Dashboard, FD/Bond/Share entry screens (purchase, interest, sell/redeem, write-off, amortize and more), 10 master screens, an Interest calculation/register screen, and ~21 reports. All figures are derived from a single holdings/transactions dataset so entry, interest, and reports can never drift out of sync. Wires the new "Investment" mega-menu into the shell and routes the previously inert Investment stub buttons.
This commit is contained in:
@@ -0,0 +1,694 @@
|
||||
<!--
|
||||
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/.
|
||||
-->
|
||||
|
||||
<div class="pg">
|
||||
<header class="pg-head">
|
||||
<div>
|
||||
<div class="pg-eyebrow">TREASURY · INVESTMENT · REPORTS</div>
|
||||
<h1 class="pg-title">Investment Reports</h1>
|
||||
<p class="pg-sub">
|
||||
Balance reports, ledgers, registers, maturity lists and the consolidated portfolio — all derived live from the
|
||||
same holdings/transactions used by the Entry screens.
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="cctr-tabs">
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeGroup === 'balance'"
|
||||
(click)="setGroup('balance', 'govtSecBalance')"
|
||||
>
|
||||
Balance Reports
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeGroup === 'ledger'"
|
||||
(click)="setGroup('ledger', 'fdLedger')"
|
||||
>
|
||||
Ledgers & Registers
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeGroup === 'maturity'"
|
||||
(click)="setGroup('maturity', 'maturedFd')"
|
||||
>
|
||||
Maturity & Lists
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeGroup === 'portfolio'"
|
||||
(click)="setGroup('portfolio', 'portfolio')"
|
||||
>
|
||||
Portfolio
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- ===================== BALANCE REPORTS ===================== -->
|
||||
@if (activeGroup === 'balance') {
|
||||
<div class="cctr-tabs">
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'govtSecBalance'"
|
||||
(click)="setReport('govtSecBalance')"
|
||||
>
|
||||
Govt Security Balance
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'shareBalance'"
|
||||
(click)="setReport('shareBalance')"
|
||||
>
|
||||
Share Balance
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'fdrBalance'"
|
||||
(click)="setReport('fdrBalance')"
|
||||
>
|
||||
FDR Balance
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'bankInvList'"
|
||||
(click)="setReport('bankInvList')"
|
||||
>
|
||||
Bank Investment List
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (activeReport === 'govtSecBalance' || activeReport === 'shareBalance' || activeReport === 'fdrBalance') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">
|
||||
{{
|
||||
activeReport === 'govtSecBalance'
|
||||
? 'Govt Security Balance Report'
|
||||
: activeReport === 'shareBalance'
|
||||
? 'Share Balance Report'
|
||||
: 'FDR Balance Report'
|
||||
}}
|
||||
</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cert No</th>
|
||||
<th>Script / Party</th>
|
||||
<th class="num">Units</th>
|
||||
<th class="num">Face Value</th>
|
||||
<th class="num">Market/Purchase Rate</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (
|
||||
h of activeReport === 'govtSecBalance'
|
||||
? govtSecHoldings
|
||||
: activeReport === 'shareBalance'
|
||||
? shareHoldings
|
||||
: fdHoldings;
|
||||
track h.certNo
|
||||
) {
|
||||
<tr>
|
||||
<td>
|
||||
<span class="pg-chip">{{ h.certNo }}</span>
|
||||
</td>
|
||||
<td>{{ h.scriptName }} — {{ h.party }}</td>
|
||||
<td class="num">{{ h.units | number }}</td>
|
||||
<td class="num">₹{{ h.faceValue | number: '1.2-2' }}</td>
|
||||
<td class="num">{{ marketPrice(h.scriptCode) || h.purchaseRate }}</td>
|
||||
<td>
|
||||
<span [class]="statusClass(h)">{{ h.status }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
@if (activeReport === 'bankInvList') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">Bank Investment List</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Party / Bank</th>
|
||||
<th class="num">No. of Holdings</th>
|
||||
<th class="num">Total Face Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (r of bankInvestmentList; track r.party) {
|
||||
<tr>
|
||||
<td>{{ r.party }}</td>
|
||||
<td class="num">{{ r.count }}</td>
|
||||
<td class="num">₹{{ r.totalFaceValue | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<!-- ===================== LEDGERS & REGISTERS ===================== -->
|
||||
@if (activeGroup === 'ledger') {
|
||||
<div class="cctr-tabs">
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'fdLedger'"
|
||||
(click)="setReport('fdLedger')"
|
||||
>
|
||||
FD Ledger
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'bondLedger'"
|
||||
(click)="setReport('bondLedger')"
|
||||
>
|
||||
Govt/Bond Ledger
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'shareLedger'"
|
||||
(click)="setReport('shareLedger')"
|
||||
>
|
||||
Share Ledger
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'intDueRegister'"
|
||||
(click)="setReport('intDueRegister')"
|
||||
>
|
||||
Interest Due Register
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'slrRegister'"
|
||||
(click)="setReport('slrRegister')"
|
||||
>
|
||||
SLR Bond Register
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'pendingReceived'"
|
||||
(click)="setReport('pendingReceived')"
|
||||
>
|
||||
Pending/Received Interest
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'amortizeLedger'"
|
||||
(click)="setReport('amortizeLedger')"
|
||||
>
|
||||
Amortize Ledger
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'dealSlip'"
|
||||
(click)="setReport('dealSlip')"
|
||||
>
|
||||
Deal Slip
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (
|
||||
activeReport === 'fdLedger' ||
|
||||
activeReport === 'bondLedger' ||
|
||||
activeReport === 'shareLedger' ||
|
||||
activeReport === 'amortizeLedger' ||
|
||||
activeReport === 'dealSlip'
|
||||
) {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">
|
||||
{{
|
||||
activeReport === 'fdLedger'
|
||||
? 'FD Ledger'
|
||||
: activeReport === 'bondLedger'
|
||||
? 'Govt/Bond Ledger'
|
||||
: activeReport === 'shareLedger'
|
||||
? 'Share Ledger'
|
||||
: activeReport === 'amortizeLedger'
|
||||
? 'Amortize Ledger'
|
||||
: 'Deal Slip Register'
|
||||
}}
|
||||
</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Voucher No</th>
|
||||
<th>Cert No</th>
|
||||
<th>Type</th>
|
||||
<th>Particulars</th>
|
||||
<th class="num">Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (
|
||||
t of activeReport === 'fdLedger'
|
||||
? fdTxns
|
||||
: activeReport === 'bondLedger'
|
||||
? bondTxns
|
||||
: activeReport === 'shareLedger'
|
||||
? shareTxns
|
||||
: activeReport === 'amortizeLedger'
|
||||
? amortizeTxns
|
||||
: dealSlips;
|
||||
track t.voucherNo
|
||||
) {
|
||||
<tr>
|
||||
<td>{{ t.txnDate }}</td>
|
||||
<td>
|
||||
<span class="pg-chip">{{ t.voucherNo }}</span>
|
||||
</td>
|
||||
<td>{{ t.certNo }}</td>
|
||||
<td>{{ t.txnType }}</td>
|
||||
<td>{{ t.particulars }}</td>
|
||||
<td class="num">₹{{ t.amount | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
} @empty {
|
||||
<tr>
|
||||
<td colspan="6" class="pg-empty">No entries.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
@if (activeReport === 'intDueRegister') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">Interest Due Register (Non-Cumulative Holdings)</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cert No</th>
|
||||
<th>Script / Party</th>
|
||||
<th>Frequency</th>
|
||||
<th class="num">Rate</th>
|
||||
<th class="num col-in">Due Amount (as on {{ asOnDate }})</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (h of interestDueRegister; track h.certNo) {
|
||||
<tr>
|
||||
<td>
|
||||
<span class="pg-chip">{{ h.certNo }}</span>
|
||||
</td>
|
||||
<td>{{ h.scriptName }} — {{ h.party }}</td>
|
||||
<td>{{ h.interestFreq }}</td>
|
||||
<td class="num">{{ h.interestRate }}%</td>
|
||||
<td class="num col-in">₹{{ h.dueAmount | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
@if (activeReport === 'slrRegister') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">SLR Bond Register</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cert No</th>
|
||||
<th>Script</th>
|
||||
<th class="num">Face Value</th>
|
||||
<th class="num">Rate</th>
|
||||
<th>Maturity Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (h of slrBondRegister; track h.certNo) {
|
||||
<tr>
|
||||
<td>
|
||||
<span class="pg-chip">{{ h.certNo }}</span>
|
||||
</td>
|
||||
<td>{{ h.scriptName }}</td>
|
||||
<td class="num">₹{{ h.faceValue | number: '1.2-2' }}</td>
|
||||
<td class="num">{{ h.interestRate }}%</td>
|
||||
<td>{{ h.maturityDate }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
@if (activeReport === 'pendingReceived') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">Received Interest / Dividend</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Cert No</th>
|
||||
<th>Particulars</th>
|
||||
<th class="num col-in">Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (t of receivedInterestTxns; track t.voucherNo) {
|
||||
<tr>
|
||||
<td>{{ t.txnDate }}</td>
|
||||
<td>{{ t.certNo }}</td>
|
||||
<td>{{ t.particulars }}</td>
|
||||
<td class="num col-in">₹{{ t.amount | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">Pending Interest (No Interest Posted Yet)</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cert No</th>
|
||||
<th>Script / Party</th>
|
||||
<th class="num col-out">Accrued (Pending)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (h of pendingInterestHoldings; track h.certNo) {
|
||||
<tr>
|
||||
<td>
|
||||
<span class="pg-chip">{{ h.certNo }}</span>
|
||||
</td>
|
||||
<td>{{ h.scriptName }} — {{ h.party }}</td>
|
||||
<td class="num col-out">₹{{ accrued(h) | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<!-- ===================== MATURITY & LISTS ===================== -->
|
||||
@if (activeGroup === 'maturity') {
|
||||
<div class="cctr-tabs">
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'maturedFd'"
|
||||
(click)="setReport('maturedFd')"
|
||||
>
|
||||
List of Matured FD
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'maturingList'"
|
||||
(click)="setReport('maturingList')"
|
||||
>
|
||||
Govt/FD Mature List
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'maturityPattern'"
|
||||
(click)="setReport('maturityPattern')"
|
||||
>
|
||||
Maturity Pattern Register
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'govtSecList'"
|
||||
(click)="setReport('govtSecList')"
|
||||
>
|
||||
Govt Security List
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'fdSecList'"
|
||||
(click)="setReport('fdSecList')"
|
||||
>
|
||||
FD Security List
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'shareSecList'"
|
||||
(click)="setReport('shareSecList')"
|
||||
>
|
||||
Share Security List
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'mfList'"
|
||||
(click)="setReport('mfList')"
|
||||
>
|
||||
Mutual Fund List
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pg-btn pg-btn--ghost"
|
||||
[class.pg-btn--active]="activeReport === 'shiftingReport'"
|
||||
(click)="setReport('shiftingReport')"
|
||||
>
|
||||
Shifting Report
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (activeReport === 'maturedFd') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">List of Matured FD</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cert No</th>
|
||||
<th>Party</th>
|
||||
<th class="num">Face Value</th>
|
||||
<th>Matured On</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (h of maturedFdList; track h.certNo) {
|
||||
<tr>
|
||||
<td>
|
||||
<span class="pg-chip">{{ h.certNo }}</span>
|
||||
</td>
|
||||
<td>{{ h.party }}</td>
|
||||
<td class="num">₹{{ h.faceValue | number: '1.2-2' }}</td>
|
||||
<td>{{ h.maturityDate }}</td>
|
||||
</tr>
|
||||
} @empty {
|
||||
<tr>
|
||||
<td colspan="4" class="pg-empty">No matured FDs.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
@if (activeReport === 'maturingList') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">Govt Security / FD Maturity List (sorted by days-to-maturity)</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cert No</th>
|
||||
<th>Instrument</th>
|
||||
<th>Script / Party</th>
|
||||
<th>Maturity Date</th>
|
||||
<th class="num">Days Left</th>
|
||||
<th class="num col-net">Maturity Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (h of maturingList; track h.certNo) {
|
||||
<tr>
|
||||
<td>
|
||||
<span class="pg-chip">{{ h.certNo }}</span>
|
||||
</td>
|
||||
<td>{{ instrumentLabel(h.instrumentType) }}</td>
|
||||
<td>{{ h.scriptName }} — {{ h.party }}</td>
|
||||
<td>{{ h.maturityDate }}</td>
|
||||
<td class="num">{{ daysLeft(h) }}</td>
|
||||
<td class="num col-net">₹{{ maturity(h) | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
@if (activeReport === 'maturityPattern') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">Maturity Pattern Register</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bucket</th>
|
||||
<th class="num">Holdings</th>
|
||||
<th class="num">Face Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (b of maturityBuckets; track b.label) {
|
||||
<tr>
|
||||
<td>{{ b.label }}</td>
|
||||
<td class="num">{{ b.count }}</td>
|
||||
<td class="num">₹{{ b.faceValue | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
@if (
|
||||
activeReport === 'govtSecList' ||
|
||||
activeReport === 'fdSecList' ||
|
||||
activeReport === 'shareSecList' ||
|
||||
activeReport === 'mfList'
|
||||
) {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">
|
||||
{{
|
||||
activeReport === 'govtSecList'
|
||||
? 'Govt Security List'
|
||||
: activeReport === 'fdSecList'
|
||||
? 'FD Security List'
|
||||
: activeReport === 'shareSecList'
|
||||
? 'Share Security List'
|
||||
: 'Mutual Fund List'
|
||||
}}
|
||||
</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cert No</th>
|
||||
<th>Script</th>
|
||||
<th>Party</th>
|
||||
<th class="num">Face Value</th>
|
||||
<th class="num">Rate</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (
|
||||
h of activeReport === 'govtSecList'
|
||||
? govtSecList
|
||||
: activeReport === 'fdSecList'
|
||||
? fdSecList
|
||||
: activeReport === 'shareSecList'
|
||||
? shareSecList
|
||||
: mutualFundList;
|
||||
track h.certNo
|
||||
) {
|
||||
<tr>
|
||||
<td>
|
||||
<span class="pg-chip">{{ h.certNo }}</span>
|
||||
</td>
|
||||
<td>{{ h.scriptName }}</td>
|
||||
<td>{{ h.party }}</td>
|
||||
<td class="num">₹{{ h.faceValue | number: '1.2-2' }}</td>
|
||||
<td class="num">{{ h.interestRate }}%</td>
|
||||
<td>
|
||||
<span [class]="statusClass(h)">{{ h.status }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
@if (activeReport === 'shiftingReport') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">
|
||||
Shifting Report — SLR Securities with Market Deviation ≥ 1% (AFS/HTM review candidates)
|
||||
</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cert No</th>
|
||||
<th>Script</th>
|
||||
<th class="num">Purchase Rate</th>
|
||||
<th class="num">Market Price</th>
|
||||
<th class="num">Deviation %</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (h of shiftingCandidates; track h.certNo) {
|
||||
<tr>
|
||||
<td>
|
||||
<span class="pg-chip">{{ h.certNo }}</span>
|
||||
</td>
|
||||
<td>{{ h.scriptName }}</td>
|
||||
<td class="num">{{ h.purchaseRate }}</td>
|
||||
<td class="num">{{ h.marketPrice }}</td>
|
||||
<td class="num" [class.col-in]="h.deviationPct > 0" [class.col-out]="h.deviationPct < 0">
|
||||
{{ h.deviationPct }}%
|
||||
</td>
|
||||
</tr>
|
||||
} @empty {
|
||||
<tr>
|
||||
<td colspan="5" class="pg-empty">No securities crossing the 1% deviation threshold today.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<!-- ===================== PORTFOLIO ===================== -->
|
||||
@if (activeGroup === 'portfolio') {
|
||||
<div class="pg-card">
|
||||
<div class="pos-section-label">Investment Portfolio — Consolidated Summary</div>
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Instrument Type</th>
|
||||
<th class="num">Holdings</th>
|
||||
<th class="num">Face Value</th>
|
||||
<th class="num col-in">Accrued Interest</th>
|
||||
<th class="num col-net">Maturity Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (r of portfolioSummary; track r.label) {
|
||||
<tr>
|
||||
<td>{{ r.label }}</td>
|
||||
<td class="num">{{ r.count }}</td>
|
||||
<td class="num">₹{{ r.faceValue | number: '1.2-2' }}</td>
|
||||
<td class="num col-in">₹{{ r.accrued | number: '1.2-2' }}</td>
|
||||
<td class="num col-net">₹{{ r.maturityValue | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="cctr-total-row">
|
||||
<td>Total</td>
|
||||
<td class="num"></td>
|
||||
<td class="num">₹{{ portfolioTotalFaceValue | number: '1.2-2' }}</td>
|
||||
<td class="num">₹{{ portfolioTotalAccrued | number: '1.2-2' }}</td>
|
||||
<td class="num">₹{{ portfolioTotalMaturity | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,247 @@
|
||||
/**
|
||||
* 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 { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
ALL_HOLDINGS,
|
||||
ALL_TXNS,
|
||||
FD_HOLDINGS,
|
||||
GOVT_SECURITY_HOLDINGS,
|
||||
NON_SLR_HOLDINGS,
|
||||
BOND_HOLDINGS,
|
||||
MUTUAL_FUND_HOLDINGS,
|
||||
SHARE_HOLDINGS,
|
||||
SCRIPT_MARKET_DETAIL,
|
||||
InstrumentType,
|
||||
InvestmentHolding,
|
||||
InvestmentTxn,
|
||||
INSTRUMENT_LABELS,
|
||||
accruedInterest,
|
||||
maturityAmount,
|
||||
daysToMaturity,
|
||||
todayDDMMYYYY
|
||||
} from '../investment-data';
|
||||
|
||||
type ReportGroup = 'balance' | 'ledger' | 'maturity' | 'portfolio';
|
||||
|
||||
/**
|
||||
* ~20 legacy Investment reports, grouped into 4 tabs. Every figure here is derived from the
|
||||
* same ALL_HOLDINGS/ALL_TXNS arrays used by the Entry screens and Dashboard — so a report can
|
||||
* never drift out of sync with what a Purchase/Sell/Interest entry actually recorded.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-investment-reports',
|
||||
templateUrl: './investment-reports.component.html',
|
||||
styleUrls: [
|
||||
'../../cashier/cashier-shared.scss',
|
||||
'../investment-shared.scss'
|
||||
],
|
||||
standalone: true,
|
||||
imports: [CommonModule]
|
||||
})
|
||||
export class InvestmentReportsComponent {
|
||||
activeGroup: ReportGroup = 'balance';
|
||||
activeReport = 'govtSecBalance';
|
||||
asOnDate = todayDDMMYYYY();
|
||||
|
||||
setGroup(group: ReportGroup, defaultReport: string): void {
|
||||
this.activeGroup = group;
|
||||
this.activeReport = defaultReport;
|
||||
}
|
||||
|
||||
setReport(report: string): void {
|
||||
this.activeReport = report;
|
||||
}
|
||||
|
||||
instrumentLabel(type: InstrumentType): string {
|
||||
return INSTRUMENT_LABELS[type];
|
||||
}
|
||||
|
||||
accrued(h: InvestmentHolding): number {
|
||||
return accruedInterest(h, this.asOnDate);
|
||||
}
|
||||
|
||||
maturity(h: InvestmentHolding): number {
|
||||
return maturityAmount(h);
|
||||
}
|
||||
|
||||
daysLeft(h: InvestmentHolding): number {
|
||||
return daysToMaturity(h, this.asOnDate);
|
||||
}
|
||||
|
||||
statusClass(h: InvestmentHolding): string {
|
||||
return `inv-badge inv-badge--${h.status.toLowerCase()}`;
|
||||
}
|
||||
|
||||
marketPrice(scriptCode: string): number | null {
|
||||
return SCRIPT_MARKET_DETAIL.find((m) => m.scriptCode === scriptCode)?.marketPrice ?? null;
|
||||
}
|
||||
|
||||
// -------------------- Balance Reports --------------------
|
||||
get govtSecHoldings(): InvestmentHolding[] {
|
||||
return GOVT_SECURITY_HOLDINGS;
|
||||
}
|
||||
get shareHoldings(): InvestmentHolding[] {
|
||||
return SHARE_HOLDINGS;
|
||||
}
|
||||
get fdHoldings(): InvestmentHolding[] {
|
||||
return FD_HOLDINGS;
|
||||
}
|
||||
get bankInvestmentList(): Array<{ party: string; count: number; totalFaceValue: number }> {
|
||||
const map = new Map<string, { party: string; count: number; totalFaceValue: number }>();
|
||||
for (const h of ALL_HOLDINGS) {
|
||||
const row = map.get(h.party) || { party: h.party, count: 0, totalFaceValue: 0 };
|
||||
row.count += 1;
|
||||
row.totalFaceValue += h.faceValue;
|
||||
map.set(h.party, row);
|
||||
}
|
||||
return [...map.values()].sort((a, b) => b.totalFaceValue - a.totalFaceValue);
|
||||
}
|
||||
|
||||
// -------------------- Ledgers & Registers --------------------
|
||||
get fdTxns(): InvestmentTxn[] {
|
||||
return ALL_TXNS.filter((t) => t.instrumentType === 'FD');
|
||||
}
|
||||
get bondTxns(): InvestmentTxn[] {
|
||||
return ALL_TXNS.filter((t) => ([
|
||||
'GOVT_SECURITY',
|
||||
'NON_SLR',
|
||||
'BOND'
|
||||
] as InstrumentType[]).includes(t.instrumentType));
|
||||
}
|
||||
get shareTxns(): InvestmentTxn[] {
|
||||
return ALL_TXNS.filter((t) => t.instrumentType === 'SHARE');
|
||||
}
|
||||
get amortizeTxns(): InvestmentTxn[] {
|
||||
return ALL_TXNS.filter((t) => t.txnType === 'AMORTIZE');
|
||||
}
|
||||
get dealSlips(): InvestmentTxn[] {
|
||||
return ALL_TXNS.filter((t) => t.txnType === 'PURCHASE');
|
||||
}
|
||||
get slrBondRegister(): InvestmentHolding[] {
|
||||
return GOVT_SECURITY_HOLDINGS.filter((h) => h.subType === 'SLR');
|
||||
}
|
||||
get interestDueRegister(): Array<InvestmentHolding & { dueAmount: number }> {
|
||||
return ALL_HOLDINGS.filter((h) => h.status === 'ACTIVE' && h.interestFreq !== 'CUMULATIVE').map((h) => ({
|
||||
...h,
|
||||
dueAmount: this.accrued(h)
|
||||
}));
|
||||
}
|
||||
get receivedInterestTxns(): InvestmentTxn[] {
|
||||
return ALL_TXNS.filter((t) => t.txnType === 'INTEREST' || t.txnType === 'DIVIDEND');
|
||||
}
|
||||
get pendingInterestHoldings(): InvestmentHolding[] {
|
||||
const receivedCerts = new Set(this.receivedInterestTxns.map((t) => t.certNo));
|
||||
return ALL_HOLDINGS.filter(
|
||||
(h) => h.status === 'ACTIVE' && h.interestFreq !== 'CUMULATIVE' && !receivedCerts.has(h.certNo)
|
||||
);
|
||||
}
|
||||
|
||||
// -------------------- Maturity & Lists --------------------
|
||||
get maturedFdList(): InvestmentHolding[] {
|
||||
return FD_HOLDINGS.filter((h) => h.status === 'MATURED');
|
||||
}
|
||||
get maturingList(): InvestmentHolding[] {
|
||||
return [
|
||||
...FD_HOLDINGS,
|
||||
...GOVT_SECURITY_HOLDINGS
|
||||
]
|
||||
.filter((h) => h.status === 'ACTIVE')
|
||||
.sort((a, b) => this.daysLeft(a) - this.daysLeft(b));
|
||||
}
|
||||
get maturityBuckets(): Array<{ label: string; count: number; faceValue: number }> {
|
||||
const buckets = [
|
||||
{ label: '0-1 Year', min: -99999, max: 365, count: 0, faceValue: 0 },
|
||||
{ label: '1-3 Years', min: 366, max: 1095, count: 0, faceValue: 0 },
|
||||
{ label: '3-5 Years', min: 1096, max: 1825, count: 0, faceValue: 0 },
|
||||
{ label: 'Above 5 Years', min: 1826, max: 999999, count: 0, faceValue: 0 }
|
||||
];
|
||||
for (const h of ALL_HOLDINGS.filter((x) => x.status === 'ACTIVE')) {
|
||||
const days = this.daysLeft(h);
|
||||
const bucket = buckets.find((b) => days >= b.min && days <= b.max);
|
||||
if (bucket) {
|
||||
bucket.count += 1;
|
||||
bucket.faceValue += h.faceValue;
|
||||
}
|
||||
}
|
||||
return buckets;
|
||||
}
|
||||
get govtSecList(): InvestmentHolding[] {
|
||||
return GOVT_SECURITY_HOLDINGS;
|
||||
}
|
||||
get fdSecList(): InvestmentHolding[] {
|
||||
return FD_HOLDINGS;
|
||||
}
|
||||
get shareSecList(): InvestmentHolding[] {
|
||||
return SHARE_HOLDINGS;
|
||||
}
|
||||
get mutualFundList(): InvestmentHolding[] {
|
||||
return MUTUAL_FUND_HOLDINGS;
|
||||
}
|
||||
get nonSlrList(): InvestmentHolding[] {
|
||||
return NON_SLR_HOLDINGS;
|
||||
}
|
||||
get bondList(): InvestmentHolding[] {
|
||||
return BOND_HOLDINGS;
|
||||
}
|
||||
/** Shifting Report — SLR securities whose market value has moved away from book value by
|
||||
* more than 1%, a proxy for "category shift" candidates (AFS/HTM reclassification review). */
|
||||
get shiftingCandidates(): Array<InvestmentHolding & { marketPrice: number; deviationPct: number }> {
|
||||
return GOVT_SECURITY_HOLDINGS.map((h) => {
|
||||
const mp = this.marketPrice(h.scriptCode);
|
||||
if (mp === null) {
|
||||
return null;
|
||||
}
|
||||
const deviationPct = +(((mp - h.purchaseRate) / h.purchaseRate) * 100).toFixed(2);
|
||||
return { ...h, marketPrice: mp, deviationPct };
|
||||
})
|
||||
.filter(
|
||||
(x): x is InvestmentHolding & { marketPrice: number; deviationPct: number } =>
|
||||
x !== null && Math.abs(x.deviationPct) >= 1
|
||||
)
|
||||
.sort((a, b) => Math.abs(b.deviationPct) - Math.abs(a.deviationPct));
|
||||
}
|
||||
|
||||
// -------------------- Portfolio --------------------
|
||||
private readonly portfolioTypes: InstrumentType[] = [
|
||||
'FD',
|
||||
'GOVT_SECURITY',
|
||||
'NON_SLR',
|
||||
'BOND',
|
||||
'MUTUAL_FUND',
|
||||
'SHARE'
|
||||
];
|
||||
get portfolioSummary(): Array<{
|
||||
label: string;
|
||||
count: number;
|
||||
faceValue: number;
|
||||
accrued: number;
|
||||
maturityValue: number;
|
||||
}> {
|
||||
return this.portfolioTypes.map((type) => {
|
||||
const holdings = ALL_HOLDINGS.filter((h) => h.instrumentType === type);
|
||||
return {
|
||||
label: INSTRUMENT_LABELS[type],
|
||||
count: holdings.length,
|
||||
faceValue: holdings.reduce((s, h) => s + h.faceValue, 0),
|
||||
accrued: holdings.reduce((s, h) => s + this.accrued(h), 0),
|
||||
maturityValue: holdings.reduce((s, h) => s + this.maturity(h), 0)
|
||||
};
|
||||
});
|
||||
}
|
||||
get portfolioTotalFaceValue(): number {
|
||||
return this.portfolioSummary.reduce((s, r) => s + r.faceValue, 0);
|
||||
}
|
||||
get portfolioTotalAccrued(): number {
|
||||
return this.portfolioSummary.reduce((s, r) => s + r.accrued, 0);
|
||||
}
|
||||
get portfolioTotalMaturity(): number {
|
||||
return this.portfolioSummary.reduce((s, r) => s + r.maturityValue, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user