@extends('backend.teacher_backend.teacher_dashboard') @section('teacher')
{{-- Print --}} {{-- Excel --}} Excel {{-- PDF --}} PDF

Student Broadsheet

Class {{ strtoupper($class->class_name) }} Session {{ request('session') }} Term(s) {{ implode(', ', $selectedTerms) }}
@foreach($subjects as $subject) @endforeach @foreach($subjects as $subject) @endforeach @foreach($students as $student) @php /* |-------------------------------------------------------------------------- | STUDENT GRAND TOTAL |-------------------------------------------------------------------------- | | Total of all Subject Percentages | */ $grandTotal = 0; /* |-------------------------------------------------------------------------- | Subject Counter |-------------------------------------------------------------------------- | | Number of Subjects Offered | */ $subjectCount = 0; @endphp {{-- =============================================================== LOOP THROUGH EVERY SUBJECT =============================================================== --}} @foreach($subjects as $subject) @php /* |-------------------------------------------------------------------------- | First Term Result |-------------------------------------------------------------------------- */ $first = $sheet[$student->id][$subject->id]['First Term'] ?? null; /* |-------------------------------------------------------------------------- | Second Term Result |-------------------------------------------------------------------------- */ $second = $sheet[$student->id][$subject->id]['Second Term'] ?? null; /* |-------------------------------------------------------------------------- | Third Term Result |-------------------------------------------------------------------------- */ $third = $sheet[$student->id][$subject->id]['Third Term'] ?? null; /* |-------------------------------------------------------------------------- | Display Values |-------------------------------------------------------------------------- | | Only display selected terms. | */ $firstCum = in_array('First Term',$selectedTerms) ? ($first->total ?? '-') : '-'; $secondCum = in_array('Second Term',$selectedTerms) ? ($second->total ?? '-') : '-'; $thirdCum = in_array('Third Term',$selectedTerms) ? ($third->total ?? '-') : '-'; /* |-------------------------------------------------------------------------- | Subject Total Cum |-------------------------------------------------------------------------- */ $totalCum = 0; $termUsed = 0; if($first){ if(in_array('First Term',$selectedTerms)){ $totalCum += $first->total; $termUsed++; } } if($second){ if(in_array('Second Term',$selectedTerms)){ $totalCum += $second->total; $termUsed++; } } if($third){ if(in_array('Third Term',$selectedTerms)){ $totalCum += $third->total; $termUsed++; } } /* |-------------------------------------------------------------------------- | Subject Percentage |-------------------------------------------------------------------------- */ $percentage = $termUsed ? round($totalCum/$termUsed,2) : 0; /* |-------------------------------------------------------------------------- | Grade |-------------------------------------------------------------------------- */ if($percentage>=70){ $grade="A"; }elseif($percentage>=60){ $grade="B"; }elseif($percentage>=50){ $grade="C"; }elseif($percentage>=45){ $grade="D"; }elseif($percentage>=40){ $grade="E"; }else{ $grade="F"; } /* |-------------------------------------------------------------------------- | Grand Total |-------------------------------------------------------------------------- */ if($termUsed){ $grandTotal += $percentage; $subjectCount++; } @endphp @endforeach @php /* |-------------------------------------------------------------------------- | Overall Average |-------------------------------------------------------------------------- */ $average = $subjectCount ? round($grandTotal/$subjectCount,2) : 0; @endphp @endforeach
S/N Student ID Student Name {{ strtoupper($subject->subject_name) }} TOTAL AVERAGE POSITION
1ST 2ND 3RD TOTAL % GRADE
{{ $loop->iteration }} {{ strtoupper($student->user->user_name) }} {{ strtoupper($student->name) }} {{ $firstCum }} {{ $secondCum }} {{ $thirdCum }} {{ $termUsed ? round($totalCum,2) : '-' }} {{ $termUsed ? round($percentage,2) : '-' }} {{ $termUsed ? $grade : '-' }} {{ round($grandTotal,2) }} {{ $average }} @php $position = $studentPositions[$student->id] ?? '-'; /* |-------------------------------------------------------------------------- | Position Suffix |-------------------------------------------------------------------------- */ if(is_numeric($position)){ if($position % 10 == 1 && $position != 11){ $suffix = "st"; }elseif($position % 10 == 2 && $position != 12){ $suffix = "nd"; }elseif($position % 10 == 3 && $position != 13){ $suffix = "rd"; }else{ $suffix = "th"; } echo $position.$suffix; }else{ echo "-"; } @endphp
@endsection