@php use App\Enums\TipoDocumento; use App\Enums\CondicionVenta; use App\Enums\MedioPago; $tipoEnum = TipoDocumento::tryFrom($documento->tipo_documento ?? ''); $tipoLabel = $tipoEnum?->label() ?? 'Documento'; $cliente = $documento->cliente; $emisor = $documento->partes?->firstWhere('rol', 'emisor'); $receptor = $documento->partes?->firstWhere('rol', 'receptor'); $resumen = $documento->resumen; $emisorNombre = $emisor?->nombre ?? $documento->empresa?->nombre ?? $documento->empresa?->nombre_legal ?? 'EMPRESA'; $emisorIdentificacion = $emisor?->numero_identificacion ?? $documento->empresa?->numero_identificacion ?? ''; $emisorTelefono = $emisor?->telefono_numero ?? ''; $emisorCorreo = $emisor?->correo_electronico ?? $documento->empresa?->correo_electronico ?? ''; $emisorDireccion = $emisor?->direccion_completa ?? $documento->empresa?->direccion ?? ''; $condicionVenta = $documento->condicion_venta; if (is_string($condicionVenta)) { $condicionVentaEnum = CondicionVenta::tryFrom($condicionVenta); } else { $condicionVentaEnum = $condicionVenta; } $medioPago = $documento->medio_pago; if (is_string($medioPago)) { $medioPagoEnum = MedioPago::tryFrom($medioPago); } else { $medioPagoEnum = $medioPago; } @endphp
{{-- HEADER --}}
{{ $emisorNombre }}
@if($emisorIdentificacion)
{{ $emisorIdentificacion }}
@endif @if($emisorTelefono || $emisorCorreo)
{{ trim(($emisorTelefono ? 'Tel: '.$emisorTelefono : '').($emisorTelefono && $emisorCorreo ? ' | ' : '').($emisorCorreo ? 'Email: '.$emisorCorreo : '')) }}
@endif @if($emisorDireccion)
{{ $emisorDireccion }}
@endif
{{ $documento->clave ?? '' }}
{{-- QR --}} @if(!empty($qrBase64))
QR Code
@endif {{-- TIPO Y FECHA --}}
{{ $tipoLabel }} {{ $documento->numero_consecutivo ?? '' }}
Fecha: {{ $documento->fecha_emision?->format('d/m/Y') ?? '' }}
{{-- CLIENTE --}} @if($cliente || $receptor)
Cliente:
{{ $cliente?->nombre ?? $receptor?->nombre ?? 'Consumidor' }}
@if($cliente?->numero_identificacion ?? $receptor?->numero_identificacion)
{{ $cliente?->numero_identificacion ?? $receptor?->numero_identificacion }}
@endif
@endif {{-- ITEMS/DETALLES --}} @if($documento->lineas && $documento->lineas->count() > 0) @foreach($documento->lineas as $linea) @endforeach
Descripción Qty Total
{{ $linea->detalle ?? '' }} {{ number_format($linea->cantidad ?? 0, 2) }} {{ number_format($linea->monto_total_linea ?? 0, 2) }}
@endif {{-- TOTALES --}}
@if($resumen) @if(($resumen->total_venta ?? 0) > 0)
Subtotal: ₡{{ number_format($resumen->total_venta ?? 0, 2) }}
@endif @if(($resumen->total_descuentos ?? 0) > 0)
Descuentos: -₡{{ number_format($resumen->total_descuentos ?? 0, 2) }}
@endif @if(($resumen->total_impuestos ?? 0) > 0)
Impuestos: ₡{{ number_format($resumen->total_impuestos ?? 0, 2) }}
@endif
₡{{ number_format($resumen->total_comprobante ?? 0, 2) }}
@endif
{{-- CONDICIONES --}}
@if($condicionVentaEnum)
Condición: {{ $condicionVentaEnum->label() ?? (string)$condicionVentaEnum }}
@endif @if($medioPagoEnum)
Pago: {{ $medioPagoEnum->label() ?? (string)$medioPagoEnum }}
@endif @if($documento->estado?->codigo_hacienda)
Estado: @if($documento->estado->codigo_hacienda == '1' || $documento->estado->codigo_hacienda == '2') ✓ Aceptado @elseif($documento->estado->codigo_hacienda == '3') ✗ Rechazado @else Enviado @endif
@endif
{{-- DYNAMIC FOOTER FOR 80MM TICKET --}} @include('pdf.footer-ticket-80mm')