@extends('Sidebar.icssacvSidebar') @section('title', 'Seguimiento') @section('contenido')
{{-- Función de cálculo de días--}} @php function getDaysFromDateWithoutWEsHs(DateTime $inicial,DateTime $final){ $intervalo = $final->diff($inicial); $dias = $intervalo->days; $periodo = new DatePeriod($inicial, new DateInterval('P1D'), $final); $feriados = array('2022-01-01','2022-03-21','2022-04-14','2022-04-15','2022-05-01','2022-05-05','2022-09-16','2022-11-02','2022-11-21', '2023-03-20'); foreach($periodo as $dt) { $curr = $dt->format('D'); if ($curr == 'Sat' || $curr == 'Sun') { $dias--; }elseif (in_array($dt->format('Y-m-d'), $feriados)) { $dias--; } } return $dias; } $fechaActual= new DateTime(); @endphp
{{-- --}} @foreach ($Consulta as $consulta) {{-- --}} @php $dias = 0; if ($consulta->fecha_inventario != NULL) { if ($consulta->fecha_avaluo != NULL) { $dias = $consulta->dias_avaluo; }else { $dias = getDaysFromDateWithoutWEsHs($fechaActual, new DateTime($consulta->fecha_inventario)); } } if ($dias == 0) { //$bg_color_exp = "bgcolor='white'"; $bg_color_exp = "style = 'color: white'"; }elseif ($dias <= 3) { //$bg_color_exp = "bgcolor='white'"; $bg_color_exp = "style = 'color: green'"; }elseif($dias >= 6){ //$bg_color_exp = "bgcolor='red'"; $bg_color_exp = "style = 'color: red'"; }else { //$bg_color_exp = "bgcolor='yellow'"; $bg_color_exp = "style = 'color: yellow'"; } @endphp {{-- --}} @php $dias = 0; if ($consulta->fecha_inventario != NULL) { if ($consulta->fecha_expediente != NULL) { $dias = $dias_expediente; }else { $dias = getDaysFromDateWithoutWEsHs($fechaActual,new DateTime($consulta->fecha_inventario)); } } if ($dias == 0) { //$bg_color_exp = "bgcolor='white'"; $bg_color_exp = "style = 'color: white'"; }elseif ($dias <= 21) { //$bg_color_exp = "bgcolor='white'"; $bg_color_exp = "style = 'color: green'"; }elseif($dias >= 31){ //$bg_color_exp = "bgcolor='red'"; $bg_color_exp = "style = 'color: red'"; }else { //$bg_color_exp = "bgcolor='yellow'"; $bg_color_exp = "style = 'color: yellow'"; } @endphp {{-- --}} @php $dias = 0; if ($consulta->fecha_expediente != NULL) { if ($consulta->fecha_venta != NULL) { $dias = getDaysFromDateWithoutWEsHs(new DateTime($consulta->fecha_venta), new DateTime( $consulta->fecha_expediente)); }else { $dias = getDaysFromDateWithoutWEsHs($fechaActual,new DateTime($consulta->fecha_expediente)); } } if ($dias == 0) { //$bg_color_exp = "bgcolor='white'"; $bg_color_exp = "style = 'color: white'"; }elseif ($dias <= 21) { //$bg_color_exp = "bgcolor='white'"; $bg_color_exp = "style = 'color: green'"; }elseif($dias >= 31){ //$bg_color_exp = "bgcolor='red'"; $bg_color_exp = "style = 'color: red'"; }else { //$bg_color_exp = "bgcolor='yellow'"; $bg_color_exp = "style = 'color: yellow'"; } @endphp {{-- --}} @endforeach
C.A. FinalNo. Eco No. Serie No. Motor C.I. Vehiculo Diagnostico Status Seg. Fecha Inventario Entrega Avaluo Entrega Expediente Fecha Venta
{!!$consulta->Ctro_Acop!!}{!!$consulta->No_Eco!!} {!!$consulta->Serie_Chasis!!} {!!$consulta->Serie_Motor!!} {!!$consulta->Cl_Vehiculo!!} {!!$consulta->Diagnostico!!} @if ($consulta->fecha_expediente != NULL) Con Expediente @elseif ($consulta->fecha_avaluo != NULL) Con Avalúo @elseif($consulta->fecha_inventario != NULL) Visitado @else Por Visitar @endif {!!$consulta->fecha_inventario!!}{!!$consulta->fecha_avaluo!!}
{!!$consulta->fecha_avaluo!!}
{!!$consulta->fecha_expediente!!}
{!!$consulta->fecha_expediente!!}
{!!$consulta->fecha_venta!!}
{!!$consulta->fecha_venta!!}
@endsection @section('titulo') @endsection @section('scripts') @endsection