@extends('layouts.app') @section('title', 'Productos Más Vendidos') @section('content')

Productos Más Vendidos

Volver a Reportes Exportar Excel
Filtros
Limpiar
Resumen

{{ count($topProducts) }}

Productos Listados

{{ number_format(array_sum(array_map(function($item) { return $item['total_quantity'] ?? 0; }, $topProducts)), 2) }}

Unidades Vendidas

${{ number_format(array_sum(array_map(function($item) { return $item['total_revenue'] ?? 0; }, $topProducts)), 2) }}

Ingresos Totales

@if(count($topProducts) > 0)
Gráfico de Productos Más Vendidos (Top 10)
@endif
Top {{ $limit ?? 50 }} Productos Más Vendidos
@forelse($topProducts as $index => $item) @empty @endforelse @if(count($topProducts) > 0) @endif
# Producto SKU Categoría Cantidad Vendida Facturas Precio Promedio Costo Unitario Ingresos Totales Margen % Margen Total
{{ $index + 1 }} {{ $item['product']->name }} @if($item['product']->brand)
{{ $item['product']->brand->name }} @endif
{{ $item['product']->sku ?? 'N/A' }} {{ $item['product']->category->name ?? 'N/A' }} {{ number_format($item['total_quantity'], 2) }} {{ number_format($item['invoice_count'], 0) }} ${{ number_format($item['avg_price'], 2) }} ${{ number_format($item['cost_price'], 2) }} ${{ number_format($item['total_revenue'], 2) }} {{ number_format($item['margin'], 2) }}% ${{ number_format($item['margin_amount'], 2) }}
No se encontraron productos vendidos en el período seleccionado.
Totales: {{ number_format(array_sum(array_map(function($item) { return $item['total_quantity'] ?? 0; }, $topProducts)), 2) }} - - - ${{ number_format(array_sum(array_map(function($item) { return $item['total_revenue'] ?? 0; }, $topProducts)), 2) }} - ${{ number_format(array_sum(array_map(function($item) { return $item['margin_amount'] ?? 0; }, $topProducts)), 2) }}
@push('scripts') @endpush @endsection