{{-- CSS --}} {{-- MAPA --}} {{-- BOOTSTRAP --}} {{-- CHART.JS --}} {{-- JAVASCRIPT --}} {{-- ENLACE A JS GENERAL --}} Reportes CT {{-- CARGANDO --}}
{{-- BOTON SUBIR --}}
@include('includes/header')
{{-- Botones de arriba --}} {{-- Obtener el id_ct almacenado en la sesión --}} @php $id_ct = session()->get('id_ct'); @endphp

REPORTES CALIDAD

{{-- CONTENEDOR CUERPO --}}
{{-- FILTRO AQUI --}}
{{-- PRIMERA FILA --}}

RESUMEN DE EVENTOS DE CALIDAD POR CT

@if (request()->query('fecha_inicio') && request()->query('fecha_fin')) Del {{ \Carbon\Carbon::parse(request()->query('fecha_inicio'))->format('d/m/Y') }} al {{ \Carbon\Carbon::parse(request()->query('fecha_fin'))->format('d/m/Y') }} @elseif (request()->query('fecha_inicio')) Del {{ \Carbon\Carbon::parse(request()->query('fecha_inicio'))->format('d/m/Y') }} al {{ \Carbon\Carbon::now()->format('d/m/Y') }} @else (Últimos 30 días) @endif

@if (is_array($resultadosQ38) && count($resultadosQ38) > 0)
@foreach ($resultadosQ38 as $index => $resultado) @endforeach
# CT Nº CUPS Cortes Microcortes Subtensiones Sobretensiones Nº Eventos Ratio
{{ $loop->iteration }} {{ !empty($resultado->nom_ct) ? $resultado->nom_ct : 'No hay datos' }} {{ !empty($resultado->total_cups) ? $resultado->total_cups : 'No hay datos' }} {{ !empty($resultado->apagones) ? $resultado->apagones : '0' }} {{ !empty($resultado->micro_cortes) ? $resultado->micro_cortes : '0' }} {{ !empty($resultado->sub_voltajes) ? $resultado->sub_voltajes : '0' }} {{ !empty($resultado->sobrevoltajes) ? $resultado->sobrevoltajes : '0' }} {{ !empty($resultado->total_eventos) ? $resultado->total_eventos : '0' }} {{ !empty($resultado->ratio) ? $resultado->ratio : '0' }}
@else

No hay datos

@endif
{{-- SEGUNDA FILA --}}

RESUMEN DE CALIDAD POR CUPS

@if (request()->query('fecha_inicio') && request()->query('fecha_fin')) Del {{ \Carbon\Carbon::parse(request()->query('fecha_inicio'))->format('d/m/Y') }} al {{ \Carbon\Carbon::parse(request()->query('fecha_fin'))->format('d/m/Y') }} @elseif (request()->query('fecha_inicio')) Del {{ \Carbon\Carbon::parse(request()->query('fecha_inicio'))->format('d/m/Y') }} al {{ \Carbon\Carbon::now()->format('d/m/Y') }} @else (Últimos 30 días) @endif

@if (is_array($resultadosQ37) && count($resultadosQ37) > 0)
@foreach ($resultadosQ37 as $index => $resultado) @endforeach
# CT CUPS Nombre CUPS Dirección CUPS Fecha Cortes Microcortes Subtensiones Sobretensiones
{{ $loop->iteration }} {{ !empty($resultado->nom_ct) ? $resultado->nom_ct : 'No hay datos' }} {{ !empty($resultado->id_cups) ? $resultado->id_cups : 'No hay datos' }} {{ !empty($resultado->nom_cups) ? $resultado->nom_cups : 'No hay datos' }} {{ !empty($resultado->dir_cups) ? $resultado->dir_cups : 'No hay datos' }} {{ !empty($resultado->fecha) ? $resultado->fecha : 'No hay datos' }} {{ !empty($resultado->apagones) ? $resultado->apagones : '0' }} {{ !empty($resultado->micro_cortes) ? $resultado->micro_cortes : '0' }} {{ !empty($resultado->sub_voltajes) ? $resultado->sub_voltajes : '0' }} {{ !empty($resultado->sobrevoltajes) ? $resultado->sobrevoltajes : '0' }}
@else

