@php header("Content-Type: application/vnd.ms-excel; charset=UTF-8"); header("Content-Disposition: attachment; filename=Informe_Guias_" . date('Ymd_His') . ".xls"); header("Pragma: no-cache"); header("Expires: 0"); @endphp @if($agrupado)

INFORME DE GUÍAS - AGRUPADO

@foreach($kardex as $item) @endforeach
SKU PRODUCTO TOTAL CAJAS COSTO UNIT. TOTAL COSTO PRECIO VENTA
{{ $item->sku }} {{ $item->nombre_producto }} {{ number_format($item->total_cajas, 2, ',', '.') }} {{ number_format($item->costo_unitario, 2, ',', '.') }} {{ number_format($item->total_cajas * $item->costo_unitario, 2, ',', '.') }} {{ number_format($item->precio_venta, 2, ',', '.') }}
@else

INFORME DE GUÍAS - DETALLADO

@foreach($kardex as $item) @endforeach
GUÍA SKU PRODUCTO TIPO DETALLE COMP. CAJAS PRECIO UNIT. COSTO UNIT. PLATAFORMA TRANSPORTADORA ESTADO F. DESPACHADA
{{ $item->GUIA }} {{ $item->sku }} {{ $item->nombre_producto }} {{ $item->tipo }} {{ $item->detalle }} {{ number_format($item->cantidad, 2, ',', '.') }} {{ number_format($item->cajas, 2, ',', '.') }} {{ number_format($item->precio_venta, 2, ',', '.') }} {{ number_format($item->costo_producto, 2, ',', '.') }} {{ $item->PLATAFORMA }} {{ $item->TRANSPORTADORA }} @php $estadoCode = strtoupper(trim($item->estado)); $label = $item->estado; switch ($estadoCode) { case 'A': $label = 'Alistamiento'; break; case 'V': $label = 'Verificado'; break; case 'C': $label = 'Confirmado'; break; case 'D': $label = 'Despachado'; break; case 'DV': $label = 'Devolución'; break; case 'AN': $label = 'Anulado'; break; default: $estadoLower = strtolower($item->estado); if (str_contains($estadoLower, 'entregado')) $label = 'Entregado'; elseif (str_contains($estadoLower, 'cancelado') || str_contains($estadoLower, 'anulado')) $label = 'Anulado'; elseif (str_contains($estadoLower, 'despachado') || str_contains($estadoLower, 'enviado')) $label = 'Despachado'; break; } @endphp {{ $label }} {{ $item->FECHADESPACHADA }}
@endif