@extends('layouts.app') @section('content')

Payroll Details

{{ $company->name }} - {{ $payroll->payroll_period }}

@can('manage-payroll', $company) @if($payroll->status !== 'paid') Edit @endif @endcan Back to Payroll
Employee Information
Employee:
{{ $payroll->employee->full_name ?? $payroll->employee->first_name . ' ' . $payroll->employee->last_name }}
Employee ID:
{{ $payroll->employee->employee_id }}
Department:
{{ $payroll->employee->department }}
Position:
{{ $payroll->employee->position }}
Period:
{{ $payroll->payroll_period }}
Pay Date:
{{ $payroll->pay_date->format('d M Y') }}
Period:
{{ $payroll->period_start->format('d M Y') }} - {{ $payroll->period_end->format('d M Y') }}
Status:
@if($payroll->status === 'paid') Paid @elseif($payroll->status === 'processed') Processed @else Draft @endif
Basic Earnings
Base Salary
RM {{ number_format($payroll->base_salary, 2) }}
Worked Months
{{ $payroll->worked_months ?? 1 }} month(s)
@php $additions = $payroll->lineItems->where('type.type', 'addition'); // Filter out zero amount additions $nonZeroAdditions = $additions->filter(function($item) { return $item->amount > 0; }); @endphp @if($nonZeroAdditions->count() > 0)
Additional Earnings
@foreach($nonZeroAdditions as $addition) @endforeach
Type EA Fields Amount Notes
{{ $addition->type->name }} @if($addition->type->ea_fields) {{ $addition->type->ea_fields }} @else - @endif RM {{ number_format($addition->amount, 2) }} {{ $addition->notes ?: '-' }}
Total Additional Earnings RM {{ number_format($nonZeroAdditions->sum('amount'), 2) }}
@endif @php $deductions = $payroll->lineItems->where('type.type', 'deduction'); $statutoryDeductions = $deductions->where('type.category', 'statutory'); $customDeductions = $deductions->where('type.category', 'custom'); // Filter out zero amount deductions $nonZeroDeductions = $deductions->filter(function($item) { return $item->amount > 0; }); @endphp @if($nonZeroDeductions->count() > 0)
Deductions
@if($statutoryDeductions->count() > 0)
Statutory Deductions
@foreach($statutoryDeductions as $deduction) @endforeach
Type Rate/Method Employee Employer Notes
{{ $deduction->type->name }} @if($deduction->type->name === 'EPF') {{ $payroll->employee->employee_epf_rate ?? 11 }}% @elseif($deduction->type->name === 'SOCSO') Table Rate @elseif($deduction->type->name === 'EIS') 0.2% @else PCB @endif RM {{ number_format($deduction->amount, 2) }} @if($deduction->type->name === 'EPF') RM {{ number_format($deduction->amount * 12/11, 2) }} @elseif($deduction->type->name === 'SOCSO') RM {{ number_format($deduction->amount * 1.75, 2) }} @elseif($deduction->type->name === 'EIS') RM {{ number_format($deduction->amount, 2) }} @else - @endif {{ $deduction->notes ?: 'Auto-calculated' }}
@endif @if($customDeductions->count() > 0)
Other Deductions
@foreach($customDeductions as $deduction) @endforeach
Type Amount Notes
{{ $deduction->type->name }} RM {{ number_format($deduction->amount, 2) }} {{ $deduction->notes ?: '-' }}
@endif
Total Deductions
RM {{ number_format($deductions->sum('amount'), 2) }}
@endif @if($payroll->notes)
Notes

{{ $payroll->notes }}

@endif
Pay Summary
Base Salary
RM {{ number_format($payroll->base_salary, 2) }}
@if($nonZeroAdditions->count() > 0)
Additional earnings
@foreach($nonZeroAdditions as $addition)
{{ $addition->type->name }}
RM {{ number_format($addition->amount, 2) }}
@endforeach @endif
Gross Pay
RM {{ number_format($payroll->gross_pay, 2) }}
@if($nonZeroDeductions->count() > 0)
Deductions
@foreach($nonZeroDeductions as $deduction)
{{ $deduction->type->name }}
RM {{ number_format($deduction->amount, 2) }}
@endforeach @endif
Net Pay
RM {{ number_format($payroll->net_pay, 2) }}
@php $companyEPF = $statutoryDeductions->where('type.name', 'EPF')->first(); $companySocso = $statutoryDeductions->where('type.name', 'SOCSO')->first(); $companyEIS = $statutoryDeductions->where('type.name', 'EIS')->first(); $totalCompanyContribution = 0; if ($companyEPF) $totalCompanyContribution += ($companyEPF->amount * 12/11); if ($companySocso) $totalCompanyContribution += ($companySocso->amount * 1.75); if ($companyEIS) $totalCompanyContribution += $companyEIS->amount; @endphp @if($totalCompanyContribution > 0)
Company Contribution
RM {{ number_format($totalCompanyContribution, 2) }}
@endif
@can('manage-payroll', $company) @if($payroll->status === 'draft')
@csrf
@elseif($payroll->status === 'processed')
@csrf
@endif @endcan View Payslip
Audit Information
Created:
{{ $payroll->created_at->format('d M Y H:i') }}
Updated:
{{ $payroll->updated_at->format('d M Y H:i') }}
Payroll ID:
#{{ $payroll->id }}
@push('styles') @endpush @endsection