@php $imageSrc = null; if(!is_null($doc['document_logo'])){ $imagePath = public_path('images/sites/logo/'. $doc['document_logo']); $imageData = base64_encode(file_get_contents($imagePath)); $imageSrc = 'data:image/png;base64,' . $imageData; // Ajustez le type MIME si nécessaire } @endphp Inventaire
@if(!is_null($imageSrc))
@endif

Inventaire

{!! nl2br($doc['document_header']) !!}
Type inventaire: Saisie des régularisations
Type d'inventaire: Cumuls de stocks à jour

Inventaire #{{ $detail['reference'] }}

Date: {{date('d-m-Y', strtotime($detail['inventory_date']))}}

Etat: @if($detail['status'] == 'validate') validé @else En cours @endif
@foreach ($cols as $k => $col) @endforeach @foreach ($detail['details'] as $i => $item) @php if($detail['status'] == 'validate'){ $reference = $item['product_reference']; $product = $item['product']['title']; $unite = $item['product']['unite']; $category = $item['product_category']; $price = $item['product_purchase_price']; $stock = $item['stock_actual']; $reorderLevel = isset($item['product']['locations'][0]) ? $item['product']['locations'][0]['reorder_level'] : 0; $regulQty = $item['stock_regul']; $regulPrice = $item['purchase_price_regul']; }else { $reference = $item['reference']; $product = $item['title']; $unite = $item['unitedetail']['title']; $category = implode(' - ', array_map(fn($cat) => "{$cat['title']}", $item['categories'])); $regulQty = isset($item['inventory']['details'][0]) ? $item['inventory']['details'][0]['stock_regul'] : 0; $regulPrice = isset($item['inventory']['details'][0]) ? $item['inventory']['details'][0]['purchase_price_regul'] : 0; $price = isset($item['supplier_prices'][0]) ? (float)$item['supplier_prices'][0]['price'] : 0; $stock = isset($item['stock'][0]) ? (float)$item['stock'][0]['stock'] : 0; $reorderLevel = isset($item['locations'][0]) ? $item['locations'][0]['reorder_level'] : 0; } $valeur = (float)$stock * (float)$price; $ecart = (float)$stock - (float)$regulQty; // Définition des couleurs en inline style $textColor = '#15803d'; // Vert par défaut $borderColor = '#15803d'; $bgColor = '#bbf7d0'; if ($stock == 0) { $textColor = '#b91c1c'; // Rouge $borderColor = '#b91c1c'; $bgColor = '#fecaca'; } elseif ($stock > 0 && $stock <= $reorderLevel) { $textColor = '#b45309'; // Orange $borderColor = '#b45309'; $bgColor = '#fed7aa'; } @endphp @endforeach
{{$col['title']}}
{{$reference}}

{{$product}}

{!! $category !!}

{{number_format($stock, 2, ",", " ")}}
{{$unite}} {{number_format($price, 2, ",", " ")."Ar"}} {{number_format($valeur, 2, ",", " ")."Ar"}}

{{number_format($regulQty, 2, ",", " ")}}

@if((float)$regulQty != 0)

Ecart: {{number_format($ecart, 2, ",", " ")}}

@endif
{{number_format($regulPrice, 2, ",", " ")."Ar"}}