@extends('dashboard.layouts.app') @section('content') @include('components.alert')
Payroll Details (Per Staff)
@php $currentMonth = now()->month; $currentYear = now()->year; $monthParam = request('month'); $yearParam = request('year'); $isAllMonth = ($monthParam === 'all'); $isAllYear = ($yearParam === 'all'); $selectedMonth = $isAllMonth ? null : (int) ($monthParam ?: $currentMonth); $selectedYear = $isAllYear ? null : (int) ($yearParam ?: $currentYear); $selectedMonthName = $selectedMonth ? date('F', mktime(0, 0, 0, $selectedMonth, 10)) : 'All months'; $selectedYearLabel = $selectedYear ? (string) $selectedYear : 'All years'; $canCheckRun = !is_null($selectedMonth) && !is_null($selectedYear); $runExistsForSelected = $canCheckRun ? \App\Models\PayrollRun::where('month', $selectedMonth)->where('year', $selectedYear)->exists() : null; $isCurrentSelection = $canCheckRun && ($selectedMonth === $currentMonth && $selectedYear === $currentYear); $currentMonthName = date('F', mktime(0, 0, 0, $currentMonth, 10)); @endphp
@if (!$canCheckRun) Showing {{ $selectedMonthName }} {{ $selectedYearLabel }} @else {{ $runExistsForSelected ? 'Run' : 'Not run' }} for {{ $selectedMonthName }} {{ $selectedYearLabel }} @endif
Clear
@if($canCheckRun && $runExistsForSelected) View PDF Export CSV @endif
Total Gross Salaries
{{ number_format($totalGross, 2) }}
Total Net Salaries
{{ number_format($totalNet, 2) }}
Total Bonuses
{{ $bonuses_total }}
Total Benalties
{{ $penalties_total }}
@forelse($rows as $row) @php $staffName = $row->full_name ?: trim(($row->first_name ?? '') . ' ' . ($row->last_name ?? '')); @endphp @empty @endforelse
Staff Pay Period Pay Date Gross Salary Net Salary Bonuses Penalties Notes Show Before Action
{{ $staffName ?: '—' }} @if(!empty($row->run_date)) {{ \Carbon\Carbon::createFromDate($row->run_date)->firstOfMonth()->format('d-m-y') }} - {{ \Carbon\Carbon::createFromDate($row->run_date)->endOfMonth()->format('d-m-y') }} @else — @endif @if(!empty($row->run_date)) {{ \Illuminate\Support\Carbon::parse($row->run_date)->format('Y-m-d') }} @else — @endif {{ number_format($row->gross_salary, 2) }} {{ number_format($row->net_salary, 2) }} {{ number_format($row->bonuses, 2) }} {{ number_format($row->penalties, 2) }} {{ $row->notes }} @if($row->in_compensation_log)

Viewed

@else

Not Viewed

@endif
@if(!empty($row->user_id)) @if(!$canCheckRun || !$runExistsForSelected) Add Compensations @else — @endif @else — @endif
No payroll staff data found.
Total {{ number_format($totalGross, 2) }} {{ number_format($totalNet, 2) }}
@endsection @push('scripts') @endpush