@extends('layouts.master') @section('title', 'Employee Payrolls') @section('content')
Payrolls

Employee Payrolls

@csrf
@csrf
{{-- Success / Error Messages --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
@foreach($payrolls as $pay) @php $attendances = $pay->employee->attendances() ->whereYear('date', $pay->year) ->whereMonth('date', $pay->month) ->get(); $lateDays = $attendances->where('status', 'late')->count(); $absentDays = $attendances->where('status', 'absent')->count(); @endphp @endforeach
Employee Month Gross Salary Deductions Net Salary Late Days Absent Days Status Paid At Actions
{{ $pay->employee->first_name }} {{ $pay->employee->last_name }} {{ \Carbon\Carbon::create($pay->year, $pay->month)->format('F, Y') }} {{ number_format($pay->gross_salary, 2) }} {{ number_format($pay->deductions, 2) }} {{ number_format($pay->net_salary, 2) }} {{ $lateDays }} {{ $absentDays }} {{ ucfirst($pay->status) }} {{ $pay->paid_at ? \Carbon\Carbon::parse($pay->paid_at)->format('d-m-Y') : '-' }} @if($pay->status == 'unpaid')
@csrf
@else Paid @endif
@endsection @push('styles') @endpush @push('scripts') @endpush