@php /** * Pre-PDWP Working Paper Form (Word-like). * Expects: $data (array) */ $data = \App\Support\WorkingPaperRichTextHtml::decodePayloadStrings(is_array($data ?? null) ? $data : []); $v = function (string $key, $default = '') use ($data) { $raw = data_get($data ?? [], $key, $default); if (is_string($raw)) { return \App\Support\HtmlDisplay::decodeEntities($raw, 8); } if (is_array($raw)) { return \App\Support\WorkingPaperRichTextHtml::decodePayloadStrings($raw); } return $raw; }; $m = function (string $key) use ($data): string { $raw = data_get($data ?? [], $key, ''); if ($raw === null || $raw === '') { return ''; } return \App\Helpers\PC\AmountMillionHelper::amountToMillion($raw); }; $pcLinkedKeys = is_array($pcLinkedKeys ?? null) ? $pcLinkedKeys : []; $ro = function (string $key) use ($pcLinkedKeys): string { return in_array($key, $pcLinkedKeys, true) ? 'readonly' : ''; }; $rbmRows = data_get($data ?? [], 'rbm', []); $rbmCount = max(1, is_array($rbmRows) ? count($rbmRows) : 0); $phys = is_array($v('schedule.physical', [])) ? $v('schedule.physical', []) : []; $fin = is_array($v('schedule.financial', [])) ? $v('schedule.financial', []) : []; $physCount = max(1, count($phys)); $finCount = max(1, count($fin)); // Section 17 (Revised Project) - support new structure (revised.items[*]) with fallback to older (revised.compare[*]) $revItems = data_get($data ?? [], 'revised.items', null); if (!is_array($revItems)) { $legacy = is_array($v('revised.compare', [])) ? $v('revised.compare', []) : []; $revItems = []; foreach ($legacy as $row) { $revItems[] = [ 'compare' => is_array($row) ? $row : [], 'reasons' => '', 'expenditure' => '', ]; } } $revItems = is_array($revItems) ? $revItems : []; $revItemsCount = max(1, count($revItems)); $revProg = is_array($v('revised.progress', [])) ? $v('revised.progress', []) : []; $revProgCount = max(1, count($revProg)); $veh = is_array($v('vehicles', [])) ? $v('vehicles', []) : []; $vehCount = max(1, count($veh)); $fac = is_array($v('facilities', [])) ? $v('facilities', []) : []; $facCount = max(1, count($fac)); $assets = is_array($v('assets', [])) ? $v('assets', []) : []; $assetsCount = max(1, count($assets)); $ta = is_array($v('tech_appraisal', [])) ? $v('tech_appraisal', []) : []; $taCount = max(1, count($ta)); $cFin = is_array($v('comments.financial', [])) ? $v('comments.financial', []) : []; $cSoc = is_array($v('comments.social', [])) ? $v('comments.social', []) : []; $cEnv = is_array($v('comments.environmental', [])) ? $v('comments.environmental', []) : []; $cRes = is_array($v('comments.results', [])) ? $v('comments.results', []) : []; $cOther = is_array($v('comments.other', [])) ? $v('comments.other', []) : []; $cRisk = is_array($v('comments.risks', [])) ? $v('comments.risks', []) : []; $cFinN = max(1, count($cFin)); $cSocN = max(1, count($cSoc)); $cEnvN = max(1, count($cEnv)); $cResN = max(1, count($cRes)); $cOtherN = max(1, count($cOther)); $cRiskN = max(1, count($cRisk)); $ce = is_array($ceProjectCostBreakdown ?? null) ? $ceProjectCostBreakdown : []; $ceHasCostBreakdown = ! empty($ce['has_lines']); @endphp @push('stylesheets') @endpush

GOVERNMENT OF SINDH

PLANNING AND DEVELOPMENT DEPARTMENT

WORKING PAPER FOR PRE-PDWP

