@extends('layouts.dashboard.superadminapp') @section('title', 'Employee Daily Attendance') @section('styles') @endsection @section('content')

UEPL / Employee Daily Attendance

Attendance Records
@php // Helper for converting decimal hours to HH:MM function decimalToHoursMinutes($decimal) { $h = floor($decimal); $m = round(($decimal - $h) * 60); return sprintf('%02d:%02d', $h, $m); } @endphp @foreach ($data as $row) @php // Parse times $checkIn = $row->check_in ? \Carbon\Carbon::parse($row->check_in) : null; $breakOut = $row->break_out ? \Carbon\Carbon::parse($row->break_out) : null; $breakIn = $row->break_in ? \Carbon\Carbon::parse($row->break_in) : null; $checkOut = $row->check_out ? \Carbon\Carbon::parse($row->check_out) : null; // Calculate total work duration (excluding break) $workDuration = null; $workHours = 0; if ($checkIn && $checkOut) { $total = $checkIn->diffInMinutes($checkOut); $break = ($breakIn && $breakOut) ? $breakOut->diffInMinutes($breakIn) : 0; $workMinutes = max(0, $total - $break); $workHours = round($workMinutes / 60, 2); $workDuration = sprintf('%02d:%02d', intdiv($workMinutes, 60), $workMinutes % 60); } // Calculate OT & Shortage $ot = $workHours > 9 ? round($workHours - 9, 2) : 0; $shortage = $workHours < 9 ? round(9 - $workHours, 2) : 0; @endphp @endforeach
Date Employee ID Employee Name Check In Break Out Break In Check Out Working Hours OT (hrs) Shortage (hrs)
{{ \Carbon\Carbon::parse($row->date)->format('d-m-Y') }} {{ $row->employee_id }} {{ $row->employee_name }} {{ $row->check_in }} {{ $row->break_out }} {{ $row->break_in }} {{ $row->check_out }} {{ $workDuration ?? '-' }} @if ($ot > 0) {{ decimalToHoursMinutes($ot) }} @else 00:00 @endif @if ($shortage > 0) {{ decimalToHoursMinutes($shortage) }} @else 00:00 @endif
@endsection @section('scripts') @endsection