@foreach($ventas as $venta) @php $desc = $venta->descuentos ? json_decode($venta->descuentos, true) : []; $descuentoGeneral = isset($desc['general']) ? $desc['general']['monto'] . ' (' . $desc['general']['tipo'] . ')' : '0'; @endphp @foreach($venta->detalles as $detalle) @endforeach @endforeach
ID Venta Vendedor Fecha Producto Cantidad Precio Unitario Subtotal Descuento Total LĂ­nea Descuento General
{{ $venta->id }} {{ $venta->user->name ?? '-' }} {{ $venta->created_at->format('d/m/Y H:i') }} {{ $detalle->producto->nombre ?? 'Producto eliminado' }} {{ $detalle->cantidad }} {{ $detalle->precio }} {{ $detalle->subtotal }} {{ $detalle->descuento ?? 0 }} {{ $detalle->subtotal - ($detalle->descuento ?? 0) }} {{ $descuentoGeneral }}