@php $d = $d ?? []; $cell = static fn ($v) => ($v !== null && $v !== '') ? e((string) $v) : '—'; $finSimple = is_array($d['financial_simple'] ?? null) ? $d['financial_simple'] : []; $fin = is_array($d['financial_status'] ?? null) ? $d['financial_status'] : []; $physicalRaw = is_array($d['physical_status'] ?? null) ? $d['physical_status'] : []; $physical = []; foreach ($physicalRaw as $sec) { if (! is_array($sec)) { continue; } if (isset($sec['components']) && is_array($sec['components'])) { foreach ($sec['components'] as $comp) { if (! is_array($comp)) { continue; } $physical[] = array_merge($comp, [ 'district' => $sec['district'] ?? '', 'taluka' => $sec['taluka'] ?? '', 'union_council' => $sec['union_council'] ?? '', 'location_unit' => $sec['unit'] ?? '', 'contractor' => $sec['contractor'] ?? '', 'consultant' => $sec['consultant'] ?? '', ]); } continue; } $physical[] = $sec; } $outputs = is_array($d['output_indicators'] ?? null) ? $d['output_indicators'] : []; $bottlenecks = is_array($d['bottlenecks'] ?? null) ? $d['bottlenecks'] : []; $overall = is_array($d['overall'] ?? null) ? $d['overall'] : []; $docs = is_array($d['supporting_documents'] ?? null) ? $d['supporting_documents'] : []; $photos = is_array($d['site_photos'] ?? null) ? $d['site_photos'] : []; $docsHtml = (string) ($d['supporting_documents_html'] ?? ''); $photosHtml = (string) ($d['site_photos_html'] ?? ''); $unexpectedFiles = is_array($d['unexpected_problems_files'] ?? null) ? $d['unexpected_problems_files'] : []; $unexpectedHtml = (string) ($d['unexpected_problems_html'] ?? ''); $submit = is_array($d['report_submission'] ?? null) ? $d['report_submission'] : []; $sigUrl = trim((string) ($submit['signature_url'] ?? '')); $finRows = [ 'approved_cost' => 'Approved Cost', 'expenditure_last_fy' => 'Expenditure up to last FY', 'adp_allocations_current_year' => 'ADP / PSDP Allocations (current year)', 'fpa' => 'FPA', 'total_release_current_year' => 'Total Release (current year)', 'total_expenditure_current_year' => 'Total Expenditure (current year)', 'releases_current_month' => 'Releases (current month)', 'expenditure_current_month' => 'Expenditure (current month)', 'expenditure_cumulative' => 'Expenditure (cumulative)', ]; @endphp PC-III (B) — Cover Preview @include('partials.pms-print-document-head')

For correct margins on all printers (especially HP): use Actual size / 100% and turn off Fit to page.

{{-- Cover --}}

{!! $cell($d['formCode'] ?? 'PC-III (B) Form') !!}

@if(!empty($d['logoDataUri'])) @endif

{{ $d['governmentLine'] ?? 'GOVERNMENT OF PAKISTAN' }}

{{ $d['commissionLine'] ?? 'PLANNING COMMISSION' }}

{{ $d['coverTitle'] ?? 'PC-III PROFORMA (B)' }}

{{ $d['coverSubtitle'] ?? 'Monthly Progress Reporting' }}

@if(!empty($d['alertNote']))

{{ $d['alertNote'] }}

@endif

{{ $d['departmentName'] ?? '—' }}

Government of Sindh

{{-- Source blocks (packed into letter sheets by JS) --}}

{!! $cell($d['formCode'] ?? null) !!}

{{ $d['governmentLine'] ?? 'GOVERNMENT OF PAKISTAN' }}

{{ $d['coverTitle'] ?? 'PC-III PROFORMA (B)' }}

{{ $d['coverSubtitle'] ?? '' }}

1. Name of Project{!! $cell($d['schemeName'] ?? null) !!}
Sponsoring Department{!! $cell($d['departmentName'] ?? null) !!}
Reporting Period (Month / Year){!! $cell($d['reportingPeriod'] ?? null) !!}
Town / UC{!! $cell($d['townUc'] ?? null) !!}

