From ef326c179f2d5ab8ffc1f0dae02ae9faa6606e8a Mon Sep 17 00:00:00 2001 From: shanshi <3316401569@qq.com> Date: Wed, 11 Nov 2026 14:08:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8B=86=E5=88=86=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E8=B4=A6=E6=88=B7=E4=B8=8E=E9=9D=9E=E5=BA=97=E9=93=BA=E8=B4=A6?= =?UTF-8?q?=E6=88=B7=E6=B1=87=E6=80=BB=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/FinanceLedgerPageData.php | 27 ++++++++++++++++--- .../pages/financial-ledger/ledger.blade.php | 11 +++++--- .../FinanceLedgerHeaderControlsTest.php | 25 +++++++++++++++++ 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/modules/EcommerceFinance/View/FinanceLedgerPageData.php b/modules/EcommerceFinance/View/FinanceLedgerPageData.php index fc541422..5d81d798 100644 --- a/modules/EcommerceFinance/View/FinanceLedgerPageData.php +++ b/modules/EcommerceFinance/View/FinanceLedgerPageData.php @@ -87,7 +87,10 @@ class FinanceLedgerPageData $tab = array_key_exists($tab, self::TABS) ? $tab : 'accounts'; $openingDate = (string) config('finance_ledger.opening_date', '2026-10-17'); $transactionView = $this->transactionView(); - $flowView = request('flows_view') === 'daily' ? 'daily' : 'summary'; + $requestedFlowView = trim((string) request('flows_view', 'summary')); + $flowView = in_array($requestedFlowView, ['summary', 'bank', 'non_store', 'daily'], true) + ? $requestedFlowView + : 'summary'; $flowPeriod = $this->dateRange('flows'); $transactionPeriod = $this->dateRange('txns'); $mappingPeriod = $this->dateRange('mapping'); @@ -591,7 +594,7 @@ class FinanceLedgerPageData { return $view === 'daily' ? $this->dailyFlows($period) - : $this->accountFlowSummary($period); + : $this->accountFlowSummary($period, $view); } private function dailyFlows(array $period): array @@ -629,13 +632,29 @@ class FinanceLedgerPageData ]; } - private function accountFlowSummary(array $period): array + private function accountFlowSummary(array $period, string $view = 'summary'): array { $customFields = $this->flowSummaryCustomFields(); $accountQuery = FinanceLedgerIndependentAccounts::exclude( $this->db()->table('fin_accounts as a'), 'a.account_short', ); + if ($view === 'bank') { + $accountQuery->where(function ($scope): void { + $scope->where(function ($account): void { + $account->whereNull('a.account_short') + ->orWhere('a.account_short', 'not like', '%支付宝%'); + })->where(function ($accountType): void { + $accountType->whereNull('a.account_type') + ->orWhere('a.account_type', 'not like', '%支付宝%'); + }); + }); + } elseif ($view === 'non_store') { + $accountQuery->where(function ($scope): void { + $scope->where('a.account_short', 'like', '%支付宝%') + ->orWhere('a.account_type', 'like', '%支付宝%'); + }); + } foreach (['flows_company' => 'a.company_name', 'flows_account' => 'a.account_short'] as $param => $column) { $value = trim((string) request($param, '')); if ($value !== '') { @@ -646,7 +665,7 @@ class FinanceLedgerPageData $accountRows = $accountQuery ->orderBy('a.company_name') ->orderBy('a.account_short') - ->get(['a.company_name', 'a.account_short']) + ->get(['a.company_name', 'a.account_short', 'a.account_type']) ->filter(static fn ($account): bool => trim((string) ($account->account_short ?? '')) !== '') ->unique('account_short') ->keyBy('account_short'); diff --git a/resources/views/business/pages/financial-ledger/ledger.blade.php b/resources/views/business/pages/financial-ledger/ledger.blade.php index 651df5cf..490451f8 100644 --- a/resources/views/business/pages/financial-ledger/ledger.blade.php +++ b/resources/views/business/pages/financial-ledger/ledger.blade.php @@ -71,6 +71,7 @@ $currentMonthEnd = now()->endOfMonth()->toDateString(); $flowPeriod = $ledgerFlowPeriod ?? ['from' => $currentMonthStart, 'to' => $currentMonthEnd]; $flowView = $ledgerFlowView ?? 'summary'; + $flowUsesAccountSummary = $flowView !== 'daily'; $flowSummaryCustomFields = $ledgerFlowSummaryCustomFields ?? []; $transactionPeriod = $ledgerTransactionPeriod ?? ['from' => $currentMonthStart, 'to' => $currentMonthEnd]; $mappingPeriod = $ledgerMappingPeriod ?? ['from' => $currentMonthStart, 'to' => $currentMonthEnd]; @@ -1079,10 +1080,12 @@