@php $basicos = $formulario->basicos ?? []; $disposiciones = data_get($formulario->disposiciones, 'items', []); $ejecucion = $formulario->ejecucion ?? []; $verificacionItems = data_get($ejecucion, 'verificacion3.items', []); $verificacionStats = [ 'puntos_totales' => data_get($ejecucion, 'verificacion3.puntos_totales'), 'puntos_obtenidos' => data_get($ejecucion, 'verificacion3.puntos_obtenidos'), 'porcentaje' => data_get($ejecucion, 'verificacion3.porcentaje'), ]; $matrizResumen = data_get($ejecucion, 'matriz', []); $matrizDetalle = $formulario->matriz ?? []; $matrizItems = data_get($matrizDetalle, 'items', data_get($matrizDetalle, 'filas', [])); $servicios = $formulario->servicios ?? []; $registroEspecial = $formulario->registro_especial ?? []; $serviciosImagenes = collect(data_get($servicios, 'imagenes_urls', [])) ->prepend(data_get($servicios, 'imagen_url')) ->filter() ->unique() ->values() ->all(); $serviciosExtras = array_slice($serviciosImagenes, 1); $registroImagenes = collect(data_get($registroEspecial, 'imagenes_urls', [])) ->prepend(data_get($registroEspecial, 'imagen_url')) ->filter() ->unique() ->values() ->all(); $registroExtras = array_slice($registroImagenes, 1); $ejecucionDepartamento = data_get($ejecucion, 'departamento', data_get($basicos, 'departamento')); $ejecucionMunicipio = data_get($ejecucion, 'municipio', data_get($basicos, 'municipio')); $ejecucionMeses = collect(data_get($ejecucion, 'meses', [])) ->filter(function ($row) { return is_array($row) && (data_get($row, 'mes') || data_get($row, 'poblacion')); }) ->values() ->all(); $ejecucionMesesLabels = collect($ejecucionMeses)->pluck('mes')->filter()->unique()->values()->all(); $ejecucionAnalisis = data_get($ejecucion, 'analisis'); $ejecucionPoblacionTotal = collect($ejecucionMeses)->sum(function ($row) { return (float) (data_get($row, 'poblacion') ?? 0); }); $matrizTotals = [ 'poblacion' => collect($matrizItems)->sum(function ($row) { return (float) (data_get($row, 'poblacion') ?? 0); }), 'act_contratadas' => collect($matrizItems)->sum(function ($row) { return (float) (data_get($row, 'act_contratadas') ?? data_get($row, 'actividades_contratadas') ?? 0); }), 'act_ejecutadas' => collect($matrizItems)->sum(function ($row) { return (float) (data_get($row, 'act_ejecutadas') ?? data_get($row, 'actividades_ejecutadas') ?? 0); }), 'vc' => collect($matrizItems)->sum(function ($row) { return (float) (data_get($row, 'vc') ?? data_get($row, 'valor_contratado') ?? 0); }), 've' => collect($matrizItems)->sum(function ($row) { return (float) (data_get($row, 've') ?? data_get($row, 'valor_ejecutado') ?? 0); }), 'ajuste' => collect($matrizItems)->sum(function ($row) { return (float) (data_get($row, 'ajuste') ?? data_get($row, 'ajustes_a_realizar') ?? 0); }), ]; $matrizJustificacion = data_get($matrizDetalle, 'justificacion_cambios_vu'); $matrizConclusiones = data_get($matrizDetalle, 'conclusiones'); $matrizAnexos = collect(data_get($matrizDetalle, 'anexos', [])) ->filter() ->map(function ($item) { if (is_array($item)) { return [ 'url' => $item['url'] ?? $item['imagen_url'] ?? $item['path'] ?? $item['storage_url'] ?? null, 'descripcion' => $item['descripcion'] ?? $item['label'] ?? null, ]; } return [ 'url' => $item, 'descripcion' => null, ]; }) ->filter(function ($row) { return !empty($row['url']); }) ->values() ->all(); $mostrarSeccionEjecucion = !empty($verificacionItems) || !empty($matrizItems) || !empty($matrizResumen) || !empty($ejecucionMeses) || !empty($ejecucionAnalisis); $indicadores = $formulario->indicadores ?? []; $indicadoresGeneral = data_get($indicadores, 'general', []); $indicadoresBloques = [ 'Indicadores de acceso' => data_get($indicadores, 'acceso.items', []), 'Indicadores de deteccion temprana' => data_get($indicadores, 'deteccion.items', []), 'Indicadores de enfermedades precursoras' => data_get($indicadores, 'precursoras.items', []), 'Indicadores de experiencia del usuario' => data_get($indicadores, 'experiencia.items', []), ]; $resultadosSalud = $formulario->resultados_salud ?? []; $resultadosItems = data_get($resultadosSalud, 'items', []); $resultadosStats = [ 'puntos_totales' => data_get($resultadosSalud, 'puntos_totales'), 'puntos_obtenidos' => data_get($resultadosSalud, 'puntos_obtenidos'), 'porcentaje' => data_get($resultadosSalud, 'porcentaje'), ]; $disposicionesStats = null; if (!empty($disposiciones)) { $total = 0.0; $obtenido = 0.0; foreach ($disposiciones as $row) { $ponderado = (float) str_replace(',', '.', (string) data_get($row, 'ponderado', 0)); $cumple = strtoupper((string) data_get($row, 'cumple', '')); if ($cumple !== 'NA') { $total += $ponderado; } if ($cumple === 'SI') { $obtenido += $ponderado; } } $disposicionesStats = [ 'total' => $total, 'obtenido' => $obtenido, 'porcentaje' => $total > 0 ? ($obtenido / $total) * 100 : null, ]; } $fmt = function ($value, $decimals = 0) { if ($value === null || $value === '') { return 'N/A'; } if (!is_numeric($value)) { return $value; } return number_format((float) $value, $decimals, ',', '.'); }; $fmtCurrency = function ($value, $decimals = 2) { if ($value === null || $value === '') { return 'N/A'; } if (!is_numeric($value)) { return $value; } return '$' . number_format((float) $value, $decimals, ',', '.'); }; $kpiResumen = collect([ [ 'label' => 'Disposiciones', 'porcentaje' => $disposicionesStats['porcentaje'] ?? null, 'detalle' => $disposicionesStats ? [ 'obtenido' => $disposicionesStats['obtenido'], 'total' => $disposicionesStats['total'], ] : null, ], [ 'label' => 'Ejecucion contractual', 'porcentaje' => is_numeric($verificacionStats['porcentaje'] ?? null) ? (float) $verificacionStats['porcentaje'] : null, 'detalle' => (isset($verificacionStats['puntos_obtenidos']) && isset($verificacionStats['puntos_totales'])) ? [ 'obtenido' => (float) $verificacionStats['puntos_obtenidos'], 'total' => (float) $verificacionStats['puntos_totales'], ] : null, ], [ 'label' => 'Resultados en salud', 'porcentaje' => is_numeric($resultadosStats['porcentaje'] ?? null) ? (float) $resultadosStats['porcentaje'] : null, 'detalle' => (isset($resultadosStats['puntos_obtenidos']) && isset($resultadosStats['puntos_totales'])) ? [ 'obtenido' => (float) $resultadosStats['puntos_obtenidos'], 'total' => (float) $resultadosStats['puntos_totales'], ] : null, ], ])->filter(function ($item) { return !is_null($item['porcentaje']); }); $promedioCumplimiento = $kpiResumen->isNotEmpty() ? $kpiResumen->avg(function ($item) { return (float) $item['porcentaje']; }) : null; @endphp @if (session('status'))
{{ session('status') }}
@endif

