feat(供应商对账): 新增厂家原始账单查看页 (#1719)
财务端可查看厂家最新上传账单原始行、上传记录和文件名,并从列表及比对详情直达。 Co-authored-by: 苏木 <594326199@qq.com> Co-committed-by: 苏木 <594326199@qq.com>
This commit is contained in:
parent
b7f768d371
commit
9b465c111a
@ -6002,6 +6002,7 @@ class Pages extends Controller
|
||||
'planting-reimbursement-workbench' => app(\Modules\EcommerceFinance\View\PlantingReimbursementWorkbenchPageData::class)->page(),
|
||||
'planting-loss' => app(\Modules\EcommerceFinance\View\PlantingLossPageData::class)->page(),
|
||||
'finance-data' => app(\Modules\EcommerceFinance\View\SupplierReconciliationPageData::class)->financeData(),
|
||||
'raw-statements' => app(\Modules\EcommerceFinance\View\SupplierReconciliationPageData::class)->rawStatementsData(),
|
||||
'supplier-data' => app(\Modules\EcommerceFinance\View\SupplierReconciliationPageData::class)->supplierData(),
|
||||
'supplier-negative-alert', 'courier-negative-alert' => $this->negativeAlertContent($page, $tab),
|
||||
'store-report-data-logic' => $this->prepareStoreReportLogic(),
|
||||
|
||||
@ -131,6 +131,10 @@ class SidebarPermissions
|
||||
$allowed[] = 'courier-payables/returned-parcels';
|
||||
}
|
||||
|
||||
if (in_array('supplier-reconciliation/finance-data', $allowed, true)) {
|
||||
$allowed[] = 'supplier-reconciliation/raw-statements';
|
||||
}
|
||||
|
||||
return array_values(array_unique($allowed));
|
||||
}
|
||||
|
||||
|
||||
@ -813,6 +813,7 @@ $navigation = [
|
||||
'icon' => 'fact_check',
|
||||
'pages' => [
|
||||
['slug' => 'finance-data', 'title' => '财务端数据'],
|
||||
['slug' => 'raw-statements', 'title' => '原始账单'],
|
||||
['slug' => 'supplier-data', 'title' => '厂家端数据'],
|
||||
],
|
||||
],
|
||||
|
||||
@ -15,6 +15,7 @@ use Modules\EcommerceFinance\Services\SupplierSummaryConfirmation;
|
||||
/**
|
||||
* 「供应商对账」页面数据:
|
||||
* - 财务端数据:按供应商与商品编码汇总,区分一致、未定价、厂家多、厂家少和数量/金额差异
|
||||
* - 原始账单:只读查看厂家最新一版上传对账单原始行
|
||||
* - 厂家端数据:厂家上传的对账单(实时)与只读的退货明细
|
||||
*/
|
||||
class SupplierReconciliationPageData
|
||||
@ -32,6 +33,9 @@ class SupplierReconciliationPageData
|
||||
/** 厂家上传的对账数据表:每页行数(短表 + 翻页)。 */
|
||||
private const PER_PAGE = 15;
|
||||
|
||||
/** 财务端查看厂家原始账单:每页行数。 */
|
||||
private const RAW_STATEMENT_PER_PAGE = 50;
|
||||
|
||||
/** 退货明细行较高:每页 10 行,并在页面内固定表头滚动查看。 */
|
||||
private const RETURN_PER_PAGE = 10;
|
||||
|
||||
@ -444,6 +448,79 @@ class SupplierReconciliationPageData
|
||||
] + $this->vendorPeriodContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* 财务端只读查看厂家最新一版上传对账单的原始行。
|
||||
*
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
public function rawStatementsData(): array
|
||||
{
|
||||
$companyId = $this->companyId();
|
||||
$mineDataset = PayablesFinalActions::DATASET_PREFIX . 'supplier:payment-reconciliation';
|
||||
$returnDataset = PayablesFinalActions::DATASET_PREFIX . 'supplier:return-reconciliation';
|
||||
$supplierNames = $this->financeSupplierNames($mineDataset, $returnDataset, $companyId);
|
||||
$uploadedSuppliers = $this->statements->uploadedSuppliers($companyId);
|
||||
sort($uploadedSuppliers, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
|
||||
$supplierQuery = trim((string) request()->query('supplier', ''));
|
||||
$selected = in_array($supplierQuery, $supplierNames, true) ? $supplierQuery : '';
|
||||
if ($supplierQuery === '' && $uploadedSuppliers !== []) {
|
||||
$selected = $uploadedSuppliers[0];
|
||||
}
|
||||
$supplierNotFound = $supplierQuery !== '' && $selected === '';
|
||||
|
||||
$month = trim((string) request()->query('month', ''));
|
||||
if (preg_match('/^\d{4}-(0[1-9]|1[0-2])$/', $month) !== 1) {
|
||||
$month = $this->latestAccountingMonth();
|
||||
}
|
||||
|
||||
$statementRows = [];
|
||||
$statementTotal = 0;
|
||||
$rowsPage = 1;
|
||||
$statementPages = 1;
|
||||
$uploads = [];
|
||||
if ($selected !== '') {
|
||||
$rowsPage = max((int) request()->query('rows_page', 1), 1);
|
||||
$statementPage = $this->statements->paginate(
|
||||
$selected,
|
||||
$companyId,
|
||||
self::RAW_STATEMENT_PER_PAGE,
|
||||
$rowsPage,
|
||||
);
|
||||
$statementTotal = (int) ($statementPage['total'] ?? 0);
|
||||
$statementPages = max((int) ceil($statementTotal / self::RAW_STATEMENT_PER_PAGE), 1);
|
||||
if ($rowsPage > $statementPages) {
|
||||
$rowsPage = $statementPages;
|
||||
$statementPage = $this->statements->paginate(
|
||||
$selected,
|
||||
$companyId,
|
||||
self::RAW_STATEMENT_PER_PAGE,
|
||||
$rowsPage,
|
||||
);
|
||||
}
|
||||
$statementRows = (array) ($statementPage['rows'] ?? []);
|
||||
$uploads = $this->statements->uploads($selected, $companyId, 10);
|
||||
}
|
||||
|
||||
return [
|
||||
'view' => 'business.pages.supplier-reconciliation.raw-statements',
|
||||
'sectionSlug' => 'supplier-reconciliation',
|
||||
'pageSlug' => 'raw-statements',
|
||||
'supplierNames' => $supplierNames,
|
||||
'supplierQuery' => $supplierQuery,
|
||||
'supplierNotFound' => $supplierNotFound,
|
||||
'selectedSupplier' => $selected,
|
||||
'statementRows' => $statementRows,
|
||||
'statementTotal' => $statementTotal,
|
||||
'rowsPage' => $rowsPage,
|
||||
'statementPages' => $statementPages,
|
||||
'perPage' => self::RAW_STATEMENT_PER_PAGE,
|
||||
'uploads' => $uploads,
|
||||
'latestUpload' => $uploads[0] ?? null,
|
||||
'month' => $month,
|
||||
];
|
||||
}
|
||||
|
||||
private function isSupplier(string $name): bool
|
||||
{
|
||||
try {
|
||||
|
||||
@ -999,7 +999,7 @@
|
||||
{{-- 钉钉单页入口(菜单隐藏时)才需要目录内页签;网页端有左侧菜单和已打开页面标签栏,不再重复。 --}}
|
||||
@include('business.pages.partials.section-page-tabs', ['section' => $section])
|
||||
@elseif (($section['slug'] ?? '') === 'supplier-reconciliation')
|
||||
{{-- 供应商对账:财务端数据 / 厂家端数据两个页签。 --}}
|
||||
{{-- 供应商对账:财务端数据 / 原始账单 / 厂家端数据。 --}}
|
||||
@include('business.pages.partials.section-page-tabs', ['section' => $section])
|
||||
@elseif (($section['slug'] ?? '') === 'negative-alerts')
|
||||
{{-- 负数预警:供应商负数预警 / 快递负数预警两个页签。 --}}
|
||||
|
||||
@ -274,6 +274,12 @@
|
||||
'comparison_filter' => $comparisonFilter,
|
||||
], static fn (mixed $value): bool => $value !== '' && $value !== null)) }}"
|
||||
class="sr-button">导出当前筛选</a>
|
||||
<a href="{{ route('business.pages.show', [
|
||||
'section' => $section['slug'],
|
||||
'page' => 'raw-statements',
|
||||
'supplier' => $selectedSupplier,
|
||||
'month' => $month,
|
||||
]) }}" class="sr-button">查看原始账单</a>
|
||||
<form id="summary-push-form"
|
||||
method="POST"
|
||||
action="{{ route('business.supplier-reconciliation.push-summary') }}">
|
||||
@ -515,6 +521,12 @@
|
||||
'supplier' => $supplier,
|
||||
'supplier_page' => $supplierPage > 1 ? $supplierPage : null,
|
||||
], static fn (mixed $value): bool => $value !== '' && $value !== null));
|
||||
$rawStatementUrl = route('business.pages.show', [
|
||||
'section' => $section['slug'],
|
||||
'page' => 'raw-statements',
|
||||
'supplier' => $supplier,
|
||||
'month' => $month,
|
||||
]);
|
||||
@endphp
|
||||
<tr>
|
||||
<td class="sr-list-select-cell">
|
||||
@ -538,6 +550,7 @@
|
||||
<td>
|
||||
<div class="sr-list-actions">
|
||||
<a class="sr-button is-small" href="{{ $detailUrl }}">查看比对</a>
|
||||
<a class="sr-button is-small" href="{{ $rawStatementUrl }}">原始账单</a>
|
||||
@if ($returnCount > 0)
|
||||
@if ($robotConfigured)
|
||||
<form method="POST"
|
||||
|
||||
@ -0,0 +1,417 @@
|
||||
<div class="raw-statement-page">
|
||||
<style>
|
||||
.raw-statement-page {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
color: var(--vip-content-ink, #171717);
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-card {
|
||||
min-width: 0;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--vip-border, #D8D2C7);
|
||||
border-radius: 10px;
|
||||
background: var(--vip-surface, #FFFFFF);
|
||||
}
|
||||
|
||||
.raw-statement-page h2 {
|
||||
margin: 0;
|
||||
font-size: .875rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-hint {
|
||||
margin: 5px 0 0;
|
||||
color: var(--vip-content-muted, #595959);
|
||||
font-size: .75rem;
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 9px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-field {
|
||||
display: grid;
|
||||
flex: 1 1 320px;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-field span {
|
||||
color: #5B5343;
|
||||
font-size: .75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-field input {
|
||||
width: 100%;
|
||||
height: 34px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid var(--vip-border, #D8D2C7);
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: var(--vip-content-ink, #171717);
|
||||
font: inherit;
|
||||
font-size: .8125rem;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-field input:focus {
|
||||
border-color: var(--vip-content-accent-dark, #856632);
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 3px rgba(133, 102, 50, .20);
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-button {
|
||||
display: inline-flex;
|
||||
min-height: 34px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--vip-border, #D8D2C7);
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: var(--vip-content-ink, #171717);
|
||||
font-size: .8125rem;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-button.is-primary {
|
||||
border-color: var(--vip-content-accent-dark, #856632);
|
||||
background: var(--vip-content-accent-dark, #856632);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-button.is-small {
|
||||
min-height: 27px;
|
||||
padding: 0 9px;
|
||||
font-size: .75rem;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-alert {
|
||||
margin-top: 10px;
|
||||
padding: 9px 11px;
|
||||
border: 1px solid #E2B7B2;
|
||||
border-radius: 8px;
|
||||
background: #FFF2F0;
|
||||
color: #8C2F26;
|
||||
font-size: .75rem;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-head-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-meta {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-meta-item {
|
||||
min-width: 0;
|
||||
padding: 9px 10px;
|
||||
border: 1px solid #E4DCCB;
|
||||
border-radius: 8px;
|
||||
background: #FCFAF5;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-meta-item span {
|
||||
display: block;
|
||||
color: var(--vip-content-muted, #595959);
|
||||
font-size: .6875rem;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-meta-item strong {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
margin-top: 3px;
|
||||
font-size: .8125rem;
|
||||
font-weight: 600;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-history {
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
margin: 10px 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-history li {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(150px, .8fr) minmax(0, 1.5fr) 90px;
|
||||
gap: 10px;
|
||||
padding: 6px 8px;
|
||||
border-bottom: 1px solid #EFEAE0;
|
||||
color: var(--vip-content-muted, #595959);
|
||||
font-size: .75rem;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-history li:first-child {
|
||||
border-top: 1px solid #EFEAE0;
|
||||
color: var(--vip-content-ink, #171717);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-history-file {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-table-wrap {
|
||||
max-height: min(66vh, 680px);
|
||||
overflow: auto;
|
||||
margin-top: 10px;
|
||||
border: 1px solid var(--vip-border, #D8D2C7);
|
||||
border-radius: 8px;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.raw-statement-page table {
|
||||
width: 100%;
|
||||
min-width: 1320px;
|
||||
border-collapse: collapse;
|
||||
font-size: .75rem;
|
||||
}
|
||||
|
||||
.raw-statement-page th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
padding: 8px 9px;
|
||||
border-bottom: 1px solid var(--vip-border, #D8D2C7);
|
||||
background: var(--vip-content-accent-soft, #F7F0DE);
|
||||
color: #5B5343;
|
||||
font-size: .75rem;
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.raw-statement-page td {
|
||||
padding: 7px 9px;
|
||||
border-bottom: 1px solid #EFEAE0;
|
||||
vertical-align: top;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.raw-statement-page td.is-number {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
margin-top: 10px;
|
||||
color: var(--vip-content-muted, #595959);
|
||||
font-size: .75rem;
|
||||
}
|
||||
|
||||
.raw-statement-page .rs-empty {
|
||||
margin-top: 12px;
|
||||
padding: 26px 16px;
|
||||
border: 1px dashed var(--vip-border, #D8D2C7);
|
||||
border-radius: 8px;
|
||||
color: var(--vip-content-muted, #595959);
|
||||
font-size: .8125rem;
|
||||
line-height: 1.65;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.raw-statement-page .rs-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.raw-statement-page .rs-meta { grid-template-columns: minmax(0, 1fr); }
|
||||
.raw-statement-page .rs-history li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="rs-card">
|
||||
<h2>厂家上传原始账单</h2>
|
||||
<p class="rs-hint">
|
||||
这里只读查看厂家当前最新一版上传对账单的原始行,不参与比对结果修改。
|
||||
当前表格展示整份上传账单,不按月份拆行;上方上传记录可查看最近版本的上传时间和文件名。
|
||||
</p>
|
||||
<form method="GET"
|
||||
action="{{ route('business.pages.show', ['section' => $sectionSlug, 'page' => $pageSlug]) }}"
|
||||
class="rs-toolbar">
|
||||
<input type="hidden" name="section" value="{{ $sectionSlug }}">
|
||||
<input type="hidden" name="page" value="{{ $pageSlug }}">
|
||||
<input type="hidden" name="month" value="{{ $month }}">
|
||||
<label class="rs-field">
|
||||
<span>厂家名称</span>
|
||||
<input type="search"
|
||||
name="supplier"
|
||||
value="{{ $supplierQuery !== '' ? $supplierQuery : $selectedSupplier }}"
|
||||
list="raw-statement-supplier-options"
|
||||
placeholder="输入厂家名称搜索"
|
||||
autocomplete="off"
|
||||
required>
|
||||
<datalist id="raw-statement-supplier-options">
|
||||
@foreach ($supplierNames as $supplierName)
|
||||
<option value="{{ $supplierName }}"></option>
|
||||
@endforeach
|
||||
</datalist>
|
||||
</label>
|
||||
<button type="submit" class="rs-button is-primary">查询厂家</button>
|
||||
</form>
|
||||
@if ($supplierNotFound)
|
||||
<div class="rs-alert" role="alert">未找到名为“{{ $supplierQuery }}”的厂家,请输入完整名称并从搜索建议中选择。</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($selectedSupplier !== '')
|
||||
<div class="rs-card">
|
||||
<div class="rs-head">
|
||||
<div>
|
||||
<h2>{{ $selectedSupplier }} · 原始账单</h2>
|
||||
<p class="rs-hint">当前显示最新一版上传数据,共 {{ number_format($statementTotal) }} 行。</p>
|
||||
</div>
|
||||
<div class="rs-head-actions">
|
||||
<a class="rs-button" href="{{ route('business.pages.show', [
|
||||
'section' => $sectionSlug,
|
||||
'page' => 'finance-data',
|
||||
'supplier' => $selectedSupplier,
|
||||
'month' => $month,
|
||||
]) }}">查看对账比对</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($latestUpload)
|
||||
<div class="rs-meta">
|
||||
<div class="rs-meta-item">
|
||||
<span>最近上传时间</span>
|
||||
<strong>{{ $latestUpload['uploaded_at'] ?? '—' }}</strong>
|
||||
</div>
|
||||
<div class="rs-meta-item">
|
||||
<span>文件名</span>
|
||||
<strong title="{{ $latestUpload['filename'] ?? '' }}">{{ $latestUpload['filename'] ?? '—' }}</strong>
|
||||
</div>
|
||||
<div class="rs-meta-item">
|
||||
<span>上传行数</span>
|
||||
<strong>{{ number_format((int) ($latestUpload['rows'] ?? 0)) }}</strong>
|
||||
</div>
|
||||
<div class="rs-meta-item">
|
||||
<span>当前比对账期</span>
|
||||
<strong>{{ $month }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (count($uploads) > 1)
|
||||
<ul class="rs-history" aria-label="最近上传记录">
|
||||
@foreach ($uploads as $upload)
|
||||
<li>
|
||||
<span>{{ $upload['uploaded_at'] ?? '—' }}</span>
|
||||
<span class="rs-history-file">{{ $upload['filename'] ?? '—' }}</span>
|
||||
<span>{{ number_format((int) ($upload['rows'] ?? 0)) }} 行</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@if ($statementTotal > 0)
|
||||
<div class="rs-table-wrap">
|
||||
<table aria-label="{{ $selectedSupplier }} 最新上传原始账单">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">序号</th>
|
||||
<th scope="col">快递名称</th>
|
||||
<th scope="col">快递单号</th>
|
||||
<th scope="col">单据编号(采购单号)</th>
|
||||
<th scope="col">创建时间</th>
|
||||
<th scope="col">供应商</th>
|
||||
<th scope="col">条码</th>
|
||||
<th scope="col">规格名称</th>
|
||||
<th scope="col">数量</th>
|
||||
<th scope="col">单价</th>
|
||||
<th scope="col">金额</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($statementRows as $index => $row)
|
||||
<tr>
|
||||
<td>{{ number_format(($rowsPage - 1) * $perPage + $index + 1) }}</td>
|
||||
<td>{{ $row['expressName'] ?? '—' }}</td>
|
||||
<td>{{ $row['expressNo'] ?? '—' }}</td>
|
||||
<td>{{ $row['purchaseNo'] ?? '—' }}</td>
|
||||
<td>{{ $row['createdAt'] ?? '—' }}</td>
|
||||
<td>{{ $row['supplier'] ?? '—' }}</td>
|
||||
<td>{{ $row['barcode'] ?? '—' }}</td>
|
||||
<td>{{ $row['skuName'] ?? '—' }}</td>
|
||||
<td class="is-number">{{ $row['qty'] ?? '—' }}</td>
|
||||
<td class="is-number">{{ $row['unitPrice'] ?? '—' }}</td>
|
||||
<td class="is-number">{{ $row['amount'] ?? '—' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@if ($statementPages > 1)
|
||||
@php
|
||||
$pageStart = max(1, min($rowsPage - 4, $statementPages - 8));
|
||||
$pageEnd = min($statementPages, $pageStart + 8);
|
||||
$pageUrl = fn (int $number): string => route('business.pages.show', [
|
||||
'section' => $sectionSlug,
|
||||
'page' => $pageSlug,
|
||||
'supplier' => $selectedSupplier,
|
||||
'month' => $month,
|
||||
'rows_page' => $number,
|
||||
]);
|
||||
@endphp
|
||||
<div class="rs-pagination">
|
||||
<span>第 {{ $rowsPage }} / {{ $statementPages }} 页,每页 {{ $perPage }} 行</span>
|
||||
@if ($rowsPage > 1)
|
||||
<a class="rs-button is-small" href="{{ $pageUrl($rowsPage - 1) }}">上一页</a>
|
||||
@endif
|
||||
@for ($number = $pageStart; $number <= $pageEnd; $number++)
|
||||
<a class="rs-button is-small {{ $number === $rowsPage ? 'is-primary' : '' }}"
|
||||
@if ($number === $rowsPage) aria-current="page" @endif
|
||||
href="{{ $pageUrl($number) }}">{{ $number }}</a>
|
||||
@endfor
|
||||
@if ($rowsPage < $statementPages)
|
||||
<a class="rs-button is-small" href="{{ $pageUrl($rowsPage + 1) }}">下一页</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<div class="rs-empty">
|
||||
该厂家还没有上传对账单。厂家上传后,这里会显示最新一版原始账单和上传记录。
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@elseif (! $supplierNotFound)
|
||||
<div class="rs-card">
|
||||
<div class="rs-empty">
|
||||
还没有厂家上传过对账单。厂家上传后,可在上方选择厂家并查看原始账单。
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@ -218,6 +218,114 @@ class SupplierReconciliationTest extends FeatureTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function test_finance_can_view_latest_uploaded_raw_statement_with_pagination(): void
|
||||
{
|
||||
$companyId = (int) $this->company->id;
|
||||
$statementRows = [];
|
||||
for ($index = 1; $index <= 52; $index++) {
|
||||
$statementRows[] = array_merge(
|
||||
$this->statementRow(
|
||||
sprintf('RAW-%02d', $index),
|
||||
'10.00',
|
||||
'1',
|
||||
'10.00',
|
||||
),
|
||||
[
|
||||
'purchaseNo' => sprintf('RAW-PO-%02d', $index),
|
||||
'createdAt' => '2026-11-30',
|
||||
'supplier' => '原始账单厂家',
|
||||
],
|
||||
);
|
||||
}
|
||||
$this->seedStatement('原始账单厂家', $statementRows);
|
||||
app(SupplierPayableOverrideStore::class)->save(
|
||||
'final:supplier:payment-reconciliation',
|
||||
'raw:mine',
|
||||
[
|
||||
'summary_month' => '2026-11',
|
||||
'purchaseNo' => 'RAW-PO-01',
|
||||
'date' => '2026-11-30',
|
||||
'supplier' => '原始账单厂家',
|
||||
'skuCode' => 'RAW-01',
|
||||
'productCode' => 'RAW-01',
|
||||
'qty' => '1',
|
||||
'unitPrice' => '10',
|
||||
'amount' => '10',
|
||||
],
|
||||
$companyId,
|
||||
null,
|
||||
);
|
||||
|
||||
$pageUrl = fn (int $page): string => route('business.pages.show', [
|
||||
'section' => 'supplier-reconciliation',
|
||||
'page' => 'raw-statements',
|
||||
'supplier' => '原始账单厂家',
|
||||
'month' => '2026-11',
|
||||
'rows_page' => $page,
|
||||
]);
|
||||
|
||||
$firstPage = $this->loginAs()->get($pageUrl(1))->assertOk();
|
||||
$firstPage->assertSeeText('厂家上传原始账单')
|
||||
->assertSeeText('原始账单厂家 · 原始账单')
|
||||
->assertSeeText('statement.csv')
|
||||
->assertSeeText('第 1 / 2 页,每页 50 行')
|
||||
->assertSeeText('RAW-01')
|
||||
->assertSeeText('RAW-50')
|
||||
->assertDontSeeText('RAW-51');
|
||||
|
||||
$this->loginAs()->get($pageUrl(2))
|
||||
->assertOk()
|
||||
->assertSeeText('第 2 / 2 页,每页 50 行')
|
||||
->assertSeeText('RAW-51')
|
||||
->assertSeeText('RAW-52')
|
||||
->assertDontSeeText('RAW-01');
|
||||
|
||||
$this->loginAs()->get(route('business.pages.show', [
|
||||
'section' => 'supplier-reconciliation',
|
||||
'page' => 'finance-data',
|
||||
'month' => '2026-11',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSeeText('原始账单')
|
||||
->assertSee('raw-statements', false);
|
||||
}
|
||||
|
||||
public function test_supplier_portal_cannot_view_the_finance_raw_statement_page(): void
|
||||
{
|
||||
$supplierUser = $this->createSupplierPortalUser('晨丰');
|
||||
|
||||
$this->withExceptionHandling();
|
||||
$this->actingAsSupplierPortal($supplierUser)
|
||||
->get(route('business.pages.show', [
|
||||
'section' => 'supplier-reconciliation',
|
||||
'page' => 'raw-statements',
|
||||
'supplier' => '晨丰',
|
||||
]))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_raw_statement_page_inherits_finance_data_page_permission(): void
|
||||
{
|
||||
$this->user->roles()->sync([Role::where('name', 'user')->firstOrFail()->id]);
|
||||
$subject = 'user_' . $this->user->id;
|
||||
setting()->set('system.sidebar_permissions', [
|
||||
'configured' => [$subject],
|
||||
'subjects' => [$subject => ['supplier-reconciliation/finance-data']],
|
||||
]);
|
||||
setting()->save();
|
||||
|
||||
$this->assertContains(
|
||||
'supplier-reconciliation/raw-statements',
|
||||
\App\Utilities\SidebarPermissions::effectiveAllowedKeys($this->user),
|
||||
);
|
||||
$section = collect(\App\Utilities\SidebarMenu::sections($this->user))
|
||||
->firstWhere('slug', 'supplier-reconciliation');
|
||||
$this->assertContains(
|
||||
'raw-statements',
|
||||
array_column($section['pages'] ?? [], 'slug'),
|
||||
);
|
||||
}
|
||||
|
||||
public function test_comparison_prefers_express_before_barcode_quantity(): void
|
||||
{
|
||||
$companyId = (int) $this->company->id;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user