@extends('adminlte::page') @section('title', 'Payroll Runs') @include('partials.ui-polish') @section('content_header')

Payroll Runs

Generate payroll, review employee items, and move runs through approval
Salary Setup
@stop @section('content') @if(session('success')) {{ session('success') }} @endif @if($errors->any()) @endif
@csrf
@csrf @foreach($periods as $period) @endforeach {{ $activeSalaryCount }} active salary {{ $activeSalaryCount === 1 ? 'structure' : 'structures' }} will be included.
@forelse($runs as $run) @empty @endforelse
Period Status Items Gross Deductions Net Action
{{ $run->period->name ?? 'Unknown period' }} @if($run->period)
{{ $run->period->period_start->format('M d') }} - {{ $run->period->period_end->format('M d, Y') }}
@endif
{{ $run->status }} {{ $run->items_count }} {{ number_format((float) $run->gross_total, 2) }} {{ number_format((float) $run->deduction_total, 2) }} {{ number_format((float) $run->net_total, 2) }} View
No payroll runs found.
@if($runs->hasPages())
{{ $runs->links() }}
@endif
@if($selectedRun) @php $workflowSteps = ['Draft' => 'Prepared', 'Reviewed' => 'Reviewed', 'Approved' => 'Approved', 'Paid' => 'Paid']; $statusOrder = array_keys($workflowSteps); $currentStatusIndex = array_search($selectedRun->status, $statusOrder, true); @endphp
{{ $workflowSteps[$selectedRun->status] ?? $selectedRun->status }} Generated {{ $selectedRun->created_at->format('M d, Y H:i') }}
@if($selectedRun->status === 'Draft') @endif @if($selectedRun->status === 'Reviewed') @can('payroll.approve') @endcan @endif @if($selectedRun->status === 'Approved') @endif
@foreach($workflowSteps as $status => $label) @php($stepIndex = array_search($status, $statusOrder, true))
{{ $label }}
@switch($status) @case('Draft') Generated payroll items @break @case('Reviewed') Finance review complete @break @case('Approved') Final approval complete @break @case('Paid') Payroll marked paid @break @endswitch
@endforeach
@foreach($payrollChecks as $check)
{{ $check['label'] }} {{ $check['passed'] ? 'OK' : ($check['blocking'] ? 'Blocker' : 'Check') }}
{{ $check['detail'] }}
@endforeach
@forelse($selectedRun->items as $item) @empty @endforelse
Employee Department Basic Allowances Deductions Employer Gross Net
{{ $item->employee->full_name ?? 'Unknown employee' }}
{{ $item->employee->employee_code ?? '' }}
{{ $item->employee->department->name ?? 'Unassigned' }} {{ number_format((float) $item->basic_salary, 2) }} {{ number_format((float) $item->total_allowances, 2) }} {{ number_format((float) $item->total_deductions, 2) }} {{ number_format((float) $item->total_employer_contributions, 2) }} {{ number_format((float) $item->gross_salary, 2) }} {{ number_format((float) $item->net_salary, 2) }}
This run has no payroll items.
Totals {{ number_format((float) $selectedRun->items->sum('total_employer_contributions'), 2) }} {{ number_format((float) $selectedRun->gross_total, 2) }} {{ number_format((float) $selectedRun->net_total, 2) }}
@if($selectedRun->approvals->isNotEmpty())
Approval Trail
@foreach($selectedRun->approvals as $approval)
{{ $approval->status }} @if($approval->approver) by {{ $approval->approver->name }} @endif {{ $approval->approved_at?->format('M d, Y H:i') }} @if($approval->comments)
{{ $approval->comments }}
@endif
@endforeach
@endif
@csrf {{ old('comments') }}
@csrf {{ old('comments') }}
@csrf {{ old('comments') }}
@endif @stop