@extends('layouts.app') @section('title', 'Fees / Invoicing') @section('content') @php $tabs = ['Voteheads', 'Govt Allocation', 'Set Fees & Invoice', 'Recurring', 'Invoice per Student', 'Fees Adjustment', 'Close Term']; $active = request()->input('tab', 'Voteheads'); @endphp

Fees / Invoicing

Configure voteheads, fee structures and student invoices

@foreach ($tabs as $tab) {{ $tab }} @endforeach
{{-- Voteheads --}}

Tuition Voteheads

@csrf
@foreach ($voteheads as $v) @endforeach
# Votehead Priority Type Default Amount
{{ $v->id }} {{ $v->name }} {{ $v->priority }} {{ $v->is_system ? 'System' : $v->category }} @php $defaults = ['vh-2' => 15000, 'vh-3' => 12000, 'vh-4' => 3000, 'vh-5' => 2000, 'vh-6' => 1500, 'vh-7' => 2500, 'vh-8' => 3500, 'vh-9' => 2500]; @endphp {{ isset($defaults['vh-'.$v->id]) ? 'KES '.number_format($defaults['vh-'.$v->id]) : '—' }} @unless ($v->is_system)
@csrf @method('DELETE')
@endunless
{{-- Govt Allocation --}}

Government Allocation Voteheads

Layout the govt voteheads used when receiving institutional allocations. Save allocations on the Gov Allocations page.

@foreach ($govtVoteheads as $v) @endforeach
# Votehead Priority
{{ $v->id }} {{ $v->name }} {{ $v->priority }}
{{-- Set Fees & Invoice --}}
@if (\App\Models\Student::FORMS) @php $seedRows = \Illuminate\Support\Facades\DB::table('fee_structures') ->where('year', '2026')->where('term', request('term', 'Term 1')) ->where('class_name', request('class', \App\Models\Student::FORMS[0]))->first(); $items = $seedRows ? \Illuminate\Support\Facades\DB::table('fee_structure_items') ->join('finance_voteheads', 'finance_voteheads.id', '=', 'fee_structure_items.votehead_id') ->where('fee_structure_items.fee_structure_id', $seedRows->id) ->select('fee_structure_items.id', 'finance_voteheads.name', 'fee_structure_items.amount') ->orderBy('finance_voteheads.priority')->get() : collect(); @endphp

Set Fees & Generate Invoices

{{ $studentInvoices }} invoices on file · {{ \App\Models\Student::FORMS[0] }} selected
@csrf @foreach ($items as $it) @endforeach
Votehead Amount
{{ $it->name }}
Total per student KES {{ number_format($items->sum('amount')) }}
@endif
{{-- Recurring --}}

Recurring Fees Wizard

Copy a class fee structure across to another class or term.

@csrf
{{-- Invoice per Student --}}

Student Invoice

@if ($student)

{{ $student->full_name }} · {{ $student->admission_no }} · {{ $student->class_name }} {{ $student->stream }}

@if ($invoice)

{{ $invoice->term }} {{ $invoice->year }} · Status: {{ $invoice->status }} · Balance: KES {{ number_format($invoice->total_balance, 2) }}

@csrf @foreach ($items as $it) @endforeach
Votehead Amount Paid Balance Adjust
{{ $it->votehead_name }} {{ number_format($it->amount, 2) }} {{ number_format($it->paid, 2) }} {{ number_format($it->balance, 2) }}
@else

No invoice found for this student yet.

@endif
@endif
{{-- Fees Adjustment --}}

Class Negotiated Fees

Per-student negotiated adjustments, e.g. siblings or performance discounts.

@if ($student && $invoice)

Applying adjustment to {{ $student->full_name }} ({{ $invoice->term }} {{ $invoice->year }}). Use the Invoice per Student tab above.

@else

Load a student above, then adjust their line items in the Invoice per Student grid.

@endif
{{-- Close Term --}}
@php $closeStats = \Illuminate\Support\Facades\DB::table('invoices')->groupBy('class_name')->selectRaw('class_name, COUNT(*) cnt, SUM(total_balance) balance')->orderBy('class_name')->get(); @endphp

Close Term

Review outstanding balances before closing a term.

@foreach ($closeStats as $s) @endforeach
Class Students Outstanding
{{ $s->class_name }} {{ $s->cnt }} KES {{ number_format($s->balance, 2) }}
@csrf @method('PUT')
@endsection