No hay datos

@endif
{{-- TERCERA FILA --}}
{{-- CORTES --}}

CORTES

@if (isset($resultadosQ39) && count($resultadosQ39) > 0 && isset($resultadosQ39[0]->fec_evento)) {{-- GRÁFICO DE CORTES --}}
@else

No hay datos

@endif

Nº Cortes

{{ count($resultadosQ43) > 0 && !empty($resultadosQ43[0]->total_eventos) ? $resultadosQ43[0]->total_eventos : 'No hay datos' }}

Ratio

{{ count($resultadosQ43) > 0 && !empty($resultadosQ43[0]->ratio) ? $resultadosQ43[0]->ratio : 'No hay datos' }}

{{-- SCRIPT PARA EL GRÁFICO DE CORTES --}}
{{-- MICROCORTES --}}

MICROCORTES

@if (isset($resultadosQ40) && count($resultadosQ40) > 0 && isset($resultadosQ40[0]->fec_evento)) {{-- GRÁFICO DE MICROCORTES --}}
@else

No hay datos

@endif

Nº Microcortes

{{ count($resultadosQ44) > 0 && !empty($resultadosQ44[0]->total_eventos) ? $resultadosQ44[0]->total_eventos : 'No hay datos' }}

Ratio

{{ count($resultadosQ44) > 0 && !empty($resultadosQ44[0]->ratio) ? $resultadosQ44[0]->ratio : 'No hay datos' }}

{{-- SCRIPT PARA EL GRÁFICO DE MICROCORTES --}}
{{-- SUBTENSIONES --}}

SUBTENSIONES

@if (isset($resultadosQ41) && count($resultadosQ41) > 0 && isset($resultadosQ41[0]->fec_evento)) {{-- GRÁFICO DE SUBTENSIONES --}}
@else

No hay datos

@endif

Nº Subtensiones

{{ count($resultadosQ45) > 0 && !empty($resultadosQ45[0]->total_eventos) ? $resultadosQ45[0]->total_eventos : 'No hay datos' }}

Ratio

{{ count($resultadosQ45) > 0 && !empty($resultadosQ45[0]->ratio) ? $resultadosQ45[0]->ratio : 'No hay datos' }}

{{-- SCRIPT PARA EL GRÁFICO DE SUBTENSIONES --}}
{{-- SOBRETENSIONES --}}

SOBRETENSIONES

@if (isset($resultadosQ42) && count($resultadosQ42) > 0 && isset($resultadosQ42[0]->fec_evento)) {{-- GRÁFICO DE SOBRETENSIONES --}}
@else

No hay datos

@endif

Nº Sobretensiones

{{ count($resultadosQ46) > 0 && !empty($resultadosQ46[0]->total_eventos) ? $resultadosQ46[0]->total_eventos : 'No hay datos' }}

Ratio

{{ count($resultadosQ46) > 0 && !empty($resultadosQ46[0]->ratio) ? $resultadosQ46[0]->ratio : 'No hay datos' }}

{{-- SCRIPT PARA EL GRÁFICO DE SOBRETENSIONES --}}
{{-- CUARTA FILA --}}

RESUMEN DE CALIDAD DE TENSIÓN E INTENSIDAD

@if (request()->query('fecha_inicio') && request()->query('fecha_fin')) Del {{ \Carbon\Carbon::parse(request()->query('fecha_inicio'))->format('d/m/Y') }} al {{ \Carbon\Carbon::parse(request()->query('fecha_fin'))->format('d/m/Y') }} @elseif (request()->query('fecha_inicio')) Del {{ \Carbon\Carbon::parse(request()->query('fecha_inicio'))->format('d/m/Y') }} al {{ \Carbon\Carbon::now()->format('d/m/Y') }} @else (Últimas 48 horas) @endif

