@php use App\Services\LogoStorageService; $emisorParte = $cotizacion->partes->firstWhere('rol', 'emisor'); $receptorParte = $cotizacion->partes->firstWhere('rol', 'receptor'); $empresa = $cotizacion->empresa; $cliente = $cotizacion->cliente; $resumen = $cotizacion->resumen; $fmtMoney = function ($n) { $n = $n ?? 0; return number_format((float) $n, 2, ',', '.'); }; $fmtQty = function ($n) { $n = $n ?? 0; return number_format((float) $n, 2, ',', '.'); }; $moneda = $cotizacion->moneda ?? 'CRC'; $monedaSimbolo = $moneda === 'CRC' ? 'CRC ' : ($moneda === 'USD' ? '$' : ($moneda . ' ')); $logoService = app(LogoStorageService::class); $logoBase64 = $empresa ? $logoService->obtenerLogoBase64($empresa->logo) : null; @endphp
@if($logoBase64) Logo @endif
{{ $empresa?->nombre ?? $empresa?->nombre_legal ?? $emisorParte?->nombre ?? 'Empresa' }}
{{ $empresa?->numero_identificacion ?? $emisorParte?->numero_identificacion ?? '' }} @if(!empty($empresa?->correo_electronico) || !empty($emisorParte?->correo_electronico)) | {{ $empresa?->correo_electronico ?? $emisorParte?->correo_electronico }} @endif
{{ $empresa?->direccion ?? $emisorParte?->direccion_completa ?? '' }}
Cotizacion
# {{ $cotizacion->numero }}
Fecha: {{ optional($cotizacion->fecha_emision)->format('d/m/Y H:i') }}
Vence: {{ optional($cotizacion->fecha_vencimiento)->format('d/m/Y') ?: '-' }}
Moneda: {{ $moneda }}
Cliente
{{ $cliente?->nombre ?? $receptorParte?->nombre ?? '-' }} @if(!empty($cliente?->numero_identificacion) || !empty($receptorParte?->numero_identificacion)) | {{ $cliente?->numero_identificacion ?? $receptorParte?->numero_identificacion }} @endif
{{ $cliente?->correo ?? $cliente?->correo_electronico ?? $receptorParte?->correo_electronico ?? '' }}
Condiciones
Forma de pago: {{ $cotizacion->condicion_venta?->label() ?? ($cotizacion->condicion_venta ?? '-') }}
Medio de pago: {{ $cotizacion->medio_pago?->label() ?? ($cotizacion->medio_pago ?? '-') }}
Estado: {{ ucfirst((string) ($cotizacion->estado ?? 'pendiente')) }}
@forelse($cotizacion->lineas as $linea) @empty @endforelse
# Detalle Cant P.Unit Desc. Total
{{ $linea->numero_linea }} {{ mb_substr((string) ($linea->detalle ?? ''), 0, 70) }} {{ $fmtQty($linea->cantidad) }} {{ $monedaSimbolo }}{{ $fmtMoney($linea->precio_unitario) }} {{ $monedaSimbolo }}{{ $fmtMoney($linea->monto_descuento) }} {{ $monedaSimbolo }}{{ $fmtMoney($linea->monto_total_linea) }}
Sin lineas
Observaciones: {{ $cotizacion->observaciones ?: '-' }}
Total venta {{ $monedaSimbolo }}{{ $fmtMoney($resumen?->total_venta) }}
Descuentos - {{ $monedaSimbolo }}{{ $fmtMoney($resumen?->total_descuentos) }}
Venta neta {{ $monedaSimbolo }}{{ $fmtMoney($resumen?->total_venta_neta) }}
Impuestos {{ $monedaSimbolo }}{{ $fmtMoney($resumen?->total_impuestos) }}
Total cotizacion {{ $monedaSimbolo }}{{ $fmtMoney($resumen?->total_comprobante) }}