@section('tituloPagina', 'Detalle de Compra') @section('anchoPantalla', '100%')
Fecha: {{ $compra->fecha }}
Total de Productos: {{ count($detalles) }}
| N° | Producto | Unidad | Cantidad | Precio Compra | Subtotal Compra | Precio Venta | Subtotal Venta | Margen de Ganancia |
|---|---|---|---|---|---|---|---|---|
| {{ $loop->iteration }} | {{ $detalle->producto->nombre }} | {{ $detalle->unidadMedida->nombre }} | {{ number_format($detalle->cantidad, 2) }} | {{ number_format($detalle->precio_unitario, 2) }} | {{ number_format($detalle->cantidad * $detalle->precio_unitario, 2) }} | {{ number_format($detalle->producto->precio_venta, 2) }} | {{ number_format($detalle->cantidad * $detalle->producto->precio_venta, 2) }} | {{ number_format(($detalle->producto->precio_venta - $detalle->precio_unitario) * $detalle->cantidad, 2) }} |
| Total | {{ number_format($detalles->sum(fn($d) => $d->cantidad * $d->precio_unitario), 2) }} | {{ number_format($detalles->sum(fn($d) => $d->cantidad * $d->producto->precio_venta), 2) }} | {{ number_format($detalles->sum(fn($d) => ($d->producto->precio_venta - $d->precio_unitario) * $d->cantidad), 2) }} | |||||