@extends('layouts.app') @section('title', 'Reportes | Veltrix v2') @section('page_title', 'Reportes') @section('page_subtitle', 'Gestion operativa en tiempo real') @section('page_icon', 'bx bxs-report') @section('content') @php $currentFilters = is_array($filters ?? null) ? $filters : []; $cashierRows = collect($cashiers ?? []); $branchRows = collect($branches ?? []); $summaryRow = is_array($summary ?? null) ? $summary : []; $salesByCashierRows = collect($salesByCashier ?? []); $topProductsRows = collect($topProducts ?? []); $frequentCustomersRows = collect($frequentCustomers ?? []); $inventorySummaryRow = is_array($inventorySummary ?? null) ? $inventorySummary : []; $inventorySnapshotRows = collect($inventorySnapshot ?? []); $inventoryMovementsRows = collect($inventoryMovements ?? []); $kardexRows = collect($kardexByRange ?? []); $cashClosingsRows = collect($cashClosings ?? []); $receivablesRow = is_array($receivables ?? null) ? $receivables : []; $payablesRow = is_array($payables ?? null) ? $payables : []; $profitByBranchRows = collect($profitByBranch ?? []); $salesByPaymentMethodRows = collect($salesByPaymentMethod ?? []); @endphp

Filtros de reporte

Limpiar
Ventas

{{ money((float) ($summaryRow['ventas_total'] ?? 0)) }}

{{ (int) ($summaryRow['ventas_count'] ?? 0) }} transacciones
Ticket promedio

{{ money((float) ($summaryRow['ticket_promedio'] ?? 0)) }}

Promedio por venta
Utilidad estimada

{{ money((float) ($summaryRow['utilidad_estimada'] ?? 0)) }}

Venta menos costo compra
Valor inventario

{{ money((float) ($inventorySummaryRow['valor_inventario'] ?? 0)) }}

Stock bajo: {{ (int) ($inventorySummaryRow['stock_bajo'] ?? 0) }}

Cuentas por cobrar

Total credito: {{ money((float) ($receivablesRow['total_credito'] ?? 0)) }}

Total abonado: {{ money((float) ($receivablesRow['total_abonado'] ?? 0)) }}

Saldo pendiente: {{ money((float) ($receivablesRow['total_saldo'] ?? 0)) }}

Cuentas por pagar

Total compras: {{ money((float) ($payablesRow['total_compras'] ?? 0)) }}

Total pagado: {{ money((float) ($payablesRow['total_pagado'] ?? 0)) }}

Saldo pendiente: {{ money((float) ($payablesRow['total_saldo'] ?? 0)) }}

Utilidad por sucursal

@forelse ($profitByBranchRows as $row) @php $profit = (float) ($row['utilidad_total'] ?? 0); @endphp @empty @endforelse
Sucursal Ventas Costo Utilidad
{{ (string) ($row['sucursal'] ?? 'Sin sucursal') }} {{ money((float) ($row['ventas_total'] ?? 0)) }} {{ money((float) ($row['costo_total'] ?? 0)) }} {{ money($profit) }}
Sin datos para el filtro actual.

Ventas por método de pago

@forelse ($salesByPaymentMethodRows as $row) @empty @endforelse
Metodo Pagos Ventas Total
{{ (string) ($row['metodo_pago'] ?? 'n/a') }} {{ (int) ($row['pagos_count'] ?? 0) }} {{ (int) ($row['ventas_count'] ?? 0) }} {{ money((float) ($row['monto_total'] ?? 0)) }}
Sin pagos para el filtro actual.

Ventas por cajero

@forelse ($salesByCashierRows as $row) @empty @endforelse
Cajero Ventas Total
{{ (string) ($row['nombre'] ?? '') }} {{ (int) ($row['ventas_count'] ?? 0) }} {{ money((float) ($row['ventas_total'] ?? 0)) }}
Sin datos para el filtro actual.

Top productos vendidos

@forelse ($topProductsRows as $row) @empty @endforelse
Producto Cantidad Vendido Utilidad
{{ (string) ($row['nombre'] ?? '') }} {{ number_format((float) ($row['cantidad'] ?? 0), 2, '.', '') }} {{ money((float) ($row['total_vendido'] ?? 0)) }} {{ money((float) ($row['utilidad_estimada'] ?? 0)) }}
Sin datos para el filtro actual.

Clientes frecuentes

@forelse ($frequentCustomersRows as $row) @empty @endforelse
Cliente Compras Total Ultima compra
{{ (string) ($row['nombre'] ?? '') }} {{ (int) ($row['compras'] ?? 0) }} {{ money((float) ($row['monto_total'] ?? 0)) }} {{ (string) ($row['ultima_compra'] ?? '') }}
Sin datos para el filtro actual.

Cierres de caja

@forelse ($cashClosingsRows as $row) @php $difference = (float) ($row['diferencia'] ?? 0); $branchName = trim((string) ($row['sucursal'] ?? '')); $cashRegister = trim((string) ($row['caja'] ?? '')); $cashDisplay = trim(($branchName !== '' ? $branchName.' / ' : '').$cashRegister); @endphp @empty @endforelse
Fecha Cajero Caja Diferencia
{{ (string) ($row['created_at'] ?? '') }} {{ (string) ($row['cajero'] ?? '') }} {{ $cashDisplay !== '' ? $cashDisplay : 'N/A' }} {{ money($difference) }}
Sin cierres para el filtro actual.

Inventario actual

@forelse ($inventorySnapshotRows as $row) @php $stockActual = (float) ($row['stock_actual'] ?? 0); $stockMinimo = (float) ($row['stock_minimo'] ?? 0); @endphp @empty @endforelse
Producto Stock Minimo Valor
{{ (string) ($row['nombre'] ?? '') }} {{ number_format($stockActual, 2, '.', '') }} {{ number_format($stockMinimo, 2, '.', '') }} {{ money((float) ($row['valor_inventario'] ?? 0)) }}
Sin productos disponibles.

Kardex por rango

@forelse ($kardexRows as $row) @php $net = (float) ($row['neto_movimiento'] ?? 0); @endphp @empty @endforelse
Producto Entradas Salidas Ajustes Neto
{{ (string) ($row['producto'] ?? '') }} {{ number_format((float) ($row['entradas'] ?? 0), 2, '.', '') }} {{ number_format((float) ($row['salidas'] ?? 0), 2, '.', '') }} {{ number_format((float) ($row['ajustes'] ?? 0), 2, '.', '') }} {{ number_format($net, 2, '.', '') }}
Sin kardex para el rango actual.

Movimientos detallados de inventario

@forelse ($inventoryMovementsRows as $row) @empty @endforelse
Fecha Tipo Producto Cantidad Referencia
{{ (string) ($row['created_at'] ?? '') }} {{ (string) ($row['tipo'] ?? '') }} {{ (string) ($row['producto'] ?? '') }} {{ number_format((float) ($row['cantidad'] ?? 0), 2, '.', '') }} {{ (string) ($row['referencia'] ?? '') }}
Sin movimientos para el filtro actual.
@endsection