@extends('layouts.master') @section('title', $title) @section('content') @php $d = $run->Details->sortBy(fn ($l) => $l->Staff?->name); $m = fn ($v) => '$' . number_format((float) $v, 2); $draft = $run->isDraft(); $sum = fn ($c) => $d->sum($c); @endphp {{-- one payroll: attendance and deductions per staff (App\Services\PayrollCalculator) --}}
All payrolls
@if ($draft && $run->period_from) @can($access . '-create') @endcan @endif @if ($draft) @can($access . '-approve') @endcan @endif

Payroll — {{ $period }} {{ $draft ? 'Draft' : 'Approved' }}

Made by {{ $run->Generator?->name ?? '—' }} on {{ $run->created_at?->format('d M, Y') }} @if (!$draft && $approver) · approved by {{ $approver }} on {{ $run->approved_at?->format('d M, Y') }} @endif @if ($run->notes) · {{ $run->notes }} @endif
Staff
{{ $d->count() }}
Basic
{{ $m($sum('basic_salary')) }}
Commission + overtime + bonus
{{ $m($sum('commission_amount') + $sum('overtime_amount') + $sum('adjustment_bonus')) }}
Deductions
{{ $m($sum('deduction_amount')) }}
Net to pay
{{ $m($sum('total')) }}
@forelse ($d as $l) @php $parts = collect([ 'Absent days' => $l->absence_deduction, 'Unpaid leave' => $l->unpaid_leave_deduction, 'Late' => $l->late_deduction, 'Left early' => $l->early_deduction, 'Deduction ' . (float) $l->deduction_percent . '%' => $l->other_deduction, 'Manual' => $l->adjustment_deduction, ])->filter(fn ($v) => $v > 0); $plus = collect(['Commission ' . (float) $l->commission_percent . '%' => $l->commission_amount, 'Overtime' => $l->overtime_amount, 'Bonus' => $l->adjustment_bonus])->filter(fn ($v) => $v > 0); @endphp @empty @endforelse @if ($d->isNotEmpty()) @endif
Staff Basic Days
work · present · absent
Leave
paid · unpaid
Late
times · min
Early · OT
minutes
Commission
+ OT + bonus
Deductions Net pay
{{ $l->Staff?->name ?? 'Deleted staff #' . $l->staff_id }} @if ($l->Staff?->attendance_exempt)Exempt@endif @if ($l->Staff?->work_days)own days@endif
day {{ $m($l->daily_rate) }}@if ($l->adjustment_note) · {{ $l->adjustment_note }}@endif
{{ $m($l->basic_salary) }} {{ (float) $l->working_days }} · {{ (float) $l->present_days }} · {{ (float) $l->absent_days }} {{ (float) $l->paid_leave_days }} · {{ (float) $l->unpaid_leave_days }} {{ $l->late_count }} · {{ $l->late_minutes }} {{ $l->early_minutes }} · {{ $l->overtime_minutes }} {{ $m($l->commission_amount + $l->overtime_amount + $l->adjustment_bonus) }} {{ $m($l->deduction_amount) }} @if ($parts->isNotEmpty())
{{ $parts->keys()->implode(', ') }}
@endif
{{ $m($l->total) }} @if ($draft) @can($access . '-update') @endcan @endif
No staff in this payroll.
Total {{ $m($sum('basic_salary')) }} {{ (float) $sum('working_days') }} · {{ (float) $sum('present_days') }} · {{ (float) $sum('absent_days') }} {{ (float) $sum('paid_leave_days') }} · {{ (float) $sum('unpaid_leave_days') }} {{ $sum('late_count') }} · {{ $sum('late_minutes') }} {{ $sum('early_minutes') }} · {{ $sum('overtime_minutes') }} {{ $m($sum('commission_amount') + $sum('overtime_amount') + $sum('adjustment_bonus')) }} {{ $m($sum('deduction_amount')) }} {{ $m($sum('total')) }}
@if ($run->rules)
Rules used
@foreach ($run->rules as $k => $v)
{{ $k }}: {{ $v }}
@endforeach
@endif @endsection @section('page_js') @endsection