@extends('template.layouts.template-base') @section('title') Salary Generate | {{ config('setting.website_name') ?: config('app.name') }} @endsection @section('content')

Salary Generate

@error('staff_type')
{{ $message }}
@enderror
@error('clients')
{{ $message }}
@enderror
@error('projects')
{{ $message }}
@enderror
@error('paysheet')
{{ $message }}
@enderror
@error('title')
{{ $message }}
@enderror
{{-- @if(isset($staffList)) --}} @if(isset($staffList) && $staffList->isEmpty())
No paysheet records with linked staff were found for the selected client/project and month.
@endif @if(isset($staffList) && $staffList->count() > 0)
@csrf
Dates: {{ date('d-m-Y',strtotime($fromDate)) .'/'. date('d-m-Y',strtotime($toDate)) }}
@if(isset($selected_client) && $selected_client->company_name)
Client: {{ $selected_client->company_name }}
@endif @if(isset($selected_project) && $selected_project->project_name)
Project: {{ $selected_project->project_name }}
@endif
@foreach($staffList as $index => $staff) @php $sourceDetail = $sourceDetailsByStaff[$staff->id] ?? null; $isCorporateSource = $sourceDetail && $selected_client?->wage_type === 'corporate'; if ($sourceDetail) { $totalPresent = $sourceDetail->pay_days ?? $sourceDetail->present_days ?? 0; $grossSalary = $isCorporateSource ? $sourceDetail->total_earnings : $sourceDetail->earned_gross; $deductions = $isCorporateSource ? $sourceDetail->total_deductions : null; $netPay = $sourceDetail->net_pay; if ($netPay === null && $grossSalary !== null && $deductions !== null) { $netPay = (float) $grossSalary - (float) $deductions; } $salaryData = [ 'net_pay' => $netPay, 'employee_epf' => $isCorporateSource ? $sourceDetail->epf_account : $sourceDetail->employee_pf, 'employee_esi' => $isCorporateSource ? $sourceDetail->esic_075 : $sourceDetail->employee_esi, 'employer_epf' => $isCorporateSource ? ($sourceDetail->epf_account_01 ?? $sourceDetail->epf_367) : $sourceDetail->employer_pf, 'employer_esi' => $isCorporateSource ? $sourceDetail->esi_325 : $sourceDetail->employer_esi, 'ctc' => $isCorporateSource ? ($sourceDetail->ctc ?? $sourceDetail->total_payable_to_contractor) : $sourceDetail->ctc, ]; } else { $totalPresent = 0; $totalWeekoff = 0; $totalHoliday = 0; $totalAbsent = 0; $totalLopDays = 0; $totalLeave = 0; $dayRecords = $staff->attendance->pluck('dayRecords')->flatten(); foreach ($dates as $date) { $record = $dayRecords->firstWhere('attendance_date', $date); $attendanceType = strtoupper($record->attendance_type ?? ''); match($attendanceType) { 'P' => $totalPresent++, 'L' => $totalLeave++, 'WO' => $totalWeekoff++, 'NH' => $totalHoliday++, 'A' => $totalAbsent++, 'LOP' => $totalLopDays++, default => null, }; } $grossSalary = $totalPresent * $staff->monthly_salary; $salaryData = \App\Helpers\Helper::epfEsiCalculator($grossSalary); } @endphp {{-- Excel Fields --}} {{-- Hidden Inputs For Saving --}} @endforeach
S.NO Emp.Code Name Dt of Joining DOL NET-PAY Account Holder Ac No IFSC Code Branch Bank UAN ESIC PF Aadhar No
{{ $index + 1 }}{{ $staff->emp_code ?? $staff->staff_id ?? '-' }} {{ $staff->staff_name }} {{ $staff->date_of_joining ?? '-' }} {{ $staff->date_of_relieving ?? '-' }} {{ number_format($salaryData['net_pay'] ?? 0, 2) }} {{ $staff->account_holder_name ?? '-' }} {{ $staff->bank_account_no ?? '-' }} {{ $staff->ifsc ?? '-' }} {{ $staff->bank_branch ?? '-' }} {{ $staff->bank_name ?? '-' }} {{ $staff->uan_no ?? '-' }} {{ $staff->esic_no ?? '-' }} {{ $staff->pf_no ?? '-' }} {{ $staff->aadhar_number ?? '-' }}
Cancel
@endif @section('scripts') @endsection @endsection