@php $fontRegular = str_replace('\\', '/', public_path('fonts/Nunito-Regular.ttf')); $fontBold = str_replace('\\', '/', public_path('fonts/Nunito-Bold.ttf')); @endphp
@php $est = $establishment ?? null; $comp = $company ?? null; if ($est && method_exists($est, 'loadMissing')) { $est->loadMissing(['district', 'province', 'department']); } $logoData = $est ? \App\Helpers\LogoHelper::getLogoBase64($comp, $est->id) : \App\Helpers\LogoHelper::getLogoBase64($comp); $totals = $reportTotals ?? \App\Helpers\BoxReportTotalsHelper::summarize($boxes_report_ingresos ?? [], $boxes_report_egresos ?? []); $fechaInicio = isset($report_date_start) ? \Carbon\Carbon::parse($report_date_start)->format('d/m/Y') : \Carbon\Carbon::parse($date_start)->format('d/m/Y'); $fechaFin = isset($report_date_end) ? \Carbon\Carbon::parse($report_date_end)->format('d/m/Y') : \Carbon\Carbon::parse($date_end)->format('d/m/Y'); $countIngresos = collect($boxes_report_ingresos ?? [])->count(); $countEgresos = collect($boxes_report_egresos ?? [])->count(); $estName = strtoupper(optional($est)->description ?: 'SIN SUCURSAL'); $legalName = strtoupper(optional($comp)->trade_name ?: optional($comp)->name ?: ''); $addressParts = []; if ($est) { if (!empty($est->trade_address) && $est->trade_address !== '-') { $addressParts[] = $est->trade_address; } elseif (!empty($est->address) && $est->address !== '-') { $addressParts[] = $est->address; } if (($est->district_id ?? '-') !== '-' && optional($est->district)->description) { $addressParts[] = optional($est->district)->description; } if (($est->province_id ?? '-') !== '-' && optional($est->province)->description) { $addressParts[] = optional($est->province)->description; } } $contactParts = array_filter([ (!empty($est->telephone) && $est->telephone !== '-') ? 'Tel. '.$est->telephone : null, (!empty($est->email) && $est->email !== '-') ? $est->email : null, ]); $contactLine = implode(' · ', $contactParts); $reportCode = 'RCJ-'.date('Ym').'-'.date('His'); $nitLine = optional($comp)->number; $neto = (float) ($totals['ganancia_neta'] ?? 0); $netoClass = $neto >= 0 ? 'kpi-value--pos' : 'kpi-value--neg'; @endphp {{-- Encabezado --}}|
@if($logoData)
|
{{ $estName }}
@if($legalName && $legalName !== $estName)
{{ $legalName }}
@endif
@if(!empty($addressParts))
{{ implode(', ', $addressParts) }}
@endif
@if($contactLine)
{{ $contactLine }}
@endif
|
Reporte de Caja
{{ $reportCode }}
|
| Periodo analizado {{ $fechaInicio }} – {{ $fechaFin }} | Ingresos {{ $countIngresos }} mov. | Egresos {{ $countEgresos }} mov. | Total ingresos $ {{ number_format($totals['subtotal_ingresos'], 2) }} | Saldo neto $ {{ number_format($neto, 2) }} |
| Ingresos y ventas | {{ $countIngresos }} registro(s) |
| # | Fecha | Doctor | Recibo | Paciente | Detalle | Pago | Monto |
|---|---|---|---|---|---|---|---|
| {{ $loop->iteration }} | {{ \Carbon\Carbon::parse($row['date'])->format('d/m/Y') }} | {{ strtoupper($row['medic'] ?? '-') }} | {{ $row['number'] ?? '-' }} | {{ $row['patient'] ?? '-' }} |
@if(!empty($row['items_details']) && is_array($row['items_details']) && count($row['items_details']) > 0)
@foreach($row['items_details'] as $item)
{{ strtoupper($item['description'] ?? 'Sin descripción') }}
Cant. {{ number_format((float)($item['quantity'] ?? 0), 2) }}
· P.U. ${{ number_format((float)($item['unit_price'] ?? 0), 2) }}
· ${{ number_format((float)($item['total'] ?? 0), 2) }}
@endforeach
@else
{{ strtoupper($row['treatment'] ?? $row['description'] ?? '-') }}
@endif
|
{{ $row['payment_group_label'] ?? 'Efectivo' }} | $ {{ number_format((float)($row['amount'] ?? 0), 2) }} |
| Egresos y gastos | {{ $countEgresos }} registro(s) |
| # | Fecha | Proveedor | Factura | Descripción | Tipo | Monto |
|---|---|---|---|---|---|---|
| {{ $loop->iteration }} | {{ \Carbon\Carbon::parse($row['date'])->format('d/m/Y') }} | {{ $supplierName ?: ($row['patient'] ?? 'Sin especificar') }} | {{ !empty($row['invoice_number']) ? $row['invoice_number'] : (!empty($row['number']) ? $row['number'] : '-') }} | {{ !empty($row['description']) ? $row['description'] : '-' }} | {{ $tipoEgreso }} | $ {{ number_format((float)($row['amount'] ?? 0), 2) }} |
|
|||||||||||||||||||||||