@php $box = $data; $company = $company ?? \App\Models\Company::first(); $establishment_id = null; if (auth()->check() && auth()->user()->establishment_id) { $establishment_id = auth()->user()->establishment_id; } if (!$establishment_id && ($box->establishment_id ?? null)) { $establishment_id = $box->establishment_id; } $establishment = $establishment_id ? (\App\Models\Establishment::find($establishment_id)) : ($box->establishment ?? null); $logo_full_path = null; if ($establishment_id) { $logoSucPath = public_path("logos_de_sistema/logosuc_{$establishment_id}.jpg"); if (file_exists($logoSucPath) && is_readable($logoSucPath)) { $logo_full_path = $logoSucPath; } else { $avatarPath = public_path("logos_de_sistema/avatar_logosuc_{$establishment_id}.jpg"); if (file_exists($avatarPath) && is_readable($avatarPath)) { $logo_full_path = $avatarPath; } else { $avatarPng = public_path("logos_de_sistema/avatar_logosuc_{$establishment_id}.png"); if (file_exists($avatarPng) && is_readable($avatarPng)) { $logo_full_path = $avatarPng; } } } } if (!$logo_full_path) { $logoSistema = public_path('logos_de_sistema/logo_sistema.jpg'); if (file_exists($logoSistema) && is_readable($logoSistema)) { $logo_full_path = $logoSistema; } } $tittle = 'EGRESO-' . str_pad($box->id, 7, '0', STR_PAD_LEFT); $supplierName = $box->supplier ? $box->supplier->name : 'SIN ESPECIFICAR'; $invoiceNumber = $box->invoice_number ?: 'SIN ESPECIFICAR'; @endphp Comprobante de Egreso @include('print.partials.ticket_header', [ 'company' => $company ?? null, 'establishment' => $establishment ?? null, 'title' => 'COMPROBANTE DE EGRESO', 'code' => $tittle ?? '', ])
Fecha: {{ \Carbon\Carbon::parse($box->date)->format('d-m-Y') }} {{ $box->created_at ? \Carbon\Carbon::parse($box->created_at)->format('H:i') : '' }}
Proveedor: {{ $supplierName }}
N° Factura: {{ $invoiceNumber }}
Detalle:
{{ $box->description ?? '-' }}
Método de pago: {{ $box->method ?: 'Efectivo' }}
Total: ${{ number_format($box->amount, 2) }}
Registrado por: {{ optional($box->user)->name ?? '-' }}
Documento generado por {{ config('app.name') }}