@php $header = ' Allowance Deduction
S.No.
Emp. Name
Emp. Code
Father/Husband Name
Designation/Category
'; $count = 1; foreach ($payrollComponentHeads1 as $component) { $header .= ''; if ($count % 1 === 0) { $header .= ''; } $count++; } $header .= '
' . @$componentAbv[$component->id] . '
'; $count = 1; foreach ($leaveTypes as $leave) { $header .= ''; if ($count % 2 === 0) { $header .= ''; } $count++; } $header .= '
WD
HRest
' . strtoupper($leave->alias) . '
Total
'; $header .= ' '; $count = 1; foreach ($payrollComponentHeads1 as $component) { $header .= ''; if ($count % 1 === 0) { $header .= ''; } $count++; } $header .= '
' . @$componentAbv[$component->id] . '
'; $count = 1; foreach ($payrollComponentHeads2 as $component) { $header .= ''; if ($count % 2 === 0) { $header .= ''; } $count++; } $header .= '
' . @$componentAbv[$component->id] . '
'; $count = 1; foreach ($payrollComponentHeads3 as $component) { $header .= ''; if ($count % 2 === 0) { $header .= ''; } $count++; } $header .= '
' . @$componentAbv[$component->id] . '
Total '; foreach ($payrollComponentHeads4 as $component) { $header .= ''; } $header .= '
Net Pay
' . @$componentAbv[$component->id] . '
Net Amt. Pay
Emp`s Sgn./LTI '; @endphp
{!! $header !!} @php $index = 1; $rowcounts = 0; $employeeTotalLeave = 0; $employeeTotalAllowance = 0; $employeeTotalDeduction = 0; $employeeOtherlAllowance = 0; $grandTotals = $totalGrassRate = $totalGrassPay = $totalDeductions = 0; @endphp @foreach ($employees as $keys => $employee) @if ($keys == 2 || $rowcounts == 3)
{{ $organization->name }}
SALARY REGISTER {{ \Carbon\Carbon::create()->month($month)->format('F') }} - {{ $year }} (See Rule 22) Branch : {{ @$workStation ? $workStation->name : 'All' }} Department : {{ @$department ? $department->name : 'All' }}
Categories: {{ isset($categoryNames) && count($categoryNames) ? $categoryNames->implode(', ') : 'All' }} Employee Type : {{ isset($employee_type) ? ucfirst($employee_type) : 'All' }} Contractor : {{ isset($contractor->name) ? ucfirst($contractor->name) : 'All' }}
{!! $header !!} @php $rowcounts = 1; @endphp @else @php $rowcounts++; @endphp @endif @php $payrollEmployeeTempStructures = isset( $employee->employeeCtcMaster->payrollEmployeeTempStructures, ) ? $employee->employeeCtcMaster->payrollEmployeeTempStructures ->groupBy('type_id') ->toArray() : []; $slipLogs = []; if (isset($employee->salarySlip->slipLogs) && !empty($employee->salarySlip->slipLogs)) { $slipLogs = $employee->salarySlip->slipLogs->pluck('calculate_salary', 'type_id'); } @endphp @php $total_paid_days = $employee->salarySlip->total_paid_days ?? 0; $week_offs = $employee->salarySlip->week_offs ?? 0; $count = 1; $employeeTotalLeave = 0; $employeeLeaves = $employee->attendanceSummary ->groupBy('leave_type') ->map(function ($item, $key) { $sum = $item->sum(function ($item1) { return ($item1->first_half_status == 'L' ? ($item1->is_short_leave == '1' ? 1 : 0.5) : 0) + ($item1->second_half_status == 'L' ? ($item1->is_short_leave == '1' ? 1 : 0.5) : 0); }); return $sum; }); $empHolidays = $employee->salarySlip->holidays ?? 0; @endphp @php $netPay = round($employeeTotalAllowance - $employeeTotalDeduction); @endphp @endforeach {{-- @endfor --}}
{{ $index++ }}
{{ $employee->name }}
{{ $employee->employee_code }}
{{ $employee->father_name }}
{{ @$employee->department->name }} - {{ @$employee->category->name }}
@php $count = 1; $val = 0; @endphp @foreach ($payrollComponentHeads1 as $component) @php if($component->id == '1744'){ $totalGrassRate = $totalGrassRate + $componentValue; } if ($count % 1 === 0) { echo ''; } $count++; @endphp @endforeach
@php $componentValue = round(isset($payrollEmployeeTempStructures[$component->id][0]) ? $payrollEmployeeTempStructures[$component->id][0]['calculate_salary'] : 0); @endphp {{ $componentValue }}
@foreach ($leaveTypes as $leave) @php $leaveVal = isset($employeeLeaves[$leave->alias]) ? $employeeLeaves[$leave->alias] : 0; $employeeTotalLeave += $leaveVal; @endphp @php if ($count % 2 === 0) { echo ''; } $count++; @endphp @endforeach
{{ $total_paid_days - ($employeeTotalLeave + $week_offs) }}
{{ $empHolidays }} {{ $week_offs }}
{{ $leaveVal }}
{{ $total_paid_days }}
@php $count = 1; $val = 0; @endphp @foreach ($payrollComponentHeads1 as $component) @php if($component->id == '1744'){ $totalGrassPay = $totalGrassPay + $componentValuePay; } if ($count % 1 === 0) { echo ''; } $count++; @endphp @endforeach
@php $componentValuePay = round(isset($slipLogs[$component->id]) && $slipLogs[$component->id] ? $slipLogs[$component->id] : 0); @endphp {{ $componentValuePay }}
@php $val = 0; $count = 1; $employeeTotalAllowance = 0; @endphp @foreach ($payrollComponentHeads2 as $component) @php $val = isset($slipLogs[$component->id]) && $slipLogs[$component->id] ? $slipLogs[$component->id] : 0; if ( $employee->employee_type == 'employee' && in_array($component->id, ['1119', '1118']) ) { $val = 0; } $employeeTotalAllowance += $val; @endphp @if ($component->id == '1744') @else @endif @php if ($count % 2 === 0) { echo ''; } $count++; @endphp @endforeach
{{ $employeeTotalAllowance }} {{ round($val) }}
@php $val = 0; $count = 1; $employeeTotalDeduction = 0; @endphp @foreach ($payrollComponentHeads3 as $component) @php $val = isset($slipLogs[$component->id]) && $slipLogs[$component->id] ? $slipLogs[$component->id] : 0; @endphp @php if ($count % 2 === 0) { echo ''; } if (!in_array($component->id, ['1650', '1651'])) { $employeeTotalDeduction += $val; } $count++; @endphp @endforeach
{{ round($val) }}
@php $totalDeductions = $totalDeductions + round($employeeTotalDeduction); @endphp {{ round($employeeTotalDeduction) }} @php $val = 0; $employeeOtherlAllowance = 0; @endphp @foreach ($payrollComponentHeads4 as $component) @php $val = isset($slipLogs[$component->id]) && $slipLogs[$component->id] ? $slipLogs[$component->id] : 0; @endphp @php $count++; $employeeOtherlAllowance += $val; @endphp @endforeach
{{ round($netPay) }}
{{ round($val) }}
@php $grandTotals = $grandTotals + round($netPay + $employeeOtherlAllowance); @endphp {{ round($netPay + $employeeOtherlAllowance) }}
Total Grass(Rate)
{{$totalGrassRate}}
Total Grass(Pay)
{{$totalGrassPay}}
Total Deduction
{{$totalDeductions}}
Total Net Pay
{{$grandTotals}}
@php // dd(true); @endphp