@extends('layouts.app') @section('titulo', 'Gestión de Caja') @section('contenido')
{{-- HEADER --}}

Apertura / Cierre de Caja

@if ($sesion) Movimientos de caja @endif
@if (! $sesion) {{-- Abrir caja --}}

No hay caja abierta

Abre la caja para empezar a vender.

@csrf
@else {{-- Caja abierta --}}
{{-- Info caja --}}

Caja abierta

En operación

Abierta por

{{ $sesion->usuario?->name ?? '—' }}

Punto de venta

{{ $sesion->puntoVenta?->nombre ?? '—' }}

Almacén

{{ $sesion->puntoVenta?->almacen?->nombre ?? '—' }}

Desde

{{ $sesion->abierta_at?->format('d/m/Y H:i') }}

Monto inicial

S/ {{ number_format($sesion->monto_inicial, 2) }}

{{-- KPIs --}}

Ventas efectivo

S/ {{ number_format($resumen['ventasEfectivo'], 2) }}

Ingresos

S/ {{ number_format($resumen['ingresos'], 2) }}

Egresos

S/ {{ number_format($resumen['egresos'], 2) }}

Esperado en caja

S/ {{ number_format($resumen['esperado'], 2) }}

{{-- Cierre / arqueo --}}

Cierre de caja (arqueo)

@csrf @method('PATCH')
Esperado S/ {{ number_format($resumen['esperado'], 2) }}
Diferencia
@endif {{-- Historial --}}

Historial de cierres

@forelse ($historial as $h) @empty @endforelse
APERTURA CIERRE RESPONSABLE INICIAL ESPERADO CONTADO DIFERENCIA
{{ $h->abierta_at?->format('d/m/Y H:i') }} {{ $h->cerrada_at?->format('d/m/Y H:i') }} {{ $h->usuario?->name ?? '—' }} S/ {{ number_format($h->monto_inicial, 2) }} S/ {{ number_format($h->monto_esperado, 2) }} S/ {{ number_format($h->monto_final, 2) }} S/ {{ number_format($h->diferencia, 2) }}
Aún no hay cierres registrados.
{{-- PAGINACIÓN --}} @if ($historial->hasPages())
Mostrando {{ $historial->firstItem() ?? 0 }} a {{ $historial->lastItem() ?? 0 }} de {{ $historial->total() }} registros
{{ $historial->links() }}
@endif
@endsection