@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 }} (Rate) {{ $pretty }} |
@endif
@endforeach
@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);
@endphp
@if (($templateData->rate ?? '0') === '1' && in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly']))
{{ $label }} (Rate) {{ $pretty }} |
@endif
{{ $label }} {{ $pretty }} |
@if (($templateData->arrear ?? '0') === '1')
{{ $label }} (Arrear) {{ $pretty }} |
@endif
@endforeach
@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', '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{{ round($componentsRate ?? 0, 4) }} | @endif @endforeach @endif @foreach ($groupData->get('components', []) as $seq) @php $key = explode('...', $seq['value'])[0]; $log = $logs->firstWhere('type_id', $key); $calculatedSalaryAmount = round(optional($log)->calculate_salary ?? 0, 4); // Override for PaidDays calculation if (in_array($seq['calculationType'] ?? '', ['PaidDays'])) { $calculatedSalaryAmount = round(optional($log)->calculate_salary ?? 0); } @endphp{{ $calculatedSalaryAmount }} | @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 @foreach ($groupData->get('components', []) as $seq) @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; } $calculatedSalaryAmount = round(optional($log)->calculate_salary ?? 0, 4); // Override for PaidDays calculation if (in_array($seq['calculationType'] ?? '', ['PaidDays'])) { $calculatedSalaryAmount = round(optional($log)->calculate_salary ?? 0); } @endphp @if (($templateData->rate ?? '0') === '1' && in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly'])){{ round($componentsRate ?? 0, 4) }} | @endif{{ $calculatedSalaryAmount }} | @if (($templateData->arrear ?? '0') === '1'){{ optional($log)->arrear_salary ?? 0 }} | @endif @endforeach @endif {{-- Summary fields --}} @foreach ($groupData->get('summary', []) as $seq) @php $key = explode('...', $seq['value'])[0]; $value = $salaryInfo->{$key} ?? 0; if($key=='total_gross'){ $value += $salaryInfo->total_earning_arrear ?? 0; } if ($loop->remaining < 3){ $value = round($value); } @endphp{{ $value }} | @endforeach @endforeach