@php $totalPayDays = 0; $totalNetSalary = 0; $totalEarningDerived = []; $dateWiseTotalPresent = []; foreach ($dateList as $date) { $dateWiseTotalPresent[$date] = 0; } $totalDeductionDerived = []; $totalEarningDerivedTotal = 0; $totalDeductionDerivedTotal = 0; @endphp
@php $totalCol = 28 + count($earningDerivedComponents) + count($deductionDerivedComponents); @endphp @foreach ($earningDerivedComponents as $component) @endforeach @foreach ($deductionDerivedComponents as $component) @endforeach @php $counter = 0; @endphp @for ($i = 0; $i <= 30; $i++) @if ($counter == 10 || $counter == 20) @endif @php $counter++; @endphp @endfor @if (count($dateList) < 31) @endif @for ($i = 0; $i < $totalCol; $i++) @endfor @foreach ($employees as $index => $employee) @php $counter = 0; $dayCount = 0; $attendanceSummary = $employee->attendanceSummary ->pluck('status', 'attendance_date') ->toArray(); $attendanceDayCount = $employee->attendanceSummary ->pluck('day_count', 'attendance_date') ->toArray(); @endphp @for ($i = 0; $i < 31; $i++) @if ($counter == 10 || $counter == 20) @endif @php $counter++; if (isset($attendanceSummary[$dateList[$i]]) && isset($attendanceDayCount[$dateList[$i]])) { $dateWiseTotalPresent[$dateList[$i]] += $attendanceDayCount[$dateList[$i]]; $dayCount += $attendanceDayCount[$dateList[$i]]; } @endphp @endfor @php $slipLogs = []; $ctc = isset($employee->salarySlip->ctc_for_month) && $employee->salarySlip->ctc_for_month ? $employee->salarySlip->ctc_for_month : 0; $totalPayDays += $dayCount; if ( isset($employee->salarySlip->slipLogs) && !empty($employee->salarySlip->slipLogs) ) { $slipLogs = $employee->salarySlip->slipLogs->pluck( 'calculate_salary', 'type_id', ); } @endphp @php $earningDerivedTotal = 0; $totalEarningDerived = []; $totalDeductionDerived = []; @endphp @foreach ($earningDerivedComponents as $component) @php $earningDerived = isset($slipLogs[$component->id]) && $slipLogs[$component->id] ? $slipLogs[$component->id] : 0; $earningDerivedTotalArr[$component->id] = ($earningDerivedTotalArr[$component->id] ?? 0) + $earningDerived; $earningDerivedTotal += $earningDerived; @endphp @endforeach @php $deductionDerivedTotal = 0; @endphp @foreach ($deductionDerivedComponents as $component) @php $deductionDerived = isset($slipLogs[$component->id]) && $slipLogs[$component->id] ? $slipLogs[$component->id] : 0; $deductionDerivedTotalArr[$component->id] = ($deductionDerivedTotalArr[$component->id] ?? 0) + $deductionDerived; $deductionDerivedTotal += $deductionDerived; @endphp @endforeach @php $totalEarningDerivedTotal += $earningDerivedTotal; $totalDeductionDerivedTotal += $deductionDerivedTotal; $netSalary = $employee->salarySlip->net_salary ?? 0; $totalNetSalary += $netSalary; @endphp @endforeach @php $counter = 0; @endphp @for ($i = 0; $i <= 30; $i++) @if ($counter == 10 || $counter == 20) @endif @php $counter++; @endphp @endfor @foreach ($earningDerivedComponents as $component) @endforeach @foreach ($deductionDerivedComponents as $component) @endforeach