{{-- ==================== Due Fees Tab Start ==================== --}}
{{-- ===== Card Header + Controls Bar ===== --}}

Due Statement

As of Today: {{ $asOfDate->format('d M, Y') }}
{{-- Session Filter (AJAX driven by parent view.blade.php) --}}
{{-- Mode Switch (Admin control: Default = Original Fee counted as Due, Toggle = Actual Due) --}}
Original Fee
Due Amount
{{-- Print Statement Button --}}
{{-- ===== Summary Cards ===== --}}
{{-- Total Due Card (Includes late fee) --}}
Total Due (With Late Fee)
৳ {{ number_format($grandTotalOriginal, 2) }}
Fee: ৳ {{ number_format($totalOriginalAmount, 2) }} + Late: ৳ {{ number_format($totalLateFee, 2) }}
{{-- Late Fee Card --}}
Total Late Fee
৳ {{ number_format($totalLateFee, 2) }}
According to Late Fee Policy
{{-- Previous Month Dues Card --}}
Previous Month Dues
@if($previousMonthsDue->isEmpty())
No previous dues
@else
{{ $previousMonthsDue->join(', ') }}
@endif
Unpaid past months
{{-- ===== Due Statement Table ===== --}}
@forelse($feesData as $index => $item) @empty @endforelse @if(count($feesData) > 0) @endif
SL Fee Type Remarks Fee Month Due Amount Late Fee Total Due
{{ $index + 1 }} {{ $item['fee_type'] }} {{ $item['note'] }} {{ $item['month'] }} {{ number_format($item['original_amount'], 2) }} {{ number_format($item['late_amount'], 2) }} {{ number_format($item['total_original_with_late'], 2) }}
No due fees found up to today ({{ $asOfDate->format('d M, Y') }}).
Total: {{ number_format($totalOriginalAmount, 2) }} {{ number_format($totalLateFee, 2) }} {{ number_format($grandTotalOriginal, 2) }}
{{-- Metadata for Clean Print Statement Generator --}} @php $printMetadata = [ 'school' => [ 'name' => $schoolInfo->school_name ?? 'Smart Shikkha School', 'address' => $schoolInfo->address ?? '', 'phone' => $schoolInfo->phone ?? '', ], 'student' => [ 'name' => $student->student_name_english ?? $student->student_name_bangla ?? 'Student', 'student_id' => $student->student_id ?? $student->id ?? '-', 'class' => $registration->class_model?->name ?? '-', 'section' => $registration->section?->name ?? '-', 'roll' => $registration->class_roll ?? '-', 'session' => $selectedSession->name ?? '-', ], 'asOfDate' => $asOfDate->format('d/m/Y'), 'totals' => [ 'original_base' => number_format($totalOriginalAmount, 2), 'due_base' => number_format($totalDue, 2), 'late_fee' => number_format($totalLateFee, 2), 'grand_original' => number_format($grandTotalOriginal, 2), 'grand_due' => number_format($grandTotalDue, 2), ], 'previousDues' => $previousMonthsDue->values()->toArray(), 'items' => collect($feesData)->map(function ($f) { return [ 'fee_type' => (string)($f['fee_type'] ?? '-'), 'note' => (string)($f['note'] ?? '-'), 'month' => (string)($f['month'] ?? '-'), 'original_amount' => number_format($f['original_amount'] ?? 0, 2), 'due_amount' => number_format($f['due_amount'] ?? 0, 2), 'late_amount' => number_format($f['late_amount'] ?? 0, 2), 'total_original_with_late' => number_format($f['total_original_with_late'] ?? 0, 2), 'total_due_with_late' => number_format($f['total_due_with_late'] ?? 0, 2), ]; })->values()->toArray(), ]; @endphp
{{-- ==================== Due Fees Tab End ==================== --}}