@extends('layouts.app') @section('title', 'Payroll Reports') @section('styles') @endsection @section('content')
โ† Back to Payroll
{{-- Filter bar --}}
@if(in_array($reportType, ['monthly_summary','department_cost','employer_contributions','payment_schedule','bank_export']))
@endif @if(in_array($reportType, ['employee_history','statutory_summary','remittance_by_body','ytd_earnings']))
@endif @if($reportType==='employee_history')
@endif
{{-- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• MONTHLY SUMMARY โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• --}} @if($reportType==='monthly_summary') @php $run = $data['run'] ?? null; $items = $data['items'] ?? collect(); @endphp @if(!$run)
No payroll run found for {{ \Carbon\Carbon::parse($month.'-01')->format('F Y') }}.
@else

Monthly Payroll Summary โ€” {{ $run->month_label }}

Run {{ $run->run_number }} ยท {{ $run->employee_count }} employees ยท Status: {{ ucfirst($run->status) }}

@foreach($items as $i) @endforeach
Emp No. Name Department Gross PAYE SHIF NSSF AHL Other Net
{{ $i->employee_number }}{{ $i->full_name }}{{ $i->department }} {{ number_format($i->gross_pay) }} {{ number_format($i->paye) }} {{ number_format($i->shif) }} {{ number_format($i->nssf_employee) }} {{ number_format($i->ahl_employee) }} {{ number_format($i->other_deductions) }} {{ number_format($i->net_pay) }}
TOTALS {{ number_format($run->total_gross) }} {{ number_format($run->total_paye) }} {{ number_format($run->total_shif) }} {{ number_format($run->total_nssf_employee) }} {{ number_format($run->total_ahl_employee) }} {{ number_format($run->total_other_deductions) }} {{ number_format($run->total_net) }}
@endif @endif {{-- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• DEPARTMENT COST โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• --}} @if($reportType==='department_cost') @php $run = $data['run'] ?? null; $rows = $data['rows'] ?? collect(); @endphp @if(!$run)
No payroll run found for {{ \Carbon\Carbon::parse($month.'-01')->format('F Y') }}.
@else

Departmental Cost Breakdown โ€” {{ $run->month_label }}

Run {{ $run->run_number }}

@php $totalCost = $rows->sum('employer_cost') ?: 1; @endphp @foreach($rows as $r) @endforeach
Department Headcount Gross Pay PAYE Net Pay Employer Cost % of Total
{{ $r->department ?? 'Unassigned' }} {{ $r->headcount }} {{ number_format($r->gross) }} {{ number_format($r->paye) }} {{ number_format($r->net) }} {{ number_format($r->employer_cost) }} {{ number_format($r->employer_cost / $totalCost * 100, 1) }}%
TOTAL {{ $rows->sum('headcount') }} {{ number_format($rows->sum('gross')) }} {{ number_format($rows->sum('paye')) }} {{ number_format($rows->sum('net')) }} {{ number_format($rows->sum('employer_cost')) }} 100%
@endif @endif {{-- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• EMPLOYEE HISTORY โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• --}} @if($reportType==='employee_history') @php $staff = $data['staff'] ?? null; $items = $data['items'] ?? collect(); @endphp @if(!$staff)
Pick an employee to view their {{ $year }} payroll history.
@else

{{ $staff->full_name }} โ€” Annual Payroll History

Employee {{ $staff->employee_number }} ยท Year {{ $year }} ยท {{ $items->count() }} months recorded

@foreach($items as $i) @endforeach
Month Run Gross Taxable PAYE SHIF NSSF AHL Net
{{ $i->run->month_label ?? '-' }} {{ $i->run->run_number ?? '' }} {{ number_format($i->gross_pay) }} {{ number_format($i->taxable_pay) }} {{ number_format($i->paye) }} {{ number_format($i->shif) }} {{ number_format($i->nssf_employee) }} {{ number_format($i->ahl_employee) }} {{ number_format($i->net_pay) }} Slip โ†’
YTD TOTAL {{ number_format($items->sum('gross_pay')) }} {{ number_format($items->sum('taxable_pay')) }} {{ number_format($items->sum('paye')) }} {{ number_format($items->sum('shif')) }} {{ number_format($items->sum('nssf_employee')) }} {{ number_format($items->sum('ahl_employee')) }} {{ number_format($items->sum('net_pay')) }}
@endif @endif {{-- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• STATUTORY SUMMARY โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• --}} @if($reportType==='statutory_summary') @php $rows = $data['rows'] ?? collect(); @endphp

Annual Statutory Summary โ€” {{ $year }}

Per-month statutory amounts due. Use this to reconcile against KRA / SHA / NSSF returns.

