@extends('layouts.app') @section('title','Payslip') @section('page-title','Payroll') @section('content') @php $bd = $record->components_breakdown ?? []; $att = $bd['attendance'] ?? []; $earnings = $bd['earnings'] ?? []; $deds = $bd['deductions'] ?? []; $summary = $bd['summary'] ?? []; $cfg = $bd['configuration'] ?? []; $currency = $cfg['currency'] ?? $record->currency ?? 'USD'; $basis = $cfg['salary_basis'] ?? 'monthly'; $hasSecondary = !empty($summary['net_pay_secondary']) && $summary['net_pay_secondary'] != ($summary['net_pay'] ?? 0); @endphp
{{-- ── Header ── --}}
{{ config('hrms.company','My Company') }}
{{ config('hrms.hr_dept','Human Resources') }}
@if(!empty($cfg['country']))
{{ $cfg['country'] }} · {{ ucfirst($basis) }} basis
@endif
PAYSLIP
{{ $record->period->name }}
{{ $record->period->start_date->format('M j') }} — {{ $record->period->end_date->format('M j, Y') }}
Employee
{{ $record->employee?->full_name ?? '—' }}
Employee No.
{{ $record->employee?->employee_number ?? '—' }}
Position
{{ $record->employee?->position ?? '—' }}
Department
{{ $record->employee?->department?->name ?? '—' }}
{{-- ── Attendance Summary ── --}} @if(!empty($att))
Attendance Summary
{{ number_format($att['days_present'] ?? 0, 1) }}
Present
{{ number_format($att['days_on_leave'] ?? 0, 1) }}
On Leave
{{ number_format($att['days_absent'] ?? 0, 1) }}
Absent
{{ number_format($att['expected_days'] ?? 0) }}
Expected
@if($basis !== 'daily')
{{ number_format($att['hours_worked'] ?? 0, 1) }}
Hours
@endif
@if(!($att['has_records'] ?? true)) @php $attMode = $att['attendance_mode'] ?? 'required'; @endphp @if($attMode === 'not_required')
Clock-in not required — full salary paid.
@else
No attendance records found — full period assumed.
@endif @endif @if($basis === 'monthly' && isset($att['daily_rate']))
Daily rate: {{ $currency }} {{ number_format($att['daily_rate'], 4) }} · Paid days: {{ number_format($att['paid_days'] ?? 0, 1) }} / {{ $att['expected_days'] ?? '—' }} @if(isset($att['absence_deduction']) && $att['absence_deduction'] > 0) · Absence deduction: {{ $currency }} {{ number_format($att['absence_deduction'], 2) }} @endif
@elseif($basis === 'hourly' && isset($att['hourly_rate']))
Hourly rate: {{ $currency }} {{ number_format($att['hourly_rate'], 4) }} · {{ number_format($att['hours_worked'] ?? 0, 2) }} hours worked
@elseif($basis === 'daily' && isset($att['daily_rate']))
Daily rate: {{ $currency }} {{ number_format($att['daily_rate'], 4) }} · {{ number_format($att['paid_days'] ?? 0, 1) }} paid days
@endif
@endif {{-- ── Earnings & Deductions ── --}}
Earnings
@foreach($earnings as $line)
{{ $line['name'] }} @if(!($line['is_taxable'] ?? true)) (non-taxable) @endif {{ $currency }} {{ number_format($line['amount'],2) }}
@endforeach
Gross Pay {{ $currency }} {{ number_format($summary['gross_pay'] ?? $record->gross_pay, 2) }}
Deductions
@foreach($deds as $line)
{{ $line['name'] }} - {{ $currency }} {{ number_format($line['amount'],2) }}
@endforeach
Total Deductions - {{ $currency }} {{ number_format($summary['total_deductions'] ?? $record->total_deductions, 2) }}
{{-- ── Net Pay ── --}}
Net Pay ({{ $currency }})
{{ $currency }} {{ number_format($summary['net_pay'] ?? $record->net_pay, 2) }}
@if($hasSecondary)
Equivalent
{{ $record->configuration?->secondary_currency_code ?? '' }} {{ number_format($summary['net_pay_secondary'],2) }}
@endif
Computer-generated payslip — no signature required  ·  Payment date: {{ $record->period->payment_date->format('F j, Y') }}
@push('styles') @endpush @endsection