@extends('app-new') @push('head-script') @endpush @push('content-header')
@endpush @section('content')| S.No. | {{-- Static employee‐info columns --}} @foreach ($groupData->get('headers', []) as $seq) @php [$key, $a] = explode('...', $seq['value']) + [null, null]; $label = $seq['alias'] ?? ($a ?: $key); @endphp{{ $label }} | @endforeach {{-- Dynamic per-month columns --}} @foreach ($monthData as $md) @php $pretty = \App\Helpers\GeneralHelper::formatDate($md); @endphp {{-- Attendance & Leave Types --}} @foreach (['att_summary', 'leave_types'] as $type) @foreach ($groupData->get($type, []) as $seq) @php [$key, $a] = explode('...', $seq['value']) + [null, null]; $label = $seq['alias'] ?? ($a ?: $key); @endphp{{ $label }} {{ $pretty }} |
@endforeach
@endforeach
{{-- Components & Rates/Arrears --}}
@if ($grouped)
{{-- Grouped format: all rates, then calculates, then arrears --}}
@if (($templateData->rate ?? '0') === '1')
@foreach ($groupData->get('components', []) as $seq)
@if (in_array($seq['calculationType'] ?? '',['PaidDays', 'Hourly']))
@php
[$key, $a] = explode('...', $seq['value']) + [
null,
null,
];
$label = $seq['alias'] ?? ($a ?: $key);
@endphp
{{ $label }} (Month Rate) {{ $pretty }} |
@endif
@endforeach
@endif
@if (($templateData->day_rate ?? '0') === '1')
@foreach ($groupData->get('components', []) as $seq)
@php
[$key, $a] = explode('...', $seq['value']) + [null, null];
$label = $seq['alias'] ?? ($a ?: $key);
$showCol = strtolower($componentAliases[$label] ?? $label);
@endphp
@if (
in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly']) &&
in_array($showCol, $dayRateComponents)
)
{{ ucfirst($label) }} (Day Rate) {{ $pretty }} |
@endif
@endforeach
{{-- Total Day Rate column --}}
Total (Day Rate) {{ $pretty }} |
@endif
@foreach ($groupData->get('components', []) as $seq)
@php
[$key, $a] = explode('...', $seq['value']) + [null, null];
$label = $seq['alias'] ?? ($a ?: $key);
@endphp
{{ $label }} {{ $pretty }} |
@endforeach
@if (($templateData->arrear ?? '0') === '1')
@foreach ($groupData->get('components', []) as $seq)
@php
[$key, $a] = explode('...', $seq['value']) + [
null,
null,
];
$label = $seq['alias'] ?? ($a ?: $key);
@endphp
{{ $label }} (Arrear) {{ $pretty }} |
@endforeach
@endif
@else
{{-- Ungrouped: Rate → Calc → Arrear per component --}}
@foreach ($groupData->get('components', []) as $seq)
@php
[$key, $a] = explode('...', $seq['value']) + [null, null];
$label = $seq['alias'] ?? ($a ?: $key);
$showCol = strtolower($componentAliases[$label] ?? $label);
@endphp
@if (($templateData->rate ?? '0') === '1' && in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly']))
{{ $label }} (Month Rate) {{ $pretty }} |
@endif
@if (
($templateData->day_rate ?? '0') === '1' &&
in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly']) &&
in_array($showCol, $dayRateComponents)
)
{{ $label }} (Day Rate) {{ $pretty }} |
@endif
{{ $label }} {{ $pretty }} |
@if (($templateData->arrear ?? '0') === '1')
{{ $label }} (Arrear) {{ $pretty }} |
@endif
@endforeach
@if (($templateData->day_rate ?? '0') === '1')
Total (Day Rate) {{ $pretty }} |
@endif
@endif
{{-- Summary fields --}}
@foreach ($groupData->get('summary', []) as $seq)
@php
[$key, $a] = explode('...', $seq['value']) + [null, null];
$label = $seq['alias'] ?? ($a ?: $key);
@endphp
{{ $label }} {{ $pretty }} |
@endforeach
@endforeach
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ ($employees->currentPage() - 1) * $employees->perPage() + $loop->iteration }} | {{-- Static cells --}} @foreach ($groupData->get('headers', []) as $seq) @php $key = explode('...', $seq['value'])[0]; @endphp@if (in_array($key, ['department' ,'subDepartment','designation', 'workstation', 'category', 'grade', 'contractor', 'state', 'shift'], true)) {{ optional($employee->{$key})->name }} @elseif ($key === 'locations') {{ $employee->locations->pluck('name')->implode(', ') }} @else {{ ucwords($employee->{$key} ?? '') }} @endif | @endforeach {{-- Dynamic rows --}} @foreach ($monthData as $md) @php $items = $employee->items[$md] ?? []; $salaryInfo = $items['salary_info'] ?? null; $logs = $salaryInfo && $salaryInfo->slipLogs ? $salaryInfo->slipLogs : collect(); $attInfo = $items['attendance_info'] ?? []; $leaveInfo = $items['leave_info'] ?? []; @endphp {{-- Attendance & Leave --}} @foreach (['att_summary', 'leave_types'] as $type) @foreach ($groupData->get($type, []) as $seq) @php $key = explode('...', $seq['value'])[0]; @endphp{{ $type === 'att_summary' ? $attInfo[$key] ?? 0 : $leaveInfo[$key] ?? 0 }} | @endforeach @endforeach {{-- Components & Rates/Arrears --}} @if ($grouped) @if (($templateData->rate ?? '0') === '1') @foreach ($groupData->get('components', []) as $seq) @if (in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly'])) @php $key = explode('...', $seq['value'])[0]; $log = $logs->firstWhere('type_id', $key); $componentsRate = optional($log)->actual_salary; if ($hourlyRateDisplay) { $componentsRate = optional($log)->value_data_type === 'Percentage' ? optional($log)->actual_salary / $hourlyRateDisplay : optional($log)->value_data; } @endphp{{ $componentsRate ?? 0 }} | @endif @endforeach @endif @if (($templateData->day_rate ?? '0') === '1') @php $totalDayRate = 0; @endphp @foreach ($groupData->get('components', []) as $seq) @php [$key, $a] = explode('...', $seq['value']) + [null, null]; $label = $seq['alias'] ?? ($a ?: $key); $showCol = strtolower($componentAliases[$label] ?? $label); @endphp @if ( in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly']) && in_array($showCol, $dayRateComponents) ) @php $log = $logs->firstWhere('type_id', $key); $monthRate = optional($log)->actual_salary ?? 0; if ($hourlyRateDisplay) { $monthRate = optional($log)->value_data_type === 'Percentage' ? optional($log)->actual_salary / $hourlyRateDisplay : optional($log)->value_data; } $dayRate = $monthRate > 0 ? $monthRate / $maxPayDays : 0; $totalDayRate += $dayRate; @endphp{{ number_format($dayRate, 2) }} | @endif @endforeach{{ number_format($totalDayRate, 2) }} | @endif @foreach ($groupData->get('components', []) as $seq) @php $key = explode('...', $seq['value'])[0]; $log = $logs->firstWhere('type_id', $key); @endphp{{ optional($log)->calculate_salary ?? 0 }} | @endforeach @if (($templateData->arrear ?? '0') === '1') @foreach ($groupData->get('components', []) as $seq) @php $key = explode('...', $seq['value'])[0]; $log = $logs->firstWhere('type_id', $key); @endphp{{ optional($log)->arrear_salary ?? 0 }} | @endforeach @endif @else @php $totalDayRate = 0; @endphp @foreach ($groupData->get('components', []) as $seq) @php [$key, $a] = explode('...', $seq['value']) + [null, null]; $label = $seq['alias'] ?? ($a ?: $key); $showCol = strtolower($componentAliases[$label] ?? $label); $log = $logs->firstWhere('type_id', $key); $componentsRate = optional($log)->actual_salary; if ($hourlyRateDisplay) { $componentsRate = optional($log)->value_data_type === 'Percentage' ? optional($log)->actual_salary / $hourlyRateDisplay : optional($log)->value_data; } $dayRate = $componentsRate > 0 ? $componentsRate / $maxPayDays : 0; @endphp @if (($templateData->rate ?? '0') === '1' && in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly'])){{ $componentsRate ?? 0 }} | @endif @if ( ($templateData->day_rate ?? '0') === '1' && in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly']) && in_array($showCol, $dayRateComponents) ) @php $totalDayRate += $dayRate; @endphp{{ number_format($dayRate, 2) }} | @endif{{ optional($log)->calculate_salary ?? 0 }} | @if (($templateData->arrear ?? '0') === '1'){{ optional($log)->arrear_salary ?? 0 }} | @endif @endforeach @if (($templateData->day_rate ?? '0') === '1'){{ number_format($totalDayRate, 2) }} | @endif @endif {{-- Summary fields --}} @foreach ($groupData->get('summary', []) as $seq) @php $key = explode('...', $seq['value'])[0]; @endphp{{ $salaryInfo->{$key} ?? 0 }} | @endforeach @endforeach