@extends('layouts.app') @section('titulo', 'Reportes') @section('contenido')
{{-- HEADER --}}

Reportes

Exportar Excel (CSV)
{{-- PESTAÑAS --}}
@foreach (['ventas'=>'Ventas','productos'=>'Productos más vendidos','inventario'=>'Inventario valorizado'] as $k=>$label) {{ $label }} @endforeach
{{-- FILTRO DE FECHAS --}} @if ($tipo !== 'inventario')
@endif {{-- ENCABEZADO IMPRESO --}} {{-- ===================== VENTAS ===================== --}} @if ($tipo === 'ventas')

Total vendido

S/ {{ number_format($kpis['total'],2) }}

N° de ventas

{{ number_format($kpis['num']) }}

Ticket promedio

S/ {{ number_format($kpis['ticket'],2) }}

IGV recaudado

S/ {{ number_format($kpis['igv'],2) }}

Ventas por día

Por método de pago

@forelse ($porMetodo as $m) @empty @endforelse
MÉTODO MONTO
{{ $m->metodo_pago }} {{ $m->n }} S/ {{ number_format($m->monto,2) }}
Sin datos en el período.
@endif {{-- ===================== PRODUCTOS ===================== --}} @if ($tipo === 'productos')

Top productos (unidades)

@forelse ($topProductos as $i=>$p) @empty @endforelse
# PRODUCTO UNIDADES INGRESOS
{{ $i+1 }} {{ $p->nombre }} {{ number_format($p->unidades) }} S/ {{ number_format($p->ingresos,2) }}
No hubo ventas en el período.
@endif {{-- ===================== INVENTARIO ===================== --}} @if ($tipo === 'inventario')

Unidades

{{ number_format($invKpis['unidades']) }}

Valor a costo

S/ {{ number_format($invKpis['costo'],2) }}

Valor a venta

S/ {{ number_format($invKpis['venta'],2) }}

@foreach ($invProductos as $p) @endforeach
PRODUCTO CATEGORÍA STOCK P. VENTA VALOR
{{ $p->nombre }} {{ $p->categoria?->nombre ?? '—' }} {{ $p->stock }} S/ {{ number_format($p->precio_venta,2) }} S/ {{ number_format($p->stock*$p->precio_venta,2) }}
@endif
@endsection @push('scripts') @if (in_array($tipo, ['ventas','productos'])) @endif @endpush