@php // Helper for time formatting function formatMinutes($minutes) { if (!$minutes || $minutes <= 0) { return '0h 00m'; } $h = floor($minutes / 60); $m = $minutes % 60; return sprintf('%dh %02dm', $h, $m); } $totalFines = isset($fines) ? $fines->where('type', 0)->sum('fine_amount') : 0; $totalBonuses = isset($fines) ? $fines->where('type', 1)->sum('fine_amount') : 0; @endphp Attendance Details - {{ optional($payroll->employee)->first_name }} {{ optional($payroll->employee)->last_name }}

Attendance Details

{{ optional($payroll->employee)->first_name }} {{ optional($payroll->employee)->last_name }} - {{ date('F Y', mktime(0, 0, 0, $payroll->pay_month, 1, $payroll->pay_year)) }}
Employee Information
Full Name {{ optional($payroll->employee)->first_name }} {{ optional($payroll->employee)->middle_name }} {{ optional($payroll->employee)->last_name }} Employee ID #{{ optional($payroll->employee)->id ?: 'N/A' }}
Mobile Number {{ optional($payroll->employee)->mobile ?: 'Not Available' }} Email Address {{ optional($payroll->employeCom)->employee_email ?: 'Not Available' }}
Salary Summary
Hours Required
{{ number_format($payroll->working_hours / 60, 1) }}h
Hours Worked
{{ number_format($payroll->actual_working_hours / 60, 1) }}h
Leave Hours
{{ $approvedLeaveHours ?? 0 }}h
Basic Salary
PKR {{ number_format($payroll->basic_salary, 0) }}
Calculated Salary
PKR {{ number_format($payroll->calculated_salary, 0) }}
Final Amount
PKR {{ number_format($adjustedSalary ?? $payroll->calculated_salary, 0) }}
Salary Breakdown
Item Details Amount
Basic Salary Monthly basic salary PKR {{ number_format($payroll->basic_salary, 0) }}
Working Hours Scheduled Required hours {{ number_format($payroll->working_hours / 60, 1) }} hours
Approved Leaves Number of approved leave days {{ $approvedLeave ?? 0 }}
Approved Leave Hours Total leave hours {{ $approvedLeaveHours ?? 0 }} hours
Hours Worked Actual hours spent {{ number_format($payroll->actual_working_hours / 60, 1) }} hours
Overtime Hours Total overtime hours {{ number_format($payroll->overtime_hours / 60, 1) }} hours
Total Fines Deductions for fines PKR {{ number_format($totalFines, 0) }}
Total Bonuses Additional bonuses PKR {{ number_format($totalBonuses, 0) }}
Attendance Summary
{{ $totalWorkingDays ?? 0 }}
Total Working Days
{{ $totalHolidays ?? 0 }}
Holidays
{{ $presentDays ?? 0 }}
Present Days
{{ $absentDays ?? 0 }}
Absent Days
{{ $attendanceRate ?? 0 }}%
Attendance Rate
@if (isset($attendances) && $attendances->count() > 0)
Daily Attendance Records
@foreach ($attendances as $attendance) @endforeach
Date Day Check In Check Out Working Hours Status
{{ \Carbon\Carbon::parse($attendance->date)->format('d M Y') }} {{ \Carbon\Carbon::parse($attendance->date)->format('l') }} {{ $attendance->check_in ? \Carbon\Carbon::parse($attendance->check_in)->format('H:i') : 'N/A' }} {{ $attendance->check_out ? \Carbon\Carbon::parse($attendance->check_out)->format('H:i') : 'N/A' }} {{ formatMinutes($attendance->working_hours ?? 0) }} @if ($attendance->check_in && $attendance->check_out) Present @elseif($attendance->check_in && !$attendance->check_out) Incomplete @else Absent @endif
@else
No Attendance Records

No attendance records found for this period.

@endif @if (isset($overtimeRecords) && $overtimeRecords->count() > 0)
Overtime Records
@foreach ($overtimeRecords as $overtime) @endforeach
Date Start Time End Time Duration Reason
{{ \Carbon\Carbon::parse($overtime->date)->format('d M Y') }} {{ $overtime->check_in ? \Carbon\Carbon::parse($overtime->check_in)->format('H:i') : 'N/A' }} {{ $overtime->check_out ? \Carbon\Carbon::parse($overtime->check_out)->format('H:i') : 'N/A' }} @php $duration = 0; if ($overtime->check_in && $overtime->check_out) { $start = \Carbon\Carbon::parse($overtime->check_in); $end = \Carbon\Carbon::parse($overtime->check_out); $duration = $end->diffInMinutes($start); } @endphp {{ formatMinutes($duration) }} {{ $overtime->description ?? 'No reason provided' }}
@endif @if (isset($fines) && $fines->count() > 0)
Fines & Bonuses
@foreach ($fines as $fine) @endforeach
Date Type Reason Amount
{{ date('d M Y', strtotime($fine->date)) }} @if ($fine->type == 0) Fine @else Bonus @endif {{ $fine->fine_reason }} {{ $fine->type == 0 ? '-' : '+' }}PKR {{ number_format($fine->fine_amount, 0) }}
Net Impact {{ $totalBonuses - $totalFines >= 0 ? '+' : '' }}PKR {{ number_format($totalBonuses - $totalFines, 0) }}
@endif @if (isset($holidays) && $holidays->count() > 0)
Public Holidays
@foreach ($holidays as $holiday) @endforeach
Holiday Name From Date To Date Description
{{ $holiday->name ?? 'Holiday' }} {{ date('d M Y', strtotime($holiday->from)) }} {{ date('d M Y', strtotime($holiday->to)) }} {{ $holiday->description ?? 'Public Holiday' }}
@endif