@include('working-papers.partials.scheme-meta-header', [ 'v' => $v, 'inputClass' => 'prepwp-input', 'textareaClass' => 'prepwp-textarea', 'fontSize' => '14px', ]) {{-- 5. Cost of Project (Rs. in Million) --}} @php $cost = data_get($data ?? [], 'cost', []); $cost = is_array($cost) ? $cost : []; $revisionKeys = array_values(array_filter(array_keys($cost), fn ($k) => $k !== 'original')); usort($revisionKeys, function ($a, $b) { $idx = function ($k) { if ($k === 'revised') return 1; if ($k === 'revised2') return 2; if (preg_match('/^revised(\d+)$/', (string) $k, $m)) return (int) $m[1]; return 9999; }; return $idx($a) <=> $idx($b); }); $visibleRevisionKeys = []; foreach ($revisionKeys as $rk) { $row = $cost[$rk] ?? []; $row = is_array($row) ? $row : []; $hasAny = false; foreach (['gop','gos','fpa','total','fec'] as $kk) { $val = data_get($row, $kk); if ($val !== null && $val !== '' && (float) str_replace(',', '', (string) $val) > 0) { $hasAny = true; break; } } if ($hasAny) $visibleRevisionKeys[] = $rk; } $revLabel = function (string $k) { if ($k === 'revised') return 'Revised'; if ($k === 'revised2') return '2nd Revised'; if (preg_match('/^revised(\d+)$/', $k, $m)) { $n = (int) $m[1]; $suffix = ($n % 100 >= 11 && $n % 100 <= 13) ? 'th' : (match ($n % 10) { 1 => 'st', 2 => 'nd', 3 => 'rd', default => 'th' }); return $n . '' . $suffix . ' Revised'; } return e($k); }; // Original + N revision rows sit under the cost header (no rowspan). @endphp @foreach($visibleRevisionKeys as $rk) @endforeach {{-- 7. Expenditure Incurred (if any) --}} {{-- 8-12 (same grid) --}}
PART-A
(Project Profile)
1. Project Title:
2. Location:
3. Authorities Responsible for;
(i) Sponsoring Agency
(ii) Executing Agency
(iii) Operation & Maintenance
4. Date of Receipt of PC-1 in P&D:
5. Cost of Project:
(Rs in Million)
Exchange Rate
1US$ = Rs (as per PC-1)
1US$ = Rs (current rate)
Source Local FPA Total FEC
GoP GoS
Original
{!! $revLabel((string) $rk) !!}
7. Expenditure Incurred (if any)
8. Period of Implementation:
9. Plan Framework:
a) ADP Allocation (CFY):
b) Sector Strategy:
c) Sector issues with relationship of the project:
10. Project’s Objectives and Brief Description: @include('working-papers.partials.objectives-brief-field', [ 'v' => $v, 'textareaClass' => 'prepwp-textarea', 'fieldIdPrefix' => 'prepwp-objectives-brief', 'canEditWorkingPaperBody' => $canEditWorkingPaperBody ?? true, ])
11. Implementation Arrangement:
12. Result Based Monitoring (RBM) Indicators
{{-- RBM table --}} @for ($idx = 0; $idx < $rbmCount; $idx++) @endfor
Input/
Activity
Output Outcome Targeted
Impact
Baseline Indicator Target after completion
{{ $v("rbm.$idx.input") }}
{{ $v("rbm.$idx.output") }}
{{ $v("rbm.$idx.baseline") }}
{{ $v("rbm.$idx.target") }}
{{ $v("rbm.$idx.impact") }}
13.Outcome of Stakeholders Consultation:
{{-- 14 Breakdown of the Project Cost --}} @if ($ceHasCostBreakdown) @include('working-papers.partials.ce-project-cost-breakdown', ['ce' => $ce, 'variant' => 'pre']) @else @endif
14.Breakdown of the Project Cost(Rs. In Million)
A.  Capital Cost component
i  
ii  
Sub-Total Capital
B.  Revenue Component
i  
ii  
Sub-Total Revenue
Total (Capital + Revenue)
{{-- 15 Physical and Financial Scheduling --}} @for($i=0; $i<$physCount; $i++) @endfor @for($i=0; $i<$finCount; $i++) @endfor
15. Physical and Financial Scheduling:
A. Physical Scheduling Unit Year-1 Year-2 Year-3 Year-4 Total
B. Financial Scheduling
(Cost Items, Rs. in Million)
Year-1 Year-2 Year-3 Year-4 Total
Total
{{-- 16 feasibility study status --}}
16. Status of Feasibility Study/PC-II Conducted In-House Conducted Through Consultants
{{-- 17 revised project (note) --}}
17.In Case of Revised Project; (please annex this information and hyperlink)
{{-- 17 (i)-(iii) revised project details (match screenshot) --}}
@for($i=0; $i<$revItemsCount; $i++) @php($cmp = is_array($revItems[$i]['compare'] ?? null) ? ($revItems[$i]['compare'] ?? []) : []) @endfor
(i) Comparison of cost estimates of the last sanctioned and revised project
Item Last Sanction Revised Proposal Total
Unit Rate Total Work Done To be Done Unit Rate Total
(ii) Reasons for Revision for each Activity;
@for($i=0; $i<$revItemsCount; $i++)
@endfor
(iii) Total expenditure incurred for each item;
@for($i=0; $i<$revItemsCount; $i++)
@endfor
@for($i=0; $i<$revProgCount; $i++) @endfor
(iv) Physical Progress Achieved;
As per last sanction Actual achievement Reasons for delay
(v) Comments of Technical Section on reasons for revision
{{-- 18-24 --}}
18.Overall Unit Cost with Basis of Cost Estimates:
19.Sustainability of the Project:
a. Annual recurring expenditure after completion (source of financing)
b. Income Generation (if any):
@for($i=0; $i<$vehCount; $i++) @endfor
20.  Requirement of Vehicles:
Sr. NoMake and Model of vehiclesExisting owned by the Executing AgencyRequirement under the projectJustifications for additional requirement
{{ $i + 1 }}
@for($i=0; $i<$facCount; $i++) @endfor
21.  Existing Facilities:
Sr. NoFacilities/Inputs/ServicesExisting with Executing AgencyRequirement under projectJustifications for additional requirement
{{ $i + 1 }}
@for($i=0; $i<$assetsCount; $i++) @endfor
22.  Ownership of project assets after completion:
Sr. NoAssets DescriptionOwnership to be transferred toJustification
{{ $i + 1 }}
23.Map & elevation of buildings (for civil works only):
24.Other relevant on-going and potential projects in the Sector:
PART-B
{{-- 25 technical appraisal --}} @for($i=0; $i<$taCount; $i++) @endfor
(Technical Appraisal)
25.  Appraisal by the Technical Section
Sr. # Observation of Technical Section Response of Sponsor Follow-up Comments
{{ $i + 1 }}
Comments of Other Section (if any)
{{-- PART C --}}
PART – C
(Project Cost & Benefit Analysis)
26.Comments offered on Financial / Social / Environmental aspects are as under:
@for($i=0; $i<$cFinN; $i++) @endfor
i.Financial:
@for($i=0; $i<$cSocN; $i++) @endfor
ii.Social:
@for($i=0; $i<$cEnvN; $i++) @endfor
iii.Environmental:
@for($i=0; $i<$cResN; $i++) @endfor
iv.Results of Analysis:
@for($i=0; $i<$cOtherN; $i++) @endfor
v.Other issues (if any):
@for($i=0; $i<$cRiskN; $i++) @endfor
vi.Risks and mitigation measures:
27.Conclusion / Recommendations:
@include('working-papers.partials.comments-inline', ['variant' => 'pre-pdwp']) @include('working-papers.partials.attachments', ['variant' => 'pre-pdwp'])
@push('scripts') @endpush