@extends('layouts.master') @section('page_title', 'Student Billing Report') @section('content')
Student Billing Report Filters

Student Billing Report

@if($termId) Term: {{ $terms->firstWhere('id', $termId)->name ?? 'Unknown' }} @else All Terms @endif

Generated: {{ Carbon\Carbon::now()->format('M d, Y g:i A') }}

Total Bills: {{ $studentBills->count() }}

${{ number_format($studentBills->sum('total_amount'), 2) }}

Total Billed

${{ number_format($studentBills->sum('payments'), 2) }}

Total Paid

${{ number_format($studentBills->sum('discounts'), 2) }}

Total Discounts

${{ number_format($studentBills->sum('total_amount') - $studentBills->sum('payments') - $studentBills->sum('discounts'), 2) }}

Outstanding

Student Bills Breakdown
@if($studentBills->count() > 0) @foreach($studentBills as $bill)
{{ $bill->student_name }}

ID: {{ $bill->student_username }} | Class: {{ $bill->class_name }}{{ $bill->section_name ? ' - ' . $bill->section_name : '' }}

${{ number_format($bill->total_amount, 2) }}

Bill Total

@if($bill->items && $bill->items->count() > 0)
Bill Items:
@foreach($bill->items as $item) @endforeach
Item Amount
{{ $item->name }} ${{ number_format($item->amount, 2) }}
Subtotal ${{ number_format($bill->items->sum('amount'), 2) }}
Payment Summary
Total Billed: ${{ number_format($bill->total_amount, 2) }}
Payments: -${{ number_format($bill->payments, 2) }}
Discounts: -${{ number_format($bill->discounts, 2) }}

Outstanding: ${{ number_format($bill->total_amount - $bill->payments - $bill->discounts, 2) }}
@endif
@endforeach @else
No Data Found
No student bills found for the selected criteria.
@endif
@endsection