@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 ? DB::table("payroll_runs")->where('month', $selectedMonth)->where('year', $selectedYear)->exists() : null; // \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 }}
@if(!empty($rows)) @forelse($rows as $row) @php $staffName = $row->full_name ?: trim(($row->first_name ?? '') . ' ' . ($row->last_name ?? '')); @endphp {{-- --}} {{-- --}} {{-- --}} @php $methods = [ 'cash' => 'Cash', 'bank_transfer'=> 'Bank Transfer', 'wallet' => 'Wallet', 'insta_pay' => 'Insta Pay', ]; @endphp @empty @endforelse @endif
Staff Pay Period Pay Roll Run Date Gross Salary Net Salary Payment Method Status
{{ $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 }} {{ $row->payment_type }} {{-- --}} @if(isset($row->paid_at)) Paid @else @endif
No payroll staff data found.
Total {{ number_format($totalGross, 2) }} {{ number_format($totalNet, 2) }}
@endsection @push('scripts') @endpush