@foreach($rows as $index => $row) @php $pid = $row['product_id'] ?? ($row['product']['id'] ?? ''); $exp = $row['inventory_lot']['expiration_date'] ?? ''; $wid = $row['warehouse_id'] ?? 0; $warehouse_status = $row['warehouse_status'] ?? ''; $confirmed = $warehouse_status == Enum::value('InventoryStocktakingWarehousesStatus.Confirmed'); // 初期値(数値として取得) $aq1 = num_unformat($row['actual_quantity_1'] ?? 0); $aq2 = num_unformat($row['actual_quantity_2'] ?? 0); $aq3 = num_unformat($row['actual_quantity_3'] ?? 0); $aq4 = num_unformat($row['actual_quantity_4'] ?? 0); $aq5 = num_unformat($row['actual_quantity_5'] ?? 0); $dq1 = num_unformat($row['defective_quantity_1'] ?? 0); $dq2 = num_unformat($row['defective_quantity_2'] ?? 0); $dq3 = num_unformat($row['defective_quantity_3'] ?? 0); $dq4 = num_unformat($row['defective_quantity_4'] ?? 0); $dq5 = num_unformat($row['defective_quantity_5'] ?? 0); @endphp {{ $loop->iteration }} {{ $row['product']['jan_code'] }} {{ $row['product']['product_name'] }} {{ $exp }} {{-- 在庫合計 = 理論(良品) + 理論(不良品) --}} {{ num_format(($row['expected_quantity'] ?? 0) + ($row['defective_expected_quantity'] ?? 0)) }} {{ num_format($row['expected_quantity']) }} {{ num_format($row['defective_expected_quantity']) }} {{ num_format($row['actual_quantity']) }} {{ num_format($row['defective_quantity']) }} {{ num_format($row['difference_quantity']) }} {{ num_format($row['defective_difference_quantity']) }} {{-- 差異合計 = 差異(良品) + 差異(不良品) --}} {{ num_format(($row['difference_quantity'] ?? 0) + ($row['defective_difference_quantity'] ?? 0)) }} {{-- 良品 1~5列 --}} @for($i = 1; $i <= 5; $i++) @php $aqKey = "actual_quantity_{$i}"; @endphp @if($confirmed) @else @endif @endfor {{-- 不良品 1~5列 --}} @for($i = 1; $i <= 5; $i++) @php $dqKey = "defective_quantity_{$i}"; @endphp @if($confirmed) @else @endif @endfor {{-- ロケーション列(読み取り専用) --}} {{ $row['product']['location_1f'] ?? '' }} {{ $row['product']['location_3f_unit'] ?? '' }} {{ $row['product']['location_3f_carton'] ?? '' }} {{-- 商品性格・中分類名(読み取り専用) --}} {{ $row['product']['product_character'] ?? '' }} {{ $row['product']['category_name'] ?? '' }} {{-- hidden fields --}} {{-- 変更検知用初期値 --}} @endforeach