2. Financial Progress (Rs. Million) — Summary

PSDP Funding (current year) Current Quarter Requirements Releases during month Expenditure during month
{!! $cell($finSimple['psdp_funding_current_year'] ?? null) !!} {!! $cell($finSimple['current_quarter_requirements'] ?? null) !!} {!! $cell($finSimple['releases_during_month'] ?? null) !!} {!! $cell($finSimple['expenditure_during_month'] ?? null) !!}

Financial Status (Capital / Revenue)

@foreach($finRows as $key => $label) @php $row = is_array($fin[$key] ?? null) ? $fin[$key] : []; @endphp @endforeach
Item Capital Revenue Total
{{ $label }} {!! $cell($row['capital'] ?? null) !!} {!! $cell($row['revenue'] ?? null) !!} {!! $cell($row['total'] ?? null) !!}

Overall Status

Financial Progress (%){!! $cell($overall['financial_progress_pct'] ?? null) !!}
Physical Progress (%){!! $cell($overall['physical_progress_pct'] ?? null) !!}
Variance (PP − FP){!! $cell($overall['variance_pp_fp'] ?? null) !!}
Reason of Variance{!! $cell($overall['reason_of_variance'] ?? null) !!}

3. Physical Progress

@forelse($physical as $i => $row) @empty @endforelse
S# Component Unit Total Qty (PC-I) Completed (cum.) Completed (month) Physical % Exp. (Rs. M) Remarks
{{ $i + 1 }} {!! $cell($row['component'] ?? null) !!} {!! $cell($row['unit'] ?? null) !!} {!! $cell($row['total_qty_pc_i'] ?? null) !!} {!! $cell($row['qty_completed_cumulative'] ?? null) !!} {!! $cell($row['qty_completed_current_month'] ?? null) !!} {!! $cell($row['physical_progress_pct'] ?? null) !!} {!! $cell($row['expenditure_rs_m'] ?? null) !!} {!! $cell($row['remarks'] ?? null) !!}

4. Output Indicators

@forelse($outputs as $i => $row) @empty @endforelse
S# Description Unit Baseline Annual Target Achieved (cum.) Achieved (month)
{{ $i + 1 }} {!! $cell($row['description'] ?? null) !!} {!! $cell($row['unit'] ?? null) !!} {!! $cell($row['baseline'] ?? null) !!} {!! $cell($row['annual_target'] ?? null) !!} {!! $cell($row['achieved_cumulative'] ?? null) !!} {!! $cell($row['achieved_month'] ?? null) !!}

5. Bottlenecks / Problems

@forelse($bottlenecks as $bn) @empty @endforelse
Select Bottleneck Remarks
{{ !empty($bn['selected']) ? '✓' : '—' }} {!! $cell($bn['label'] ?? null) !!} {!! $cell($bn['remarks'] ?? null) !!}
@if(trim((string) ($d['unexpected_problems'] ?? '')) !== '' && ($d['unexpected_problems'] ?? '') !== '—')
Unexpected problems / other issues: {{ $d['unexpected_problems'] }}
@endif
@if($unexpectedHtml !== '' || $unexpectedFiles !== [])

Unexpected problems — attachments:

@if($unexpectedHtml !== '') {!! $unexpectedHtml !!} @else @endif
@endif

6. Attachments

Supporting documents:

@if($docsHtml !== '') {!! $docsHtml !!} @elseif($docs !== []) @else

@endif

Site photographs:

@if($photosHtml !== '') {!! $photosHtml !!} @elseif($photos !== []) @else

@endif

7. Report Submitted By

Name{!! $cell($submit['name'] ?? null) !!}
Designation{!! $cell($submit['designation'] ?? null) !!}
Contact{!! $cell($submit['contact'] ?? null) !!}
Email{!! $cell($submit['email'] ?? null) !!}
Reporting Period{!! $cell($submit['reporting_period'] ?? null) !!}
Submission Date{!! $cell($submit['submission_date'] ?? null) !!}
Signature @if($sigUrl !== '') Signature @else (No signature on file for submitter) @endif