Employee Summary
Employee Name
: {{ $employee->name }}
Employee ID : {{$employee->emp_no}}
Pay Period : {{ $dataSalary->year }} {{ $monthName }}
Pay Date : 10/{{$dataSalary->month}}/{{$dataSalary->year}}
Rs.{{ number_format($totalGrossEarnings,0) }}
Total Gross Pay
@php
$year = $dataSalary->year;
$month = $dataSalary->month;
$daysInMonth = \Carbon\Carbon::createFromDate($year, $month)->daysInMonth;
$leaves = $daysInMonth - $dataSalary->paid_days;
@endphp
Paid Days: {{$dataSalary->paid_days}}
LWP Days: {{$leaves}}
| Earnings |
Amount |
Deductions |
Amount |
@php
$totalGrossEarnings = 0;
$totalDeductions = 0;
$allounces[] = (object)[
'component_name' => 'Other',
'calculated_amount' => $otherAllowance, // you can change the amount if needed
];
$maxRows = max(count($allounces), count($deducations));
@endphp
{{-- Allowances and Deductions --}}
@for ($i = 0; $i < $maxRows; $i++)
{{-- Earnings --}}
@if (isset($allounces[$i]))
| {{ $allounces[$i]->component_name }} |
{{ number_format($allounces[$i]->calculated_amount, 2) }}
@php
$totalGrossEarnings += $allounces[$i]->calculated_amount;
@endphp
|
@else
| |
@endif
{{-- Deductions --}}
@if (isset($deducations[$i]))
{{ $deducations[$i]->component_name }} |
{{ number_format($deducations[$i]->calculated_amount, 2) }}
@php
$totalDeductions += $deducations[$i]->calculated_amount;
@endphp
|
@else
| |
@endif
@endfor
{{-- Totals --}}
| Gross Earnings |
{{ number_format($totalGrossEarnings, 2) }} |
Total Deductions |
{{ number_format($totalDeductions, 2) }} |
Total Net Payable
Gross Earnings - Total Deductions
@php
$totalNewSalary = $totalGrossEarnings - $totalDeductions;
// dd($totalGrossEarnings , $totalDeductions , $dataSalary->leave_deduction)
@endphp
Rs.{{number_format($totalNewSalary,0)}}
@php
function numberToWordsIndian($num) {
$a = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine',
'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen',
'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen'];
$b = ['', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'];
if (strlen($num) > 9) return 'Overflow';
$num = str_pad($num, 9, '0', STR_PAD_LEFT);
$n = sscanf($num, "%2d%2d%2d%1d%2d");
$str = '';
$str .= ($n[0]) ? (($n[0] < 20) ? $a[$n[0]] : $b[intval($n[0]/10)] . ' ' . $a[$n[0]%10]) . ' Crore ' : '';
$str .= ($n[1]) ? (($n[1] < 20) ? $a[$n[1]] : $b[intval($n[1]/10)] . ' ' . $a[$n[1]%10]) . ' Lakh ' : '';
$str .= ($n[2]) ? (($n[2] < 20) ? $a[$n[2]] : $b[intval($n[2]/10)] . ' ' . $a[$n[2]%10]) . ' Thousand ' : '';
$str .= ($n[3]) ? $a[$n[3]] . ' Hundred ' : '';
$str .= ($n[4]) ? (($str != '') ? 'and ' : '') . (($n[4] < 20) ? $a[$n[4]] : $b[intval($n[4]/10)] . ' ' . $a[$n[4]%10]) . ' ' : '';
return trim($str) . ' Rupees only.';
}
$netSalaryWords = numberToWordsIndian($totalNewSalary);
@endphp
Amount In Words: {{ $netSalaryWords }}
{{--
Amount In Words : Loading...;
--}}