oss file updated, profitl loss as per the day month and also with date select

This commit is contained in:
2026-08-01 11:46:11 +05:30
parent 4261f9659e
commit bd753f4983
33 changed files with 8748 additions and 404 deletions
@@ -0,0 +1,523 @@
<!--
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="glr-root">
<!-- HEADER -->
<div class="glr-head">
<div class="glr-head-left">
<fa-icon icon="book-open" class="glr-head-ic"></fa-icon>
<div>
<h2 class="glr-head-t">General Ledger — {{ reportLabel }}</h2>
<div class="glr-head-s">
CBSNexora Bank Ltd &middot; {{ branchLabel }} &middot; Period <strong>{{ rangeLabel }}</strong> &middot;
{{ ledgerPeriod.label }}
</div>
</div>
</div>
<button class="glr-btn glr-btn-xls" [disabled]="generating" (click)="exportExcel()">
<fa-icon icon="file-csv"></fa-icon>
{{ generating ? 'Exporting…' : 'Export to Excel' }}
</button>
</div>
<!-- FILTER BAR -->
<div class="glr-filters">
<div class="glr-filter">
<label>Period</label>
<div class="glr-seg">
<button [class.active]="periodMode === 'day'" (click)="periodMode = 'day'">Day-wise</button>
<button [class.active]="periodMode === 'month'" (click)="periodMode = 'month'">Month-wise</button>
<button [class.active]="periodMode === 'range'" (click)="periodMode = 'range'">Date Range</button>
</div>
</div>
@if (periodMode === 'day') {
<div class="glr-filter">
<label>Date</label>
<input
class="glr-inp"
type="date"
[(ngModel)]="filterDay"
[min]="ledgerPeriod.fyStart"
[max]="ledgerPeriod.fyEnd"
/>
</div>
}
@if (periodMode === 'month') {
<div class="glr-filter">
<label>Month</label>
<input class="glr-inp" type="month" [(ngModel)]="filterMonth" min="2026-04" max="2026-07" />
</div>
}
@if (periodMode === 'range') {
<div class="glr-filter">
<label>From</label>
<input
class="glr-inp"
type="date"
[(ngModel)]="filterFrom"
[min]="ledgerPeriod.fyStart"
[max]="ledgerPeriod.fyEnd"
/>
</div>
<div class="glr-filter">
<label>To</label>
<input
class="glr-inp"
type="date"
[(ngModel)]="filterTo"
[min]="ledgerPeriod.fyStart"
[max]="ledgerPeriod.fyEnd"
/>
</div>
}
<div class="glr-filter">
<label>Branch</label>
<select class="glr-inp" [(ngModel)]="branchCode">
<option value="">All Branches (Consolidated)</option>
@for (b of branches; track b.code) {
<option [value]="b.code">{{ b.code }} — {{ b.name }}</option>
}
</select>
</div>
<button class="glr-btn" (click)="resetFilters()">Reset</button>
</div>
<!-- REPORT SELECTOR -->
<div class="glr-tabs">
@for (r of reports; track r.code) {
<button class="glr-tab" [class.active]="activeReport === r.code" (click)="showReport(r.code)">
<fa-icon [icon]="r.icon"></fa-icon> {{ r.label }}
</button>
}
</div>
<!-- ══════════════ TRIAL BALANCE ══════════════ -->
@if (activeReport === 'trial-balance') {
<div class="glr-section">
<div class="glr-balance" [class.glr-balance--bad]="!tbBalanced">
<fa-icon [icon]="tbBalanced ? 'check-circle' : 'exclamation-triangle'"></fa-icon>
<span>
Closing Dr <strong>&#8377;{{ tbClosingDebit | number: '1.2-2' }}</strong> &middot; Closing Cr
<strong>&#8377;{{ tbClosingCredit | number: '1.2-2' }}</strong> —
{{ tbBalanced ? 'trial balance tallies' : 'OUT OF BALANCE — investigate before closing the period' }}
</span>
</div>
<div class="glr-tbl-wrap">
<table class="glr-tbl">
<thead>
<tr>
<th>GL Code</th>
<th>Account</th>
<th>Group</th>
<th class="ta-r">Opening Dr</th>
<th class="ta-r">Opening Cr</th>
<th class="ta-r">Period Dr</th>
<th class="ta-r">Period Cr</th>
<th class="ta-r">Closing Dr</th>
<th class="ta-r">Closing Cr</th>
</tr>
</thead>
<tbody>
@for (r of data.trialBalance; track r.code) {
<tr>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}</td>
<td class="muted">{{ r.group }}</td>
<td class="ta-r mono">{{ r.openingDebit ? (r.openingDebit | number: '1.2-2') : '' }}</td>
<td class="ta-r mono">{{ r.openingCredit ? (r.openingCredit | number: '1.2-2') : '' }}</td>
<td class="ta-r mono">{{ r.periodDebit ? (r.periodDebit | number: '1.2-2') : '' }}</td>
<td class="ta-r mono">{{ r.periodCredit ? (r.periodCredit | number: '1.2-2') : '' }}</td>
<td class="ta-r mono">{{ r.closingDebit ? (r.closingDebit | number: '1.2-2') : '' }}</td>
<td class="ta-r mono">{{ r.closingCredit ? (r.closingCredit | number: '1.2-2') : '' }}</td>
</tr>
} @empty {
<tr>
<td colspan="9" class="glr-empty">No ledger activity for this period and branch.</td>
</tr>
}
<tr class="total-row">
<td colspan="3">TOTAL ({{ data.trialBalance.length }} accounts)</td>
<td class="ta-r mono">{{ tbOpeningDebit | number: '1.2-2' }}</td>
<td class="ta-r mono">{{ tbOpeningCredit | number: '1.2-2' }}</td>
<td class="ta-r mono">{{ tbPeriodDebit | number: '1.2-2' }}</td>
<td class="ta-r mono">{{ tbPeriodCredit | number: '1.2-2' }}</td>
<td class="ta-r mono">{{ tbClosingDebit | number: '1.2-2' }}</td>
<td class="ta-r mono">{{ tbClosingCredit | number: '1.2-2' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
}
<!-- ══════════════ PROFIT AND LOSS ══════════════ -->
@if (activeReport === 'profit-and-loss') {
<div class="glr-section">
<div class="glr-kpis">
<div class="glr-kpi glr-kpi--teal">
<div class="glr-kpi-n">&#8377;{{ totalIncome | number: '1.2-2' }}</div>
<div class="glr-kpi-l">Total Income</div>
</div>
<div class="glr-kpi glr-kpi--amber">
<div class="glr-kpi-n">&#8377;{{ totalExpense | number: '1.2-2' }}</div>
<div class="glr-kpi-l">Total Expenditure</div>
</div>
<div class="glr-kpi" [class.glr-kpi--green]="netProfit >= 0" [class.glr-kpi--red]="netProfit < 0">
<div class="glr-kpi-n">&#8377;{{ netProfit | number: '1.2-2' }}</div>
<div class="glr-kpi-l">{{ netProfit >= 0 ? 'Net Profit' : 'Net Loss' }}</div>
<div class="glr-kpi-sub">{{ netProfitPct | number: '1.2-2' }}% of income</div>
</div>
</div>
<div class="glr-two-col">
<div class="glr-tbl-wrap">
<div class="glr-tbl-h">Expenditure</div>
<table class="glr-tbl">
<thead>
<tr>
<th>GL Code</th>
<th>Particulars</th>
<th class="ta-r">Amount (&#8377;)</th>
</tr>
</thead>
<tbody>
@for (r of pnlExpense; track r.code) {
<tr>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}<span class="muted"> · {{ r.group }}</span></td>
<td class="ta-r mono">{{ r.amount | number: '1.2-2' }}</td>
</tr>
} @empty {
<tr>
<td colspan="3" class="glr-empty">No expenditure posted in this period.</td>
</tr>
}
<tr class="total-row">
<td colspan="2">Total Expenditure</td>
<td class="ta-r mono">{{ totalExpense | number: '1.2-2' }}</td>
</tr>
@if (netProfit >= 0) {
<tr class="total-row glr-profit-row">
<td colspan="2">Net Profit carried to Balance Sheet</td>
<td class="ta-r mono">{{ netProfit | number: '1.2-2' }}</td>
</tr>
}
</tbody>
</table>
</div>
<div class="glr-tbl-wrap">
<div class="glr-tbl-h">Income</div>
<table class="glr-tbl">
<thead>
<tr>
<th>GL Code</th>
<th>Particulars</th>
<th class="ta-r">Amount (&#8377;)</th>
</tr>
</thead>
<tbody>
@for (r of pnlIncome; track r.code) {
<tr>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}<span class="muted"> · {{ r.group }}</span></td>
<td class="ta-r mono">{{ r.amount | number: '1.2-2' }}</td>
</tr>
} @empty {
<tr>
<td colspan="3" class="glr-empty">No income posted in this period.</td>
</tr>
}
<tr class="total-row">
<td colspan="2">Total Income</td>
<td class="ta-r mono">{{ totalIncome | number: '1.2-2' }}</td>
</tr>
@if (netProfit < 0) {
<tr class="total-row glr-loss-row">
<td colspan="2">Net Loss carried to Balance Sheet</td>
<td class="ta-r mono">{{ -netProfit | number: '1.2-2' }}</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
}
<!-- ══════════════ CONSOLIDATED BALANCE SHEET ══════════════ -->
@if (activeReport === 'balance-sheet') {
<div class="glr-section">
<div class="glr-balance" [class.glr-balance--bad]="!bsBalanced">
<fa-icon [icon]="bsBalanced ? 'check-circle' : 'exclamation-triangle'"></fa-icon>
<span>
Total Assets <strong>&#8377;{{ bsTotalAssets | number: '1.2-2' }}</strong> &middot; Total Liabilities
<strong>&#8377;{{ bsTotalLiabilities | number: '1.2-2' }}</strong> —
{{ bsBalanced ? 'balance sheet tallies' : 'OUT OF BALANCE' }}
</span>
</div>
<div class="glr-two-col">
<div class="glr-tbl-wrap">
<div class="glr-tbl-h">Capital &amp; Liabilities &mdash; as at {{ range.to }}</div>
<table class="glr-tbl">
<thead>
<tr>
<th>GL Code</th>
<th>Particulars</th>
<th class="ta-r">Amount (&#8377;)</th>
</tr>
</thead>
<tbody>
@for (r of bsLiabilities; track r.code) {
<tr>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}<span class="muted"> · {{ r.group }}</span></td>
<td class="ta-r mono">{{ r.amount | number: '1.2-2' }}</td>
</tr>
}
<tr>
<td class="mono">—</td>
<td>Surplus for the period<span class="muted"> · Profit &amp; Loss</span></td>
<td class="ta-r mono">{{ bsSurplus | number: '1.2-2' }}</td>
</tr>
<tr class="total-row">
<td colspan="2">Total Capital &amp; Liabilities</td>
<td class="ta-r mono">{{ bsTotalLiabilities | number: '1.2-2' }}</td>
</tr>
</tbody>
</table>
</div>
<div class="glr-tbl-wrap">
<div class="glr-tbl-h">Assets &mdash; as at {{ range.to }}</div>
<table class="glr-tbl">
<thead>
<tr>
<th>GL Code</th>
<th>Particulars</th>
<th class="ta-r">Amount (&#8377;)</th>
</tr>
</thead>
<tbody>
@for (r of bsAssets; track r.code) {
<tr>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}<span class="muted"> · {{ r.group }}</span></td>
<td class="ta-r mono">{{ r.amount | number: '1.2-2' }}</td>
</tr>
}
<tr class="total-row">
<td colspan="2">Total Assets</td>
<td class="ta-r mono">{{ bsTotalAssets | number: '1.2-2' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
}
<!-- ══════════════ COMPARATIVE BALANCE SHEET ══════════════ -->
@if (activeReport === 'comparative-balance-sheet') {
<div class="glr-section">
<p class="glr-note">
Compares the closing position as at <strong>{{ range.to }}</strong> against the position immediately before
this period began. Change the filter above to compare a different span.
</p>
@for (block of [{ title: 'Capital & Liabilities', rows: compLiabilities }, { title: 'Assets', rows: compAssets }]; track block.title) {
<div class="glr-tbl-wrap">
<div class="glr-tbl-h">{{ block.title }}</div>
<table class="glr-tbl">
<thead>
<tr>
<th>GL Code</th>
<th>Particulars</th>
<th class="ta-r">Current (&#8377;)</th>
<th class="ta-r">Previous (&#8377;)</th>
<th class="ta-r">Variance (&#8377;)</th>
<th class="ta-r">Variance %</th>
</tr>
</thead>
<tbody>
@for (r of block.rows; track r.code) {
<tr>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}<span class="muted"> · {{ r.group }}</span></td>
<td class="ta-r mono">{{ r.current | number: '1.2-2' }}</td>
<td class="ta-r mono">{{ r.previous | number: '1.2-2' }}</td>
<td class="ta-r mono" [class.var-up]="r.variance > 0" [class.var-down]="r.variance < 0">
{{ r.variance | number: '1.2-2' }}
</td>
<td class="ta-r mono" [class.var-up]="r.variance > 0" [class.var-down]="r.variance < 0">
{{ r.variancePct === null ? '—' : (r.variancePct | number: '1.2-2') + '%' }}
</td>
</tr>
} @empty {
<tr>
<td colspan="6" class="glr-empty">Nothing to compare for this period and branch.</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
}
<!-- ══════════════ CONTINGENT LIABILITIES ══════════════ -->
@if (activeReport === 'contingent-liabilities') {
<div class="glr-section">
<p class="glr-note">
Off-balance-sheet commitments outstanding as at <strong>{{ range.to }}</strong>. These are memoranda accounts
and are deliberately excluded from the Trial Balance and Balance Sheet totals.
</p>
<div class="glr-tbl-wrap">
<table class="glr-tbl">
<thead>
<tr>
<th>GL Code</th>
<th>Particulars</th>
<th>Group</th>
<th class="ta-r">Amount (&#8377;)</th>
</tr>
</thead>
<tbody>
@for (r of data.contingent; track r.code) {
<tr>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}</td>
<td class="muted">{{ r.group }}</td>
<td class="ta-r mono">{{ r.amount | number: '1.2-2' }}</td>
</tr>
} @empty {
<tr>
<td colspan="4" class="glr-empty">No contingent exposures outstanding for this selection.</td>
</tr>
}
<tr class="total-row">
<td colspan="3">Total Contingent Liabilities</td>
<td class="ta-r mono">{{ contingentTotal | number: '1.2-2' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
}
<!-- ══════════════ GL WISE DR / CR ══════════════ -->
@if (activeReport === 'gl-wise-dr-cr') {
<div class="glr-section">
<p class="glr-note">
Debit and credit turnover posted between <strong>{{ rangeLabel }}</strong> for {{ branchLabel }}. Every
voucher is double-entry, so the debit and credit totals below must match.
</p>
<div class="glr-tbl-wrap">
<table class="glr-tbl">
<thead>
<tr>
<th>GL Code</th>
<th>Account</th>
<th>Type</th>
<th>Group</th>
<th class="ta-r">Debit (&#8377;)</th>
<th class="ta-r">Credit (&#8377;)</th>
<th class="ta-r">Net (Dr &minus; Cr)</th>
<th class="ta-c">Vouchers</th>
</tr>
</thead>
<tbody>
@for (r of data.glWise; track r.code) {
<tr>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}</td>
<td>
<span class="type-pill" [class]="'type-' + r.type.toLowerCase()">{{ r.type }}</span>
</td>
<td class="muted">{{ r.group }}</td>
<td class="ta-r mono">{{ r.debit ? (r.debit | number: '1.2-2') : '' }}</td>
<td class="ta-r mono">{{ r.credit ? (r.credit | number: '1.2-2') : '' }}</td>
<td class="ta-r mono" [class.var-up]="r.net > 0" [class.var-down]="r.net < 0">
{{ r.net | number: '1.2-2' }}
</td>
<td class="ta-c mono">{{ r.vouchers }}</td>
</tr>
} @empty {
<tr>
<td colspan="8" class="glr-empty">No postings for this period and branch.</td>
</tr>
}
<tr class="total-row">
<td colspan="4">TOTAL ({{ data.glWise.length }} accounts)</td>
<td class="ta-r mono">{{ glWiseDebit | number: '1.2-2' }}</td>
<td class="ta-r mono">{{ glWiseCredit | number: '1.2-2' }}</td>
<td class="ta-r mono">{{ glWiseDebit - glWiseCredit | number: '1.2-2' }}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
}
<!-- ══════════════ MISC EXPENSE LEDGER ══════════════ -->
@if (activeReport === 'misc-expense-ledger') {
<div class="glr-section">
<p class="glr-note">
Every miscellaneous-expense voucher posted between <strong>{{ rangeLabel }}</strong> for {{ branchLabel }}
&mdash; {{ miscRows.length | number }} entries.
</p>
<div class="glr-tbl-wrap glr-tbl-wrap--tall">
<table class="glr-tbl">
<thead>
<tr>
<th>Date</th>
<th>Voucher No</th>
<th>Branch</th>
<th>GL Code</th>
<th>Account</th>
<th>Narration</th>
<th class="ta-r">Amount (&#8377;)</th>
</tr>
</thead>
<tbody>
@for (r of miscRows; track r.voucherNo + r.code) {
<tr>
<td class="mono">{{ r.date }}</td>
<td class="mono">{{ r.voucherNo }}</td>
<td>{{ branchName(r.branchCode) }}</td>
<td class="mono">{{ r.code }}</td>
<td>{{ r.name }}</td>
<td class="muted">{{ r.narration }}</td>
<td class="ta-r mono">{{ r.amount | number: '1.2-2' }}</td>
</tr>
} @empty {
<tr>
<td colspan="7" class="glr-empty">No miscellaneous expenses posted for this selection.</td>
</tr>
}
</tbody>
<tfoot>
<tr class="total-row">
<td colspan="6">Total Miscellaneous Expenses</td>
<td class="ta-r mono">{{ miscTotal | number: '1.2-2' }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
}
<!-- TOAST -->
<div class="glr-toast" [class.show]="toastVisible">{{ toastMsg }}</div>
</div>