@php $months = collect(range(1, 12))->mapWithKeys(fn ($m) => [$m => date('F', mktime(0, 0, 0, $m, 1))]); $yearOptions = collect(range(now()->year, now()->year - 3))->mapWithKeys(fn ($y) => [$y => (string) $y]); $ready = $staff->filter(fn ($employee) => isset($previews[$employee->id])); $totals = [ 'gross' => round(array_sum(array_column($previews, 'gross_salary')), 2), 'deductions' => round(array_sum(array_column($previews, 'total_deductions')), 2), 'net' => round(array_sum(array_column($previews, 'net_pay')), 2), ]; @endphp Manual entry instead @if ($errors->any())

Please fix the following before generating:

@endif @if ($existing)
A run already exists for {{ $existing->period_label }}. Open it instead — a month can only have one run.
@endif
@csrf

Payroll period

The preview uses the selected month, so unpaid leave, overtime and commissions must already be recorded for it.

Employees included

{{ $ready->count() }} of {{ $staff->count() }} active staff have a pay basis. Select the people to include in this run.

@if ($staff->isEmpty()) @else
@foreach ($staff as $employee) @php($preview = $previews[$employee->id] ?? null) @if ($preview) @else @endif @endforeach
Employee Cost centre Basic Allowances Commissions Deductions Net pay Extras
@if ($preview) @endif
{{ $employee->name }}
{{ $employee->employee_no ?? '—' }}{{ $employee->designation ? ' · '.$employee->designation : '' }}
{{ $preview['cost_center'] ?? $employee->department?->name ?? '—' }} {{ money($preview['basic_salary'], false) }} @if ((float) $preview['unpaid_leave_deduction'] > 0)
−{{ money($preview['unpaid_leave_deduction'], false) }} unpaid ({{ $preview['unpaid_leave_days'] }}d)
@endif
{{ money($preview['allowances'], false) }} {{ money($preview['commission'], false) }} {{ money($preview['total_deductions'], false) }} {{ money($preview['net_pay'], false) }}
@if ((float) $preview['loan_deduction'] > 0) @endif @if ((float) $preview['claims_reimbursement'] > 0) @endif @if ((float) $preview['helb'] > 0) @endif @if ((float) $preview['union_dues'] > 0) @endif @if ((float) $preview['fringe_benefit_tax'] > 0) @endif @if ((float) $preview['insurance_relief'] > 0) @endif
No pay basis — add an active contract or assign a pay grade step on the staff file.
@endif
Selected gross {{ money($totals['gross']) }} Deductions {{ money($totals['deductions']) }} Net {{ money($totals['net']) }}
@can('payroll.process') @endcan