Revision del formulario

Consulta en modo lectura los datos suministrados por el prestador.

Formulario #{{ $formulario->id }}
NIT {{ $formulario->nit ?? data_get($basicos, 'nit', 'N/A') }}
Municipio / sede {{ $formulario->municipio ?? data_get($basicos, 'municipio', 'N/A') }}
Periodo evaluado {{ data_get($basicos, 'periodo_evaluado') ?? data_get($ejecucion, 'periodo', 'N/A') }}
Estado {{ ucfirst($formulario->estado ?? 'borrador') }}
Creado por {{ $formulario->creado_por ?? 'N/A' }}
Fecha de registro {{ optional($formulario->created_at)->format('d/m/Y H:i') ?? 'N/A' }}
@if(!empty($basicos))

Seccion 1 Datos basicos del contrato

@if(!empty($basicos['anexos_disponibles'])) @endif
Modalidad {{ $basicos['modalidad'] ?? 'N/A' }} Numero de contrato {{ $basicos['numero_contrato'] ?? 'N/A' }}
Prestador {{ $basicos['prestador'] ?? 'N/A' }}
Nivel de complejidad {{ $basicos['complejidad'] ?? $basicos['nivel_complejidad'] ?? 'N/A' }} Nivel de atencion {{ $basicos['nivel_atencion'] ?? 'N/A' }}
Fecha inicio {{ $basicos['fecha_inicio'] ?? 'N/A' }} Fecha final {{ $basicos['fecha_final'] ?? 'N/A' }}
Duracion (meses) {{ $basicos['duracion_contrato'] ?? 'N/A' }} Fecha firma contrato {{ $basicos['fecha_firma_contrato'] ?? 'N/A' }}
Departamento {{ $basicos['departamento'] ?? 'N/A' }} Municipio {{ $basicos['municipio'] ?? 'N/A' }}
Contratante {{ $basicos['contratante'] ?? 'N/A' }}
Objeto del contrato
Poblacion inicial {{ $fmt($basicos['poblacion_inicial'] ?? null) }} Valor per capita {{ $fmt($basicos['valor_per_capita'] ?? null, 2) }}
Valor total mes {{ $fmt($basicos['valor_total_mes'] ?? null, 2) }} Numero de informe {{ $basicos['numero_informe'] ?? 'N/A' }}
Novedad contractual {{ $basicos['novedad_contractual'] ?? 'N/A' }}
Anexos disponibles {{ $basicos['anexos_disponibles'] }}
@endif @if(!empty($disposiciones) || !empty($servicios) || !empty($registroEspecial))

