Files
cbsnexora/src/app/investment/bond-investment/bond-investment.component.html
T
nitesh 63ac900e42 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.
2026-08-01 09:17:06 +05:30

1094 lines
45 KiB
HTML

<!--
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 · GOVT SECURITY / NON-SLR / BOND / MUTUAL FUND</div>
<h1 class="pg-title">Govt. Security / Bond Entry</h1>
<p class="pg-sub">
Purchase, Redemption, Interest Calculation, Sell, Write-off, Amortize, Yearly Amortize Process, GOI Category
Transfer, Investment Depreciation and Mutual Fund Transfer.
</p>
</div>
<div class="pg-toolbar">
<label class="pg-field">
<span>Bond Type</span>
<select class="pg-select" [ngModel]="bondType" (ngModelChange)="setBondType($event)">
@for (o of bondTypeOptions; track o.value) {
<option [value]="o.value">{{ o.label }}</option>
}
</select>
</label>
</div>
</header>
<div class="cctr-tabs">
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'holdings'"
(click)="setTab('holdings')"
>
Holdings
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'purchase'"
(click)="setTab('purchase')"
>
01 Purchase Entry
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'redemption'"
(click)="setTab('redemption')"
>
02 Redemption Entry
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'interest'"
(click)="setTab('interest')"
>
03 Interest Entry
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'sell'"
(click)="setTab('sell')"
>
04 Sell Entry
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'writeoff'"
(click)="setTab('writeoff')"
>
05 Write Off Entry
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'amortize'"
(click)="setTab('amortize')"
>
06 Amortize Entry
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'amortizeYearly'"
(click)="setTab('amortizeYearly')"
>
07 Amortize Yearly Process
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'goiTransfer'"
(click)="setTab('goiTransfer')"
>
08 GOI Category Transfer
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'depreciation'"
(click)="setTab('depreciation')"
>
09 Investment Depreciation
</button>
<button
type="button"
class="pg-btn pg-btn--ghost"
[class.pg-btn--active]="activeTab === 'mfTransfer'"
(click)="setTab('mfTransfer')"
>
10 Mutual Fund Transfer
</button>
</div>
<!-- ===================== HOLDINGS ===================== -->
@if (activeTab === 'holdings') {
<div class="pg-card">
<div class="pos-section-label">{{ instrumentLabel(bondType) }} Holdings Register</div>
<table class="pg-table">
<thead>
<tr>
<th>Cert No</th>
<th>Script</th>
<th>Party</th>
<th class="num">Units</th>
<th class="num">Face Value</th>
<th class="num">Rate</th>
<th>Purchase Date</th>
<th>Maturity Date</th>
<th class="num col-in">Accrued Interest</th>
<th class="num col-net">Maturity Value</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@for (h of holdingsForType; 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.units | number }}</td>
<td class="num">₹{{ h.faceValue | number: '1.2-2' }}</td>
<td class="num">{{ h.interestRate }}%</td>
<td>{{ h.purchaseDate }}</td>
<td>{{ h.maturityDate }}</td>
<td class="num col-in">₹{{ accrued(h) | number: '1.2-2' }}</td>
<td class="num col-net">₹{{ maturity(h) | number: '1.2-2' }}</td>
<td>
<span [class]="statusClass(h)">{{ h.status }}</span>
</td>
</tr>
} @empty {
<tr>
<td colspan="11" class="pg-empty">No {{ instrumentLabel(bondType) }} holdings yet.</td>
</tr>
}
</tbody>
</table>
</div>
}
<!-- ===================== 01 PURCHASE ENTRY ===================== -->
@if (activeTab === 'purchase') {
<div class="pg-card">
<div class="pos-section-label">
Investment - Govt.Security/Bond Entry ({{ instrumentLabel(purchaseForm.bondType) }})
</div>
<div class="inv-form-grid">
<label class="inv-form-field">
<span>* Bond Type</span>
<select [(ngModel)]="purchaseForm.bondType">
@for (o of bondTypeOptions; track o.value) {
<option [value]="o.value">{{ o.label }}</option>
}
</select>
</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><input type="text" [(ngModel)]="purchaseForm.dealDate" placeholder="DD-MM-YYYY"
/></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">
<span>* Script Code</span>
<select [(ngModel)]="purchaseForm.scriptCode" (ngModelChange)="onScriptChange()">
<option value="">-- Select --</option>
@for (s of scriptsForType; track s.scriptCode) {
<option [value]="s.scriptCode">{{ s.scriptCode }} — {{ s.scriptName }}</option>
}
</select>
</label>
<label class="inv-form-field"
><span>* Cert No</span><input type="text" [(ngModel)]="purchaseForm.certNo"
/></label>
<label class="inv-form-field">
<span>Settlement Type</span>
<select [(ngModel)]="purchaseForm.settlementType">
<option value="T+0">T+0</option>
<option value="T+1">T+1</option>
<option value="T+2">T+2</option>
</select>
</label>
<label class="inv-form-field"
><span>Settlement Dt</span
><input type="text" [(ngModel)]="purchaseForm.settlementDt" placeholder="DD-MM-YYYY"
/></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) {
<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"
><span>Holding Days</span><input type="number" [(ngModel)]="purchaseForm.holdingDays" min="0"
/></label>
<label class="inv-form-field"
><span>* Consider Amt</span><input type="number" [(ngModel)]="purchaseForm.considerAmt" min="0"
/></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>
} @else {
<label class="inv-form-field"
><span>Face Value</span><input type="number" [(ngModel)]="purchaseForm.faceValue" min="0"
/></label>
<label class="inv-form-field"
><span>Purchase Rate (per 100)</span
><input type="number" [(ngModel)]="purchaseForm.purchaseRate" min="0" step="0.0001"
/></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><input type="text" [(ngModel)]="purchaseForm.issueDate" placeholder="DD-MM-YYYY"
/></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><input type="text" [(ngModel)]="purchaseForm.meetDt" placeholder="DD-MM-YYYY"
/></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">
<span>* Category</span>
<select [(ngModel)]="purchaseForm.category">
<option value="">-- Select --</option>
@for (c of categoryOptions; track c) {
<option [value]="c">{{ c }}</option>
}
</select>
</label>
@if (!isMutualFund) {
<label class="inv-form-field"
><span>Int Rate</span><input type="number" [(ngModel)]="purchaseForm.intRate" min="0" step="0.01"
/></label>
<label class="inv-form-field"
><span>YTM (computed)</span><input type="text" [value]="purchaseYtm" readonly
/></label>
<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>Int Date</span><input type="text" [(ngModel)]="purchaseForm.intDate" placeholder="DD-MM-YYYY"
/></label>
<label class="inv-form-field"
><span>* Last Int.dt</span><input type="text" [(ngModel)]="purchaseForm.lastIntDt" placeholder="DD-MM-YYYY"
/></label>
<label class="inv-form-field"
><span>Accrued Interest (computed)</span
><input type="text" [value]="purchaseAccruedInterest | number: '1.2-2'" readonly
/></label>
<label class="inv-form-field"
><span>Settlement Amt of Pur. (computed)</span
><input type="text" [value]="purchaseSettlementAmount | number: '1.4-4'" readonly
/></label>
<label class="inv-form-field">
<span>Deal Type</span>
<select [(ngModel)]="purchaseForm.dealType">
@for (d of dealTypeOptions; track d) {
<option [value]="d">{{ d }}</option>
}
</select>
</label>
<label class="inv-form-field">
<span>Market</span>
<select [(ngModel)]="purchaseForm.market">
@for (m of marketOptions; track m) {
<option [value]="m">{{ m }}</option>
}
</select>
</label>
<label class="inv-form-field">
<span>Mark CBLO</span>
<select [(ngModel)]="purchaseForm.markCblo">
<option value="NO">NO</option>
<option value="YES">YES</option>
</select>
</label>
<label class="inv-form-field"
><span>Amortize Amt.</span><input type="number" [(ngModel)]="purchaseForm.amortizeAmt"
/></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>Corp. Bond</span>
<select [(ngModel)]="purchaseForm.corpBond">
<option value="NO">NO</option>
<option value="YES">YES</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>Register Add</span><input type="text" [(ngModel)]="purchaseForm.registerAdd"
/></label>
<label class="inv-form-field"
><span>Regi City</span><input type="text" [(ngModel)]="purchaseForm.regiCity"
/></label>
<label class="inv-form-field"
><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">
<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)="dropPurchase()">Drop</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="cancelPurchase()">Cancel</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="exitPurchase()">Exit</button>
</div>
</div>
}
<!-- ===================== 02 REDEMPTION ENTRY ===================== -->
@if (activeTab === 'redemption') {
<div class="pg-card">
<div class="pos-section-label">Investment - Redemption Entry Gov/Bond</div>
<div class="inv-form-grid">
<label class="inv-form-field">
<span>Cert No / Deal No *</span>
<select [(ngModel)]="redeemCertNo">
<option value="">-- Select --</option>
@for (h of activeHoldingsForType; track h.certNo) {
<option [value]="h.certNo">{{ h.certNo }} — {{ h.scriptName }}</option>
}
</select>
</label>
@if (redeemHolding; as h) {
<label class="inv-form-field"><span>Script</span><input type="text" [value]="h.scriptName" readonly /></label>
<label class="inv-form-field"
><span>Face Value</span><input type="text" [value]="'₹' + (h.faceValue | number: '1.2-2')" readonly
/></label>
<label class="inv-form-field"
><span>Maturity Date</span><input type="text" [value]="h.maturityDate" readonly
/></label>
<label class="inv-form-field"
><span>Days to Maturity</span><input type="text" [value]="daysLeft(h)" readonly
/></label>
}
<label class="inv-form-field"
><span>Redemption Date *</span><input type="text" [(ngModel)]="redeemDate" placeholder="DD-MM-YYYY"
/></label>
<label class="inv-form-field"
><span>Redemption Proceeds (computed)</span
><input type="text" [value]="'₹' + (redeemAmount | number: '1.2-2')" readonly
/></label>
<label class="inv-form-field"><span>Remarks</span><input type="text" [(ngModel)]="redeemRemarks" /></label>
</div>
<div class="inv-form-actions">
<button type="button" class="pg-btn pg-btn--primary" (click)="saveRedemption()">Save</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
</div>
</div>
}
<!-- ===================== 03 INTEREST ENTRY / CALCULATION ===================== -->
@if (activeTab === 'interest') {
<div class="pg-card">
<div class="pos-section-label">Investment - Govt./Bond Interest calculation</div>
<div class="inv-form-grid">
<label class="inv-form-field"
><span>Date</span><input type="text" [(ngModel)]="intCalcDate" placeholder="DD-MM-YYYY"
/></label>
<label class="inv-form-field">
<span>Type</span>
<select [(ngModel)]="intCalcType">
<option value="">-- All Types --</option>
@for (o of bondTypeOptions; track o.value) {
<option [value]="o.value">{{ o.label }}</option>
}
</select>
</label>
<label class="inv-form-field">
<span>Script</span>
<select [(ngModel)]="intCalcScript">
<option value="">-- All Scripts --</option>
@for (s of scriptOptions; track s.scriptCode) {
<option [value]="s.scriptCode">{{ s.scriptCode }} — {{ s.scriptName }}</option>
}
</select>
</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>
</div>
<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--ghost" (click)="setTab('holdings')">Exit</button>
</div>
<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>
}
<!-- ===================== 04 SELL ENTRY ===================== -->
@if (activeTab === 'sell') {
<div class="pg-card">
<div class="pos-section-label">Investment - Govt.Security/Bond Sell Entry</div>
<div class="inv-form-grid">
<label class="inv-form-field">
<span>Mode</span>
<select [(ngModel)]="sellForm.mode">
<option value="SELL">SELL</option>
<option value="REDEEM">REDEEM</option>
<option value="MUTUAL_FUND_SELL">MUTUAL FUND SELL</option>
</select>
</label>
<label class="inv-form-field">
<span>Purchase Search By</span>
<select [(ngModel)]="sellForm.searchBy">
<option value="DEAL_NO">DEAL NO</option>
<option value="ISIN_NO">ISIN NO</option>
</select>
</label>
<label class="inv-form-field"
><span>Search Value</span><input type="text" [(ngModel)]="sellForm.searchValue"
/></label>
<label class="inv-form-field">
<span>&nbsp;</span>
<button type="button" class="pg-btn pg-btn--ghost" (click)="searchPurchaseForSell()">Load Purchase</button>
</label>
</div>
<div class="inv-form-grid">
<label class="inv-form-field">
<span>* Bond Type</span>
<select [(ngModel)]="sellForm.bondType">
@for (o of bondTypeOptions; track o.value) {
<option [value]="o.value">{{ o.label }}</option>
}
</select>
</label>
<label class="inv-form-field"
><span>* Script Code</span><input type="text" [(ngModel)]="sellForm.scriptCode"
/></label>
<label class="inv-form-field"><span>* Cert No</span><input type="text" [(ngModel)]="sellForm.certNo" /></label>
<label class="inv-form-field">
<span>Buyer Code</span>
<select [(ngModel)]="sellForm.buyerCode">
<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><input type="text" [(ngModel)]="sellForm.subType" /></label>
<label class="inv-form-field"><span>* ISIN</span><input type="text" [(ngModel)]="sellForm.isin" /></label>
<label class="inv-form-field"
><span>TBill GL.A/C.</span><input type="text" [(ngModel)]="sellForm.tbillGlAc"
/></label>
<label class="inv-form-field"
><span>* Deal Date</span><input type="text" [(ngModel)]="sellForm.dealDate" placeholder="DD-MM-YYYY"
/></label>
<label class="inv-form-field"
><span>* Deal Time</span><input type="text" [(ngModel)]="sellForm.dealTime" placeholder="HH:mm:ss"
/></label>
<label class="inv-form-field">
<span>Settlement Type</span>
<select [(ngModel)]="sellForm.settlementType">
<option value="T+0">T+0</option>
<option value="T+1">T+1</option>
<option value="T+2">T+2</option>
</select>
</label>
<label class="inv-form-field"
><span>Settlement Dt</span><input type="text" [(ngModel)]="sellForm.settlementDt" placeholder="DD-MM-YYYY"
/></label>
<label class="inv-form-field"
><span>* Face Value</span><input type="number" [(ngModel)]="sellForm.faceValue" min="0"
/></label>
<label class="inv-form-field"
><span>Sell Rate *</span><input type="number" [(ngModel)]="sellForm.sellRate" min="0" step="0.0001"
/></label>
<label class="inv-form-field"
><span>* Unit Val</span><input type="number" [(ngModel)]="sellForm.unitVal" min="0"
/></label>
<label class="inv-form-field"
><span>* Sell Unit</span><input type="number" [(ngModel)]="sellForm.sellUnit" min="0"
/></label>
<label class="inv-form-field"
><span>TDS Amt.</span><input type="number" [(ngModel)]="sellForm.tdsAmt" min="0"
/></label>
<label class="inv-form-field"
><span>Brokerage</span><input type="number" [(ngModel)]="sellForm.brokerage" min="0"
/></label>
<label class="inv-form-field"
><span>* DB. To A/c</span><input type="text" [(ngModel)]="sellForm.dbToAc"
/></label>
<label class="inv-form-field"
><span>Amortize Amt.</span><input type="number" [(ngModel)]="sellForm.amortizeAmt"
/></label>
<label class="inv-form-field"
><span>Sale Diff (computed)</span><input type="text" [value]="sellSaleDiff | number: '1.2-2'" readonly
/></label>
<label class="inv-form-field"
><span>Premium Loss (computed)</span><input type="text" [value]="sellPremiumLoss | number: '1.2-2'" readonly
/></label>
<label class="inv-form-field"
><span>Accrued Int. (computed)</span
><input type="text" [value]="sellAccruedInterest | number: '1.2-2'" readonly
/></label>
<label class="inv-form-field"
><span>Days (computed)</span><input type="text" [value]="sellAccruedDays" readonly
/></label>
<label class="inv-form-field"
><span>Consideration Amt. (computed)</span
><input type="text" [value]="sellConsideration | number: '1.2-2'" readonly
/></label>
<label class="inv-form-field"
><span>Pay Amt (computed)</span><input type="text" [value]="sellPayAmount | number: '1.2-2'" readonly
/></label>
<label class="inv-form-field">
<span>Recomm. Authority</span>
<select [(ngModel)]="sellForm.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)]="sellForm.sanctionAuthority">
<option value="">-- Select --</option>
@for (a of authorityOptions; track a) {
<option [value]="a">{{ a }}</option>
}
</select>
</label>
<label class="inv-form-field"
><span>CALL MONEY</span
><input type="checkbox" [(ngModel)]="sellForm.callMoney" style="height: 18px; width: 18px"
/></label>
</div>
<div class="inv-form-actions">
<button type="button" class="pg-btn pg-btn--primary" (click)="saveSell()">Save</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="searchPurchaseForSell()">Retrieve</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="cancelSell()">Cancel</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="exitSell()">Exit</button>
</div>
</div>
}
<!-- ===================== 05 WRITE OFF ENTRY ===================== -->
@if (activeTab === 'writeoff') {
<div class="pg-card">
<div class="pos-section-label">Investment - Write Off Entry Gov/Bond</div>
<div class="inv-form-grid">
<label class="inv-form-field">
<span>Cert No *</span>
<select [(ngModel)]="writeoffCertNo">
<option value="">-- Select --</option>
@for (h of activeHoldingsForType; track h.certNo) {
<option [value]="h.certNo">{{ h.certNo }} — {{ h.scriptName }}</option>
}
</select>
</label>
@if (writeoffHolding; as h) {
<label class="inv-form-field"
><span>Face Value to be Written Off</span
><input type="text" [value]="'₹' + (h.faceValue | number: '1.2-2')" readonly
/></label>
}
<label class="inv-form-field"><span>Reason *</span><input type="text" [(ngModel)]="writeoffReason" /></label>
</div>
<div class="inv-form-actions">
<button type="button" class="pg-btn pg-btn--primary" (click)="saveWriteoff()">Save</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
</div>
</div>
}
<!-- ===================== 06 AMORTIZE ENTRY ===================== -->
@if (activeTab === 'amortize') {
<div class="pg-card">
<div class="pos-section-label">Investment - Amortize Entry (Premium / Discount)</div>
<div class="inv-form-grid">
<label class="inv-form-field">
<span>Cert No *</span>
<select [(ngModel)]="amortizeCertNo">
<option value="">-- Select --</option>
@for (h of activeHoldingsForType; track h.certNo) {
<option [value]="h.certNo">{{ h.certNo }} — {{ h.scriptName }}</option>
}
</select>
</label>
@if (amortizeHolding; as h) {
<label class="inv-form-field"
><span>Purchase Rate</span><input type="text" [value]="h.purchaseRate" readonly
/></label>
<label class="inv-form-field"
><span>Suggested Yearly Amortization</span
><input type="text" [value]="'₹' + (suggestedAmortizeAmt | number: '1.2-2')" readonly
/></label>
}
<label class="inv-form-field"
><span>Amortize Amount</span
><input type="number" [(ngModel)]="amortizeAmt" min="0" [placeholder]="suggestedAmortizeAmt"
/></label>
</div>
<div class="inv-form-actions">
<button type="button" class="pg-btn pg-btn--primary" (click)="saveAmortize()">Save</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
</div>
</div>
}
<!-- ===================== 07 AMORTIZE YEARLY PROCESS ===================== -->
@if (activeTab === 'amortizeYearly') {
<div class="pg-card">
<div class="pos-section-label">Investment - Amortize Yearly Process</div>
<div class="inv-form-grid">
<label class="inv-form-field"
><span>Financial Year</span><input type="text" [(ngModel)]="amortizeYear"
/></label>
<label class="inv-form-field"
><span>Holdings to Process</span><input type="text" [value]="amortizeYearlyTargets.length" readonly
/></label>
<label class="inv-form-field"
><span>Total Amortization</span
><input type="text" [value]="'₹' + (amortizeYearlyTotal | number: '1.2-2')" readonly
/></label>
</div>
<div class="inv-form-actions">
<button type="button" class="pg-btn pg-btn--primary" (click)="runAmortizeYearly()">Process</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
</div>
<table class="pg-table">
<thead>
<tr>
<th>Cert No</th>
<th>Script</th>
<th class="num">Face Value</th>
<th class="num">Purchase Rate</th>
<th>Maturity Date</th>
<th class="num col-out">Yearly Amortization</th>
</tr>
</thead>
<tbody>
@for (t of amortizeYearlyTargets; track t.holding.certNo) {
<tr>
<td>
<span class="pg-chip">{{ t.holding.certNo }}</span>
</td>
<td>{{ t.holding.scriptName }}</td>
<td class="num">₹{{ t.holding.faceValue | number: '1.2-2' }}</td>
<td class="num">{{ t.holding.purchaseRate }}</td>
<td>{{ t.holding.maturityDate }}</td>
<td class="num col-out">₹{{ t.amount | number: '1.2-2' }}</td>
</tr>
} @empty {
<tr>
<td colspan="6" class="pg-empty">No premium-carrying holdings require amortization.</td>
</tr>
}
</tbody>
</table>
</div>
}
<!-- ===================== 08 GOI CATEGORY TRANSFER ===================== -->
@if (activeTab === 'goiTransfer') {
<div class="pg-card">
<div class="pos-section-label">Investment - GOI Category Transfer (HTM / AFS / HFT shift)</div>
<div class="inv-form-grid">
<label class="inv-form-field">
<span>Cert No *</span>
<select [(ngModel)]="goiCertNo">
<option value="">-- Select --</option>
@for (h of holdings; track h.certNo) {
<option [value]="h.certNo">{{ h.certNo }} — {{ h.scriptName }}</option>
}
</select>
</label>
@if (goiHolding; as h) {
<label class="inv-form-field"><span>Script</span><input type="text" [value]="h.scriptName" readonly /></label>
<label class="inv-form-field"
><span>Face Value</span><input type="text" [value]="'₹' + (h.faceValue | number: '1.2-2')" readonly
/></label>
}
<label class="inv-form-field">
<span>From Category *</span>
<select [(ngModel)]="goiFromCategory">
<option value="">-- Select --</option>
@for (c of categoryOptions; track c) {
<option [value]="c">{{ c }}</option>
}
</select>
</label>
<label class="inv-form-field">
<span>To Category *</span>
<select [(ngModel)]="goiToCategory">
<option value="">-- Select --</option>
@for (c of categoryOptions; track c) {
<option [value]="c">{{ c }}</option>
}
</select>
</label>
<label class="inv-form-field"
><span>Transfer Date *</span><input type="text" [(ngModel)]="goiTransferDate" placeholder="DD-MM-YYYY"
/></label>
</div>
<div class="inv-form-actions">
<button type="button" class="pg-btn pg-btn--primary" (click)="saveGoiTransfer()">Save</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
</div>
</div>
}
<!-- ===================== 09 INVESTMENT DEPRECIATION ===================== -->
@if (activeTab === 'depreciation') {
<div class="pg-card">
<div class="pos-section-label">Investment - Investment Depreciation (Mark-to-Market Provisioning)</div>
<div class="inv-form-grid">
<label class="inv-form-field"
><span>Valuation Date</span><input type="text" [(ngModel)]="depreciationDate" placeholder="DD-MM-YYYY"
/></label>
<label class="inv-form-field">
<span>Category</span>
<select [(ngModel)]="depreciationCategory">
<option value="">-- All Categories --</option>
@for (c of categoryOptions; track c) {
<option [value]="c">{{ c }}</option>
}
</select>
</label>
<label class="inv-form-field"
><span>Holdings Requiring Provision</span><input type="text" [value]="depreciationTargets.length" readonly
/></label>
<label class="inv-form-field"
><span>Total Depreciation</span
><input type="text" [value]="'₹' + (depreciationTotal | number: '1.2-2')" readonly
/></label>
</div>
<div class="inv-form-actions">
<button type="button" class="pg-btn pg-btn--primary" (click)="runDepreciation()">Process</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
</div>
<table class="pg-table">
<thead>
<tr>
<th>Cert No</th>
<th>Script</th>
<th class="num">Book Rate</th>
<th class="num">Market Price</th>
<th class="num col-out">Depreciation</th>
</tr>
</thead>
<tbody>
@for (t of depreciationTargets; track t.holding.certNo) {
<tr>
<td>
<span class="pg-chip">{{ t.holding.certNo }}</span>
</td>
<td>{{ t.holding.scriptName }}</td>
<td class="num">{{ t.holding.purchaseRate }}</td>
<td class="num">{{ t.marketPrice }}</td>
<td class="num col-out">₹{{ t.depreciation | number: '1.2-2' }}</td>
</tr>
} @empty {
<tr>
<td colspan="5" class="pg-empty">No holdings require depreciation provisioning.</td>
</tr>
}
</tbody>
</table>
</div>
}
<!-- ===================== 10 MUTUAL FUND TRANSFER ===================== -->
@if (activeTab === 'mfTransfer') {
<div class="pg-card">
<div class="pos-section-label">Investment - Mutual Fund Transfer (Switch between schemes)</div>
<div class="inv-form-grid">
<label class="inv-form-field">
<span>From Holding *</span>
<select [(ngModel)]="mfFromCertNo">
<option value="">-- Select --</option>
@for (h of mfHoldings; track h.certNo) {
<option [value]="h.certNo">{{ h.certNo }} — {{ h.scriptName }}</option>
}
</select>
</label>
@if (mfFromHolding; as h) {
<label class="inv-form-field"><span>Units Held</span><input type="text" [value]="h.units" readonly /></label>
<label class="inv-form-field"><span>NAV</span><input type="text" [value]="h.purchaseRate" readonly /></label>
}
<label class="inv-form-field">
<span>To Product *</span>
<select [(ngModel)]="mfToProduct">
<option value="">-- Select --</option>
@for (p of mfProductOptions; track p.productCode) {
<option [value]="p.productName">{{ p.productName }} ({{ p.amcName }})</option>
}
</select>
</label>
<label class="inv-form-field"
><span>Units to Transfer *</span><input type="number" [(ngModel)]="mfTransferUnits" min="0" step="0.001"
/></label>
<label class="inv-form-field"
><span>Transfer Date *</span><input type="text" [(ngModel)]="mfTransferDate" placeholder="DD-MM-YYYY"
/></label>
<label class="inv-form-field"
><span>Transfer Value (computed)</span
><input type="text" [value]="'₹' + (mfTransferValue | number: '1.2-2')" readonly
/></label>
</div>
<div class="inv-form-actions">
<button type="button" class="pg-btn pg-btn--primary" (click)="saveMfTransfer()">Save</button>
<button type="button" class="pg-btn pg-btn--ghost" (click)="setTab('holdings')">Exit</button>
</div>
</div>
}
<!-- Transaction log on every entry tab -->
@if (activeTab !== 'holdings') {
<div class="pg-card">
<div class="pos-section-label">{{ instrumentLabel(bondType) }} Transaction Log</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 txnsForType; 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 transactions yet.</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
<div class="inv-toast" [class.show]="toastVisible">{{ toastMsg }}</div>