@extends('app-new') @push('head-script') @endpush @push('content-header') @endpush @section('content')
@foreach ($reportTemplates as $template) @endforeach
Filter
@if (isset($templateId)) @endif
@if ($finalHeaders) @php $groupData = collect($finalHeaders)->groupBy('type'); $grouped = ($templateData->group ?? '0') === '1' ? '1' : '0'; $dayRateComponents = ['basic_salary', 'hra', 'da','sp_allow']; @endphp
{{-- Static employee‐info columns --}} @foreach ($groupData->get('headers', []) as $seq) @php [$key, $a] = explode('...', $seq['value']) + [null, null]; $label = $seq['alias'] ?? ($a ?: $key); @endphp @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 @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 @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) ) @endif @endforeach {{-- Total Day Rate column --}} @endif @foreach ($groupData->get('components', []) as $seq) @php [$key, $a] = explode('...', $seq['value']) + [null, null]; $label = $seq['alias'] ?? ($a ?: $key); @endphp @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 @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'])) @endif @if ( ($templateData->day_rate ?? '0') === '1' && in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly']) && in_array($showCol, $dayRateComponents) ) @endif @if (($templateData->arrear ?? '0') === '1') @endif @endforeach @if (($templateData->day_rate ?? '0') === '1') @endif @endif {{-- Summary fields --}} @foreach ($groupData->get('summary', []) as $seq) @php [$key, $a] = explode('...', $seq['value']) + [null, null]; $label = $seq['alias'] ?? ($a ?: $key); @endphp @endforeach @endforeach @foreach ($employees as $employee) {{-- Static cells --}} @foreach ($groupData->get('headers', []) as $seq) @php $key = explode('...', $seq['value'])[0]; @endphp @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 @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 @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 @endif @endforeach @endif @foreach ($groupData->get('components', []) as $seq) @php $key = explode('...', $seq['value'])[0]; $log = $logs->firstWhere('type_id', $key); @endphp @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 @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'])) @endif @if ( ($templateData->day_rate ?? '0') === '1' && in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly']) && in_array($showCol, $dayRateComponents) ) @php $totalDayRate += $dayRate; @endphp @endif @if (($templateData->arrear ?? '0') === '1') @endif @endforeach @if (($templateData->day_rate ?? '0') === '1') @endif @endif {{-- Summary fields --}} @foreach ($groupData->get('summary', []) as $seq) @php $key = explode('...', $seq['value'])[0]; @endphp @endforeach @endforeach @endforeach
S.No.{{ $label }}{{ $label }}
{{ $pretty }}
{{ $label }} (Month Rate)
{{ $pretty }}
{{ ucfirst($label) }} (Day Rate)
{{ $pretty }}
Total (Day Rate)
{{ $pretty }}
{{ $label }}
{{ $pretty }}
{{ $label }} (Arrear)
{{ $pretty }}
{{ $label }} (Month Rate)
{{ $pretty }}
{{ $label }} (Day Rate)
{{ $pretty }}
{{ $label }}
{{ $pretty }}
{{ $label }} (Arrear)
{{ $pretty }}
Total (Day Rate)
{{ $pretty }}
{{ $label }}
{{ $pretty }}
{{ ($employees->currentPage() - 1) * $employees->perPage() + $loop->iteration }} @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 {{ $type === 'att_summary' ? $attInfo[$key] ?? 0 : $leaveInfo[$key] ?? 0 }} {{ $componentsRate ?? 0 }}{{ number_format($dayRate, 2) }}{{ number_format($totalDayRate, 2) }}{{ optional($log)->calculate_salary ?? 0 }}{{ optional($log)->arrear_salary ?? 0 }}{{ $componentsRate ?? 0 }}{{ number_format($dayRate, 2) }}{{ optional($log)->calculate_salary ?? 0 }}{{ optional($log)->arrear_salary ?? 0 }}{{ number_format($totalDayRate, 2) }}{{ $salaryInfo->{$key} ?? 0 }}
Showing {{ $employees->firstItem() ?? 0 }} to {{ $employees->lastItem() ?? 0 }} from {{ $employees->total() }} records
{{ $employees->appends($request->except('page', 'auth_user', 'auth_type'))->links('pagination::bootstrap-4') }}
@endif
{{-- Sequence modal --}}
@endsection @push('footer-script') @endpush