@extends('fragments.fullTemplate') @section('titulo') Cobranza @endsection @php use App\Http\Controllers\cobranza_controller; use App\Servicio_Cliente_Concepto; use App\Cobranza; use App\Programacion_muestra; $id_usuario = session('id_usuario'); if (! session('id_usuario')) { header('location: /'); die(); } $fecha_actual = date("Y-m-d"); @endphp @section('contenido')
@if(session()->has('success')) @endif @if(session()->has('warning')) @endif @if(session()->has('error')) @endif @if (count($errors) > 0) @endif

Cliente Factura:
{{ $datos_cliente->nombre_cliente_factura }}

Crédito: @if ($estatus_credito_calculado === 'Activo') Activo @elseif ($estatus_credito_calculado === 'Suspendido') Suspendido @else Inactivo @endif

Días de crédito: {{ (int)($datos_cliente->dias_credito ?? 0) }}

Monto límite de crédito: @if(!is_null($datos_cliente->monto_limite_credito)) ${{ number_format($datos_cliente->monto_limite_credito, 2, '.', ',') }} @else N/A @endif

Fecha límite de crédito: @if(!empty($datos_cliente->fecha_limite_credito)) {{ \Carbon\Carbon::parse($datos_cliente->fecha_limite_credito)->format('d/m/Y') }} @else N/A @endif

Comentario sobre el crédito: @if(!empty($datos_cliente->comentario_credito)) {{ $datos_cliente->comentario_credito }} @else N/A @endif

@if ($id_servicio_cliente_concepto != NULL)

Deuda parcial: ${{ number_format($deuda_total_cliente_factura, 2, '.', ',') }}

@else

Deuda total: ${{ number_format($deuda_total_cliente_factura, 2, '.', ',') }}

@endif @if($mostrar_alerta_credito)
{{ $mensaje_alerta_credito }}
@endif

Contactos:

@foreach ($datos_contacto as $dato_contacto) @php $rawType = $dato_contacto->type_id; $sinTipo = is_null($rawType) || $rawType === '' || $rawType === 'null'; $typeIds = []; if (!$sinTipo) { if (is_array($rawType)) { $typeIds = $rawType; } else { $decoded = json_decode($rawType, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) { $typeIds = $decoded; } else { $typeIds = [(string) $rawType]; } } } $tiene4 = in_array("4", array_map('strval', $typeIds), true); $mostrar = $tiene4; // Aquí a diferencia del correo, NO mostramos si no tiene tipo. @endphp @if ($mostrar) @endif @endforeach
Nombre E-mail Teléfono Extensión Celular
{{ $dato_contacto->nombre_contacto }} {{ $dato_contacto->correo }} {{ $dato_contacto->telefono }} {{ $dato_contacto->extension }} {{ $dato_contacto->celular }}
{{--

CONTACTOS

@foreach ($datos_contacto as $dato_contacto) @endforeach
Nombre E-mail Teléfono Extensión Celular
{{$dato_contacto->nombre_contacto}} {{$dato_contacto->correo}} {{$dato_contacto->telefono}} {{$dato_contacto->extension}} {{$dato_contacto->celular}}
--}} {{--
...
--}} {{--

Cliente Factura:
{{$datos_cliente->nombre_cliente_factura}}

Crédito: @if ($datos_cliente->dias_credito > 0) Activo @else Inactivo @endif

Cliente Informe:
{{$datos_cliente->nombre_cliente_informe}}




--}} {{--
--}} @if ($permisos->crear == 1 || $permisos->gerente) {{-- --}} @endif
@include('Cobranza.Informes.send_mail_recordatorio_por_cliente_cobranzas_modal') @include('Cobranza.Informes.create_cobranza_modal') {{--@include('Cobranza.Informes.create_cobranza_modal')--}} @include('Cobranza.Otros_Servicios.create_cobranza_otros_servicios_modal') @php function calculo_fecha_cobro($id_servicio_cliente_concepto){ $fecha_cobro=""; $datos_muestra_reporte = Servicio_Cliente_Concepto::select( 'num_informe', 'fecha_emision' ) ->where('id_servicio_cliente_concepto',$id_servicio_cliente_concepto) ->first(); $datos_cobranza = Cobranza::select( 'fecha_promesa_pago' ) ->where('id_servicio_cliente_concepto',$id_servicio_cliente_concepto) ->first(); if ($datos_cobranza != null) { if ($datos_cobranza->fecha_promesa_pago) { $fecha_promesa_pago = date("d-m-Y",strtotime($datos_cobranza->fecha_promesa_pago)); $fecha_cobro = strtotime('-7 day', strtotime($fecha_promesa_pago)); $fecha_cobro = date("d-m-Y", $fecha_cobro); } }else{ $datos_muestra = Servicio_Cliente_Concepto::select( 'muestras.observaciones', 'programacion_muestras.fecha_entrega_cliente', 'programacion_muestras.fecha_emision', 'servicio_cliente_reportes.fecha_limite_credito' ) ->join('programacion_muestras','servicio_cliente_conceptos.id_programacion_muestra','=','programacion_muestras.id_programacion_muestra') ->join('servicio_cliente_reportes','servicio_cliente_conceptos.id_servicio_cliente_reporte','=','servicio_cliente_reportes.id_servicio_cliente_reporte') ->join('inspeccion_muestras','programacion_muestras.id_inspeccion_muestra','=','inspeccion_muestras.id_inspeccion_muestra') ->join('muestras','inspeccion_muestras.id_muestra','=','muestras.id_muestra') ->where('id_servicio_cliente_concepto',$id_servicio_cliente_concepto) ->first(); if ($datos_muestra != null) { if ($datos_muestra->fecha_limite_credito != null) { $fecha_promesa_pago = date("d-m-Y",strtotime($datos_muestra->fecha_limite_credito)); $fecha_cobro = strtotime('-7 day', strtotime($fecha_promesa_pago)); $fecha_cobro = date("d-m-Y", $fecha_cobro); }else{ $fecha_emision = date("d-m-Y",strtotime($datos_muestra->fecha_emision)); $fecha_promesa_pago = strtotime('-7 day', strtotime($fecha_emision)); $fecha_promesa_pago = date("d-m-Y", $fecha_promesa_pago); $fecha_cobro = strtotime('-7 day', strtotime($fecha_promesa_pago)); $fecha_cobro = date("d-m-Y", $fecha_cobro); } }else{ $datos_muestra_programacion = Servicio_Cliente_Concepto::select( 'num_informe', 'fecha_emision' ) ->where('id_servicio_cliente_concepto',$id_servicio_cliente_concepto) ->first(); if ($datos_muestra_programacion->fecha_emision != null) { $fecha_emision = date("d-m-Y",strtotime($datos_muestra_programacion->fecha_emision)); $fecha_promesa_pago = strtotime('-7 day', strtotime($fecha_emision)); $fecha_promesa_pago = date("d-m-Y", $fecha_promesa_pago); $fecha_cobro = strtotime('-7 day', strtotime($fecha_promesa_pago)); $fecha_cobro = date("d-m-Y", $fecha_cobro); } } } return $fecha_cobro; } @endphp @endsection