Reportes Gerenciales
Análisis detallado de rendimiento
@php
$tabs = [
'resumen' => ['label' => '📊 Resumen', 'color' => '#0d6efd'],
'diario' => ['label' => '📅 Por día', 'color' => '#0d6efd'],
'utilidad' => ['label' => '💰 Utilidad', 'color' => '#198754'],
'pagos' => ['label' => '💳 Métodos de pago','color' => '#6f42c1'],
'mesas' => ['label' => '🪑 Por mesa/área', 'color' => '#fd7e14'],
'horas' => ['label' => '⏰ Por hora', 'color' => '#0dcaf0'],
'comprobantes' => ['label' => '🧾 Comprobantes', 'color' => '#6610f2'],
'gastos' => ['label' => '💸 Gastos', 'color' => '#dc3545'],
'personal' => ['label' => '👤 Personal', 'color' => '#d63384'],
];
@endphp
@if($tipo === 'resumen')
Ventas
{{ number_format($kpiVentas) }}
Ingresos
{{ $currency }}{{ number_format($kpiIngresos, 2) }}
Ticket Promedio
{{ $currency }}{{ number_format($kpiTicketProm, 2) }}
Propinas
{{ $currency }}{{ number_format($kpiPropinas, 2) }}
| Producto | Cant. | Ingresos |
@forelse($topProducts as $prod)
| {{ $prod->name }} | {{ $prod->qty }} | {{ $currency }}{{ number_format($prod->revenue, 2) }} |
@empty
| Sin datos |
@endforelse
| Producto | Cant. Vendida |
@forelse($worstProducts as $prod)
| {{ $prod->name }} | {{ $prod->qty }} |
@empty
| Sin datos |
@endforelse
@elseif($tipo === 'diario')
| Fecha | N° Ventas | Ingresos |
@forelse($ventasDiarias as $d)
| {{ \Carbon\Carbon::parse($d->dia)->format('d/m/Y') }} | {{ $d->num_ventas }} | {{ $currency }}{{ number_format($d->ingresos, 2) }} |
@empty
| Sin datos |
@endforelse
@if($ventasDiarias->count())
| TOTAL | {{ $ventasDiarias->sum('num_ventas') }} | {{ $currency }}{{ number_format($ventasDiarias->sum('ingresos'), 2) }} |
@endif
@elseif($tipo === 'utilidad')
@php $ti=$tc=$tu=0; @endphp
| Fecha | Ingresos | Costos | Utilidad | Margen |
@forelse($utilidad as $d)
@php
$ti+=$d->ingresos; $tc+=$d->costos; $u=$d->ingresos-$d->costos; $tu+=$u;
$m = $d->ingresos>0 ? round($u/$d->ingresos*100,1) : 0;
$color = $u >= 0 ? 'success' : 'danger';
@endphp
| {{ \Carbon\Carbon::parse($d->dia)->format('d/m/Y') }} |
{{ $currency }}{{ number_format($d->ingresos, 2) }} |
-{{ $currency }}{{ number_format($d->costos, 2) }} |
{{ $currency }}{{ number_format($u, 2) }} |
{{ $m }}% |
@empty
| Sin datos |
@endforelse
@if($utilidad->count())
@php $tm = $ti>0?round($tu/$ti*100,1):0; @endphp
| TOTAL | {{ $currency }}{{ number_format($ti,2) }} | -{{ $currency }}{{ number_format($tc,2) }} | {{ $currency }}{{ number_format($tu,2) }} | {{ $tm }}% |
@endif
@elseif($tipo === 'pagos')
| Método | N° Ventas | Total |
@forelse($pagos as $p)
| {{ $p->payment_method ?? 'Sin especificar' }} | {{ $p->num_ventas }} | {{ $currency }}{{ number_format($p->total, 2) }} |
@empty
| Sin datos |
@endforelse
@elseif($tipo === 'mesas')
| Mesa | Área | N° Ventas | Total |
@forelse($mesas as $m)
| {{ $m->mesa }} | {{ $m->area }} | {{ $m->num_ventas }} | {{ $currency }}{{ number_format($m->total, 2) }} |
@empty
| Sin datos (ventas de mesón, no de mesas específicas) |
@endforelse
@elseif($tipo === 'horas')
@elseif($tipo === 'comprobantes')
| Tipo | Estado SUNAT | Cantidad | Total |
@forelse($comprobantes as $c)
@php
$colorEstado = match($c->sunat_status) {
'ACCEPTED' => 'success', 'OBSERVED' => 'warning', 'PENDING' => 'secondary', 'ERROR', 'REJECTED' => 'danger', default => 'secondary',
};
@endphp
| {{ $c->document_type }} |
{{ $c->sunat_status ?? 'N/A' }} |
{{ $c->cantidad }} |
{{ $currency }}{{ number_format($c->total, 2) }} |
@empty
| Sin datos |
@endforelse
@elseif($tipo === 'gastos')
@php $utilidadNeta = $totalIngresos - $totalGastos; @endphp
Ingresos
{{ $currency }}{{ number_format($totalIngresos, 2) }}
Gastos
{{ $currency }}{{ number_format($totalGastos, 2) }}
Utilidad Neta
{{ $currency }}{{ number_format($utilidadNeta, 2) }}
| Fecha | Descripción | Registrado por | Monto |
@forelse($gastos as $g)
| {{ $g->created_at->format('d/m/Y') }} | {{ $g->description }} | {{ $g->user->name ?? '—' }} | -{{ $currency }}{{ number_format($g->amount, 2) }} |
@empty
| Sin gastos registrados |
@endforelse
@elseif($tipo === 'personal')
| Personal | N° Ventas | Total Vendido |
@forelse($salesByWaiter as $w)
| {{ $w->name }} | {{ $w->orders_count }} | {{ $currency }}{{ number_format($w->total_sales, 2) }} |
@empty
| Sin datos |
@endforelse
@endif
@endsection