@php if (!function_exists('complianceRegisterExcelFormatTime')) { function complianceRegisterExcelFormatTime($time) { return $time && $time != '00:00:00' ? date('H:i', strtotime($time)) : '-'; } } if (!function_exists('complianceRegisterExcelFormatHours')) { function complianceRegisterExcelFormatHours($time) { return $time && $time != '00:00:00' ? substr($time, 0, 5) : '-'; } } $dayColumnCount = count($dateArr); $summaryColumns = ['WO', 'HD', 'EL', 'CL', 'SL', 'OL']; $totalColumns = 1 + $dayColumnCount + count($summaryColumns); $orgAddressParts = []; if ($organization->address) { foreach (['line_1', 'line_2', 'line_3', 'postal_code'] as $addressField) { if (!empty($organization->address->{$addressField})) { $orgAddressParts[] = $organization->address->{$addressField}; } } } // Palette $bandDark = 'background-color:#2F5597;color:#FFFFFF;'; $bandLight = 'background-color:#D9E2F3;color:#1F3864;'; $headerFill = 'background-color:#BDD7EE;'; $labelFill = 'background-color:#DDEBF7;'; $empBandFill = 'background-color:#F2F2F2;'; $summaryFill = 'background-color:#E2EFDA;'; $weekOffFill = 'background-color:#FFF2CC;'; $holidayFill = 'background-color:#FCE4D6;'; $border = 'border:1px solid #B7B7B7;'; @endphp @if (!empty($orgAddressParts)) @endif {{-- Column header --}} @foreach ($dateArr as $date) @endforeach @foreach ($summaryColumns as $summaryLabel) @endforeach @foreach ($dateArr as $date) @endforeach @foreach ($employeeSummary as $employee) @php $atSummary = $employee->registerAttSummary; $woHo = $employee->woHoCounts; $leaveCounts = $employee->registerLeaveCounts; $summaryValues = [ @$woHo['total_week_off'] ?: 0, @$woHo['total_holiday'] ?: 0, @$leaveCounts['EL'] ?: 0, @$leaveCounts['CL'] ?: 0, @$leaveCounts['SL'] ?: 0, @$leaveCounts['OL'] ?: 0, ]; @endphp {{-- Employee identity band --}} {{-- 1. In Time --}} @foreach ($dateArr as $date) @php $a = $atSummary[$date] ?? null; $isWeekOff = $a && $a->on_duty == 2; $isHoliday = $a && $a->on_duty == 3 && $a->is_week_off == 0; $hideTime = $isWeekOff || $isHoliday; $cellFill = $isWeekOff ? $weekOffFill : ($isHoliday ? $holidayFill : ''); @endphp @endforeach @foreach ($summaryColumns as $index => $summaryLabel) @endforeach {{-- 2. Out Time --}} @foreach ($dateArr as $date) @php $a = $atSummary[$date] ?? null; $isWeekOff = $a && $a->on_duty == 2; $isHoliday = $a && $a->on_duty == 3 && $a->is_week_off == 0; $hideTime = $isWeekOff || $isHoliday; $cellFill = $isWeekOff ? $weekOffFill : ($isHoliday ? $holidayFill : ''); $outTime = $a ? ($a->fact_out_time ?: $a->out_time) : null; @endphp @endforeach {{-- 3. Total Working Hours --}} @foreach ($dateArr as $date) @php $a = $atSummary[$date] ?? null; $isWeekOff = $a && $a->on_duty == 2; $isHoliday = $a && $a->on_duty == 3 && $a->is_week_off == 0; $hideTime = $isWeekOff || $isHoliday; $cellFill = $isWeekOff ? $weekOffFill : ($isHoliday ? $holidayFill : ''); @endphp @endforeach {{-- 4. Attendance Status --}} @foreach ($dateArr as $date) @php $a = $atSummary[$date] ?? null; $statusLabel = '-'; $isWeekOff = false; $isHoliday = false; if ($a) { if ($a->on_duty == 2) { $statusLabel = 'WO'; $isWeekOff = true; } elseif ($a->on_duty == 3 && $a->is_week_off == 0) { $statusLabel = 'H'; $isHoliday = true; } else { $statusLabel = $a->status ?: '-'; } } $cellFill = $isWeekOff ? $weekOffFill : ($isHoliday ? $holidayFill : ''); @endphp @endforeach {{-- Spacer / divider between employees --}} @endforeach
{{ $organization->name }}
{{ implode(', ', $orgAddressParts) }}
Attendance Register for the month of {{ $monthYearLabel }}
 
  {{ date('d', strtotime($date)) }} {{ $summaryLabel }}
{{ date('D', strtotime($date)) }}
PayCode: {{ $employee->employee_code }}   |   Cardno: {{ $employee->card_no ?: $employee->employee_code }}   |   Name: {{ $employee->name }}   |   Shift: {{ @$employee->shift->name }}   |   Desig: {{ @$employee->designation->name }}   |   Paid Days: {{ @$employee->vwAttendanceSummary->total_pay_days }}   |   Present Days: {{ @$employee->vwAttendanceSummary->total_present }}
In Time {{ $a && !$hideTime ? complianceRegisterExcelFormatTime($a->in_time) : '-' }} {{ $summaryValues[$index] }}
Out Time {{ $a && !$hideTime ? complianceRegisterExcelFormatTime($outTime) : '-' }}
Work Hrs {{ $a && !$hideTime ? complianceRegisterExcelFormatHours($a->fact_working_hour) : '-' }}
Status {{ $statusLabel }}