<?php
/** PSI 销售出库打印正文（由 psi_print_shell 包裹） */
/** @var array $s @var array $item */
$chn = ($s['channel'] ?? '') === 'export' ? '外贸出口' : '内销';
$amt = (float)($s['qty'] ?? 0) * (float)($s['price'] ?? 0);
?>
<h2>销售出库单</h2>
<div class="sub"><?php echo e($s['order_no']); ?></div>
<div class="meta">
    <span><b>客户：</b><?php echo e($s['customer']); ?></span>
    <span><b>渠道：</b><?php echo $chn . ($s['region'] ? ' / ' . e($s['region']) : ''); ?></span>
    <span><b>批次/缸号：</b><?php echo e($s['batch_no'] ?: '—'); ?></span>
    <span><b>出库日期：</b><?php echo e($s['created_at']); ?></span>
</div>
<table>
    <thead><tr><th>物品</th><th>规格</th><th>单位</th><th>数量</th><th>单价</th><th>金额</th></tr></thead>
    <tbody>
        <tr>
            <td><?php echo e($item['name'] ?? '—'); ?></td>
            <td><?php echo e($item['spec'] ?? ''); ?></td>
            <td><?php echo e($item['unit'] ?? ''); ?></td>
            <td><?php echo e($s['qty'] ?? 0); ?></td>
            <td>¥<?php echo e(number_format((float)($s['price'] ?? 0), 2)); ?></td>
            <td>¥<?php echo e(number_format($amt, 2)); ?></td>
        </tr>
    </tbody>
    <tfoot><tr><th colspan="5" style="text-align:right">合计</th><th>¥<?php echo e(number_format($amt, 2)); ?></th></tr></tfoot>
</table>
<?php if ($s['remark']): ?><p style="font-size:13px;color:#374151;margin-top:10px"><b>备注：</b><?php echo e($s['remark']); ?></p><?php endif; ?>
<div class="sign"><span>发货：____________</span><span>收货签字：____________</span></div>
