@once @push('stylesheets') @endpush @endonce @php use App\Helpers\PC\AmountMillionHelper; use App\Services\ReportPreviewPresenter; $pciIiiBFormatMillionForDisplay = static function (string $plain): string { $plain = trim($plain); if ($plain === '' || $plain === '0') { return '0'; } if (! preg_match('/^(\d+)(\.\d+)?$/', $plain, $m)) { return $plain; } $intPart = ltrim($m[1], '0') ?: '0'; $len = strlen($intPart); $buf = ''; for ($i = 0; $i < $len; $i++) { if ($i > 0 && ($len - $i) % 3 === 0) { $buf .= ','; } $buf .= $intPart[$i]; } if (isset($m[2]) && $m[2] !== '' && $m[2] !== '.') { $buf .= $m[2]; } return $buf; }; $pciIiiBFinDisplayAmt = function (mixed $raw) use ($pciIiiBEdit, $pciIiiBFormatMillionForDisplay): string { if ($raw === null || $raw === '') { return ''; } $plain = AmountMillionHelper::normalizePlanProvisionAmountInput($raw); if ($plain === null || $plain === '' || ! is_numeric($plain)) { return ''; } if (! $pciIiiBEdit) { return ReportPreviewPresenter::amountMillionDisplay($raw); } $n = (float) $plain; if ($n <= 0) { return $n === 0.0 ? '0' : ''; } $trimmed = rtrim(rtrim(sprintf('%.6F', $n), '0'), '.'); return $pciIiiBFormatMillionForDisplay($trimmed === '' ? '0' : $trimmed); }; $pciIiiBFinDisplayPct = function (mixed $raw) use ($pciIiiBEdit): string { if ($raw === null || $raw === '') { return ''; } $plain = AmountMillionHelper::normalizePlanProvisionAmountInput( is_string($raw) ? str_replace('%', '', $raw) : $raw ); if ($plain === null || $plain === '' || ! is_numeric($plain)) { return (string) $raw; } $n = min(100, max(0, (float) $plain)); if ($pciIiiBEdit) { return number_format($n, 2, '.', ''); } return number_format($n, 2).'%'; }; $pciIiiBFinRowVal = function (string $rowKey, string $col) use ($pciIiiBFinancial, $pciIiiBFinDisplayAmt): string { $row = $pciIiiBFinancial[$rowKey] ?? null; return is_array($row) ? $pciIiiBFinDisplayAmt($row[$col] ?? '') : ''; }; $pciIiiBFinFromBpms = is_array($pciIiiBFinFromBpms ?? null) ? $pciIiiBFinFromBpms : []; $pciIiiBFinBpmsYearLabel = (string) ($pciIiiBFinBpmsYearLabel ?? ''); $pciIiiBFinRows = [ ['key' => 'approved_cost', 'label' => 'Approved Cost', 'sub' => 'Active cost from BPMS', 'month' => false, 'bpms' => true], ['key' => 'expenditure_last_fy', 'label' => 'Expenditure up to end of Last F.Y.', 'sub' => 'From BPMS (uploaded / budget year)', 'month' => false, 'bpms' => true], [ 'key' => 'adp_allocations_current_year', 'label' => 'ADP Allocations (Current Year)', 'sub' => $pciIiiBFinBpmsYearLabel !== '' ? ('Last locked year: '.$pciIiiBFinBpmsYearLabel) : 'Last locked year in BPMS', 'month' => false, 'bpms' => true, ], [ 'key' => 'fpa', 'label' => 'FPA', 'sub' => $pciIiiBFinBpmsYearLabel !== '' ? ('Foreign Project Assistance — '.$pciIiiBFinBpmsYearLabel.' (BPMS allocation)') : 'Foreign Project Assistance (BPMS allocation)', 'month' => false, 'bpms' => true, ], ['key' => 'total_release_current_year', 'label' => 'Total Release (Current Year)', 'sub' => $pciIiiBFinBpmsYearLabel !== '' ? $pciIiiBFinBpmsYearLabel : 'From BPMS', 'month' => false, 'bpms' => true], ['key' => 'total_expenditure_current_year', 'label' => 'Total Expenditure (Current Year)', 'sub' => $pciIiiBFinBpmsYearLabel !== '' ? $pciIiiBFinBpmsYearLabel : 'From BPMS', 'month' => false, 'bpms' => true], ['key' => 'releases_current_month', 'label' => 'Releases (Current Month)', 'sub' => '', 'month' => true, 'bpms' => false], ['key' => 'expenditure_current_month', 'label' => 'Expenditure (Current Month)', 'sub' => '', 'month' => true, 'bpms' => false], ]; $pciIiiBFinFp = $pciIiiBFinDisplayPct($pciIiiBFinancial['overall_financial_progress_pct'] ?? ''); $pciIiiBFinPp = $pciIiiBFinDisplayPct($pciIiiBFinancial['overall_physical_progress_pct'] ?? ''); $pciIiiBFinVarianceReason = (string) ($pciIiiBFinancial['reason_of_variance'] ?? ''); @endphp
| Description | Capital (Rs. M) | Revenue (Rs. M) | Total (Rs. M) |
|---|---|---|---|
|
{{ $finRow['label'] }}
@if($finRow['sub'] !== '')
{{ $finRow['sub'] }}
@endif
|
|||
|
Expenditure Cumulative (Auto)
= Last F.Y. Expd + Total Expd (Current Year)
|
| S.No. | Status Indicator | Value |
|---|---|---|
| 1 |
Overall Financial Progress (FP) %
= Expenditure Cumulative ÷ (Approved Cost + FPA) × 100
|
|
| 2 | Overall Physical Progress (PP) % | |
| 3 |
Variance of PP and FP (PP – FP) %
Auto-calculated
|