@extends('reportes.layouts.pdf-base') @section('estilos-adicionales') @endsection @section('contenido') {{-- EVOLUCIÓN POR GESTIÓN (si hay múltiples gestiones) --}} @if (isset($evolucion) && $evolucion->count() > 1)

📈 Evolución Histórica

@foreach ($evolucion as $item)
{{ $item['gestion'] }}
{{ $item['total_poas'] }} POAs
Bs. {{ number_format($item['presupuesto'] / 1000000, 1) }}M
{{ $item['porcentaje'] }}% ejec.
@endforeach
@endif {{-- RANKINGS TOP 5 --}}

🏆 Rankings - Top 5

{{-- Mejor Ejecución --}}
✅ Mejor Ejecución
@foreach ($rankings['mejor_ejecucion'] as $index => $poa) @php $porcentaje = $poa->presupuesto_inicial > 0 ? round(($poa->ejecutado / $poa->presupuesto_inicial) * 100, 2) : 0; @endphp
{{ $index + 1 }}. {{ Str::limit($poa->unidadEducativa->nombre ?? 'N/A', 28) }}
{{ $porcentaje }}%
@endforeach
{{-- Mayor Presupuesto --}}
💰 Mayor Presupuesto
@foreach ($rankings['mayor_presupuesto'] as $index => $poa)
{{ $index + 1 }}. {{ Str::limit($poa->unidadEducativa->nombre ?? 'N/A', 28) }}
Bs. {{ number_format($poa->presupuesto_inicial / 1000, 0) }}K
@endforeach
{{-- Requieren Atención --}}
⚠️ Requieren Atención
@foreach ($rankings['menor_ejecucion'] as $index => $poa) @php $porcentaje = $poa->presupuesto_inicial > 0 ? round(($poa->ejecutado / $poa->presupuesto_inicial) * 100, 2) : 0; @endphp
{{ Str::limit($poa->unidadEducativa->nombre ?? 'N/A', 28) }}
{{ $porcentaje }}%
@endforeach
{{-- TABLA COMPLETA --}}

📋 Listado Completo por Unidad Educativa

@foreach ($poas->sortByDesc(function ($p) { return $p->presupuesto_inicial > 0 ? ($p->ejecutado / $p->presupuesto_inicial) * 100 : 0; }) as $index => $poa) @php $porcentaje = $poa->presupuesto_inicial > 0 ? round(($poa->ejecutado / $poa->presupuesto_inicial) * 100, 2) : 0; $clase = match (true) { $porcentaje >= 80 => 'background: #e8f5e9;', $porcentaje >= 50 => 'background: #fff9c4;', default => 'background: #ffebee;', }; $estadoLabel = match (true) { $porcentaje >= 80 => 'Óptimo', $porcentaje >= 50 => 'Aceptable', default => 'Bajo', }; @endphp @endforeach
Unidad Educativa Gestión Cant. Presupuesto Ejecutado % Ejec. Estado
{{ $index + 1 }} {{ $poa->unidadEducativa->nombre ?? 'N/A' }} {{ $poa->gestion }} {{ $poa->cantidad ?? 0 }} Bs. {{ number_format($poa->presupuesto_inicial, 2) }} Bs. {{ number_format($poa->ejecutado, 2) }} {{ $porcentaje }}% {{ $estadoLabel }}
TOTALES: Bs. {{ number_format($estadisticas['presupuesto_total'], 2) }} Bs. {{ number_format($estadisticas['ejecutado_total'], 2) }} {{ $estadisticas['porcentaje_ejecucion'] }}%
{{-- RESUMEN --}}
RESUMEN: Total UEs: {{ $poas->count() }} | Gestión: {{ $gestion }} | Promedio Ejecución: {{ $estadisticas['porcentaje_ejecucion'] }}%
@endsection @section('footer-extra') Reporte por Gestión {{ $gestion ?? '' }} @endsection