@extends('admin.layouts.app') @section('title', get_setting('site_name').' | Payroll') @section('content') @if(\App\Support\BranchWiseFeature::missingBranchAssignment())
{{ __('Your branch is not assigned. Contact HQ admin to assign a warehouse/branch.') }}
@endif

Payroll

Generate payslips individually or in bulk from attendance and salary setup.

{{ __('View Payslips') }}
@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif @if(!empty($payrollPeriodLabel))
{{ __('Payroll period') }}: {{ $payrollPeriodLabel }} {{ __('Change settings') }}
@endif @if(!empty($payrollPeriodError))
{{ $payrollPeriodError }}
@endif
{{ __('Bulk Generate Payslips') }}
@csrf
@if(\App\Services\SalaryStructureService::enabled())

{{ __('Bulk generate applies lunch from attendance and setup defaults for mobile/travel (no monthly override).') }}

@endif
{{ __('Single Employee Payroll') }}
@if($staff_id != null && $payrollPreview) @php extract($payrollPreview); @endphp
@csrf
@if($staff_info)
{{ $staff_info->user?->name ?? '—' }}
ID: {{ $staff_info->user_id ?? '—' }} · {{ $staff_info->designation?->name ?? 'No Designation' }} · {{ $staff_info->warehouse?->name ?? '—' }}
{{ date('F', mktime(0, 0, 0, $month, 1)) }} {{ $year }}
@if(!empty($period_label))
{{ __('Period') }}: {{ $period_label }}
@endif
@endif
{{ $attendanceSummary['present'] }}
Present
{{ $attendanceSummary['delay'] }}
Delay
{{ $attendanceSummary['extra_delay'] }}
Extra Delay
{{ $attendanceSummary['leave_days'] }}
Leave Days
{{ __('Allowances') }}
{{ __('House Allowance') }}{{ number_format((float) $salary->house_rent, 2) }}
{{ __('Medical Allowance') }}{{ number_format((float) $salary->medical, 2) }}
{{ __('Food Allowance') }}{{ number_format((float) $salary->food, 2) }}
{{ __('Conveyance Allowance') }}{{ number_format((float) $salary->conveyance, 2) }}
{{ __('Utility Allowance') }}{{ number_format((float) $salary->utility, 2) }}
{{ __('Others Allowance') }}{{ number_format((float) $salary->Others, 2) }}
@foreach($salary->normalizedCustomAllowances() as $customAllow) @if((float)($customAllow['amount'] ?? 0) > 0)
{{ $customAllow['label'] ?: __('Other allowance') }}{{ number_format((float) $customAllow['amount'], 2) }}
@endif @endforeach
{{ __('Deductions') }}
{{ __('Provident Fund') }}{{ number_format($pf_employee_amount, 2) }}
@if((int)get_setting('swf') === 1)
{{ __('Staff Welfare Fund') }}{{ number_format($swf_employee_amount, 2) }}
@endif @foreach($salary->normalizedCustomDeductions() as $customDed) @if((float)($customDed['amount'] ?? 0) > 0)
{{ $customDed['label'] ?: __('Other deduction') }}{{ number_format((float) $customDed['amount'], 2) }}
@endif @endforeach @if(\App\Services\PayrollIncomeTaxService::enabled() && $income_tax_amount > 0)
{{ \App\Services\PayrollIncomeTaxService::label() }}{{ number_format($income_tax_amount, 2) }}
@endif
{{ __('Unpaid Leave') }} ({{ $unpaid_leave_count }} {{ __('days') }}) {{ number_format($unpaid_leave_amount, 2) }}
@if(get_setting('extra_delay') == 1)
{{ __('Absent For Extra Delay') }} ({{ $count }} {{ __('days') }}) {{ number_format($extra_delay_amount, 2) }}
@endif
{{ __('Absent') }} ({{ $absent_count }} {{ __('days') }}) {{ number_format($absent_count_amount, 2) }}
{{ __('Loan/Advance Salary') }} @if($advance_salary_recived && $advance_salary_recived->isNotEmpty()) @foreach ($advance_salary_recived as $advance_salary) {{ $advance_salary->month }}-{{ $advance_salary->year }} ({{ number_format((float) $advance_salary->amount, 2) }})@if(!$loop->last), @endif @endforeach @endif {{ number_format($advance_amount, 2) }}
{{ __('Overview') }}
{{ __('Bonus and arrear add to gross for this month; income tax uses total gross. Use 0 if none.') }} @if(\App\Services\SalaryStructureService::enabled())
{{ __('Attendance-based lunch and optional mobile/travel overrides are included in total gross when rules are enabled.') }} @endif
@if(\App\Services\SalaryStructureService::enabled() && $structurePayrollPreview)
{{ __('Salary structure (this month)') }}
@php $breakdown = $structurePayrollPreview['breakdown'] ?? []; $lunchAmt = 0; foreach ($breakdown as $bk => $bv) { if (str_contains($bk, 'lunch')) { $lunchAmt = (float) $bv; break; } } @endphp @if($lunchAmt > 0 || ($structureUiMeta['lunch_rate'] > 0 && ($structureUiMeta['scoped_rules'] ?? false)))

{{ __('Lunch') }}: {{ number_format($lunchAmt, 2) }} @if($structureUiMeta['lunch_rate'] > 0) ({{ number_format($structureUiMeta['lunch_rate'], 2) }} × {{ (int) ($presentDays ?? 0) }} {{ __('days') }}) @endif

@elseif(($structureUiMeta['scoped_rules'] ?? false) && $structureUiMeta['lunch_rate'] <= 0)

{{ __('Lunch allowance does not apply to this employee (scoped rules).') }}

@endif @if($structureUiMeta['has_mobile'])
@endif @if($structureUiMeta['has_travel'])
@endif

{{ __('Variable additions this month') }}: {{ number_format($structureAdditionalGross, 2) }}

@endif
@if(\App\Services\SalaryStructureService::enabled())
@endif
@elseif($staff_id != null && ! $payrollPreview)
{{ __('Could not load payroll preview. Check salary setup and try again.') }}
@endif @endsection @section('script') @endsection