@extends('layouts.app') @section('title', 'Productos Más Vendidos') @section('content')
Productos Listados
Unidades Vendidas
Ingresos Totales
| # | 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) }} | |||