feat: show bank affiliation in account directory #1083
@ -215,33 +215,9 @@ class FinanceLedgerPageData
|
||||
}
|
||||
}
|
||||
|
||||
$accountType = trim((string) request('accounts_type', ''));
|
||||
if ($accountType !== '') {
|
||||
$query->where(function (Builder $effectiveType) use ($accountType): void {
|
||||
$effectiveType->where(function (Builder $baseType) use ($accountType): void {
|
||||
$baseType->whereNotIn(
|
||||
'a.account_short',
|
||||
$this->db()->table('fin_account_type_overrides')->select('account_short'),
|
||||
);
|
||||
if ($accountType === self::ACCOUNT_FILTER_EMPTY) {
|
||||
$baseType->where(function (Builder $blank): void {
|
||||
$blank->whereNull('a.account_type')->orWhere('a.account_type', '');
|
||||
});
|
||||
} else {
|
||||
$baseType->where('a.account_type', $accountType);
|
||||
}
|
||||
});
|
||||
|
||||
$overrideType = $this->db()->table('fin_account_type_overrides')->select('account_short');
|
||||
if ($accountType === self::ACCOUNT_FILTER_EMPTY) {
|
||||
$overrideType->where(function (Builder $blank): void {
|
||||
$blank->whereNull('account_type')->orWhere('account_type', '');
|
||||
});
|
||||
} else {
|
||||
$overrideType->where('account_type', $accountType);
|
||||
}
|
||||
$effectiveType->orWhereIn('a.account_short', $overrideType);
|
||||
});
|
||||
$bankAffiliation = trim((string) request('accounts_bank', ''));
|
||||
if ($bankAffiliation !== '') {
|
||||
$this->applyBankAffiliationFilter($query, 'a.account_short', $bankAffiliation);
|
||||
}
|
||||
|
||||
$balanceRange = trim((string) request('accounts_balance', ''));
|
||||
@ -287,11 +263,12 @@ class FinanceLedgerPageData
|
||||
: $this->db()->table('fin_account_type_overrides')
|
||||
->whereIn('account_short', $accountShorts)
|
||||
->pluck('account_type', 'account_short');
|
||||
$rows->getCollection()->transform(static function ($row) use ($statuses, $typeOverrides) {
|
||||
$rows->getCollection()->transform(function ($row) use ($statuses, $typeOverrides) {
|
||||
$row->account_status = FinanceLedgerAccountStatus::normalize($statuses[$row->account_short] ?? null);
|
||||
if ($typeOverrides->has($row->account_short)) {
|
||||
$row->account_type = (string) ($typeOverrides->get($row->account_short) ?? '');
|
||||
}
|
||||
$row->bank_affiliation = $this->bankAffiliation((string) $row->account_short);
|
||||
$row->account_should_keep = FinanceLedgerAccountShouldKeep::display(
|
||||
$row->account_should_keep ?? null,
|
||||
$row->company_plan ?? null,
|
||||
@ -857,6 +834,56 @@ class FinanceLedgerPageData
|
||||
return '';
|
||||
}
|
||||
|
||||
private function bankAffiliationSqlExpression(string $column): string
|
||||
{
|
||||
$suffixesByLabel = [];
|
||||
foreach (self::BANK_AFFILIATION_SUFFIXES as $suffix => $label) {
|
||||
$suffixesByLabel[$label][] = $suffix;
|
||||
}
|
||||
|
||||
$cases = [];
|
||||
foreach ($suffixesByLabel as $label => $suffixes) {
|
||||
$conditions = array_map(
|
||||
fn (string $suffix): string => $column . " LIKE " . $this->db()->getPdo()->quote('%' . $suffix),
|
||||
$suffixes,
|
||||
);
|
||||
$cases[] = 'WHEN (' . implode(' OR ', $conditions) . ') THEN '
|
||||
. $this->db()->getPdo()->quote($label);
|
||||
}
|
||||
|
||||
return 'CASE ' . implode(' ', $cases) . " ELSE '' END";
|
||||
}
|
||||
|
||||
private function applyBankAffiliationFilter(Builder $query, string $column, string $bankAffiliation): void
|
||||
{
|
||||
if ($bankAffiliation === self::ACCOUNT_FILTER_EMPTY) {
|
||||
$query->where(function (Builder $scope) use ($column): void {
|
||||
foreach (array_keys(self::BANK_AFFILIATION_SUFFIXES) as $suffix) {
|
||||
$scope->where($column, 'not like', '%' . $suffix);
|
||||
}
|
||||
$scope->orWhereNull($column);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$suffixes = array_keys(array_filter(
|
||||
self::BANK_AFFILIATION_SUFFIXES,
|
||||
static fn (string $label): bool => $label === $bankAffiliation,
|
||||
));
|
||||
if ($suffixes === []) {
|
||||
$query->whereRaw('1 = 0');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$query->where(function (Builder $scope) use ($column, $suffixes): void {
|
||||
foreach ($suffixes as $suffix) {
|
||||
$scope->orWhere($column, 'like', '%' . $suffix);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 期初取筛选开始日前每个账户的最近期末;开始日后才起账的账户取首个流水期初。
|
||||
* 期末取筛选结束日前每个账户的最近期末,避免对期间内每天余额重复求和。
|
||||
@ -1575,6 +1602,7 @@ class FinanceLedgerPageData
|
||||
->whereNotNull('region')->where('region', '<>', '')
|
||||
->distinct()->orderBy('region')->pluck('region')->all(),
|
||||
'types' => $types,
|
||||
'banks' => array_values(array_unique(array_values(self::BANK_AFFILIATION_SUFFIXES))),
|
||||
];
|
||||
}
|
||||
|
||||
@ -1708,15 +1736,13 @@ class FinanceLedgerPageData
|
||||
{
|
||||
$a = $this->queryAlias('a');
|
||||
$statusTable = $this->tableName('fin_account_statuses');
|
||||
$typeTable = $this->tableName('fin_account_type_overrides');
|
||||
$statusExpression = "COALESCE((SELECT NULLIF(s.status, '') FROM {$statusTable} s WHERE s.account_short = {$a}.account_short LIMIT 1), 'normal')";
|
||||
$typeExpression = "COALESCE((SELECT NULLIF(o.account_type, '') FROM {$typeTable} o WHERE o.account_short = {$a}.account_short LIMIT 1), NULLIF({$a}.account_type, ''), '')";
|
||||
$keepExpression = "COALESCE(NULLIF({$a}.account_should_keep, ''), CASE WHEN COALESCE({$a}.company_plan, '') = '' THEN '' WHEN {$a}.company_plan LIKE '%保留%' THEN '是' ELSE '否' END)";
|
||||
|
||||
return [
|
||||
'company_name' => ['sort' => $a . '.company_name', 'type' => 'text'],
|
||||
'account_short' => ['sort' => $a . '.account_short', 'type' => 'text'],
|
||||
'account_type' => ['sort' => $typeExpression, 'type' => 'enum'],
|
||||
'bank_affiliation' => ['sort' => $this->bankAffiliationSqlExpression($a . '.account_short'), 'type' => 'enum'],
|
||||
'account_status' => ['sort' => $statusExpression, 'type' => 'enum'],
|
||||
'region' => ['sort' => $a . '.region', 'type' => 'text'],
|
||||
'account_no' => ['sort' => $a . '.account_no', 'type' => 'text'],
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
$accountStatusOptions = $ledgerAccountStatusOptions ?? \App\Utilities\FinanceLedgerAccountStatus::OPTIONS;
|
||||
$accountFilterOptions = $ledgerAccountFilterOptions ?? ['regions' => [], 'types' => []];
|
||||
$accountTypeOptions = $accountFilterOptions['types'] ?? [];
|
||||
$accountBankOptions = $accountFilterOptions['banks'] ?? [];
|
||||
$accountPlanOptions = $ledgerAccountPlanOptions ?? [];
|
||||
$companyOptions = $ledgerCompanyOptions ?? [];
|
||||
$accountKeepOptions = $ledgerAccountKeepOptions ?? \App\Utilities\FinanceLedgerAccountShouldKeep::OPTIONS;
|
||||
@ -24,7 +25,7 @@
|
||||
request('accounts_short'),
|
||||
request('accounts_status'),
|
||||
request('accounts_region'),
|
||||
request('accounts_type'),
|
||||
request('accounts_bank'),
|
||||
request('accounts_balance'),
|
||||
], static fn ($value): bool => trim((string) $value) !== ''));
|
||||
$money = static fn ($value): string => $value === null || $value === '' ? '' : number_format((float) $value, 2);
|
||||
@ -147,7 +148,7 @@
|
||||
'accounts' => [
|
||||
['company_name', '公司名称', 'text'],
|
||||
['account_short', '账户简称', 'text'],
|
||||
['account_type', '账户类型', 'enum', ['options' => $optionMap($accountTypeOptions)]],
|
||||
['bank_affiliation', '所属银行', 'enum', ['options' => $optionMap($accountBankOptions)]],
|
||||
['account_status', '账户状态', 'enum', ['options' => $accountStatusOptions, 'headerClass' => 'ledger-status-column']],
|
||||
['region', '地区', 'text'],
|
||||
['account_no', '账号', 'text'],
|
||||
@ -679,7 +680,7 @@
|
||||
<div class="ledger-field" style="min-width:11rem"><label for="accounts-short">账户简称</label><input id="accounts-short" name="accounts_short" list="ledger-account-list" value="{{ request('accounts_short') }}" placeholder="选择或输入"></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-status">账户状态</label><select id="accounts-status" name="accounts_status"><option value="">全部状态</option>@foreach ($accountStatusOptions as $statusCode => $statusLabel)<option value="{{ $statusCode }}" @selected(request('accounts_status') === $statusCode)>{{ $statusLabel }}</option>@endforeach</select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-region">地区</label><select id="accounts-region" name="accounts_region"><option value="">全部地区</option>@foreach (($accountFilterOptions['regions'] ?? []) as $region)<option value="{{ $region }}" @selected(request('accounts_region') === $region)>{{ $region }}</option>@endforeach<option value="__empty__" @selected(request('accounts_region') === '__empty__')>未填写</option></select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-type">账户类型</label><select id="accounts-type" name="accounts_type"><option value="">全部类型</option>@foreach (($accountFilterOptions['types'] ?? []) as $type)<option value="{{ $type }}" @selected(request('accounts_type') === $type)>{{ $type }}</option>@endforeach<option value="__empty__" @selected(request('accounts_type') === '__empty__')>未填写</option></select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-bank">所属银行</label><select id="accounts-bank" name="accounts_bank"><option value="">全部银行</option>@foreach ($accountBankOptions as $bank)<option value="{{ $bank }}" @selected(request('accounts_bank') === $bank)>{{ $bank }}</option>@endforeach<option value="__empty__" @selected(request('accounts_bank') === '__empty__')>未填写</option></select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-balance">当前余额</label><select id="accounts-balance" name="accounts_balance"><option value="">全部金额</option><option value="0-5" @selected(request('accounts_balance') === '0-5')>0-5万</option><option value="5-20" @selected(request('accounts_balance') === '5-20')>5-20万</option><option value="20-plus" @selected(request('accounts_balance') === '20-plus')>20万以上</option></select></div>
|
||||
@if ($activeAccountFilterCount > 0)
|
||||
<span class="ledger-filter-state" data-account-filter-state role="status" aria-live="polite" title="当前有 {{ $activeAccountFilterCount }} 个筛选条件生效"><span class="material-icons-outlined" aria-hidden="true">filter_alt</span><span>筛选中</span><b>{{ $activeAccountFilterCount }}</b></span>
|
||||
@ -695,7 +696,7 @@
|
||||
新增公司/账户
|
||||
</button>
|
||||
@endif
|
||||
<div class="ledger-column-picker" data-ledger-column-picker data-column-storage-key="caiwu.financial-ledger.accounts.preferences.v4.{{ auth()->id() }}.{{ company_id() }}">
|
||||
<div class="ledger-column-picker" data-ledger-column-picker data-column-storage-key="caiwu.financial-ledger.accounts.preferences.v5.{{ auth()->id() }}.{{ company_id() }}">
|
||||
<button class="ledger-btn" type="button" data-ledger-column-toggle aria-expanded="false"><span class="material-icons-outlined" aria-hidden="true">view_column</span>列设置</button>
|
||||
<div class="ledger-column-panel" data-ledger-column-panel role="group" aria-label="选择账户总表展示列" hidden>
|
||||
<p class="ledger-column-help">拖动字段可调整列顺序;拖动表头右侧边界可调整列宽,双击边界恢复默认。</p>
|
||||
@ -972,19 +973,7 @@
|
||||
<button class="ledger-row-edit" type="button" title="编辑账户 {{ $row->account_short }}" aria-label="编辑账户 {{ $row->account_short }}" data-ledger-account-edit data-edit-url="{{ route('business.financial-ledger.accounts.edit', ['id' => $row->id]) }}" data-save-url="{{ route('business.financial-ledger.accounts.update', ['id' => $row->id]) }}"><span class="material-icons-outlined" aria-hidden="true">edit</span></button>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($canEditAccountType)
|
||||
<span class="ledger-account-readonly" data-account-edit-display data-account-type-display>{{ $row->account_type ?: '未填写' }}</span>
|
||||
<select class="ledger-inline-select ledger-type-select ledger-account-editor" data-account-editor data-account-type data-account-short="{{ $row->account_short }}" data-url="{{ route('business.financial-ledger.accounts.type') }}" aria-label="账户 {{ $row->account_short }} 类型" disabled>
|
||||
<option value="" @selected(($row->account_type ?? '') === '')>未填写</option>
|
||||
@foreach ($accountTypeOptions as $accountType)
|
||||
<option value="{{ $accountType }}" @selected($row->account_type === $accountType)>{{ $accountType }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<span class="ledger-account-readonly">{{ $row->account_type ?: '未填写' }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $row->bank_affiliation ?: '未填写' }}</td>
|
||||
<td class="ledger-status-column">
|
||||
@if ($canEditAccountStatus)
|
||||
<span class="ledger-status-badge ledger-account-readonly" data-account-edit-display data-account-status-display data-status="{{ $row->account_status }}">{{ $accountStatusOptions[$row->account_status] ?? '正常' }}</span>
|
||||
|
||||
@ -108,23 +108,21 @@ class FinanceLedgerAccountStatusTest extends FeatureTestCase
|
||||
->assertSee('name="accounts_short"', false)
|
||||
->assertSee('name="accounts_status"', false)
|
||||
->assertSee('name="accounts_region"', false)
|
||||
->assertSee('name="accounts_type"', false)
|
||||
->assertSee('name="accounts_bank"', false)
|
||||
->assertSee('name="accounts_balance"', false)
|
||||
->assertSee('0-5万')
|
||||
->assertSee('5-20万')
|
||||
->assertSee('20万以上')
|
||||
->assertSee('data-account-type', false)
|
||||
->assertSee('data-account-plan', false)
|
||||
->assertSee('data-account-keep', false)
|
||||
->assertSee('data-account-plan-display', false)
|
||||
->assertSee('data-account-keep-display', false)
|
||||
->assertSee('ledger-type-select', false)
|
||||
->assertSee('data-mapping-bulk', false)
|
||||
->assertSee('导出录入模板')
|
||||
->assertSee('data-account-template-download', false)
|
||||
->assertSee('data-account-template-download-status', false)
|
||||
->assertSee('data-ledger-header-field="account_short"', false)
|
||||
->assertSee('data-ledger-header-field="account_type"', false)
|
||||
->assertSee('data-ledger-header-field="bank_affiliation"', false)
|
||||
->assertSee('data-ledger-header-field="account_status"', false)
|
||||
->assertSee('data-ledger-header-field="company_plan"', false)
|
||||
->assertSee('data-ledger-header-field="account_should_keep"', false)
|
||||
@ -313,7 +311,6 @@ class FinanceLedgerAccountStatusTest extends FeatureTestCase
|
||||
->assertSee('>12.00</td>', false)
|
||||
->assertSee('>0.35</td>', false)
|
||||
->assertSee('>20.00 / 1.00</td>', false)
|
||||
->assertSee('>5.00</td>', false)
|
||||
->assertSee('<td class="center" title="200000/10000">20.00 / 1.00</td>', false)
|
||||
->assertSee('<td class="center" title="300,000.00 元">30.00</td>', false)
|
||||
->assertSee('<td class="center" title="400,000.00 元">40.00</td>', false)
|
||||
@ -739,25 +736,25 @@ class FinanceLedgerAccountStatusTest extends FeatureTestCase
|
||||
->assertSee('accounts_short=page-test', false);
|
||||
}
|
||||
|
||||
public function test_account_filters_narrow_by_short_status_region_and_type(): void
|
||||
public function test_account_filters_narrow_by_short_status_region_and_bank(): void
|
||||
{
|
||||
$connection = DB::connection('business_mirror');
|
||||
$connection->table('fin_accounts')->insert([
|
||||
[
|
||||
'company_name' => '筛选测试公司甲',
|
||||
'account_short' => '筛选账户甲',
|
||||
'account_short' => '筛选账户甲农行',
|
||||
'region' => '上海',
|
||||
'account_type' => '公户',
|
||||
],
|
||||
[
|
||||
'company_name' => '筛选测试公司乙',
|
||||
'account_short' => '筛选账户乙',
|
||||
'account_short' => '筛选账户乙中行',
|
||||
'region' => '杭州',
|
||||
'account_type' => '个人卡',
|
||||
],
|
||||
]);
|
||||
$connection->table('fin_account_statuses')->insert([
|
||||
'account_short' => '筛选账户乙',
|
||||
'account_short' => '筛选账户乙中行',
|
||||
'status' => 'limited',
|
||||
'updated_by' => 'Test User',
|
||||
]);
|
||||
@ -769,11 +766,11 @@ class FinanceLedgerAccountStatusTest extends FeatureTestCase
|
||||
'accounts_short' => '筛选账户',
|
||||
'accounts_status' => 'limited',
|
||||
'accounts_region' => '杭州',
|
||||
'accounts_type' => '个人卡',
|
||||
'accounts_bank' => '中国银行',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('data-account-short="筛选账户乙"', false)
|
||||
->assertDontSee('data-account-short="筛选账户甲"', false)
|
||||
->assertSee('data-account-short="筛选账户乙中行"', false)
|
||||
->assertDontSee('data-account-short="筛选账户甲农行"', false)
|
||||
->assertSee('data-account-filter-state', false)
|
||||
->assertSee('筛选中')
|
||||
->assertSee('value="limited" selected', false);
|
||||
@ -786,8 +783,8 @@ class FinanceLedgerAccountStatusTest extends FeatureTestCase
|
||||
'accounts_status' => 'normal',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('data-account-short="筛选账户甲"', false)
|
||||
->assertDontSee('data-account-short="筛选账户乙"', false);
|
||||
->assertSee('data-account-short="筛选账户甲农行"', false)
|
||||
->assertDontSee('data-account-short="筛选账户乙中行"', false);
|
||||
|
||||
$this->loginAs()->get(route('business.pages.show', [
|
||||
'company_id' => $this->company->id,
|
||||
@ -796,35 +793,35 @@ class FinanceLedgerAccountStatusTest extends FeatureTestCase
|
||||
'accounts_short' => '测试账户',
|
||||
'accounts_status' => 'normal',
|
||||
'accounts_region' => '__empty__',
|
||||
'accounts_type' => '__empty__',
|
||||
'accounts_bank' => '__empty__',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('data-account-short="测试账户"', false);
|
||||
}
|
||||
|
||||
public function test_account_type_can_be_saved_and_filtered_by_effective_value(): void
|
||||
public function test_account_type_can_be_saved_without_changing_bank_affiliation_filter(): void
|
||||
{
|
||||
$connection = DB::connection('business_mirror');
|
||||
$connection->table('fin_accounts')->insert([
|
||||
[
|
||||
'company_name' => '类型测试公司甲',
|
||||
'account_short' => '类型账户甲',
|
||||
'account_short' => '类型账户甲农行',
|
||||
'account_type' => '公户',
|
||||
],
|
||||
[
|
||||
'company_name' => '类型测试公司乙',
|
||||
'account_short' => '类型账户乙',
|
||||
'account_short' => '类型账户乙中行',
|
||||
'account_type' => '个人卡',
|
||||
],
|
||||
[
|
||||
'company_name' => '类型测试公司丙',
|
||||
'account_short' => '类型账户丙',
|
||||
'account_short' => '类型账户丙支付宝',
|
||||
'account_type' => '支付宝',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->loginAs()->postJson($this->typeUrl(), [
|
||||
'account_short' => '类型账户甲',
|
||||
'account_short' => '类型账户甲农行',
|
||||
'account_type' => '网商银行',
|
||||
])
|
||||
->assertOk()
|
||||
@ -832,13 +829,13 @@ class FinanceLedgerAccountStatusTest extends FeatureTestCase
|
||||
->assertJsonPath('label', '网商银行');
|
||||
|
||||
$this->loginAs()->postJson($this->typeUrl(), [
|
||||
'account_short' => '类型账户甲',
|
||||
'account_short' => '类型账户甲农行',
|
||||
'account_type' => '个人卡',
|
||||
])->assertOk();
|
||||
|
||||
$this->assertDatabaseCount('fin_account_type_overrides', 1, 'business_mirror');
|
||||
$this->assertDatabaseHas('fin_account_type_overrides', [
|
||||
'account_short' => '类型账户甲',
|
||||
'account_short' => '类型账户甲农行',
|
||||
'account_type' => '个人卡',
|
||||
'updated_by' => 'Test User',
|
||||
], 'business_mirror');
|
||||
@ -847,25 +844,25 @@ class FinanceLedgerAccountStatusTest extends FeatureTestCase
|
||||
'company_id' => $this->company->id,
|
||||
'section' => 'financial-operations',
|
||||
'page' => 'ledger',
|
||||
'accounts_type' => '个人卡',
|
||||
'accounts_bank' => '农业银行',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('data-account-short="类型账户甲"', false)
|
||||
->assertSee('data-account-short="类型账户乙"', false)
|
||||
->assertDontSee('data-account-short="类型账户丙"', false)
|
||||
->assertSee('value="个人卡" selected', false);
|
||||
->assertSee('data-account-short="类型账户甲农行"', false)
|
||||
->assertDontSee('data-account-short="类型账户乙中行"', false)
|
||||
->assertDontSee('data-account-short="类型账户丙支付宝"', false)
|
||||
->assertSee('value="农业银行" selected', false);
|
||||
|
||||
$this->loginAs()->get(route('business.pages.show', [
|
||||
'company_id' => $this->company->id,
|
||||
'section' => 'financial-operations',
|
||||
'page' => 'ledger',
|
||||
'accounts_type' => '公户',
|
||||
'accounts_bank' => '中国银行',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertDontSee('data-account-short="类型账户甲"', false);
|
||||
->assertDontSee('data-account-short="类型账户甲农行"', false);
|
||||
|
||||
$this->withExceptionHandling()->loginAs()->postJson($this->typeUrl(), [
|
||||
'account_short' => '类型账户甲',
|
||||
'account_short' => '类型账户甲农行',
|
||||
'account_type' => '不存在的类型',
|
||||
])->assertUnprocessable()->assertJsonPath('message', '请选择现有账户类型。');
|
||||
}
|
||||
|
||||
@ -524,15 +524,21 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase
|
||||
$this->assertStringContainsString('data-ledger-account-row="账户丁网商"', $allHtml);
|
||||
$this->assertSame(1, preg_match('/<table class="ledger-table ledger-accounts-table">(.*?)<\/table>/s', $allHtml, $accountsTable));
|
||||
$this->assertSame(21, substr_count($accountsTable[1], 'data-ledger-header-details'));
|
||||
$this->assertStringContainsString('data-ledger-header-field="bank_affiliation"', $accountsTable[1]);
|
||||
$this->assertStringNotContainsString('data-ledger-header-field="account_type"', $accountsTable[1]);
|
||||
$this->assertStringContainsString('>所属银行</span>', $accountsTable[1]);
|
||||
$this->assertStringContainsString('name="accounts_bank"', $allHtml);
|
||||
$this->assertSame(1, preg_match('/<tr data-ledger-account-row="账户甲">(.*?)<\/tr>/s', $allHtml, $accountRow));
|
||||
$this->assertSame(21, substr_count($accountRow[1], '<td'));
|
||||
$this->assertSame(1, preg_match('/<tr data-ledger-account-row="账户丁网商">(.*?)<\/tr>/s', $allHtml, $bankAccountRow));
|
||||
$this->assertStringContainsString('<td>网商银行</td>', $bankAccountRow[1]);
|
||||
$this->assertStringNotContainsString('>预计出清天数</span>', $allHtml);
|
||||
$this->assertStringNotContainsString('>提额目标(万元)</span>', $allHtml);
|
||||
$this->assertStringNotContainsString('>提额状态</span>', $allHtml);
|
||||
$this->assertStringNotContainsString('>提额动作</span>', $allHtml);
|
||||
$this->assertStringNotContainsString('>已做动作</span>', $allHtml);
|
||||
$this->assertStringNotContainsString('>下一步</span>', $allHtml);
|
||||
$this->assertStringContainsString('caiwu.financial-ledger.accounts.preferences.v4.', $allHtml);
|
||||
$this->assertStringContainsString('caiwu.financial-ledger.accounts.preferences.v5.', $allHtml);
|
||||
|
||||
$bankHtml = $this->loginAs()->get($this->pageUrl([
|
||||
'accounts_view' => 'bank',
|
||||
@ -555,6 +561,37 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase
|
||||
$this->assertStringNotContainsString('data-ledger-account-row="账户丁网商"', $nonStoreHtml);
|
||||
}
|
||||
|
||||
public function test_account_directory_bank_affiliation_filter_uses_account_short_suffix(): void
|
||||
{
|
||||
DB::connection('business_mirror')->table('fin_accounts')->insert([
|
||||
[
|
||||
'company_name' => '丙公司',
|
||||
'account_short' => '账户丙支付宝',
|
||||
'account_type' => '公户',
|
||||
'current_balance' => 0,
|
||||
'daily_available' => 0,
|
||||
'blocked_amount' => 0,
|
||||
],
|
||||
[
|
||||
'company_name' => '丁公司',
|
||||
'account_short' => '账户丁网商',
|
||||
'account_type' => '公户',
|
||||
'current_balance' => 0,
|
||||
'daily_available' => 0,
|
||||
'blocked_amount' => 0,
|
||||
],
|
||||
]);
|
||||
|
||||
$html = $this->loginAs()->get($this->pageUrl([
|
||||
'accounts_bank' => '支付宝',
|
||||
]))->assertOk()->getContent();
|
||||
|
||||
$this->assertStringContainsString('value="支付宝" selected', $html);
|
||||
$this->assertStringContainsString('data-ledger-account-row="账户丙支付宝"', $html);
|
||||
$this->assertStringNotContainsString('data-ledger-account-row="账户乙"', $html);
|
||||
$this->assertStringNotContainsString('data-ledger-account-row="账户甲"', $html);
|
||||
}
|
||||
|
||||
public function test_account_bank_affiliation_uses_only_the_account_short_suffix(): void
|
||||
{
|
||||
$affiliations = [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user