@extends('layout.report', ['max_width' => '100%']) @section('report') @php $sums = []; @endphp

Missed Hours Report

{{ $group->name }}      {{ 'Week ' . $from . ' to ' . $to }}        {{ 'exported at: ' . date('d-m-Y H:i') }}
@foreach ($courses as $course) @endforeach {{-- --}} @foreach ($courses as $course) @php $sums[$course->id] = [ 'missed' => 0, 'excused_hours' => 0, ]; @endphp @endforeach @php $sums['morning'] = [ 'missed' => 0, 'excused_hours' => 0, ]; $sums['total'] = [ 'missed' => 0, 'excused_hours' => 0, ]; @endphp {{-- --}} {{-- --}} @foreach ($students as $student) @foreach ($courses as $course) @php $missed = $student->missedHours($course->id, $from, $to); $excused = $student->excusedHours($course->id, $from, $to); $sums[$course->id]['missed'] += $missed; $sums[$course->id]['excused_hours'] += $excused; @endphp @endforeach @php // $total_morning = max(0,$student->morningAbsences($from, $to)->sum('total_missed_hours')); // $excused_morning = $student->morningAbsences($from, $to, false, true)->sum('excused_hours'); $total_missed = $student->missedHours(null, $from, $to); $total_excused = $student->excusedHours(null, $from, $to, false, true); $sums['total']['missed'] += $total_missed; $sums['total']['excused_hours'] += $total_excused; // $sums['morning']['missed'] += $total_morning; // $sums['morning']['excused_hours'] += $excused_morning; @endphp {{-- --}} {{-- --}} @endforeach @foreach ($courses as $course) @endforeach {{-- --}} {{-- --}}
no Name{{ $course->name }}Morning AssemblyTotal
missed execusemissedexecusemissed execuse
{{ $loop->iteration }} {{ $student->user->name }}{{ $missed }} {{ $excused }}{{ $total_morning }}{{ $excused_morning }}{{ $total_missed }} {{ $total_excused }}
Total{{ $sums[$course->id]['missed'] }} {{ $sums[$course->id]['excused_hours'] }}{{ $sums['morning']['missed'] }}{{ $sums['morning']['excused_hours'] }}{{ $sums['total']['missed'] }} {{ $sums['total']['excused_hours'] }}
@endsection