@if (is_array($resultadosQ48) && count($resultadosQ48) > 0 && is_array($resultadosQ49) && count($resultadosQ49) > 0)
@php $combinedResults = []; foreach ($resultadosQ48 as $resultado) { $combinedResults[$resultado->id_ct][ 'desequilibrio_voltaje' ] = $resultado; } foreach ($resultadosQ49 as $resultado) { $combinedResults[$resultado->id_ct][ 'voltajes' ] = $resultado; } @endphp @foreach ($combinedResults as $id_ct => $resultados) @php $backgroundStyle = ''; if ( $resultados['desequilibrio_voltaje'] ->avg_pct_deseq_voltaje !== null ) { if ( $resultados['desequilibrio_voltaje'] ->avg_pct_deseq_voltaje <= 3 ) { $backgroundStyle = 'linear-gradient(to bottom, rgba(76, 218, 19, 0.4), rgba(55, 157, 14, 0.9))'; } else { $backgroundStyle = 'linear-gradient(to bottom, rgba(248, 73, 90, 0.6), rgba(206, 60, 73, 0.9))'; } } @endphp @php $backgroundStyleCorriente = ''; // Default color if no data if ( $resultados['desequilibrio_voltaje'] ->avg_pct_deseq_corriente !== null ) { if ( $resultados['desequilibrio_voltaje'] ->avg_pct_deseq_corriente <= 30 ) { $backgroundStyleCorriente = 'linear-gradient(to bottom, rgba(76, 218, 19, 0.4), rgba(55, 157, 14, 0.9))'; } else { $backgroundStyleCorriente = 'linear-gradient(to bottom, rgba(248, 73, 90, 0.6), rgba(206, 60, 73, 0.9))'; } } @endphp @endforeach
# CT Desequilibrio Voltaje Desequilibrio Corriente Voltaje Fase R Voltaje Fase S Voltaje Fase T
Max Min Promedio Max Min Promedio Max Min Promedio Max Min Promedio Max Min Promedio
{{ $loop->iteration }} {{ $resultados['desequilibrio_voltaje']->nom_ct !== null ? $resultados['desequilibrio_voltaje']->nom_ct : 'No hay datos' }} {{ $resultados['desequilibrio_voltaje']->max_pct_deseq_voltaje !== null ? $resultados['desequilibrio_voltaje']->max_pct_deseq_voltaje : 'No hay datos' }} {{ $resultados['desequilibrio_voltaje']->min_pct_deseq_voltaje !== null ? $resultados['desequilibrio_voltaje']->min_pct_deseq_voltaje : 'No hay datos' }} {{ $resultados['desequilibrio_voltaje']->avg_pct_deseq_voltaje !== null ? $resultados['desequilibrio_voltaje']->avg_pct_deseq_voltaje : 'No hay datos' }} {{ $resultados['desequilibrio_voltaje']->max_pct_deseq_corriente !== null ? $resultados['desequilibrio_voltaje']->max_pct_deseq_corriente : 'No hay datos' }} {{ $resultados['desequilibrio_voltaje']->min_pct_deseq_corriente !== null ? $resultados['desequilibrio_voltaje']->min_pct_deseq_corriente : 'No hay datos' }} {{ $resultados['desequilibrio_voltaje']->avg_pct_deseq_corriente !== null ? $resultados['desequilibrio_voltaje']->avg_pct_deseq_corriente : 'No hay datos' }} {{ $resultados['voltajes']->max_volt1 !== null ? $resultados['voltajes']->max_volt1 : 'No hay datos' }} {{ $resultados['voltajes']->min_volt1 !== null ? $resultados['voltajes']->min_volt1 : 'No hay datos' }} {{ $resultados['voltajes']->prom_volt1 !== null ? $resultados['voltajes']->prom_volt1 : 'No hay datos' }} {{ $resultados['voltajes']->max_volt2 !== null ? $resultados['voltajes']->max_volt2 : 'No hay datos' }} {{ $resultados['voltajes']->min_volt2 !== null ? $resultados['voltajes']->min_volt2 : 'No hay datos' }} {{ $resultados['voltajes']->prom_volt2 !== null ? $resultados['voltajes']->prom_volt2 : 'No hay datos' }} {{ $resultados['voltajes']->max_volt3 !== null ? $resultados['voltajes']->max_volt3 : 'No hay datos' }} {{ $resultados['voltajes']->min_volt3 !== null ? $resultados['voltajes']->min_volt3 : 'No hay datos' }} {{ $resultados['voltajes']->prom_volt3 !== null ? $resultados['voltajes']->prom_volt3 : 'No hay datos' }}
@else