@foreach($rows as $r) @php $nssf = $r->total_nssf_employee + $r->total_nssf_employer; $ahl = $r->total_ahl_employee + $r->total_ahl_employer; $tot = $r->total_paye + $r->total_shif + $nssf + $ahl; @endphp @endforeach
Month Run PAYE SHIF NSSF (E+E) AHL (E+E) Total Statutory
{{ $r->month_label }} {{ $r->run_number }} {{ number_format($r->total_paye) }} {{ number_format($r->total_shif) }} {{ number_format($nssf) }} {{ number_format($ahl) }} {{ number_format($tot) }}
TOTAL โ€” {{ $year }} {{ number_format($rows->sum('total_paye')) }} {{ number_format($rows->sum('total_shif')) }} {{ number_format($rows->sum('total_nssf_employee') + $rows->sum('total_nssf_employer')) }} {{ number_format($rows->sum('total_ahl_employee') + $rows->sum('total_ahl_employer')) }} {{ number_format($rows->sum('total_paye') + $rows->sum('total_shif') + $rows->sum('total_nssf_employee') + $rows->sum('total_nssf_employer') + $rows->sum('total_ahl_employee') + $rows->sum('total_ahl_employer')) }}
@endif {{-- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• EMPLOYER CONTRIBUTIONS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• --}} @if($reportType==='employer_contributions') @php $run = $data['run'] ?? null; @endphp @if(!$run)
No payroll run found for {{ \Carbon\Carbon::parse($month.'-01')->format('F Y') }}.
@else

Employer Contributions โ€” {{ $run->month_label }}

Run {{ $run->run_number }} ยท The amounts the hospital pays on top of gross salaries.

NSSF Employer

{{ number_format($run->total_nssf_employer) }}

AHL Employer

{{ number_format($run->total_ahl_employer) }}

Total Employer Burden

{{ number_format($run->total_nssf_employer + $run->total_ahl_employer) }}

Gross Salaries

KES {{ number_format($run->total_gross) }}

Total Cost to Hospital

KES {{ number_format($run->total_employer_cost) }}

Gross + Employer NSSF + Employer AHL

@endif @endif {{-- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• PAYMENT SCHEDULE โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• --}} @if($reportType==='payment_schedule') @php $run = $data['run'] ?? null; $items = $data['items'] ?? collect(); @endphp @if(!$run)
No payroll run found for {{ \Carbon\Carbon::parse($month.'-01')->format('F Y') }}.
@else

Payment Schedule โ€” {{ $run->month_label }}

Run {{ $run->run_number }} ยท {{ $items->count() }} payments

โฌ‡ Export Bank CSV
@foreach($items as $i) @endforeach
Emp No. Name Method Bank / M-Pesa Account / Phone Net Amount Reference
{{ $i->employee_number }} {{ $i->full_name }} {{ $i->payment_method }} {{ $i->payment_method === 'mobile' ? 'M-PESA' : ($i->bank_name ?? '-') }} {{ $i->payment_method === 'mobile' ? $i->mobile_payment_number : ($i->bank_account ?? '-') }} {{ number_format($i->net_pay, 2) }} {{ $run->run_number }}-{{ $i->employee_number }}
TOTAL{{ number_format($items->sum('net_pay'), 2) }}
@endif @endif {{-- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• REMITTANCES BY BODY โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• --}} @if($reportType==='remittance_by_body') @php $rows = $data['rows'] ?? collect(); @endphp

Remittances by Statutory Body โ€” {{ $year }}

@foreach($rows as $r) @endforeach
Body Total Due Paid Outstanding Late Payments
{{ $r->label }} {{ number_format($r->total_due) }} {{ number_format($r->total_paid) }} {{ number_format($r->total_outstanding) }} @if($r->late_count > 0){{ $r->late_count }}@else 0@endif
@endif {{-- โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• YTD EARNINGS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• --}} @if($reportType==='ytd_earnings') @php $rows = $data['rows'] ?? collect(); @endphp

Year-to-Date Earnings per Employee โ€” {{ $year }}

Useful for KRA P9A forms, loan letters, and certificates of earnings.

@foreach($rows as $r) @endforeach
Emp No. Name Months YTD Gross YTD PAYE YTD SHIF YTD NSSF YTD AHL YTD Net
{{ $r->employee_number }} {{ $r->full_name }} {{ $r->months_paid }} {{ number_format($r->ytd_gross) }} {{ number_format($r->ytd_paye) }} {{ number_format($r->ytd_shif) }} {{ number_format($r->ytd_nssf) }} {{ number_format($r->ytd_ahl) }} {{ number_format($r->ytd_net) }}
TOTAL {{ number_format($rows->sum('ytd_gross')) }} {{ number_format($rows->sum('ytd_paye')) }} {{ number_format($rows->sum('ytd_shif')) }} {{ number_format($rows->sum('ytd_nssf')) }} {{ number_format($rows->sum('ytd_ahl')) }} {{ number_format($rows->sum('ytd_net')) }}
@endif @endsection