@extends('print.template.checklist') @section('title', '発注依頼書') @section('head') @parent @endsection @section('header')
@yield('header-left')
要Re:FAX
**≪発注依頼書≫**
作成日 {{ $created_at }}  {PAGENO}頁
入荷予定日 {{$entities[0]->planned_delivery_date}}
{{ $entities[0]->contractor->code }}
{{ $entities[0]->contractor->name }} 御中
発注番号 {{$entities[0]->id}}
TEL:
{{ $entities[0]->contractor->tel }}
FAX:
{{ $entities[0]->contractor->fax }}
{{$client->name}}
TEL: {{$client->tel}}
FAX: {{$client->fax}}
発注担当者: {{ $entities[0]->ordering_manager}}
{{ $entities[0]->warehouse_name}}
@endsection @section('table-details') @php $items = []; $items_without_id = []; $trade_notes = []; foreach ($entities as $entity) { $trade_notes[] = $entity->trade->note; // 各 trade の note を配列に保存 foreach ($entity->trade->trade_items as $item) { if(!is_null($item->item_id)) { $items[] = $item; $target_quantity_type = $item->quantity_type; $next_target_quantity_type = ($target_quantity_type === \App\Enums\QuantityType::CASE->value) ? \App\Enums\QuantityType::PIECE->value : \App\Enums\QuantityType::CASE->value; $item->jan_code=\App\Models\ItemSearchInformation::where('item_id',$item->item_id) ->where('code_type',\App\Enums\EItemSearchCodeType::JAN->value) ->orderByRaw("FIELD(quantity_type, ?, ?)", [$target_quantity_type, $next_target_quantity_type]) ->orderBy('priority','asc') ->first(); } else { $items_without_id[] = $item; } } } @endphp @foreach($items as $item) @endforeach
品番
JANコード
相手先品番
商品名 規格 発注数 明細備考
{{ $item->item->code }}
@php if($item->jan_code){ $jan_code = $item->jan_code->search_string; }else{ $jan_code = ''; } // 相手先品番(取引先品番) $partner_id = $item->trade->partner_id; $partner_item_code = null; if ($partner_id && $item->item_id) { $connection = \App\Models\ItemConnection::where('partner_id', $partner_id) ->where('item_id', $item->item_id) ->first(); $partner_item_code = $connection?->partner_item_code; } @endphp {{ $jan_code }}
{{ $partner_item_code ?? '' }}
{{ $item->item->name_main }} {{ $item->item->packaging }} {{ number_format($item->quantity) }} {{ \App\Enums\QuantityType::tryFrom($item->quantity_type)?->name() }} {{ $item->note }}
備考
@foreach($trade_notes as $trade_note) {{$trade_note}}
@endforeach
@endsection