|
@php
$logoSrc = $config?->logo_base64;
if (!$logoSrc && $config?->logo) {
$paths = [
storage_path('app/public/' . $config->logo),
public_path('storage/' . $config->logo),
public_path($config->logo),
base_path('../public_html/storage/' . $config->logo),
base_path('../public_html/' . $config->logo),
isset($_SERVER['DOCUMENT_ROOT']) ? rtrim($_SERVER['DOCUMENT_ROOT'], '/\\') . '/storage/' . $config->logo : null,
isset($_SERVER['DOCUMENT_ROOT']) ? rtrim($_SERVER['DOCUMENT_ROOT'], '/\\') . '/' . $config->logo : null,
];
foreach ($paths as $p) {
if ($p && file_exists($p) && is_file($p)) {
$ext = strtolower(pathinfo($p, PATHINFO_EXTENSION));
$mime = match($ext) {
'png' => 'image/png',
'jpg', 'jpeg' => 'image/jpeg',
'gif' => 'image/gif',
'svg' => 'image/svg+xml',
'webp' => 'image/webp',
default => 'image/png',
};
$data = @file_get_contents($p);
if ($data) {
$logoSrc = 'data:' . $mime . ';base64,' . base64_encode($data);
break;
}
}
}
}
@endphp
@if ($logoSrc)
{{ $config->nombre_comercial ?: $config->nombre_empresa }}
{{ $config->nombre_empresa }}
@if($config->direccion) {{ $config->direccion }} @endif @if($config->poblacion || $config->provincia) {{ trim(($config->poblacion ?? '').' - '.($config->provincia ?? '').' - '.($config->pais ?? 'Perú')) }} @endif @if($config->telefono) Tel: {{ $config->telefono }} | @endif @if($config->email) Email: {{ $config->email }} @endif |
R.U.C. N° {{ $config->nif ?? '20000000001' }}
{{ $tipoDocNombre }}
{{ $venta->referencia }}
|
| SEÑOR(ES): | {{ $venta->cliente ? $venta->cliente->nombre_completo : 'CLIENTES VARIOS' }} | FECHA EMISIÓN: | {{ $venta->fecha->format('d/m/Y H:i') }} |
| {{ ($venta->cliente && strlen($venta->cliente->nif) === 11) ? 'RUC:' : 'DNI / DOC:' }} | {{ $venta->cliente?->nif ?: '00000000' }} | MONEDA: | SOLES (PEN) |
| DIRECCIÓN: | {{ $venta->cliente?->direccion ?: '-' }} | FORMA PAGO: | {{ $venta->forma_pago === 'yape_plin' ? 'Yape / Plin' : $venta->forma_pago }} |
| ITEM | CANT. | UNIDAD | DESCRIPCIÓN | P. UNIT | TASA | TOTAL |
|---|---|---|---|---|---|---|
| {{ $idx + 1 }} | {{ number_format($d->cantidad, 0) }} | NIU | {{ $d->descripcion }} | {{ formato_moneda($d->precio_unitario) }} | {{ (float)$d->iva > 0 ? (number_format($d->iva, 0).'%') : 'EXON.' }} | {{ formato_moneda($d->total) }} |
|
{{ numero_a_letras((float)$venta->total) }}
@if($venta->sunat_hash)
Resumen Hash: {{ $venta->sunat_hash }}
@endif
@if($config->pie_ticket)
{{ $config->pie_ticket }}
@endif
|
|
|
@php
$docCliente = $venta->cliente?->nif ?? '00000000';
$qrData = implode('|', [
$config->nif ?? '',
$tipoSunat,
$venta->serie,
str_pad($venta->numero, 8, '0', STR_PAD_LEFT),
number_format($venta->iva_importe, 2, '.', ''),
number_format($venta->total, 2, '.', ''),
$venta->fecha->format('Y-m-d'),
strlen($docCliente) === 11 ? '6' : '1',
$docCliente
]);
$qrUrl = 'https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=' . urlencode($qrData);
@endphp
|
Representación Impresa de la {{ $tipoDocNombre }} Autorizado mediante Resolución de Superintendencia SUNAT. Consulte la validez de este comprobante en el portal de SUNAT. @if($venta->sunat_mensaje) {{ $venta->sunat_mensaje }} @endif |