@extends('print.template.checklist')
@section('title', '発注依頼書')
@section('head')
@parent
@endsection
@section('header')
納品予定日 {{$entities[0]->planned_delivery_date}}
【入庫倉庫】{{$warehouse->code}} {{$warehouse->name}}
【仕入先】{{$entities[0]->supplier->partner->code}} {{$entities[0]->supplier->partner->name}}
【備考】{{$entities[0]->trade->note}}
@endsection
@section('table-header')
発注番号
ロケーション
倉区
品番
商品名
規格
数量
区分
@endsection
@section('table-details')
@foreach($entities as $entity)
@foreach($entity->trade->trade_items as $item)
@if(!is_null($item->item_id))
@php
// 初期化
$item->stock_allocation_name = '';
$item->location_code = '';
// 現在庫を取得
$real_stock = App\Models\RealStock::with(['location', 'stock_allocation'])
->where('warehouse_id', $warehouse->id)
->where('item_id', $item->item->id)
->first();
$item->stock_allocation_name = $real_stock?->stock_allocation?->name;
$item->location_code = $real_stock?->location?->getLocationCode;
@endphp
{{ $entity->id }}
{{ $item->location_code }}
{{ $item->stock_allocation_name }}
{{ $item->item->code }}
{{ $item->item->name_main }}
{{ $item->item->packaging }}
{{ number_format($item->quantity) }}
{{ \App\Enums\QuantityType::tryFrom($item->quantity_type)?->name() }}
@endif
@endforeach
@endforeach
@endsection