@php $logo = \App\Models\Utility::get_file('uploads/logo'); $company_logo = \App\Models\Utility::GetLogo(); $creatorId = \Auth::user()->creatorId(); $setting = DB::table('settings')->where('created_by', $creatorId)->pluck('value', 'name')->toArray(); $settings_data = \App\Models\Utility::settingsById($creatorId); @endphp @php $addressParts = array_filter([ $settings_data['company_address'] ?? '', $settings_data['company_city'] ?? '', $settings_data['company_state'] ?? '', $settings_data['company_zipcode'] ?? '', ]); @endphp @php $salaryMonthParts = explode('-', $payslip->salary_month); $year = $salaryMonthParts[0]; $month = $salaryMonthParts[1]; // Optional: Convert month number to name $monthNames = [ '01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December' ]; $monthName = $monthNames[$month]; @endphp

{{ $settings_data['company_name'] ?? 'Company Name' }}

@if(empty($settings_data['company_name']))

Update company details from settings

@endif

{{ implode(' , ', $addressParts) }}

Payslip for the month of {{ $monthName }} {{ $year }}

{{__('Name')}}: {{$employee->name}}
{{ __('Join Date') }} : {{ \App\Models\Utility::formatDate($employee->company_doj) }}
{{__('Location')}} : {{$employee->branch_location}}
{{__('Effective Working Days')}} :{{$payslip->working_days}}
{{__('Days In Month')}} : {{$payslip->days_in_month}}
{{__('LOP')}} : {{$payslip->lop}}
{{__('Pan No')}}:{{$employee->pan_number}}
{{__('PF No')}} : {{$employee->pf_number}}
{{__('UAN No')}} : {{$employee->uan_number}}
{{__('ESI NO')}} : {{$employee->esi_number}}
{{__('Bank Details')}} : {{ $employee->account_number }}
{{ $employee->bank_identifier_code }}
{{ $employee->bank_name }}
@php $allowances = json_decode($payslip->allowance ?? '[]'); $commissions = json_decode($payslip->commission ?? '[]'); $overtimes = json_decode($payslip->overtime ?? '[]'); $other_payments = json_decode($payslip->other_payment ?? '[]'); $deductions = json_decode($payslip->saturation_deduction ?? '[]'); $loans = json_decode($payslip->loan ?? '[]'); // Combine all earnings into one array $all_earnings = []; foreach ($allowances as $item) { $full = $item->type == 'percentage' ? ($item->amount * $payslip->basic_salary) / 100 : $item->amount; $actual = $item->type == 'percentage' ? ($item->actual_amount * $payslip->basic_salary) / 100 : $item->actual_amount; $all_earnings[] = ['title' => $item->title, 'full' => $full, 'actual' => $actual]; } foreach ($commissions as $item) { $amount = $item->type == 'percentage' ? ($item->amount * $payslip->basic_salary) / 100 : $item->amount; $all_earnings[] = ['title' => $item->title, 'full' => $amount, 'actual' => $amount]; } foreach ($other_payments as $item) { $amount = $item->type == 'percentage' ? ($item->amount * $payslip->basic_salary) / 100 : $item->amount; $all_earnings[] = ['title' => $item->title, 'full' => $amount, 'actual' => $amount]; } foreach ($overtimes as $ot) { $amount = ($ot->number_of_days ?? 0) * ($ot->hours ?? 0) * ($ot->rate ?? 0); $all_earnings[] = ['title' => $ot->title, 'full' => $amount, 'actual' => $amount]; } // Combine all deductions into one array (excluding LOP with 0 amount) $all_deductions = []; foreach ($deductions as $deduct) { $amount = $deduct->type == 'percentage' ? ($deduct->amount * $payslip->basic_salary) / 100 : $deduct->amount; if ($amount > 0) { $all_deductions[] = ['title' => $deduct->title, 'amount' => $amount]; } } foreach ($loans as $loan) { $amount = $loan->amount ?? 0; if ($amount > 0) { $all_deductions[] = ['title' => $loan->title ?? 'Loan', 'amount' => $amount]; } } $totalFullEarning = 0; $totalActualEarning = 0; $totalDeduction = 0; // Calculate totals for earnings foreach ($all_earnings as $earning) { $totalFullEarning += $earning['full']; $totalActualEarning += $earning['actual']; } // Calculate total deductions foreach ($all_deductions as $deduction) { $totalDeduction += $deduction['amount']; } // Determine the maximum number of rows needed $maxRows = max(count($all_earnings), count($all_deductions)); @endphp
@for ($i = 0; $i < $maxRows; $i++) {{-- Earnings Column --}} @if ($i < count($all_earnings)) @php $earning = $all_earnings[$i]; @endphp @else @endif {{-- Deductions Column --}} @if ($i < count($all_deductions)) @php $deduction = $all_deductions[$i]; @endphp @else @endif @endfor
{{__('Earning')}} {{__('Full')}} {{__('Actual')}} {{__('Deduction')}} {{__('Actual')}}
{{ $earning['title'] }} {{ \Auth::user()->priceFormat($earning['full']) }} {{ \Auth::user()->priceFormat($earning['actual']) }}{{ $deduction['title'] }} {{ \Auth::user()->priceFormat($deduction['amount']) }}
{{ __('Total Earnings') }} {{ \Auth::user()->priceFormat($totalFullEarning) }} {{ \Auth::user()->priceFormat($totalActualEarning) }} {{ __('Total Deduction') }} {{ \Auth::user()->priceFormat(round($totalDeduction)) }}
@php $netSalary = round($payslip->net_payble); $netPay = max(0, round($payslip->net_payble)); $fmt = new \NumberFormatter('en_IN', \NumberFormatter::SPELLOUT); $inWords = ucfirst($fmt->format($netPay)) . ' rupees only'; @endphp

{{ __('Net Pay for the Month (Total Earning - Total Deduction):') }} {{ \Auth::user()->priceFormat($netSalary) }}
( {{ $inWords }} )

{{ __('THIS IS A SYSTEM GENERATED PAYSLIP AND DOES NOT REQUIRE SIGNATURE') }}