@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'; @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 @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); @endphp @if (($templateData->rate ?? '0') === '1' && in_array($seq['calculationType'] ?? '', ['PaidDays', 'Hourly'])) @endif @if (($templateData->arrear ?? '0') === '1') @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 @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 @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 @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 @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'])) @endif @if (($templateData->arrear ?? '0') === '1') @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 @endforeach @endforeach @endforeach
S.No.{{ $label }}{{ $label }}
{{ $pretty }}
{{ $label }} (Rate)
{{ $pretty }}
{{ $label }}
{{ $pretty }}
{{ $label }} (Arrear)
{{ $pretty }}
{{ $label }} (Rate)
{{ $pretty }}
{{ $label }}
{{ $pretty }}
{{ $label }} (Arrear)
{{ $pretty }}
{{ $label }}
{{ $pretty }}
{{ ($employees->currentPage() - 1) * $employees->perPage() + $loop->iteration }} @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 {{ $type === 'att_summary' ? $attInfo[$key] ?? 0 : $leaveInfo[$key] ?? 0 }} {{ round($componentsRate ?? 0, 4) }}{{ $calculatedSalaryAmount }}{{ optional($log)->arrear_salary ?? 0 }}{{ round($componentsRate ?? 0, 4) }}{{ $calculatedSalaryAmount }}{{ optional($log)->arrear_salary ?? 0 }}{{ $value }}
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