{{-- Logo N School Details--}} {{----}}
{{ strtoupper(Qs::getSetting('system_name')) }}
{{--
--}} {{ ucwords($s['address']) }}
TABULATION SHEET FOR {{ strtoupper($my_class->name) }} {{strtoupper($section->name ?? '')}} {{strtoupper($ex->name ?? '')}} {{strtoupper($year ?? '')}}

{{--Background Logo--}}
{{-- Tabulation Begins --}} @foreach($subjects as $sub) @endforeach {{-- @if($ex->term == 3) @endif--}} @php // Compute each student's total marks and sort descending $students = $students->map(function ($s) use ($marks, $tex, $subjects, $exam_id) { $s->computed_total = $marks ->where('student_id', $s->user_id) ->where('exam_id', $exam_id) ->sum($tex); return $s; })->sortByDesc('computed_total')->values(); $prev_total = null; $rank = 0; $position = 0; @endphp @foreach($students as $index => $s) @php // Assign rank based on total marks if ($s->computed_total !== $prev_total) { $rank = ++$position; $prev_total = $s->computed_total; } $subject_count = $subjects->count(); $student_average = $subject_count > 0 ? round($s->computed_total / $subject_count, 2) : '-'; @endphp @foreach($subjects as $sub) @endforeach @endforeach
# NAMES_OF_STUDENTS_IN_CLASS{{ strtoupper($sub->slug ?: $sub->name) }}1ST TERM TOTAL 2ND TERM TOTAL 3RD TERM TOTAL CUM Total CUM AverageTotal Average Position
{{ $rank }} {{ $s->user->name }} {{ $marks->where('student_id', $s->user_id) ->where('subject_id', $sub->id) ->first()->$tex ?? '-' }} {{ $s->computed_total ?: '-' }} {{ $student_average ?: '-' }} {!! Mk::getSuffix($rank) !!}