Seccion 2 Disposiciones evaluadas

@if(!empty($disposiciones)) @foreach($disposiciones as $index => $item) @endforeach
# Item Cumple Ponderado Observaciones
{{ $index + 1 }} {{ $item['item'] ?? 'N/A' }} {{ strtoupper($item['cumple'] ?? 'N/A') }} {{ $fmt($item['ponderado'] ?? null, 1) }} {{ $item['observaciones'] ?? 'N/A' }}
@if($disposicionesStats && !is_null($disposicionesStats['porcentaje']))
Porcentaje de cumplimiento {{ $fmt($disposicionesStats['porcentaje'], 1) }}%
{{ $fmt($disposicionesStats['obtenido'], 1) }} / {{ $fmt($disposicionesStats['total'], 1) }} puntos
@endif @else

No se registraron disposiciones durante el diligenciamiento.

@endif @if(!empty($servicios) || !empty($registroEspecial))

Soportes asociados

@if(!empty($servicios))
Servicios contratados @if(!empty($servicios['descripcion']))

{{ $servicios['descripcion'] }}

@endif
@if(!empty($serviciosImagenes)) Ver evidencia Servicios contratados @if(!empty($serviciosExtras))
Archivos adicionales: @foreach($serviciosExtras as $extraIndex => $url) #{{ $extraIndex + 2 }} @endforeach
@endif @endif
@endif @if(!empty($registroEspecial))
Registro especial del prestador @if(!empty($registroEspecial['descripcion']))

{{ $registroEspecial['descripcion'] }}