No hay datos

@endif
{{-- QUINTA FILA --}}

RESUMEN DE NIVEL DE TENSIÓN POR CUPS

@if (request()->query('fecha_inicio') && request()->query('fecha_fin')) Del {{ \Carbon\Carbon::parse(request()->query('fecha_inicio'))->format('d/m/Y') }} al {{ \Carbon\Carbon::parse(request()->query('fecha_fin'))->format('d/m/Y') }} @elseif (request()->query('fecha_inicio')) Del {{ \Carbon\Carbon::parse(request()->query('fecha_inicio'))->format('d/m/Y') }} al {{ \Carbon\Carbon::now()->format('d/m/Y') }} @else (Últimos 7 días) @endif

@if (is_array($resultadosQ51) && count($resultadosQ51) > 0)
@foreach ($resultadosQ51 as $index => $resultado) @php // Verifica si $resultado es un objeto antes de acceder a sus propiedades if (is_object($resultado)) { // Condición para el campo "round" if ($resultado->round > 243) { $fondoRound = 'linear-gradient(to bottom, rgba(248, 73, 90, 0.6), rgba(206, 60, 73, 0.9))'; // Si "round" es mayor que 243 ROJO } elseif ($resultado->round < 218) { $fondoRound = 'linear-gradient(to bottom, rgba(255, 165, 0, 0.6), rgba(255, 140, 0, 0.9));'; // Si "round" es menor que 218 } else { $fondoRound = 'transparent'; // Si no cumple ninguna condición } // Condición para el campo "max" if ($resultado->max > 243) { $fondoMax = 'linear-gradient(to bottom, rgba(248, 73, 90, 0.6), rgba(206, 60, 73, 0.9))'; // Si "max" es mayor que 243 ROJO } elseif ($resultado->max < 218) { $fondoMax = 'linear-gradient(to bottom, rgba(255, 165, 0, 0.6), rgba(255, 140, 0, 0.9));'; // Si "max" es menor que 218 } else { $fondoMax = 'transparent'; // Si no cumple ninguna condición } // Condición para el campo "min" if ($resultado->min > 243) { $fondoMin = 'linear-gradient(to bottom, rgba(248, 73, 90, 0.6), rgba(206, 60, 73, 0.9))'; // Si "min" es mayor que 243 ROJO } elseif ($resultado->min < 218) { $fondoMin = 'linear-gradient(to bottom, rgba(255, 165, 0, 0.6), rgba(255, 140, 0, 0.9));'; // Si "min" es menor que 218 } else { $fondoMin = 'transparent'; // Si no cumple ninguna condición } } else { // Si $resultado no es un objeto, establecemos valores predeterminados $fondoRound = $fondoMax = $fondoMin = 'transparent'; } @endphp @endforeach
# ID CUPS Nombre Dirección Contador Última fecha de lectura Promedio Máximo Mínimo Número de lecturas
{{ $loop->iteration }} {{ !empty($resultado->id_cups) ? $resultado->id_cups : 'No hay datos' }} {{ !empty($resultado->nom_cups) ? $resultado->nom_cups : 'No hay datos' }} {{ !empty($resultado->dir_cups) ? $resultado->dir_cups : 'No hay datos' }} {{ !empty($resultado->id_cnt) ? $resultado->id_cnt : 'No hay datos' }} {{ !empty($resultado->fec_lectura) ? $resultado->fec_lectura : 'No hay datos' }} {{ !empty($resultado->round) ? $resultado->round : '0' }} {{ !empty($resultado->max) ? $resultado->max : '0' }} {{ !empty($resultado->min) ? $resultado->min : '0' }} {{ !empty($resultado->count) ? $resultado->count : '0' }}
@else

No hay datos

@endif