@extends('layouts.master') @section('title', __('index.employee_tax_report')) @section('action', __('index.tax_report_detail')) @section('main-content')
@include('admin.section.flash_message') @include('admin.payroll.taxReport.common.breadcrumb')
{{ __('index.tax_report_detail_of') }} {{ $reportData->employee->name }} ({{ $reportData->fiscalYear->year }})
{{ __('index.salary_sheet') }}
@php $isBsEnabled = \App\Helpers\AppHelper::ifDateInBsEnabled(); $enableTaxExemption = \App\Helpers\AppHelper::enableTaxExemption(); $monthData = json_decode($reportData->months, true) ?? []; $totalMonth = count($monthData); $firstDay = $reportData->fiscalYear->start_date; $lastDay = $reportData->fiscalYear->end_date; $startMonth = (int)\App\Helpers\AppHelper::getMonthValue($firstDay) ; $endMonth = (int)\App\Helpers\AppHelper::getMonthValue($lastDay) ; $allMonths = []; $totalBonusTax = 0; $totalBonusAmount = 0; for ($i = 0; $i < 12; $i++) { $allMonths[] = (($startMonth + $i - 1) % 12) + 1; } $months = $isBsEnabled ? [ 1 => 'Baishakh', 2 => 'Jestha', 3 => 'Asar', 4 => 'Shrawan', 5 => 'Bhadra', 6 => 'Ashwin', 7 => 'kartik', 8 => 'Mangsir', 9 => 'Poush', 10 => 'Magh', 11 => 'Falgun', 12 => 'Chaitra' ] :[ 1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', 9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December' ]; $monthlyTotals = array_fill(1, 12, 0); $totalMonthlyDeduction = array_fill(1, 12, 0); $monthlyTDS = array_fill(1, 12, 0); $totalAnnualIncome = 0; $totalAnnualDeduction = 0; $totalTds = 0; // Initialize monthly values from reportDetail $monthlyBasicSalary = []; $monthlyFixedAllowance = []; $monthlySsfContribution = []; $monthlySsfDeduction = []; $monthlyPfContribution = []; $monthlyPfDeduction = []; foreach ($reportData->reportDetail as $detail) { $month = $detail->month; $monthlyBasicSalary[$month] = $detail->basic_salary ?? 0; $monthlyFixedAllowance[$month] = $detail->fixed_allowance ?? 0; if($reportData->total_ssf_contribution >0){ $monthlySsfContribution[$month] = $detail->ssf_contribution ?? 0; $monthlySsfDeduction[$month] = $detail->ssf_deduction ?? 0; } if($reportData->total_pf_contribution >0){ $monthlyPfContribution[$month] = $detail->pf_contribution ?? 0; $monthlyPfDeduction[$month] = $detail->pf_deduction ?? 0; } } // Aggregate earning components by month and component name $earningComponentsByName = []; foreach ($reportData->componentDetail as $detail) { if ($detail->salaryComponent->component_type === 'earning') { $name = $detail->salaryComponent->name ?? 'Unknown Earning'; $month = $detail->month; $earningComponentsByName[$name][$month] = $detail->amount ?? 0; if (in_array($month, $monthData)) { $monthlyTotals[$month] += $detail->amount ?? 0; $totalAnnualIncome += $detail->amount ?? 0; } } } // Aggregate deduction components by month and component name $deductionComponentsByName = []; foreach ($reportData->componentDetail as $detail) { if ($detail->salaryComponent->component_type === 'deductions') { $name = $detail->salaryComponent->name ?? 'Unknown Deduction'; $month = $detail->month; $deductionComponentsByName[$name][$month] = $detail->amount ?? 0; if (in_array($month, $monthData)) { $totalMonthlyDeduction[$month] += $detail->amount ?? 0; $totalAnnualDeduction += $detail->amount ?? 0; } } } // Aggregate additional earning components by month and component name $additionalEarningComponentsByName = []; foreach ($reportData->additionalDetail as $detail) { if ($detail->salaryComponent->component_type === 'earning') { $name = $detail->salaryComponent->name ?? 'Unknown Earning'; $month = $detail->month; $additionalEarningComponentsByName[$name][$month] = $detail->amount ?? 0; if (in_array($month, $monthData)) { $monthlyTotals[$month] += $detail->amount ?? 0; $totalAnnualIncome += $detail->amount ?? 0; } } } // additional components $additionalDeductionComponentsByName = []; foreach ($reportData->additionalDetail as $detail) { if ($detail->salaryComponent->component_type === 'deductions') { $name = $detail->salaryComponent->name ?? 'Unknown Deduction'; $month = $detail->month; $additionalDeductionComponentsByName[$name][$month] = $detail->amount ?? 0; if (in_array($month, $monthData)) { $totalMonthlyDeduction[$month] += $detail->amount ?? 0; $totalAnnualDeduction += $detail->amount ?? 0; } } } // Aggregate bonus details $bonusComponentsByMonth = []; foreach ($reportData->bonusDetail as $bonus) { $month = $bonus->month; if (in_array($month, $monthData)) { $name = $bonus->bonus->title ?? 'Bonus'; $bonusComponentsByMonth[$name][$month] = $bonus->amount ?? 0; $monthlyTotals[$month] += $bonus->amount ?? 0; $totalAnnualIncome += $bonus->amount ?? 0; $totalBonusTax += $bonus->tax ?? 0; $totalBonusAmount += $bonus->amount ?? 0; } } // Aggregate TDS details foreach ($reportData->tdsDetail as $tdsDetail) { $monthlyTDS[$tdsDetail->month] = $tdsDetail->amount; } $totalTds = $reportData->total_payable_tds; // Add totals from reportDetail $totalAnnualIncome += $reportData->total_basic_salary + $reportData->total_allowance; $totalAnnualDeduction += ($reportData->total_ssf_deduction +$reportData->total_pf_deduction); @endphp @foreach($allMonths as $month) @endforeach @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @php $monthlyTotals[$month] += $monthlyBasicSalary[$month] ?? 0; @endphp @else @endif @endforeach @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @php $monthlyTotals[$month] += $monthlyFixedAllowance[$month] ?? 0; @endphp @else @endif @endforeach @foreach($earningComponentsByName as $name => $values) @php $isFixed = false; $annualAmount = 0; foreach ($reportData->componentDetail as $detail) { if ($detail->salaryComponent->component_type === 'earning' && $detail->salaryComponent->name === $name) { $isFixed = $detail->salaryComponent->value_type === 'fixed'; if ($isFixed) { $annualAmount = $detail->salaryComponent->annual_component_value ?? 0; } else { $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); } break; } } if (!$isFixed) { $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); } @endphp @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @else @endif @endforeach @endforeach @foreach($additionalEarningComponentsByName as $name => $values) @php $isFixed = false; $annualAmount = 0; foreach ($reportData->additionalDetail as $detail) { if ($detail->salaryComponent->component_type === 'earning' && $detail->salaryComponent->name === $name) { $isFixed = $detail->salaryComponent->value_type === 'fixed'; if ($isFixed) { $annualAmount = $detail->salaryComponent->annual_component_value ?? 0; } else { $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); } break; } } if (!$isFixed) { $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); } @endphp @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @else @endif @endforeach @endforeach @foreach($bonusComponentsByMonth as $name => $values) @php $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); @endphp @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @else @endif @endforeach @endforeach @foreach($allMonths as $month) @if(in_array($month, $monthData)) @else @endif @endforeach @if($reportData->total_ssf_deduction >0) @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @php $totalMonthlyDeduction[$month] += $monthlySsfDeduction[$month] ?? 0; @endphp @else @endif @endforeach @endif @if($reportData->total_pf_deduction >0) @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @php $totalMonthlyDeduction[$month] += $monthlyPfDeduction[$month] ?? 0; @endphp @else @endif @endforeach @endif @foreach($deductionComponentsByName as $name => $values) @php $isFixed = false; $annualAmount = 0; foreach ($reportData->componentDetail as $detail) { if ($detail->salaryComponent->component_type === 'deductions' && $detail->salaryComponent->name === $name) { $isFixed = $detail->salaryComponent->value_type === 'fixed'; if ($isFixed) { $annualAmount = $detail->salaryComponent->annual_component_value ?? 0; } else { $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); } break; } } if (!$isFixed) { $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); } @endphp @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @else @endif @endforeach @endforeach @foreach($additionalDeductionComponentsByName as $name => $values) @php $isFixed = false; $annualAmount = 0; foreach ($reportData->additionalDetail as $detail) { if ($detail->salaryComponent->component_type === 'deductions' && $detail->salaryComponent->name === $name) { $isFixed = $detail->salaryComponent->value_type === 'fixed'; if ($isFixed) { $annualAmount = $detail->salaryComponent->annual_component_value ?? 0; } else { $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); } break; } } if (!$isFixed) { $annualAmount = array_sum(array_intersect_key($values, array_flip($monthData))); } @endphp @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @else @endif @endforeach @endforeach @foreach($allMonths as $month) @if(in_array($month, $monthData)) @else @endif @endforeach @foreach($allMonths as $month) @if(in_array($month, $monthData)) @else @endif @endforeach @foreach($allMonths as $month) @if(in_array($month, $monthData)) @else @endif @endforeach @php $annualTotalPayable = $totalAnnualIncome - $totalAnnualDeduction - $totalTds; @endphp @foreach($allMonths as $month) @if(in_array($month, $monthData)) @php $monthlyTotalPayable = $monthlyTotals[$month] - $totalMonthlyDeduction[$month] - ($monthlyTDS[$month] ?? 0); @endphp @else @endif @endforeach
{{ __('index.particular') }} {{ __('index.total') }}{{ $months[$month] }}
{{ __('index.income') }}
{{ __('index.basic_salary') }} {{ $currency }} {{ $reportData->total_basic_salary }}{{ $currency }} {{ $monthlyBasicSalary[$month] ?? 0 }}
{{ __('index.fixed_allowance') }} {{ $currency }} {{ $reportData->total_allowance }}{{ $currency }} {{ $monthlyFixedAllowance[$month] ?? 0 }}
{{ $name }}{{ $currency }} {{ $annualAmount }}{{ $currency }} {{ $values[$month] ?? 0 }}
{{ $name }}{{ $currency }} {{ $annualAmount }}{{ $currency }} {{ $values[$month] ?? 0 }}
{{ $name }}{{ $currency }} {{ $annualAmount }}{{ $currency }} {{ $values[$month] ?? 0 }}
{{ __('index.total_earning') }} {{ $currency }} {{ $totalAnnualIncome }}{{ $currency }} {{ $monthlyTotals[$month] }}
{{ __('index.deductions') }}
{{ __('index.ssf_deduction') }} ({{ __('index.salary') }}) {{ $currency }} {{ $reportData->total_ssf_deduction }}{{ $currency }} {{ $monthlySsfDeduction[$month] ?? 0 }}
{{ __('index.pf_deduction') }} ({{ __('index.salary') }}) {{ $currency }} {{ $reportData->total_pf_deduction }}{{ $currency }} {{ $monthlyPfDeduction[$month] ?? 0 }}
{{ $name }}{{ $currency }} {{ $annualAmount }}{{ $currency }} {{ $values[$month] ?? 0 }}
{{ $name }}{{ $currency }} {{ $annualAmount }}{{ $currency }} {{ $values[$month] ?? 0 }}
{{ __('index.total_deduction') }} {{ $currency }} {{ $totalAnnualDeduction }}{{ $currency }} {{ $totalMonthlyDeduction[$month] }}
{{ __('index.actual_salary') }} {{ $currency }} {{ $totalAnnualIncome - $totalBonusAmount - $totalAnnualDeduction }}{{ $currency }} {{ $monthlyTotals[$month] - $totalMonthlyDeduction[$month] }}
Tds {{ $currency }} {{ $totalTds }}{{ $monthlyTDS[$month] ? $currency . ' ' . $monthlyTDS[$month] : '' }}
{{ __('index.total_payable') }}{{ $currency }} {{ $annualTotalPayable }}{{ $currency }} {{ $monthlyTotalPayable }}
{{ __('index.additional_information') }} (This is for office use only. it doesn't fall under taxable income. )
@foreach($allMonths as $month) @endforeach @if($reportData->total_ssf_contribution >0) @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @php $monthlyTotals[$month] += $monthlySsfContribution[$month] ?? 0; @endphp @else @endif @endforeach @endif @if($reportData->total_pf_contribution >0) @foreach($allMonths as $month) @php $showData = in_array($month, $monthData); @endphp @if($showData) @php $monthlyTotals[$month] += $monthlyPfContribution[$month] ?? 0; @endphp @else @endif @endforeach @endif
{{ __('index.particular') }} {{ __('index.total') }}{{ $months[$month] }}
{{ __('index.ssf_contribution') }} ({{ __('index.office') }}) {{ $currency }} {{ $reportData->total_ssf_contribution }}{{ $currency }} {{ $monthlySsfContribution[$month] ?? 0 }}
{{ __('index.pf_contribution') }} ({{ __('index.office') }}) {{ $currency }} {{ $reportData->total_pf_contribution }}{{ $currency }} {{ $monthlyPfContribution[$month] ?? 0 }}
@php $taxableIncome = $totalAnnualIncome - $totalAnnualDeduction - $totalBonusAmount; @endphp @if (isset($taxData[$reportData->employee->marital_status]))
{{ __('index.tax_calculation_on_taxable_income') }} ({{ ucfirst($reportData->employee->marital_status) }})
@php $remainingIncome = $taxableIncome; $totalTax = 0; $isFirstBracket = true; @endphp @foreach($taxData[$reportData->employee->marital_status] as $bracket) @php $from = $bracket->annual_salary_from; $to = $bracket->annual_salary_to >= 1.0E+20 ? null : $bracket->annual_salary_to; $percent = $bracket->tds_in_percent; $bracketIncome = min(max($remainingIncome, 0), $to ? $to - $from : $remainingIncome); $taxAmount = $bracketIncome * ($percent / 100); if (($enableTaxExemption == 1) && $isFirstBracket && $reportData->total_ssf_deduction > 0) { $taxAmount = 0; } $totalTax += $taxAmount; $remainingIncome -= $bracketIncome; $isFirstBracket = false; @endphp @endforeach @php $totalTax += $totalBonusTax; $taxDeduction = ($reportData->medical_claim ?? 0) + ($reportData->female_discount ?? 0) + ($reportData->other_discount ?? 0); @endphp
{{ __('index.from') }} {{ __('index.to') }} {{ __('index.income') }} {{ __('index.percent') }} {{ __('index.tax_amount') }}
{{ $currency }} {{ $from }} {{ $to ? $currency . ' ' . $to : '' }} {{ $currency }} {{ $bracketIncome }} {{ $percent }}% {{ $currency }} {{ $taxAmount }}
{{ __('index.total') }} {{ $currency }} {{ $taxableIncome }} {{ $currency }} {{ $totalTax }}
{{ __('index.less_tax_deduction') }} {{ __('index.medical_claim') }} {{ $currency }} {{ $reportData->medical_claim ?? 0 }}
{{ __('index.female_discount') }} {{ $currency }} {{ $reportData->female_discount ?? 0 }}
{{ __('index.other_discount') }} {{ $currency }} {{ $reportData->other_discount ?? 0 }}
{{ __('index.total_payable_tds') }} (* with bonus tax) {{ $currency }} {{ $totalTax - $taxDeduction }}
{{ __('index.total_paid_tds') }} {{ $currency }} {{ $reportData->total_paid_tds ?? 0 }}
{{ __('index.total_due_tds') }} {{ $currency }} {{($totalTax - $taxDeduction - ($reportData->total_paid_tds ?? 0)) }}
@else

{{ __('index.tax_data_not_available') }} ({{ $reportData->employee->name }}).

@endif
@endsection