@extends('layouts.app') @section('titulo', 'Reportes') @section('contenido')

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 (no aplica a inventario) --}} @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->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
#ProductoUnidadesIngresos
{{ $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
ProductoCategoríaStockP. VentaValor
{{ $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