@extends('app-new') @push('head-script') @endpush @push('content-header') @endpush @section('content')
{{-- Flash Messages --}}
@if(session('status')) @endif @if(session('error')) @endif
{{-- Action Bar --}}
{{ ucfirst($declaration->declaration_type ?? 'Provisional') }} Declaration @if(($declaration->status ?? '') === 'calculated') Calculated @elseif(($declaration->status ?? '') === 'active') ✓ Active @else {{ ucfirst($declaration->status ?? 'Draft') }} @endif @if(in_array($declaration->status ?? '', ['calculated', 'draft'])) @php $pendingProofs = 0; if (($declaration->declaration_type ?? 'provisional') === 'final') { $pendingProofs = $declaration->details->where('declared_amount', '>', 0)->filter(function($d) { return empty($d->proof_status) || $d->proof_status !== 'verified'; })->count(); } @endphp @if(($declaration->declaration_type ?? 'provisional') === 'final' && $pendingProofs > 0) {{ $pendingProofs }} proof(s) pending @endif @endif
{{-- Step 1: Employee & Income Details --}}

Step 1: Employee & Income Details

Employee
{{ $declaration->employee->name ?? 'N/A' }} ({{ $declaration->employee->employee_code ?? '' }})
Tax Regime
{{ strtoupper($declaration->regime ?? 'OLD') }} REGIME
Financial Year
{{ $declaration->financialYear?->label ?? $fy ?? 'N/A' }}
Declaration Type
{{ ucfirst($declaration->declaration_type ?? 'Provisional') }} @if(($declaration->declaration_type ?? 'provisional') === 'provisional') Based on assumed investments @else With proofs – uses approved amounts @endif
@if($profile)
Salary Components
Annual CTC
₹ {{ number_format($profile->annual_ctc ?? 0, 0) }}
Basic Salary (Annual)
₹ {{ number_format($profile->basic_salary ?? 0, 0) }}
HRA Received (Annual)
₹ {{ number_format($profile->hra_received ?? 0, 0) }}
PAN Number
{{ $profile->pan_number ?? 'N/A' }}
Rent Paid (Annual)
₹ {{ number_format($profile->rent_paid ?? 0, 0) }}
Rent Receipt / Agreement
@if(!empty($profile->rent_proof_file)) View @if(($profile->rent_proof_status ?? '') === 'verified') Verified @elseif(($profile->rent_proof_status ?? '') === 'rejected') Rejected @else Pending @endif @else Not uploaded @endif
Metro City
{{ ($profile->is_metro_city ?? false) ? 'Yes' : 'No' }}
@endif
{{-- Step 2: Section-wise Declarations (Old Regime Only) --}} @if(($declaration->regime ?? 'old') === 'old' && $deductions && count($deductions) > 0)

Step 2: Investment Declarations (Section-wise)

@if(($declaration->declaration_type ?? 'provisional') === 'final') Final Declaration @endif
@foreach($deductions as $deduction) @endforeach
Section Description Declared (₹) Approved (₹) Proof Remarks
{{ $deduction->taxSection->section_code ?? 'N/A' }} {{ $deduction->taxSection->name ?? '' }} @if($deduction->taxSectionHead)
↳ {{ $deduction->taxSectionHead->name ?? '' }} @endif @if($deduction->description)
{{ $deduction->description }} @endif
{{ number_format($deduction->declared_amount ?? 0, 0) }} @if(($deduction->approved_amount ?? 0) != ($deduction->declared_amount ?? 0)) {{ number_format($deduction->approved_amount ?? 0, 0) }} @else {{ number_format($deduction->approved_amount ?? 0, 0) }} @endif @if($deduction->proof_file) View @else — @endif {{ $deduction->proof_remarks ?? '—' }}
Total: ₹ {{ number_format($deductions->sum('declared_amount'), 0) }} ₹ {{ number_format($deductions->sum('approved_amount'), 0) }}
@endif {{-- TDS Calculation Sheet --}} @if($calculation) @php $regime = $declaration->regime ?? 'old'; $grossIncome = (float)($calculation->gross_income ?? 0); $actualSalary = (float)($calculation->actual_salary ?? 0); $projectedSalary = (float)($calculation->projected_salary ?? 0); $stdDed = (float)($calculation->standard_deduction ?? 0); $gti = max(0, $grossIncome - $stdDed); $hraEx = (float)($calculation->hra_exemption ?? 0); $chap6 = max(0, ($calculation->total_deductions ?? 0) - $hraEx - $stdDed); $taxableInc = (float)($calculation->taxable_income ?? 0); $taxAmt = (float)($calculation->tax_amount ?? 0); $surcharge = (float)($calculation->surcharge ?? 0); $rebate = (float)($calculation->rebate ?? 0); $cess = (float)($calculation->education_cess ?? 0); $totalTax = (float)($calculation->total_tax ?? 0); $deducted = (float)($calculation->tax_already_deducted ?? 0); $remaining = (float)($calculation->remaining_tax ?? 0); $months = (int)($calculation->remaining_months ?? 0); $monthlyTds = (float)($calculation->monthly_tds ?? 0); $regimeLabel = strtoupper($regime) . ' Regime'; @endphp

