@php $cut = $cut ?? null; $movimientos = $movimientos ?? collect(); $mvType = function ($tx) { if (($tx->type ?? '') === 'expense') return 'Salida'; return str_contains(mb_strtolower((string) ($tx->category ?? '')), 'apartado') ? 'Apartado' : 'Aportación'; }; $mvMethod = function ($tx) { $m = mb_strtolower(trim((string) ($tx->method ?? ''))); if ($m === '') return 'Otro'; if (str_contains($m, 'efectiv')) return 'Efectivo'; if (str_contains($m, 'spei')) return 'SPEI'; if (str_contains($m, 'transfer') || str_contains($m, 'dep')) return 'Transferencia'; if (str_contains($m, 'tarjeta') || str_contains($m, 'tpv')) return 'Tarjeta'; return 'Otro'; }; $companyName = $companyName ?? ''; $companyAddress = $companyAddress ?? ''; $companyPhone = $companyPhone ?? ''; $autoPrint = $autoPrint ?? false; $byMethod = $cut && is_array($cut->totals_by_method) ? $cut->totals_by_method : []; $ti = $cut ? (float) $cut->total_ingresos : 0; $diff = $cut ? (float) $cut->diferencia : 0; $cuadra = abs($diff) < 0.005; $estado = $cuadra ? 'Todo cuadra' : ($diff < 0 ? 'Falta dinero' : 'Sobra dinero'); @endphp
| Total Apartados | ${{ number_format($cut?->total_apartados ?? 0,2) }} |
| Total Aportaciones | ${{ number_format(($cut?->total_aportaciones ?? 0) + ($cut?->total_abonos ?? 0),2) }} |
| Total Ingresos | ${{ number_format($cut?->total_ingresos ?? 0,2) }} |
| Salidas de Caja | −${{ number_format($cut?->total_salidas ?? 0,2) }} |
| Saldo Esperado en Caja | ${{ number_format(($cut?->total_ingresos ?? 0) - ($cut?->total_salidas ?? 0),2) }} |
| Método de pago | Movimientos | Total | % |
|---|---|---|---|
| {{ $bucket }} | {{ $row['count'] ?? 0 }} | ${{ number_format($row['total'] ?? 0,2) }} | {{ $ti > 0 ? number_format(($row['total'] ?? 0) / $ti * 100, 1) : '0.0' }}% |
| Sin ingresos. | |||
| # | Fecha / Hora | Tipo | Cliente | Lote | Método | Importe |
|---|---|---|---|---|---|---|
| {{ $i + 1 }} | {{ optional($tx->date)->format('d/m/Y') }} {{ optional($tx->created_at)->format('h:i A') }} |
{{ $mvType($tx) }}@if($tx->description) {{ \Illuminate\Support\Str::limit(\Illuminate\Support\Str::beforeLast($tx->description, ' - '), 38) }} @endif |
{{ $tx->client?->name ?? '—' }} | {{ $tx->lote?->label ?? '—' }} | {{ $mvMethod($tx) }} | {{ $isIn ? '' : '−' }}${{ number_format($tx->amount,2) }} |
| Sin movimientos registrados en la fecha del corte. | ||||||