Files
MES/app/views/Inventory/stock.php
T
2026-08-08 18:28:49 +08:00

69 lines
3.3 KiB
PHP

<?php
include APP_PATH . 'app/views/layouts/admin_header.php';
?>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-list"></i> 库存列表</h3>
<div class="box-tools">
<a href="<?php echo BASE_URL; ?>/Inventory/stockAdd" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> 添加库存</a>
</div>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>序号</th>
<th>产品名称</th>
<th>规格型号</th>
<th>物料分类</th>
<th>库存数量</th>
<th>单位</th>
<th>参考单价</th>
<th>最低库存</th>
<th>仓库</th>
<th>库位</th>
<th style="width:150px">操作</th>
</tr>
</thead>
<tbody>
<?php if (!empty($stocks)): ?>
<?php foreach ($stocks as $s): ?>
<?php
$isLow = $s['min_stock'] > 0 && $s['quantity'] <= $s['min_stock'];
?>
<tr class="<?php echo $isLow ? 'danger' : ''; ?>">
<td><?php echo $s['id']; ?></td>
<td><?php echo htmlspecialchars($s['product_name']); ?></td>
<td><?php echo htmlspecialchars($s['product_model']); ?></td>
<td><?php echo htmlspecialchars($s['category']); ?></td>
<td>
<span class="label label-<?php echo $isLow ? 'danger' : 'success'; ?>">
<?php echo $s['quantity']; ?>
</span>
</td>
<td><?php echo htmlspecialchars($s['unit']); ?></td>
<td>&yen;<?php echo number_format($s['unit_price'], 2); ?></td>
<td><?php echo $s['min_stock']; ?></td>
<td><?php echo htmlspecialchars($s['warehouse']); ?></td>
<td><?php echo htmlspecialchars($s['location']); ?></td>
<td>
<a href="<?php echo BASE_URL; ?>/Inventory/stockEdit?id=<?php echo $s['id']; ?>" class="btn btn-xs btn-info"><i class="fa fa-edit"></i> 编辑</a>
<form method="post" action="<?php echo BASE_URL; ?>/Inventory/stockDelete" style="display:inline" onsubmit="return confirm('确定删除该库存记录吗?');">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrfToken ?? ''); ?>">
<input type="hidden" name="id" value="<?php echo $s['id']; ?>">
<button type="submit" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i> 删除</button>
</form>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td colspan="11" class="text-center text-muted">暂无库存数据</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<?php include APP_PATH . 'app/views/layouts/admin_footer.php'; ?>