TDS Calculation Sheet Version {{ $calculation->version ?? 1 }} · {{ $calculation->created_at?->format('d-M-Y H:i') ?? '' }}

{{ ucfirst($calculation->status ?? 'Calculated') }}
{{-- Projected Gross Salary breakdown --}} {{-- Standard Deduction --}} {{-- GTI --}} {{-- Old Regime deductions --}} @if($regime === 'old') @if($calculation->deductions && count($calculation->deductions) > 0) @foreach($calculation->deductions as $calcDed) @if(($calcDed->eligible_amount ?? 0) > 0) @endif @endforeach @endif @endif {{-- Total Taxable Income --}} {{-- Tax --}}
Description Projected (₹) {{ $regimeLabel }} (₹)
Actual Salary (past months from payslips) {{ number_format($actualSalary, 0) }}
Projected Salary (current & future months from CTC) {{ number_format($projectedSalary, 0) }}
Projected Gross Salary (Total) {{ number_format($grossIncome, 0) }} {{ number_format($grossIncome, 0) }}
Less: Standard Deduction u/s 16 -{{ number_format($stdDed, 0) }}
Gross Total Income {{ number_format($gti, 0) }}
Less: HRA Exemption {{ $hraEx > 0 ? '-' . number_format($hraEx, 0) : '0' }}
Less: Deductions under Chapter VI-A {{ $chap6 > 0 ? '-' . number_format($chap6, 0) : '0' }}
{{ $calcDed->taxSection->section_code ?? '' }} — {{ $calcDed->taxSection->name ?? '' }} @if($calcDed->taxSectionHead) — {{ $calcDed->taxSectionHead->name }}@endif {{ number_format($calcDed->eligible_amount, 0) }}
Total Taxable Income {{ number_format($taxableInc, 0) }}
Tax on Total Income {{ number_format($taxAmt, 0) }}
Add: Surcharge {{ number_format($surcharge, 0) }}
Less: Rebate u/s 87A {{ $rebate > 0 ? '-' . number_format($rebate, 0) : '0' }}
Add: Health & Education Cess (4%) {{ number_format($cess, 0) }}
Total Tax Liability {{ number_format($totalTax, 0) }}
Less: Tax Deducted Till Date {{ number_format($deducted, 0) }}
Tax to be Deducted (Balance) {{ number_format($remaining, 0) }}
Remaining Months in FY {{ $months }} months
Monthly TDS ₹ {{ number_format($monthlyTds, 0) }}
@else
No Calculation Found

Tax has not been calculated for this declaration yet.

Edit & Calculate
@endif {{-- Monthly TDS Breakdown --}} @if($monthly_tds && count($monthly_tds) > 0)

Monthly TDS Breakdown

@foreach($monthly_tds as $tds) @endforeach
Month & Year Gross Salary (₹) TDS Amount (₹) Cumulative TDS (₹) Status
{{ DateTime::createFromFormat('!m', $tds->month ?? 1)->format('F') }} {{ $tds->year ?? date('Y') }} {{ number_format($tds->gross_salary ?? 0, 0) }} {{ number_format($tds->tds_amount ?? 0, 0) }} {{ number_format($tds->cumulative_tds ?? 0, 0) }} @if(($tds->status ?? '') === 'deducted') Deducted @elseif(($tds->status ?? '') === 'pending') Pending @else {{ ucfirst($tds->status ?? 'N/A') }} @endif
@endif {{-- Version History --}} @if($versionChain && count($versionChain) > 1)

Calculation Version History

@foreach($versionChain as $version) id === ($calculation->id ?? null)) class="table-active" @endif> @endforeach
Version Status Created Gross Income (₹) Taxable Income (₹) Total Tax (₹)
v{{ $version->version ?? 1 }} @if($version->id === ($calculation->id ?? null)) CURRENT @endif @if(($version->status ?? '') === 'superseded') Superseded @elseif(($version->status ?? '') === 'active') Active @elseif(($version->status ?? '') === 'calculated') Calculated @else {{ ucfirst($version->status ?? 'N/A') }} @endif {{ $version->created_at?->format('d-M-Y H:i') ?? 'N/A' }} {{ number_format($version->gross_income ?? 0, 0) }} {{ number_format($version->taxable_income ?? 0, 0) }} {{ number_format($version->total_tax ?? 0, 0) }}
@endif {{-- Approval Logs --}} @if($declaration->approvalLogs && count($declaration->approvalLogs) > 0)

Approval Workflow History

@foreach($declaration->approvalLogs->sortByDesc('created_at') as $log) @endforeach
Date & Time Action By Comments
{{ $log->created_at?->format('d-M-Y H:i') ?? 'N/A' }} @if(($log->action ?? '') === 'calculated') Calculated @elseif(($log->action ?? '') === 'approved') Approved @elseif(($log->action ?? '') === 'rejected') Rejected @elseif(($log->action ?? '') === 'superseded') Superseded @else {{ ucfirst($log->action ?? 'N/A') }} @endif {{ $log->actionUser->name ?? 'System' }} {{ $log->comments ?? '-' }}
@endif
{{-- Approve Modal --}} {{-- Reject Modal --}} @endsection @push('footer-script') @endpush