{{-- Summary Table --}} @php $summaryAdvisors = $advisorReport ?? collect(); @endphp @if($summaryAdvisors->count())
Advisor Commission Summary
@foreach($summaryAdvisors as $i => $adv) @endforeach
# Advisor Name Code Students Total Fee Collected Advisor Fee Comm % Commission Earned
{{ $i+1 }} {{ $adv->name }} {{ $adv->advisor_code }} {{ $adv->students }} ₹{{ number_format($adv->total_fee, 0) }} ₹{{ number_format($adv->collected, 0) }} ₹{{ number_format($adv->advisor_fee, 0) }} {{ $adv->commission }}% ₹{{ number_format($adv->commission_amt, 0) }}
TOTAL: {{ $summaryAdvisors->sum('students') }} ₹{{ number_format($summaryAdvisors->sum('total_fee'), 0) }} ₹{{ number_format($summaryAdvisors->sum('collected'), 0) }} ₹{{ number_format($summaryAdvisors->sum('advisor_fee'), 0) }} ₹{{ number_format($summaryAdvisors->sum('commission_amt'), 0) }}
@endif {{-- Per-Advisor Detail --}}
Advisor-Wise Student Detail
@php $grandCommission = 0; $grandAdvisorFee = 0; @endphp @forelse($advisorDetails as $advName => $rows) @php $firstRow = $rows->first(); $advCode = $firstRow->advisor_code ?? ''; $commRate = $firstRow->commission_rate ?? 0; $subtotalFee = $rows->sum('total_fee'); $subtotalAdvFee = $rows->sum('advisor_fee'); $subtotalPaid = $rows->sum('paid'); $subtotalComm = round($subtotalAdvFee * $commRate / 100, 2); $grandAdvisorFee += $subtotalAdvFee; $grandCommission += $subtotalComm; @endphp
{{ $advName }}   |   Code: {{ $advCode }}   |   Commission: {{ $commRate }}%   |   {{ $rows->count() }} Students   |   Commission Earned: ₹{{ number_format($subtotalComm, 0) }}
@foreach($rows as $i => $row) @php $commEarned = round($row->advisor_fee * $commRate / 100, 2); @endphp @endforeach
# Student Name Enrollment No Institute Course Total Fee Advisor Fee Paid Commission
{{ $i+1 }} {{ $row->student_name }} {{ $row->enrollment_no }} {{ $row->institute_name }} {{ $row->course_name }} ₹{{ number_format($row->total_fee, 0) }} ₹{{ number_format($row->advisor_fee, 0) }} ₹{{ number_format($row->paid, 0) }} ₹{{ number_format($commEarned, 0) }}
Advisor Subtotal: ₹{{ number_format($subtotalFee, 0) }} ₹{{ number_format($subtotalAdvFee, 0) }} ₹{{ number_format($subtotalPaid, 0) }} ₹{{ number_format($subtotalComm, 0) }}
@empty

No advisor commission data found for the selected filters.

@endforelse @if(!$advisorDetails->isEmpty())
GRAND COMMISSION TOTAL: ₹{{ number_format($grandAdvisorFee, 0) }} ₹{{ number_format($grandCommission, 0) }}
@endif