@endif
@if(!empty($registroImagenes)) Ver evidencia Registro especial @if(!empty($registroExtras))
Archivos adicionales: @foreach($registroExtras as $extraIndex => $url) #{{ $extraIndex + 2 }} @endforeach
@endif @endif
@endif
@endif
@endif @if($mostrarSeccionEjecucion)

Seccion 3 Ejecucion contractual

@if(!empty($ejecucionMeses))

INFORMACIÓN DE POBLACIÓN

@foreach($ejecucionMeses as $index => $mesRow) @endforeach
# Mes Departamento Municipio / sede Poblacion reportada
{{ $index + 1 }} {{ data_get($mesRow, 'mes', 'N/A') }} {{ data_get($mesRow, 'departamento', $ejecucionDepartamento ?? 'N/A') }} {{ data_get($mesRow, 'municipio', $ejecucionMunicipio ?? 'N/A') }} {{ $fmt(data_get($mesRow, 'poblacion') ?? null) }}
@endif @if(!empty($ejecucionAnalisis))
Analisis del periodo:
{{ $ejecucionAnalisis }}
@endif @if(!empty($matrizItems))

Matriz de evaluacion del contrato

@foreach($matrizItems as $index => $row) @endforeach
# Periodo Mes Valor x usuario Poblacion Act. contratadas Valor contratado Act. ejecutadas % ejecucion Valor ejecutado Ajuste
{{ $index + 1 }} {{ data_get($row, 'periodo', 'N/A') }} {{ data_get($row, 'mes', 'N/A') }} {{ $fmtCurrency(data_get($row, 'valor_x_usuario') ?? data_get($row, 'valor_usuario') ?? data_get($row, 'vu')) }} {{ $fmt(data_get($row, 'poblacion') ?? null) }} {{ $fmt(data_get($row, 'act_contratadas') ?? data_get($row, 'actividades_contratadas') ?? null) }} {{ $fmtCurrency(data_get($row, 'vc') ?? data_get($row, 'valor_contratado') ?? null) }} {{ $fmt(data_get($row, 'act_ejecutadas') ?? data_get($row, 'actividades_ejecutadas') ?? null) }} {{ $fmt(data_get($row, 'pct') ?? data_get($row, 'porcentaje') ?? null, 1) }}% {{ $fmtCurrency(data_get($row, 've') ?? data_get($row, 'valor_ejecutado') ?? null) }} {{ $fmtCurrency(data_get($row, 'ajuste') ?? data_get($row, 'ajustes_a_realizar') ?? null) }}
Totales {{ $fmt($matrizTotals['poblacion'] ?? null) }} {{ $fmt($matrizTotals['act_contratadas'] ?? null) }} {{ $fmtCurrency($matrizTotals['vc'] ?? null) }} {{ $fmt($matrizTotals['act_ejecutadas'] ?? null) }} {{ $fmtCurrency($matrizTotals['ve'] ?? null) }} {{ $fmtCurrency($matrizTotals['ajuste'] ?? null) }}
@endif @if(!empty($matrizResumen))
@foreach([ '_pct_I' => 'Trimestre I', '_pct_II' => 'Trimestre II', '_pct_III' => 'Trimestre III', '_pct_IV' => 'Trimestre IV', '_pct_total' => 'Promedio anual', ] as $key => $label) @if(isset($matrizResumen[$key]))
{{ $label }} {{ $fmt($matrizResumen[$key], 1) }}%
@endif @endforeach @foreach([ '_sum_ajustes_I' => 'Ajustes T1', '_sum_ajustes_II' => 'Ajustes T2', '_sum_ajustes_III' => 'Ajustes T3', '_sum_ajustes_IV' => 'Ajustes T4', ] as $key => $label) @if(isset($matrizResumen[$key]))
{{ $label }} {{ $fmt($matrizResumen[$key], 1) }}
@endif @endforeach
@endif @if(!empty($matrizJustificacion))
Justificacion de cambios de VU:
{{ $matrizJustificacion }}
@endif @if(!empty($matrizConclusiones))
Conclusiones de la matriz:
{{ $matrizConclusiones }}
@endif @if(!empty($matrizAnexos))
@foreach($matrizAnexos as $anexo)
Anexo @if(!empty($anexo['descripcion']))

