@extends('admin.admin_dashboard') @section('admin') @php // dynamic weights from first row (same for all subjects in a term) $firstRow = collect($subjectBreakdown)->first() ?? []; $mtPctHead = $firstRow['mt_pct'] ?? 0; $termPctHead= $firstRow['term_pct'] ?? 0; // running totals $tMtFull = $tMtObt = $tMtContrib = 0; $tTermFull = $tTermObt = $tTermContrib = 0; $tFinal = 0; // convenience $rows = collect($subjectBreakdown)->values(); @endphp
{{-- School Header --}}
School Logo

{{ $school->name ?? config('app.name', 'Your School') }}

{{ $school->address ?? 'Address' }} | Phone: {{ $school->phone ?? '-' }}

{{-- Top bar: title + export --}}

Marksheet – {{ $student->student_name_english ?? $student->name ?? 'Student' }}{{ $student->admission_roll ? ' - Roll: '.$student->admission_roll : '' }}

PDF Excel
{{-- Exam / Student Meta --}}
Exam {{ $exam->exam_name }} Session {{ $exam->session->name ?? '-' }}
Class {{ $exam->class->name ?? '-' }} Section {{ $section->name ?? '-' }}
Student Name {{ $student->student_name_english ?? $student->name ?? '-' }} Student ID {{ $student->student_id ?? $student->id }}
Class Position {{ $positionClass ?? '-' }} Section Position {{ $positionSection ?? '-' }}
{{-- Result detail marks --}}
Result detail marks
{{-- MT --}} {{-- Term --}} @foreach($rows as $row) @php // term components → MCQ/CQ/Practical obtain $comp = collect($row['term_components'] ?? []); $findComp = function($label) use ($comp) { $r = $comp->first(function($c) use ($label){ return isset($c['name']) && strcasecmp($c['name'], $label) === 0; }); return $r['obt'] ?? null; }; $mcq = $findComp('MCQ'); $cq = $findComp('CQ'); $prac= $findComp('Practical'); // accumulate totals $tMtFull += floatval($row['mt_full'] ?? 0); $tMtObt += floatval($row['mt_total'] ?? 0); $tMtContrib += floatval($row['mt_contrib'] ?? 0); $tTermFull += floatval($row['term_total_full'] ?? 0); $tTermObt += floatval($row['term_total_obt'] ?? 0); $tTermContrib += floatval($row['term_contrib'] ?? 0); $tFinal += floatval($row['final_percent_of_100'] ?? 0); @endphp {{-- MT --}} {{-- Term --}} {{-- Final + Grade --}} @endforeach {{-- Totals Row --}} {{-- MT totals --}} {{-- Term totals --}} {{-- Final sum + overall grade --}}
Subject MT ({{ number_format($mtPctHead,2) }}%) Term ({{ number_format($termPctHead,2) }}%) Final marks Grade
Full Marks Obtain ContributionFull marks MCQ CQ Practical Total obtain Contribution
{{ $row['subject_name'] }} {{ !is_null($row['mt_full']) ? number_format($row['mt_full'],2) : '-' }} {{ !is_null($row['mt_total']) ? number_format($row['mt_total'],2) : '-' }} {{ number_format($row['mt_contrib'] ?? 0, 2) }} {{ number_format($row['term_total_full'] ?? 0, 2) }} {{ !is_null($mcq) ? number_format($mcq,2) : '-' }} {{ !is_null($cq) ? number_format($cq,2) : '-' }} {{ !is_null($prac)? number_format($prac,2): '-' }} {{ number_format($row['term_total_obt'] ?? 0, 2) }} {{ number_format($row['term_contrib'] ?? 0, 2) }}{{ number_format($row['final_percent_of_100'] ?? 0, 2) }} {{ $row['grade'] ?? '-' }}
Total{{ number_format($tMtFull,2) }} {{ number_format($tMtObt,2) }} {{ number_format($tMtContrib,2) }}{{ number_format($tTermFull,2) }} - - - {{ number_format($tTermObt,2) }} {{ number_format($tTermContrib,2) }}{{ number_format($tFinal,2) }} {{ $overallGrade ?? '-' }}
Average % (across subjects) {{ number_format($avgPercent ?? 0, 2) }}
@endsection