Files
2026-08-08 15:53:53 +08:00

67 lines
3.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/** PSI 销售/采购订单明细(合并筛选) */
/** @var string $type @var array $so @var array $po */
$soStatus = ['pending'=>'待处理','partial'=>'部分交付','delivered'=>'已交付','closed'=>'已关闭'];
$poStatus = ['pending'=>'待处理','partial'=>'部分收货','received'=>'已收货','closed'=>'已关闭'];
?>
<div class="page-head">
<div><h1>销售 / 采购订单明细</h1><div class="desc">合并查看销售订单与采购订单(含金额)</div></div>
<a class="btn-ghost" href="<?php echo site_url('PSI/reports'); ?>">← 报表中心</a>
</div>
<div class="panel">
<div class="panel-bar">
<h3>筛选</h3>
<div class="seg" style="display:flex;gap:8px">
<a class="btn-sm <?php echo $type==='all'?'btn-primary':'btn-ghost'; ?>" href="<?php echo site_url('PSI/reports/soPo?type=all'); ?>">全部</a>
<a class="btn-sm <?php echo $type==='sales'?'btn-primary':'btn-ghost'; ?>" href="<?php echo site_url('PSI/reports/soPo?type=sales'); ?>">仅销售订单</a>
<a class="btn-sm <?php echo $type==='purchase'?'btn-primary':'btn-ghost'; ?>" href="<?php echo site_url('PSI/reports/soPo?type=purchase'); ?>">仅采购订单</a>
</div>
</div>
<?php if ($type !== 'purchase'): ?>
<h4 style="margin:14px 0 8px">销售订单(<?php echo count($so); ?></h4>
<div class="table-wrap">
<table class="tbl">
<thead><tr><th>订单号</th><th>客户</th><th>业务员</th><th>渠道</th><th>明细</th><th>金额</th><th>状态</th></tr></thead>
<tbody>
<?php foreach ($so as $o): ?>
<tr>
<td><?php echo e($o['order_no']); ?></td>
<td><?php echo e($o['customer']); ?></td>
<td><?php echo e($o['salesman']); ?></td>
<td><?php echo $o['channel']==='export'?'外贸':'内贸'; ?></td>
<td class="muted"><?php echo count($o['_items']??[]); ?> 项</td>
<td>¥<?php echo e(number_format((float)($o['_amt'] ?? 0), 2)); ?></td>
<td><?php echo $soStatus[$o['status']] ?? '待处理'; ?></td>
</tr>
<?php endforeach; ?>
<?php if (empty($so)): ?><tr><td colspan="7" class="muted" style="text-align:center;padding:14px">无销售订单</td></tr><?php endif; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if ($type !== 'sales'): ?>
<h4 style="margin:18px 0 8px">采购订单(<?php echo count($po); ?></h4>
<div class="table-wrap">
<table class="tbl">
<thead><tr><th>订单号</th><th>供应商</th><th>采购员</th><th>明细</th><th>金额</th><th>状态</th></tr></thead>
<tbody>
<?php foreach ($po as $o): ?>
<tr>
<td><?php echo e($o['order_no']); ?></td>
<td><?php echo e($o['supplier_name']); ?></td>
<td><?php echo e($o['salesman']); ?></td>
<td class="muted"><?php echo count($o['_items']??[]); ?> 项</td>
<td>¥<?php echo e(number_format((float)($o['_amt'] ?? 0), 2)); ?></td>
<td><?php echo $poStatus[$o['status']] ?? '待处理'; ?></td>
</tr>
<?php endforeach; ?>
<?php if (empty($po)): ?><tr><td colspan="6" class="muted" style="text-align:center;padding:14px">无采购订单</td></tr><?php endif; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>