Electronic Time Card

@foreach ($employees as $employee)
User ID = {{ $employee['employee_no'] }} Name = {{ $employee['personname'] }} ✓ = Excused Date : {{ date('d-m-Y', strtotime($employee['start_date'])) }} - {{ date('d-m-Y', strtotime($employee['end_date'])) }}
@php $rest_day_overtime = 0; $holiday_day_overtime = 0; @endphp @foreach ($employee['att'] as $attData) @if ($attData) @endif @endforeach
Date Day Day Type Sche In Break Resume Out Work Overtime Short Request Leave Taken Remark
{{ date('d-m-Y', strtotime($attData['date'])) ?? null }} {{ date('l', strtotime($attData['date'])) ?? null }} {{ $attData['day_type'] ?? null }} {!! $attData['sche'] ?? null !!} {!! $attData['in_time'] ?? null !!} {!! $attData['break_time'] ?? null !!} {!! $attData['resume_time'] ?? null !!} {!! $attData['out_time'] ?? null !!} {{ $attData['work'] ?? null }} {{ $attData['overtime'] == '00:00' ? null : $attData['overtime'] }} {{ isset($attData['short']) && $attData['short'] !== "00:00" ? $attData['short'] : "" }} {{ isset($attData['ot_approved']) && $attData['ot_approved'] !== "00:00" ? $attData['ot_approved'] : "" }} {{ $attData['leave_taken'] ?? null }} {{ $attData['remark'] ?? null }}
@php $workDays = 0; $flexiDays = 0; $holidays = 0; $holiday = 0; $workDayPresent = 0; $flexiDayPresent = 0; $holidayPresent = 0; $holidayPresents = 0; $workDayHours = 0; $flexiDayHours = 0; $holidayHours = 0; $holidayHour = 0; $workDayOvertimeHours = 0; $flexiOvertimeHours = 0; $holiOvertimeHours = 0; $workDayShortHours = 0; $flexiShortHours = 0; $holiShortHours = 0; @endphp @foreach ($employee['att'] as $attData) @php if (isset($attData['day_type']) && $attData['day_type'] == 'Work') { $workDays += 1; if ((isset($attData['in_time']) && $attData['in_time'] != '00:00' && $attData['in_time'] != null) || $attData['break_time'] || $attData['resume_time'] || $attData['out_time']) { $workDayPresent += 1; } if (isset($attData['work'])) { $workDayHours = second_to_hhmm(explode_time($workDayHours) + explode_time($attData['work'])); $glbSettingType = DB::table('settings') ->where('field', 'workday_round_type') ->first(); $glbSettingMin = DB::table('settings') ->where('field', 'workday_round_min') ->first(); if ($glbSettingType && $glbSettingMin && isset($workDayHours) && $workDayHours != '' && $workDayHours != null && $workDayHours != '00:00') { if ($glbSettingType->value == 'up') { $workDayHours = roundUpNearestMinuteInterval($workDayHours, $glbSettingMin->value); } elseif ($glbSettingType->value == 'down') { $workDayHours = roundDownNearestMinuteInterval($workDayHours, $glbSettingMin->value); } } } if (isset($attData['overtime'])) { $workDayOvertimeHours = second_to_hhmm(explode_time($workDayOvertimeHours) + explode_time($attData['overtime'])); } if (isset($attData['short'])) { $workDayShortHours = second_to_hhmm(explode_time($workDayShortHours) + explode_time($attData['short'])); } } if (isset($attData['day_type']) && $attData['day_type'] == 'Flexi') { $flexiDays += 1; if ((isset($attData['in_time']) && $attData['in_time'] != '00:00' && $attData['in_time'] != null) || $attData['break_time'] || $attData['resume_time'] || $attData['out_time']) { $flexiDayPresent += 1; } if (isset($attData['work'])) { $flexiDayHours = second_to_hhmm(explode_time($flexiDayHours) + explode_time($attData['work'])); } if (isset($attData['overtime'])) { $flexiOvertimeHours = second_to_hhmm(explode_time($flexiOvertimeHours) + explode_time($attData['overtime'])); } if (isset($attData['short'])) { $flexiShortHours = second_to_hhmm(explode_time($flexiShortHours) + explode_time($attData['short'])); } } if ((isset($attData['day_type']) && $attData['day_type'] == 'Rest')) { $holidays += 1; if ((isset($attData['in_time']) && $attData['in_time'] != '00:00' && $attData['in_time'] != null) || $attData['break_time'] || $attData['resume_time'] || $attData['out_time']) { $holidayPresent += 1; } if (isset($attData['work'])) { if(isset($attData['overtime']) && ($attData['overtime']!='') && ($attData['overtime']!='00:00')){ $rest_day_overtime=$rest_day_overtime+abs(explode_time($attData['overtime'])); } $holidayHours = second_to_hhmm(explode_time($holidayHours) + explode_time($attData['work'])); $glbSettingType = DB::table('settings') ->where('field', 'restday_round_type') ->first(); $glbSettingMin = DB::table('settings') ->where('field', 'restday_round_min') ->first(); if ($glbSettingType && $glbSettingMin && isset($holidayHours) && $holidayHours != '' && $holidayHours != null && $holidayHours != '00:00') { if ($glbSettingType->value == 'up') { $holidayHours = roundUpNearestMinuteInterval($holidayHours, $glbSettingMin->value); } elseif ($glbSettingType->value == 'down') { $holidayHours = roundDownNearestMinuteInterval($holidayHours, $glbSettingMin->value); } } } if (isset($attData['overtime'])) { $holiOvertimeHours = second_to_hhmm(explode_time($holiOvertimeHours) + explode_time($attData['overtime'])); } if (isset($attData['short'])) { $holiShortHours = second_to_hhmm(explode_time($holiShortHours) + explode_time($attData['short'])); } } if ((isset($attData['day_type']) && $attData['day_type'] == "Holiday")) { $holiday += 1; if ((isset($attData['in_time']) && $attData['in_time'] != '00:00' && $attData['in_time'] != null) || $attData['break_time'] || $attData['resume_time'] || $attData['out_time']) { $holidayPresents += 1; } if (isset($attData['work'])) { if(isset($attData['overtime']) && ($attData['overtime']!='') && ($attData['overtime']!='00:00')){ $holiday_day_overtime=$holiday_day_overtime+abs(explode_time($attData['overtime'])); } $holidayHour = second_to_hhmm(explode_time($holidayHour) + abs(explode_time($attData['work']))); $glbSettingType = DB::table('settings') ->where('field', 'restday_round_type') ->first(); $glbSettingMin = DB::table('settings') ->where('field', 'restday_round_min') ->first(); if ($glbSettingType && $glbSettingMin && isset($holidayHour) && $holidayHour != '' && $holidayHour != null && $holidayHour != '00:00') { if ($glbSettingType->value == 'up') { $holidayHour = roundUpNearestMinuteInterval($holidayHour, $glbSettingMin->value); } elseif ($glbSettingType->value == 'down') { $holidayHour = roundDownNearestMinuteInterval($holidayHour, $glbSettingMin->value); } } } if (isset($attData['overtime'])) { $holiOvertimeHours = second_to_hhmm(explode_time($holiOvertimeHours) + explode_time($attData['overtime'])); } if (isset($attData['short'])) { $holiShortHours = second_to_hhmm(explode_time($holiShortHours) + explode_time($attData['short'])); } } @endphp @endforeach
Day Type Total Days Present Work Overtime Short
Workday {{ $workDays }} {{ $workDayPresent }} {{ $workDayHours == '00:00' ? 0 : $workDayHours }} {{ $workDayOvertimeHours == '00:00' ? 0 : $workDayOvertimeHours }} {{ $workDayShortHours == '00:00' ? 0 : $workDayShortHours }}
FlexiDay {{ $flexiDays }} {{ $flexiDayPresent }} {{ $flexiDayHours == '00:00' ? 0 : $flexiDayHours }} {{ $flexiOvertimeHours == '00:00' ? 0 : $flexiOvertimeHours }} {{ $flexiShortHours == '00:00' ? 0 : $flexiShortHours }}
RestDay {{ $holidays }} {{ $holidayPresent }} {{ $holidayHours == '00:00' ? 0 : $holidayHours }} {{ second_to_hhmm($rest_day_overtime) == '00:00' ? 0 : second_to_hhmm($rest_day_overtime) }} {{ $holiShortHours == '00:00' ? 0 : $holiShortHours }}
HoliDay {{ $holiday }} {{ $holidayPresents }} {{ $holidayHour == '00:00' ? 0 : $holidayHour }} {{ second_to_hhmm($holiday_day_overtime) == '00:00' ? 0 : second_to_hhmm($holiday_day_overtime) }} {{ $holiShortHours == '00:00' ? 0 : $holiShortHours }}
Total {{ $workDays + $flexiDays + $holidays + $holiday}} {{ $workDayPresent + $flexiDayPresent + $holidayPresent + $holidayPresents}} @php $totalWorkDayHrs = second_to_hhmm(explode_time($workDayHours) + explode_time($flexiDayHours) + explode_time($holidayHours)); @endphp {{ $totalWorkDayHrs == '00:00' ? 0 : $totalWorkDayHrs }} @php $totalWorkDayOvertimeHrs = second_to_hhmm(explode_time($workDayOvertimeHours) + explode_time($flexiOvertimeHours) + explode_time($holiOvertimeHours)); @endphp {{ $totalWorkDayOvertimeHrs == '00:00' ? 0 : $totalWorkDayOvertimeHrs }} @php $totalWorkDayShortHR = second_to_hhmm(explode_time($workDayShortHours) + explode_time($flexiShortHours) + explode_time($holiShortHours)); @endphp {{ $totalWorkDayShortHR == '00:00' ? 0 : $totalWorkDayShortHR }}
@php $leaveCount = 0; @endphp @foreach ($leaveNames as $key => $lv) @if ($key <= 6) @php $leaveType = $lv->type; $leaveName = $lv->name; @endphp @endif @endforeach
Leave Type Total
{{ $leaveName }} @php $leaveList = array_filter($employee['att'], function ($value) use ($leaveType) { if (isset($value['leave_taken'])) { return $leaveType == $value['leave_taken']; } }); $leaveCount += count($leaveList); @endphp {{ count($leaveList) }}
Total {{ $leaveCount }}
@php $leaveCount = 0; @endphp @foreach ($leaveNames as $key => $lv) @if ($key > 6) @php $leaveType = $lv->type; $leaveName = $lv->name; @endphp @endif @endforeach
Leave Type Total
{{ $leaveName }} @php $leaveList = array_filter($employee['att'], function ($value) use ($leaveType) { if (isset($value['leave_taken'])) { return $leaveType == $value['leave_taken']; } }); $leaveCount += count($leaveList); @endphp {{ count($leaveList) }}
Total {{ $leaveCount }}
@endforeach