@php $periodLabel = 'FY ' . ($financialYearLabel ?? ''); $grossComponents = $payrollTemplateComponets->filter(function ($component) { return $component->group_type_name == 'Gross' && $component->type == 'earning'; })->values(); $ctcComponents = $payrollTemplateComponets->filter(function ($component) { return $component->group_type_name == 'CTC' && $component->type == 'earning'; })->values(); $otherEarningComponents = $payrollTemplateComponets->filter(function ($component) { return $component->group_type_name == 'Others' && $component->type == 'earning'; })->values(); $reimbursementComponents = collect($reimbursementEligibilities ?? [])->values(); $ctcSectionComponents = $grossComponents->concat($ctcComponents)->values(); $grossMonthlyTotal = round($grossComponents->sum(function ($component) { return (float) ($component->calculate_salary ?? 0); }), 2); $ctcMonthlyTotal = round($ctcComponents->sum(function ($component) { return (float) ($component->calculate_salary ?? 0); }), 2); $otherEarningMonthlyTotal = round($otherEarningComponents->sum(function ($component) { return (float) ($component->calculate_salary ?? 0); }), 2); $ctcSectionMonthlyTotal = round($grossMonthlyTotal + $ctcMonthlyTotal, 2); $reimbursementAnnualTotal = round($reimbursementComponents->sum(function ($component) { return (float) ($component->actual_amount ?? $component->eligible_amount ?? 0); }), 2); $reimbursementMonthlyTotal = round($reimbursementAnnualTotal / 12, 2); $grandMonthlyTotal = round($grossMonthlyTotal + $ctcMonthlyTotal + $otherEarningMonthlyTotal + $reimbursementMonthlyTotal, 2); $grandAnnualTotal = round(($grossMonthlyTotal * 12) + ($ctcMonthlyTotal * 12) + ($otherEarningMonthlyTotal * 12) + $reimbursementAnnualTotal, 2); $formatCurrency = function ($amount, $showDashForZero = false) { $amount = (float) $amount; if ($showDashForZero && abs($amount) < 0.00001) { return '—'; } return number_format($amount, 2, '.', ','); }; @endphp
| # | Component | Per Month (₹) | Per Annum (₹) |
|---|---|---|---|
|
CTC Components
|
|||
| {{ $index + 1 }} | {{ $component->type_name }} | {{ $formatCurrency($monthlyAmount, true) }} | {{ $formatCurrency($annualAmount, true) }} |
| CTC | {{ $formatCurrency($ctcSectionMonthlyTotal) }} | {{ $formatCurrency($ctcSectionMonthlyTotal * 12) }} | |
|
Other Allowances
|
|||
| {{ $ctcSectionComponents->count() + $index + 1 }} | {{ $component->head->display_name ?? $component->head->name ?? '-' }} | {{ $formatCurrency($monthlyAmount, true) }} | {{ $formatCurrency($annualAmount, true) }} |
| Other Allowances | {{ $formatCurrency($reimbursementMonthlyTotal) }} | {{ $formatCurrency($reimbursementAnnualTotal) }} | |
|
Other Benefits
|
|||
| {{ $ctcSectionComponents->count() + $reimbursementComponents->count() + $index + 1 }} | {{ $component->type_name }} | {{ $formatCurrency($monthlyAmount, true) }} | {{ $formatCurrency($annualAmount, true) }} |
| Other Benefits | {{ $formatCurrency($otherEarningMonthlyTotal) }} | {{ $formatCurrency($otherEarningMonthlyTotal * 12) }} | |
| Total | {{ $formatCurrency($grandMonthlyTotal) }} | {{ $formatCurrency($grandAnnualTotal) }} | |