<?php
/** PSI 手动调整库存（盘盈/盘亏/报损） */
$isMat = $type === 'material';
$label = $isMat ? '物料' : '成品';
?>
<div class="page-head"><h1>调整库存 — <?php echo e($item['name']); ?></h1></div>
<div class="panel">
    <p>当前库存：<b><?php echo e((float)($item['stock'] ?? 0)); ?></b></p>
    <form method="post" action="<?php echo site_url('PSI/' . ($isMat ? 'materials' : 'products') . '/adjust/' . $item['id']); ?>">
        <?php echo csrf_field(); ?>
        <div class="form-grid">
            <div class="field"><label>方向</label>
                <select name="direction">
                    <option value="in">入库 +（盘盈）</option>
                    <option value="out">出库 -（盘亏/报损）</option>
                </select>
            </div>
            <div class="field"><label>数量 *</label><input name="qty" type="number" step="0.01" required></div>
        </div>
        <button class="btn-primary" type="submit">确认调整</button>
        <a class="btn-soft" href="<?php echo site_url('PSI/' . ($isMat ? 'materials' : 'products')); ?>">取消</a>
    </form>
</div>
