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

{{ $employee->full_name ?? ($employee->first_name . ' ' . $employee->last_name) }}

{{ $employee->job_title ?? '' }} — {{ __('payroll.payroll_year', ['year' => $year]) }}

{{ __('employee.contractType') }}
{{ __('employee.contract_' . ($employee->contract_type ?? 'full_time')) }}
{{ __('employee.baseSalary') }}
{{ number_format($employee->base_salary ?? 0) }}
{{ __('employee.hireDate') }}
{{ $employee->hire_date ? calendar_date($employee->hire_date) : '-' }}
{{ __('employee.status') }}
{{ __('employee.status_' . $employee->status) }}
{{ __('payroll.total_gross') }}
{{ number_format($yearlyGross) }}
{{ __('payroll.total_deductions') }}
{{ number_format($yearlyDeductions + $yearlyAdvances) }}
{{ __('payroll.total_net') }}
{{ number_format($yearlyNet) }}
{{ __('payroll.total_paid') }}
{{ number_format($yearlyPaid) }}
{{ __('payroll.total_unpaid') }}
{{ number_format($yearlyUnpaid) }}
@foreach(range(1, 12) as $m) @isset($financials[$m])

{{ $persianMonths[$m] ?? $m }}

@php $monthFinancials = $financials[$m]; $monthGross = $monthFinancials->whereIn('type', ['salary', 'overtime', 'bonus', 'allowance'])->sum('amount'); $monthDeductions = $monthFinancials->where('type', 'deduction')->sum('amount'); $monthAdvances = $monthFinancials->where('type', 'advance')->sum('amount'); $monthNet = $monthGross - $monthDeductions - $monthAdvances; $monthPaid = $monthFinancials->where('is_paid', true)->whereIn('type', ['salary', 'overtime', 'bonus', 'allowance'])->sum('amount'); @endphp
{{ __('payroll.total_gross') }}: {{ number_format($monthGross) }} {{ __('payroll.total_deductions') }}: {{ number_format($monthDeductions + $monthAdvances) }} {{ __('payroll.total_net') }}: {{ number_format($monthNet) }} @if($monthPaid < $monthGross) {{ __('payroll.unpaid') }}: {{ number_format($monthGross - $monthPaid) }} @endif
@foreach($monthFinancials as $f) @endforeach
{{ __('payroll.type_' . $f->type) }} {{ in_array($f->type, ['deduction', 'advance']) ? '-' : '' }}{{ number_format($f->amount) }} {{ $f->description ?? '-' }} {{ $f->effective_date ? calendar_date($f->effective_date) : '-' }} @if($f->is_paid) {{ __('payroll.paid') }} @else {{ __('payroll.pay') }} @endif
@endisset @endforeach @if($financials->isEmpty())
{{ __('payroll.no_records_year') }}
@endif
@endsection