供应商对账:财务端数据在月份后新增「对账人」筛选 (#365)

对账人筛选取自终版货款对账的对账人列,按月过滤后生成选项;选择后供应商列表与比对明细同步过滤。
This commit is contained in:
renshen 2026-10-17 08:57:14 +08:00
parent 87eaf48c2c
commit 2a80f380e6
3 changed files with 56 additions and 1 deletions

View File

@ -52,6 +52,24 @@ class SupplierReconciliationPageData
$month = '';
}
$reconcilers = [];
foreach ($mine as $row) {
$name = trim((string) ($row['reconciler'] ?? ''));
if ($name !== '') {
$reconcilers[$name] = true;
}
}
$reconcilers = array_keys($reconcilers);
sort($reconcilers);
$reconciler = trim((string) request()->query('reconciler', ''));
if ($reconciler !== '') {
$mine = array_values(array_filter(
$mine,
static fn (array $row): bool => trim((string) ($row['reconciler'] ?? '')) === $reconciler,
));
}
$suppliers = [];
foreach ($mine as $row) {
$name = trim((string) ($row['supplier'] ?? ''));
@ -83,6 +101,8 @@ class SupplierReconciliationPageData
'uploads' => $uploads,
'months' => $months,
'month' => $month,
'reconcilers' => $reconcilers,
'reconciler' => $reconciler,
'selectedSupplier' => $selected,
'detail' => $detail,
'statementTemplateUrl' => route('business.supplier-reconciliation.template'),

View File

@ -50,6 +50,14 @@
@endforeach
</select>
</label>
<label class="sr-field"><span>对账人</span>
<select name="reconciler" onchange="this.form.submit()">
<option value="">全部对账人</option>
@foreach ($reconcilers as $optionReconciler)
<option value="{{ $optionReconciler }}" @selected($reconciler === $optionReconciler)>{{ $optionReconciler }}</option>
@endforeach
</select>
</label>
<label class="sr-field"><span>供应商</span>
<select name="supplier" onchange="this.form.submit()">
<option value="">请选择厂家</option>
@ -90,7 +98,7 @@
<td class="sr-muted">{{ $upload['uploaded_at'] ?? '—' }}</td>
<td class="is-num">{{ $upload ? number_format((int) ($upload['rows'] ?? 0)) : '—' }}</td>
<td>
<a class="sr-button" href="{{ route('business.pages.show', ['section' => $section['slug'], 'page' => $page['slug'], 'month' => $month, 'supplier' => $supplier]) }}">查看比对</a>
<a class="sr-button" href="{{ route('business.pages.show', ['section' => $section['slug'], 'page' => $page['slug'], 'month' => $month, 'reconciler' => $reconciler, 'supplier' => $supplier]) }}">查看比对</a>
</td>
</tr>
@empty

View File

@ -42,9 +42,36 @@ class SupplierReconciliationTest extends FeatureTestCase
->assertSeeText('厂家端数据')
->assertSeeText('厂家多')
->assertSeeText('取金额低的一方结算')
->assertSeeText('对账人')
->assertSeeText('下载对账单模板');
}
public function test_finance_page_filters_suppliers_by_reconciler(): void
{
$store = app(SupplierPayableOverrideStore::class);
$companyId = (int) $this->company->id;
$store->save('final:supplier:payment-reconciliation', 'line:000001', [
'summary_month' => '2026-09', 'supplier' => '晨丰', 'skuCode' => 'ZSJ-1',
'qty' => '2', 'unitPrice' => '128', 'amount' => '256', 'reconciler' => '张三',
], $companyId, null);
$store->save('final:supplier:payment-reconciliation', 'line:000002', [
'summary_month' => '2026-09', 'supplier' => '鸣飞家具', 'skuCode' => 'SJ-1',
'qty' => '1', 'unitPrice' => '96', 'amount' => '96', 'reconciler' => '李四',
], $companyId, null);
$this->loginAs()
->get(route('business.pages.show', [
'section' => 'supplier-reconciliation',
'page' => 'finance-data',
'reconciler' => '张三',
]))
->assertOk()
->assertSeeText('对账人')
->assertSeeText('张三')
->assertSeeText('晨丰')
->assertDontSeeText('鸣飞家具');
}
public function test_supplier_page_shows_uploads_and_return_rows(): void
{
$this->seedStatement('晨丰', [