{{ $anexo['descripcion'] }}

@endif
Ver evidencia Anexo ejecucion contractual
@endforeach
@endif @if(!empty($verificacionItems)) @foreach($verificacionItems as $index => $row) @endforeach
# Item Cumple Ponderado Observaciones
{{ $index + 1 }} {{ $row['item'] ?? 'N/A' }} {{ strtoupper($row['cumple'] ?? 'N/A') }} {{ $fmt($row['ponderado'] ?? null, 1) }} {{ $row['observaciones'] ?? 'N/A' }}
@endif @if(!empty($verificacionStats['porcentaje']) || !empty($matrizResumen['_sum_ajustes_total']))
@if(!empty($verificacionStats['porcentaje']))
Porcentaje de cumplimiento {{ $fmt($verificacionStats['porcentaje'], 1) }}%
{{ $fmt($verificacionStats['puntos_obtenidos'], 1) }} / {{ $fmt($verificacionStats['puntos_totales'], 1) }} puntos
@endif @if(!empty($matrizResumen['_sum_ajustes_total']))
Ajustes reportados {{ $fmt($matrizResumen['_sum_ajustes_total'], 1) }}
Consolidado de la matriz de seguimiento
@endif
@endif
@endif @php $tieneIndicadores = !empty($indicadoresGeneral) || collect($indicadoresBloques)->flatten(1)->isNotEmpty() || !empty($resultadosItems); @endphp @if($tieneIndicadores)

Indicadores Seguimiento de resultados y analisis

@if(is_array($indicadoresGeneral) && !empty(data_get($indicadoresGeneral, 'descripcion')))

{{ data_get($indicadoresGeneral, 'descripcion') }}

@endif @foreach($indicadoresBloques as $titulo => $bloque) @if(!empty($bloque))

{{ $titulo }}

@foreach($bloque as $index => $row) @endforeach
# Indicador Meta Resultado Observaciones
{{ $index + 1 }} {{ data_get($row, 'item', 'N/A') }} {{ data_get($row, 'meta', 'N/A') }} {{ data_get($row, 'resultado', 'N/A') }} {{ data_get($row, 'observaciones', 'N/A') }}
@endif @endforeach @if(!empty($resultadosItems))

Resultados en salud

@foreach($resultadosItems as $index => $row) @endforeach
# Item evaluado Ponderado Cumple Observaciones
{{ $index + 1 }} {{ data_get($row, 'item', 'N/A') }} {{ $fmt(data_get($row, 'ponderado'), 1) }} {{ strtoupper(data_get($row, 'cumple', 'N/A')) }} {{ data_get($row, 'observaciones', 'N/A') }}
Resultados en salud {{ $fmt($resultadosStats['porcentaje'], 1) }}%
{{ $fmt($resultadosStats['puntos_obtenidos'], 1) }} / {{ $fmt($resultadosStats['puntos_totales'], 1) }} puntos
@endif
@endif @if($kpiResumen->isNotEmpty())

Resumen Cumplimiento general

@foreach($kpiResumen as $item)
{{ $item['label'] }} {{ $fmt($item['porcentaje'], 1) }}% @if(!empty($item['detalle']))
{{ $fmt($item['detalle']['obtenido'], 1) }} / {{ $fmt($item['detalle']['total'], 1) }} puntos
@endif
@endforeach
@if(!is_null($promedioCumplimiento))
Promedio general de cumplimiento: {{ $fmt($promedioCumplimiento, 1) }}%
@endif
@endif @if(strtolower((string)($formulario->estado ?? '')) !== 'finalizado')

Firmas Aprobación y cierre de revisión

Carga las firmas del auditor y del prestador para finalizar la revisión. Formatos permitidos: JPG, PNG, WEBP. Máx. 4 MB por archivo.

@csrf
@endif