{{-- Staff performance report (weekly / monthly / custom) in the house PDF style: the officer's narrative, the figures behind it, the work by location and the approval history. Every figure is the snapshot saved on the report. --}} @extends('layouts.PdfReportLayout') @php $s = $report->stats ?? []; $n = fn ($v) => number_format((float) ($v ?? 0)); $money = fn ($v) => 'TZS '.number_format((float) ($v ?? 0), fmod((float) ($v ?? 0), 1.0) == 0.0 ? 0 : 2); $paragraphs = fn ($text) => array_filter(preg_split('/\n\s*\n/', (string) $text)); $place = fn ($v) => $v ?? 'Not recorded'; // Group the location rows region -> district, with subtotals. $groups = []; foreach ($report->locations ?? [] as $row) { $groups[$row['region'] ?? ''][$row['district'] ?? ''][] = $row; } $sum = fn (array $rows, string $key) => array_sum(array_column($rows, $key)); $all = $report->locations ?? []; @endphp @section('doc_title', $docTitle) @section('doc_subtitle', $docSubtitle) @section('meta')
{{ $p }}
@endforeach @if($report->other_duties){{ $p }}
@endforeach @endif{{ $p }}
@endforeach @if($report->challenges) @foreach($paragraphs($report->challenges) as $p){{ $p }}
@endforeach @endif @if($report->next_steps){{ $p }}
@endforeach @endif| Jobs conducted | {{ $n($s['jobs_conducted'] ?? 0) }} | Instruments inspected | {{ $n($s['instruments_inspected'] ?? 0) }} |
| Jobs completed | {{ $n($s['jobs_completed'] ?? 0) }} | Verified / rejected / condemned | {{ $n($s['instruments_verified'] ?? 0) }} / {{ $n($s['instruments_rejected'] ?? 0) }} / {{ $n($s['instruments_condemned'] ?? 0) }} |
| Jobs pending (overdue) | {{ $n($s['jobs_pending'] ?? 0) }} ({{ $n($s['jobs_overdue'] ?? 0) }}) | Certificates issued | {{ $n($s['certificates_issued'] ?? 0) }} |
| Customers served (new / repeat) | {{ $n($s['customers_served'] ?? 0) }} ({{ $n($s['new_customers'] ?? 0) }} / {{ $n($s['repeat_customers'] ?? 0) }}) | Premises served | {{ $n($s['premises_served'] ?? 0) }} |
| Bills generated / paid / cancelled | {{ $n($s['bills_generated'] ?? 0) }} / {{ $n($s['bills_paid'] ?? 0) }} / {{ $n($s['bills_cancelled'] ?? 0) }} | Amount billed | {{ $money($s['amount_billed'] ?? 0) }} |
| Amount paid | {{ $money($s['amount_paid'] ?? 0) }} | Outstanding balance | {{ $money($s['amount_outstanding'] ?? 0) }} |
| Activity | Instruments | Jobs | Verified | Adjusted | Rejected | Completed | Pending |
|---|---|---|---|---|---|---|---|
| {{ $a['label'] }} | {{ collect($a['instruments'])->map(fn ($i) => $i['count'].' '.$i['label'])->implode(', ') }} | {{ $n($a['jobs']) }} | {{ $n($a['verified']) }} | {{ $n($a['adjusted']) }} | {{ $n($a['rejected']) }} | {{ $n($a['completed']) }} | {{ $n($a['incomplete']) }} |
No located work was recorded in this period.
@else| Region | District | Ward | Jobs | Instruments | Completed | Pending |
|---|---|---|---|---|---|---|
| {{ $place($row['region']) }} | {{ $place($row['district']) }} | {{ $place($row['ward']) }} | {{ $n($row['jobs_started']) }} | {{ $n($row['instruments_inspected']) }} | {{ $n($row['jobs_completed']) }} | {{ $n($row['jobs_pending']) }} |
| {{ $district }} District total | {{ $n($sum($rows, 'jobs_started')) }} | {{ $n($sum($rows, 'instruments_inspected')) }} | {{ $n($sum($rows, 'jobs_completed')) }} | {{ $n($sum($rows, 'jobs_pending')) }} | ||
| {{ $region }} Region total | {{ $n($sum($regionRows, 'jobs_started')) }} | {{ $n($sum($regionRows, 'instruments_inspected')) }} | {{ $n($sum($regionRows, 'jobs_completed')) }} | {{ $n($sum($regionRows, 'jobs_pending')) }} | ||
| Grand total | {{ $n($sum($all, 'jobs_started')) }} | {{ $n($sum($all, 'instruments_inspected')) }} | {{ $n($sum($all, 'jobs_completed')) }} | {{ $n($sum($all, 'jobs_pending')) }} | ||
Location is the region, district and ward of the customer premises the job was for, as registered in WMA-MIS. "Not recorded" means the customer has no address on record.
@endif @if($report->events->isNotEmpty())| Date | Action | By | Note |
|---|---|---|---|
| {{ $event->created_at?->format('d M Y, H:i') }} | {{ ucfirst(str_replace('_', ' ', $event->action)) }} | {{ $event->actor_name }} | {{ $event->note }} |
|
Officer: {{ $report->officer_name }}
|
Supervisor: {{ $report->reviewed_by_name ?: '' }}
|