@php use Carbon\CarbonPeriod; $period = CarbonPeriod::create($monthStart, $monthEnd); @endphp @php $period->rewind(); @endphp @foreach ($period as $date) @php $isSunday = $date->isSunday(); $bg = $isSunday ? '#fee2e2' : '#f3f4f6'; @endphp @endforeach @php $period->rewind(); @endphp @foreach ($employees as $emp) @php $rowPeriod = CarbonPeriod::create($monthStart, $monthEnd); @endphp @foreach ($rowPeriod as $day) @php $dayStr = $day->toDateString(); $entry = $data[$emp->id][$dayStr] ?? null; @endphp @endforeach @endforeach {{-- Grand totals row --}} @php $footerPeriod = CarbonPeriod::create($monthStart, $monthEnd); @endphp @foreach ($footerPeriod as $day) @php $dayStr = $day->toDateString(); $colTotal = $dayTotals[$dayStr] ?? 0; @endphp @endforeach
Employee Master – {{ $currentMonthLabel }}
Employee Total (₹) {{ $date->format('d') }} ({{ $date->format('D') }})
{{ $emp->name }} {{ number_format($totals[$emp->id] ?? 0, 2) }} @if ($entry) {{ (int) $entry['amount'] }} @if (!empty($entry['is_return'])) (R*) @endif @endif
Total {{ number_format($grandTotal ?? 0, 2) }} @if ($colTotal > 0) {{ (int) $colTotal }} @endif