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

UEPL | Employee Daily Attendance

day, 00 month 0000
@if(session('success')) @endif @if(session('error')) @endif
Attendance Records
@php function decimalToHoursMinutes($decimal) { $h = floor($decimal); $m = round(($decimal - $h) * 60); return sprintf('%02d:%02d', $h, $m); } @endphp @foreach($data as $row) @php $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; $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); } $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 ?? '-' }} @if($workDuration) {{ $workDuration }} @else - @endif @if($ot > 0) {{ decimalToHoursMinutes($ot) }} @else 00:00 @endif @if($shortage > 0) {{ decimalToHoursMinutes($shortage) }} @else 00:00 @endif
@endsection @section('scripts') @endsection