@extends('garage.layouts.app') @section('title', 'Payroll run') @section('content') @include('garage.hr.styles')
Payroll run
Month: {{ $run->month }}
Excel PDF @if(!empty($run->garage_voucher_id)) Payroll JV @if(!empty($run->garage_fund_voucher_id)) Employee Fund JV @endif
@csrf
@else
@csrf
@endif
@csrf
Back
@php $payslipByEmployee = []; foreach ($payslips as $ps) { $payslipByEmployee[(int) $ps->garage_employee_id] = $ps; } @endphp @php $tBasic = 0; $tAllow = 0; $tBonus = 0; $tDed = 0; $tFine = 0; $tAdvance = 0; $tNet = 0; $tFixedEmpAllow = 0; $tVarEmpAllow = 0; $tEmpFund = 0; foreach($payslips as $pp){ $tBasic += (float)($pp->basic_salary ?? 0); $tAllow += (float)($pp->total_allowance ?? 0); $tBonus += (float)($pp->total_bonus ?? 0); $tDed += (float)($pp->total_deduction ?? 0); $tFine += (float)($pp->total_fine ?? 0); $tAdvance += (float)($pp->total_advance ?? 0); $tNet += (float)($pp->net_pay ?? 0); $tFixedEmpAllow += (float)($pp->employee_fixed_allowance ?? 0); $tVarEmpAllow += (float)($pp->employee_variable_allowance ?? 0); $tEmpFund += (float)($pp->employee_fund_deduction ?? 0); } @endphp

Click a summary card or a linked amount in the table to see line-by-line breakdown.

Basic
{{ number_format($tBasic, 2) }}
Allow
{{ number_format($tAllow,2) }}
F {{ number_format($tFixedEmpAllow, 0) }} · V {{ number_format($tVarEmpAllow, 0) }}
Bonus
{{ number_format($tBonus,2) }}
Ded
{{ number_format($tDed,2) }}
Adv {{ number_format($tAdvance, 0) }} · Fund {{ number_format($tEmpFund, 0) }}
Fine
{{ number_format($tFine, 2) }}
Net pay
{{ number_format($tNet, 2) }}
@csrf
Checked employees are included in payroll. You can add more anytime.
0 selected @if(in_array((string)($run->status ?? ''), ['draft','posted'], true)) @endif
@forelse($employees as $emp) @php $p = $payslipByEmployee[(int) $emp->id] ?? null; $included = $p !== null; $jvPostedForRun = !empty($run->garage_voucher_id); $hideSelector = $included && $jvPostedForRun; $lineAgg = $p ? ($lineAggByPayslip[(int) $p->id] ?? null) : null; $displayBasic = 0.0; $displayFixed = 0.0; $displayVar = 0.0; $displayFund = 0.0; $displayAdvance = 0.0; $displayAllow = 0.0; $displayBonus = 0.0; $displayDed = 0.0; $displayFine = 0.0; $displayNet = 0.0; if ($included) { $displayBasic = (float) ($p->basic_salary ?? 0); $displayFixed = (float) ($p->employee_fixed_allowance ?? 0); $displayVar = (float) ($p->employee_variable_allowance ?? 0); $displayFund = (float) ($p->employee_fund_deduction ?? 0); if ($displayFund <= 0) { $displayFund = (float) ($p->employee_fund_master ?? 0); } $displayAdvance = (float) ($p->total_advance ?? 0); if ($displayAdvance <= 0) { $displayAdvance = (float) ($lineAgg->line_advance ?? 0); } $displayAllow = (float) ($p->total_allowance ?? 0); if ($displayAllow <= 0) { $displayAllow = (float) ($lineAgg->line_allowance ?? 0); } $displayBonus = (float) ($p->total_bonus ?? 0); if ($displayBonus <= 0) { $displayBonus = (float) ($lineAgg->line_bonus ?? 0); } $displayDed = (float) ($p->total_deduction ?? 0); if ($displayDed <= 0) { $displayDed = (float) ($lineAgg->line_deduction ?? 0); } $displayFine = (float) ($p->total_fine ?? 0); if ($displayFine <= 0) { $displayFine = (float) ($lineAgg->line_fine ?? 0); } $displayNet = (float) ($p->net_pay ?? 0); } else { $preview = $previewByEmployee[(int) $emp->id] ?? null; if ($preview) { $displayBasic = (float) ($preview['basic'] ?? 0); $displayFixed = (float) ($preview['fixed'] ?? 0); $displayVar = (float) ($preview['var'] ?? 0); $displayFund = (float) ($preview['fund'] ?? 0); $displayAdvance = (float) ($preview['advance'] ?? 0); $displayAllow = (float) ($preview['allow'] ?? 0); $displayBonus = (float) ($preview['bonus'] ?? 0); $displayDed = (float) ($preview['ded'] ?? 0); $displayFine = (float) ($preview['fine'] ?? 0); $displayNet = (float) ($preview['net'] ?? 0); } } @endphp @include('garage.payroll._amount-cell', ['amount' => $displayBasic, 'category' => 'basic', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @include('garage.payroll._amount-cell', ['amount' => $displayFixed, 'category' => 'allowance', 'filter' => 'fixed', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @include('garage.payroll._amount-cell', ['amount' => $displayVar, 'category' => 'allowance', 'filter' => 'variable', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @include('garage.payroll._amount-cell', ['amount' => $displayFund, 'category' => 'deduction', 'filter' => 'fund', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @include('garage.payroll._amount-cell', ['amount' => $displayAdvance, 'category' => 'advance', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @include('garage.payroll._amount-cell', ['amount' => $displayAllow, 'category' => 'allowance', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @include('garage.payroll._amount-cell', ['amount' => $displayBonus, 'category' => 'bonus', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @include('garage.payroll._amount-cell', ['amount' => $displayDed, 'category' => 'deduction', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @include('garage.payroll._amount-cell', ['amount' => $displayFine, 'category' => 'fine', 'employeeId' => $emp->id, 'employeeName' => $emp->name, 'hasDetail' => (bool) $p]) @empty @endforelse
Employee Status Basic Fixed Alw Var Alw Emp Fund Advance Allow Bonus Ded Fine Net Payslip
@if($hideSelector) @else @endif
@if(!empty($emp->garage_ledger_id)) {{ $emp->name }} @else {{ $emp->name }} @endif
{{ $emp->code ?: '—' }}
@if($included) @if($hideSelector) Posted in JV @else Included @endif @else Not included @endif @if((int)($emp->is_active ?? 1) !== 1) Inactive @endif {{ number_format($displayNet, 2) }} @if($p) @else @endif
No employees found.
@include('garage.payroll._detail-modal')
@endsection @push('styles') @endpush @push('scripts') @endpush