diff --git a/app/Business/BusinessSummaryCards.php b/app/Business/BusinessSummaryCards.php index dbbaac72..8ecc8de3 100644 --- a/app/Business/BusinessSummaryCards.php +++ b/app/Business/BusinessSummaryCards.php @@ -76,9 +76,6 @@ class BusinessSummaryCards $normalStores = (int) ($summary['normal_stores'] ?? 0); $previousStores = (int) ($summary['previous_month_stores'] ?? 0); $currentStores = (int) ($summary['current_month_stores'] ?? 0); - $previousShare = $normalStores > 0 - ? number_format($previousStores / $normalStores * 100, 1) . '%' - : '0.0%'; return [ $this->card('正常存续店铺', $normalStores, '只统计开店中店铺,不含关店和已注销', ['status' => '0'], 'integer', 'accent'), @@ -92,16 +89,6 @@ class BusinessSummaryCards 'sort' => $summary['current_month_key'] ?? null, 'direction' => 'desc', ], 'amount', 'warning'), - $this->card($previousLabel . '有销量店铺', $previousStores, '占正常存续店铺 ' . $previousShare, [ - 'status' => '0', - 'sort' => $summary['previous_month_key'] ?? null, - 'direction' => 'desc', - ]), - $this->card($currentLabel . '有销量店铺', $currentStores, $currentStores === 0 ? '当前还未同步当月销量' : '正常存续店铺中当月已有销量', [ - 'status' => '0', - 'sort' => $summary['current_month_key'] ?? null, - 'direction' => 'desc', - ]), ]; } @@ -143,7 +130,7 @@ class BusinessSummaryCards $this->card('数据状态', '待取数', '规则已定义,业务数据尚未接入', [], 'text', 'warning'), $this->card('完整表头', '22 列', '包含序号、征管口径、收入、税额与备注', [], 'text'), $this->card('计算税种', '4 类', '增值税、附加税、印花税、所得税', [], 'text'), - $this->card('必补口径', '2 项', '工商类型与征收方式', [], 'text', 'warning'), + $this->card('计税口径', '3 项', '公司税务类型、工商类型和征收方式', [], 'text'), $this->card('当前记录', '0 条', '数据接入后按完整字段展示', [], 'text'), ]; } diff --git a/app/Business/UpstreamBusinessInformation.php b/app/Business/UpstreamBusinessInformation.php index 67b39aa1..8ee746cd 100644 --- a/app/Business/UpstreamBusinessInformation.php +++ b/app/Business/UpstreamBusinessInformation.php @@ -319,6 +319,12 @@ SQL); $filters = StoreReportRepository::requestFilters(); $rows = $this->storeReportRows($filters); + // 整列为 0 的月份视为没有销量,默认隐藏;仍可从「筛选字段」手动打开。 + request()->attributes->set( + 'store-report.default_hidden_columns', + $this->columnsWithoutData($rows, 'sales_', zeroCountsAsData: false), + ); + $offset = ($page - 1) * $perPage; return [ @@ -544,12 +550,20 @@ SQL); $row['tax_type'] = $retained ? ($this->normalizeTaxType($taxType) ?? '待维护') : '/'; + $businessType = trim((string) $businessType); $row['business_registration_type'] = $retained - ? (trim((string) $businessType) !== '' ? trim((string) $businessType) : '待维护') + && in_array($businessType, ['核定', '个人独资企业'], true) + ? $businessType : '/'; } unset($row); + // 整列为空的月份默认隐藏;金额 0 仍视为有账单,不隐藏。 + request()->attributes->set( + 'subject-operating-report.default_hidden_columns', + $this->columnsWithoutData($rows, 'income_', zeroCountsAsData: true), + ); + $rows = array_values(array_filter($rows, fn (array $row): bool => $this->subjectMatchesFilters($row, $filters))); $summary = $this->subjectSummary($rows, $companyStatusReady); $this->sortSubjectRows($rows, $filters); @@ -641,6 +655,36 @@ SQL); }; } + /** + * 返回整列都没有数据的月份列;这类列只默认隐藏,字段和数据不会被删除。 + * + * @param list> $rows + * @return list + */ + private function columnsWithoutData(array $rows, string $prefix, bool $zeroCountsAsData): array + { + $columns = []; + + for ($month = 1; $month <= 12; $month++) { + $key = sprintf('%s%02d', $prefix, $month); + foreach ($rows as $row) { + $value = $row[$key] ?? null; + if ($value === null || $value === '') { + continue; + } + if (! $zeroCountsAsData && (float) $value === 0.0) { + continue; + } + + continue 2; + } + + $columns[] = $key; + } + + return $columns; + } + /** @param array $row @param array $filters */ private function subjectMatchesFilters(array $row, array $filters): bool { @@ -1024,7 +1068,9 @@ SQL); default => $row['company_status'] ?? null, }; $businessType = trim((string) ($row['business_registration_type'] ?? '')); - $row['business_registration_type'] = in_array($businessType, ['', '/'], true) ? null : $businessType; + $row['business_registration_type'] = in_array($businessType, ['核定', '个人独资企业'], true) + ? $businessType + : '/'; return $row; } diff --git a/app/Console/Commands/ImportDingProcessDetails.php b/app/Console/Commands/ImportDingProcessDetails.php new file mode 100644 index 00000000..c9e4639c --- /dev/null +++ b/app/Console/Commands/ImportDingProcessDetails.php @@ -0,0 +1,43 @@ +import( + (string) $this->argument('file'), + (string) $this->option('scope'), + (bool) $this->option('replace'), + ); + } catch (Throwable $exception) { + $this->error('导入失败:' . $exception->getMessage()); + + return self::FAILURE; + } + + $this->info(sprintf( + '导入完成:%d 行,跳过占位 %d 行,跳过无效 %d 行,重复 %d 行,范围 %s。', + $result['rows'], + $result['placeholders'], + $result['invalid'], + $result['duplicates'], + $result['scope'], + )); + + return self::SUCCESS; + } +} diff --git a/app/Utilities/BusinessNavigation.php b/app/Utilities/BusinessNavigation.php index 6aca5455..556b645b 100644 --- a/app/Utilities/BusinessNavigation.php +++ b/app/Utilities/BusinessNavigation.php @@ -10,6 +10,29 @@ class BusinessNavigation public static function all(): array { $navigation = config('business_navigation', []); + $pageExtensions = (array) config('business_navigation_page_extensions', []); + + foreach ($navigation as &$section) { + $sectionSlug = (string) ($section['slug'] ?? ''); + + foreach ((array) ($pageExtensions[$sectionSlug] ?? []) as $extension) { + $extensionSlug = trim((string) ($extension['slug'] ?? '')); + + if ($extensionSlug === '') { + continue; + } + + $exists = collect($section['pages'] ?? [])->contains( + static fn (array $page): bool => (string) ($page['slug'] ?? '') === $extensionSlug + ); + + if (! $exists) { + $section['pages'][] = $extension; + } + } + } + unset($section); + $titles = (array) setting('navigation.titles', []); $sectionTitles = (array) ($titles['sections'] ?? []); $pageTitles = (array) ($titles['pages'] ?? []); diff --git a/config/business_navigation_page_extensions.php b/config/business_navigation_page_extensions.php new file mode 100644 index 00000000..981e6a08 --- /dev/null +++ b/config/business_navigation_page_extensions.php @@ -0,0 +1,19 @@ + [ + [ + 'slug' => 'process-details', + 'title' => '流程明细', + ], + ], +]; diff --git a/config/labor_expense_table.php b/config/labor_expense_table.php index b621ca25..3d2316af 100644 --- a/config/labor_expense_table.php +++ b/config/labor_expense_table.php @@ -19,20 +19,20 @@ return [ ['key' => 'F', 'label' => '8月应发工资', 'group' => 'original', 'kind' => 'number'], ['key' => 'G', 'label' => '原社保个人扣款', 'group' => 'original', 'kind' => 'number'], ['key' => 'H', 'label' => '原公积金个人扣款', 'group' => 'original', 'kind' => 'number'], - ['key' => 'I', 'label' => '扣除额', 'group' => 'original', 'kind' => 'number'], + ['key' => 'I', 'label' => '扣除额', 'group' => 'original', 'kind' => 'formula_number', 'formula' => '=5000'], ['key' => 'J', 'label' => '原需报个税基数', 'group' => 'original', 'kind' => 'formula_number', 'formula' => '=F#-G#-H#-I#'], ['key' => 'K', 'label' => '原个税比列', 'group' => 'original', 'kind' => 'formula_percent', 'formula' => '=IF(J#<=0,"",IF(J#<=3000,0.03,IF(J#<=12000,0.1,IF(J#<=25000,0.2,IF(J#<=35000,0.25,IF(J#<=55000,0.3,IF(J#<=80000,0.35,0.45)))))))'], - ['key' => 'L', 'label' => '原速算扣除数', 'group' => 'original', 'kind' => 'number'], - ['key' => 'M', 'label' => '原需交个税金额', 'group' => 'original', 'kind' => 'number'], + ['key' => 'L', 'label' => '原速算扣除数', 'group' => 'original', 'kind' => 'formula_number', 'formula' => '=IF(J#<=0,"",IF(J#<=3000,0,IF(J#<=12000,210,IF(J#<=25000,1410,IF(J#<=35000,2660,IF(J#<=55000,4410,IF(J#<=80000,7160,15160)))))))'], + ['key' => 'M', 'label' => '原需交个税金额', 'group' => 'original', 'kind' => 'formula_number', 'formula' => '=J#*K#-L#'], ['key' => 'N', 'label' => '原需年交个税金额', 'group' => 'original', 'kind' => 'formula_number', 'formula' => '=M#*12'], - ['key' => 'O', 'label' => '新公积金缴存基数', 'group' => 'fund', 'kind' => 'number'], - ['key' => 'P', 'label' => '新单位公积金月缴存12%', 'group' => 'fund', 'kind' => 'number'], - ['key' => 'Q', 'label' => '新个人公积金月缴存12%', 'group' => 'fund', 'kind' => 'number'], - ['key' => 'R', 'label' => '超额代扣缴', 'group' => 'fund', 'kind' => 'number'], + ['key' => 'O', 'label' => '新公积金缴存基数', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=IF(F#<=0,"",IF(F#<=8500,4952,IF(F#<=15000,8000,IF(F#<=25000,10000,12000))))'], + ['key' => 'P', 'label' => '新单位公积金月缴存12%', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=O#*0.12'], + ['key' => 'Q', 'label' => '新个人公积金月缴存12%', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=O#*0.12'], + ['key' => 'R', 'label' => '超额代扣缴', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=Q#-H#'], ['key' => 'S', 'label' => '新月度应纳税所得额', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=F#-G#-I#-P#-R#'], ['key' => 'T', 'label' => '新月度个税比列', 'group' => 'fund', 'kind' => 'formula_percent', 'formula' => '=IF(S#<=0,"",IF(S#<=3000,0.03,IF(S#<=12000,0.1,IF(S#<=25000,0.2,IF(S#<=35000,0.25,IF(S#<=55000,0.3,IF(S#<=80000,0.35,0.45)))))))'], - ['key' => 'U', 'label' => '新月度新速算扣除数', 'group' => 'fund', 'kind' => 'number'], - ['key' => 'V', 'label' => '新月度个税金额', 'group' => 'fund', 'kind' => 'number'], + ['key' => 'U', 'label' => '新月度新速算扣除数', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=IF(S#<=0,"",IF(S#<=3000,0,IF(S#<=12000,210,IF(S#<=25000,1410,IF(S#<=35000,2660,IF(S#<=55000,4410,IF(S#<=80000,7160,15160)))))))'], + ['key' => 'V', 'label' => '新月度个税金额', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=S#*T#-U#'], ['key' => 'W', 'label' => '全年应纳税所得额', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=S#*12'], ['key' => 'X', 'label' => '年度税率', 'group' => 'fund', 'kind' => 'formula_percent', 'formula' => '=IF(S#=0,"",IF(W#<=0,0,IF(W#<=36000,0.03,IF(W#<=144000,0.1,IF(W#<=300000,0.2,IF(W#<=420000,0.25,IF(W#<=660000,0.3,IF(W#<=960000,0.35,0.45))))))))'], ['key' => 'Y', 'label' => '年度速算扣除数', 'group' => 'fund', 'kind' => 'formula_number', 'formula' => '=IF(W#=0,"",IF(W#<=0,0,IF(W#<=36000,0,IF(W#<=144000,2520,IF(W#<=300000,16920,IF(W#<=420000,31920,IF(W#<=660000,52920,IF(W#<=960000,85920,181920))))))))'], @@ -44,7 +44,7 @@ return [ ['key' => 'AE', 'label' => '新8月工资应发', 'group' => 'salary_parttime', 'kind' => 'formula_number', 'formula' => '=F#-AD#'], ['key' => 'AF', 'label' => '新月度应纳税所得额', 'group' => 'salary_parttime', 'kind' => 'formula_number', 'formula' => '=AE#-G#-I#-P#-R#'], ['key' => 'AG', 'label' => '新月度个税比列', 'group' => 'salary_parttime', 'kind' => 'formula_percent', 'formula' => '=IF(AF#<=0,"",IF(AF#<=3000,0.03,IF(AF#<=12000,0.1,IF(AF#<=25000,0.2,IF(AF#<=35000,0.25,IF(AF#<=55000,0.3,IF(AF#<=80000,0.35,0.45)))))))'], - ['key' => 'AH', 'label' => '新月度新速算扣除数', 'group' => 'salary_parttime', 'kind' => 'number'], + ['key' => 'AH', 'label' => '新月度新速算扣除数', 'group' => 'salary_parttime', 'kind' => 'formula_number', 'formula' => '=IF(AF#<=0,"",IF(AF#<=3000,0,IF(AF#<=12000,210,IF(AF#<=25000,1410,IF(AF#<=35000,2660,IF(AF#<=55000,4410,IF(AF#<=80000,7160,15160)))))))'], ['key' => 'AI', 'label' => '新月度个税金额', 'group' => 'salary_parttime', 'kind' => 'number'], ['key' => 'AJ', 'label' => '全年应纳税所得额', 'group' => 'salary_parttime', 'kind' => 'formula_number', 'formula' => '=AF#*12'], ['key' => 'AK', 'label' => '年度税率', 'group' => 'salary_parttime', 'kind' => 'formula_percent', 'formula' => '=IF(AJ#=0,"",IF(AJ#<=0,0,IF(AJ#<=36000,0.03,IF(AJ#<=144000,0.1,IF(AJ#<=300000,0.2,IF(AJ#<=420000,0.25,IF(AJ#<=660000,0.3,IF(AJ#<=960000,0.35,0.45))))))))'], diff --git a/database/migrations/2026_10_26_150000_create_ding_process_detail_mirror_tables.php b/database/migrations/2026_10_26_150000_create_ding_process_detail_mirror_tables.php new file mode 100644 index 00000000..f239f079 --- /dev/null +++ b/database/migrations/2026_10_26_150000_create_ding_process_detail_mirror_tables.php @@ -0,0 +1,68 @@ +environment('testing') + || (string) config('system_database.mode', 'bootstrap') === 'bootstrap') { + return; + } + + $schema = Schema::connection($this->connection()); + + if ($schema->hasTable('ding_process_detail_mirror')) { + return; + } + + $schema->create('ding_process_detail_mirror', function (Blueprint $table): void { + $table->bigIncrements('id'); + $table->string('business_id', 32); + $table->unsignedInteger('line_no'); + $table->string('business_month', 6)->index(); + $table->string('originator_name', 100)->nullable()->index(); + $table->string('status', 20)->nullable()->index(); + $table->string('document_type', 100)->nullable()->index(); + $table->text('purpose')->nullable(); + $table->string('account_code', 64)->nullable(); + $table->string('account_name', 255)->nullable(); + $table->decimal('amount', 18, 2)->nullable(); + $table->string('bank_account_code', 255)->nullable(); + $table->string('bank_account_name', 255)->nullable(); + $table->decimal('bank_amount', 18, 2)->nullable(); + $table->string('payment_method', 50)->nullable(); + $table->string('paid_at', 50)->nullable(); + $table->string('source_scope', 40)->default('personal_permission')->index(); + $table->dateTime('synced_at', 6); + $table->timestamps(); + + $table->unique( + ['business_id', 'line_no'], + 'ding_process_detail_business_line_unique', + ); + $table->index( + ['business_month', 'document_type'], + 'ding_process_detail_month_type_index', + ); + }); + } + + public function down(): void + { + if (app()->environment('testing') + || (string) config('system_database.mode', 'bootstrap') === 'bootstrap') { + return; + } + + Schema::connection($this->connection())->dropIfExists('ding_process_detail_mirror'); + } +}; diff --git a/deploy/finance-batch-imports.json b/deploy/finance-batch-imports.json index 71b2efec..310315db 100644 --- a/deploy/finance-batch-imports.json +++ b/deploy/finance-batch-imports.json @@ -1,4 +1,5 @@ [ + "ding:import-process-details", "accessory-reship:import-courier-configs", "account-ledger-remarks:import", "account-mapping:import-files", diff --git a/docs/主体维度经营报表需求说明.md b/docs/主体维度经营报表需求说明.md index e0c651c8..0fb76b1e 100644 --- a/docs/主体维度经营报表需求说明.md +++ b/docs/主体维度经营报表需求说明.md @@ -28,7 +28,7 @@ | 2 | 主体 | 主体名称;作为主体合并键 | | 3 | 公司类型 | 主体公司类型,来源于 `rpt` | | 4 | 税务类型 | 主体税务类型,优先读取 `fin_companies.tax_type`,缺失时使用 `rpt.fys_companyInfo.taxCategoryAndType` | -| 5 | 工商类型 | 主体工商类型,读取 `fin_companies.business_type`;空值或 `/` 按统一缺失值展示 | +| 5 | 工商类型 | 主体工商类型,读取 `fin_companies.business_type`;仅“核定”和“个人独资企业”为有效值,其他统一显示 `/` | | 6 | 最近12个月累计收入 | 最近12个完整自然月收入合计,排除当前月 | | 7 | 1月收入 | 当前年份 1 月收入,当前月或无账单时为空 | | 8 | 2月收入 | 当前年份 2 月收入,当前月或无账单时为空 | diff --git a/modules/EcommerceFinance/Http/Controllers/ProcessDetails.php b/modules/EcommerceFinance/Http/Controllers/ProcessDetails.php new file mode 100644 index 00000000..73f52b29 --- /dev/null +++ b/modules/EcommerceFinance/Http/Controllers/ProcessDetails.php @@ -0,0 +1,139 @@ +filters($request); + $page = max((int) $request->query('page', 1), 1); + $perPage = 50; + + try { + $result = $this->repository->paginate($filters, $page, $perPage); + $options = $this->repository->filterOptions(); + + return view('business.pages.financial-operations.process-details', [ + 'section' => ['slug' => 'financial-operations', 'title' => '财务经营报表'], + 'page' => ['slug' => 'process-details', 'title' => '流程明细'], + 'rows' => new LengthAwarePaginator( + $result['data'], + $result['total'], + $perPage, + $page, + ['path' => $request->url(), 'query' => $request->except('page')], + ), + 'filters' => $filters, + 'summary' => $result['summary'], + 'months' => $options['months'], + 'documentTypes' => $options['document_types'], + 'statuses' => $options['statuses'], + 'mirrorStatus' => $result['status'], + 'mirrorSyncedAt' => $result['last_synced_at'], + 'scope' => $result['scope'], + 'error' => null, + ]); + } catch (Throwable $exception) { + report($exception); + + return view('business.pages.financial-operations.process-details', [ + 'section' => ['slug' => 'financial-operations', 'title' => '财务经营报表'], + 'page' => ['slug' => 'process-details', 'title' => '流程明细'], + 'rows' => new LengthAwarePaginator([], 0, $perPage, $page, [ + 'path' => $request->url(), + 'query' => $request->except('page'), + ]), + 'filters' => $filters, + 'summary' => [ + 'rows' => 0, + 'approvals' => 0, + 'amount_total' => 0.0, + 'bank_amount_total' => 0.0, + ], + 'months' => [], + 'documentTypes' => [], + 'statuses' => [], + 'mirrorStatus' => 'unavailable', + 'mirrorSyncedAt' => null, + 'scope' => $this->repository->scope(), + 'error' => '流程明细镜像尚未完成导入,请稍后重试。', + ]); + } + } + + public function export(Request $request): StreamedResponse|RedirectResponse + { + if (! $this->repository->ready()) { + return redirect() + ->route('business.pages.show', [ + 'section' => 'financial-operations', + 'page' => 'process-details', + ]) + ->withErrors(['export' => '流程明细镜像尚未完成导入,暂时不能导出。']); + } + + $filters = $this->filters($request); + + return response()->streamDownload(function () use ($filters): void { + $stream = fopen('php://output', 'wb'); + fwrite($stream, "\xEF\xBB\xBF"); + fputcsv($stream, DingProcessDetailMirrorImporter::HEADERS); + + $number = 0; + foreach ($this->repository->exportRows($filters) as $row) { + $number++; + fputcsv($stream, [ + $number, + (string) ($row['business_id'] ?? ''), + (string) ($row['originator_name'] ?? ''), + (string) ($row['status'] ?? ''), + (string) ($row['document_type'] ?? ''), + (string) ($row['purpose'] ?? ''), + (int) ($row['line_no'] ?? 0), + (string) ($row['account_code'] ?? ''), + (string) ($row['account_name'] ?? ''), + $row['amount'] ?? '', + (string) ($row['bank_account_code'] ?? ''), + (string) ($row['bank_account_name'] ?? ''), + $row['bank_amount'] ?? '', + (string) ($row['payment_method'] ?? ''), + (string) ($row['paid_at'] ?? ''), + ]); + } + + fclose($stream); + }, '流程明细_' . now()->format('Ymd_His') . '.csv', [ + 'Content-Type' => 'text/csv; charset=UTF-8', + ]); + } + + /** @return array */ + private function filters(Request $request): array + { + $month = trim((string) $request->query('month', '')); + $status = trim((string) $request->query('status', '')); + + return [ + 'month' => preg_match('/^\d{4}-\d{2}$/', $month) === 1 ? $month : '', + 'document_type' => mb_substr(trim((string) $request->query('document_type', '')), 0, 100), + 'status' => mb_substr($status, 0, 20), + 'business_id' => mb_substr(trim((string) $request->query('business_id', '')), 0, 32), + 'originator_name' => mb_substr(trim((string) $request->query('originator_name', '')), 0, 100), + 'keyword' => mb_substr(trim((string) $request->query('keyword', '')), 0, 100), + ]; + } +} diff --git a/modules/EcommerceFinance/Repositories/BusinessInformationMirrorRepository.php b/modules/EcommerceFinance/Repositories/BusinessInformationMirrorRepository.php index aa5b7217..8103d54e 100644 --- a/modules/EcommerceFinance/Repositories/BusinessInformationMirrorRepository.php +++ b/modules/EcommerceFinance/Repositories/BusinessInformationMirrorRepository.php @@ -175,7 +175,7 @@ SQL) ->all(); } - /** @return array */ + /** @return array */ public function companyClassificationsByNames(array $names): array { $names = array_values(array_unique(array_filter(array_map('trim', $names)))); @@ -194,7 +194,9 @@ SQL) return [trim((string) $row->name) => [ 'status' => $status !== '' ? $status : null, 'tax_type' => trim((string) ($row->tax_type ?? '')) ?: null, - 'business_registration_type' => in_array($businessType, ['', '/'], true) ? null : $businessType, + 'business_registration_type' => in_array($businessType, ['核定', '个人独资企业'], true) + ? $businessType + : '/', ]]; }) ->all(); diff --git a/modules/EcommerceFinance/Repositories/DingProcessDetailMirrorRepository.php b/modules/EcommerceFinance/Repositories/DingProcessDetailMirrorRepository.php new file mode 100644 index 00000000..689e0835 --- /dev/null +++ b/modules/EcommerceFinance/Repositories/DingProcessDetailMirrorRepository.php @@ -0,0 +1,222 @@ +connection = $database->connection( + (string) config('upstream_mirrors.connection', 'business_mirror') + ); + } + + public function scope(): string + { + $scope = trim((string) config( + 'upstream_mirrors.ding_process_details.scope', + self::DEFAULT_SCOPE, + )); + + return $scope !== '' ? $scope : self::DEFAULT_SCOPE; + } + + public function datasetKey(): string + { + return self::DATASET_PREFIX . $this->scope(); + } + + public function ready(): bool + { + $schema = Schema::connection($this->connection->getName()); + + if (! $schema->hasTable('ding_process_detail_mirror') + || ! $schema->hasTable('business_mirror_table_states')) { + return false; + } + + $state = $this->state(); + + return $state !== null && ($state['initial_completed_at'] ?? null) !== null; + } + + /** @return array|null */ + public function state(): ?array + { + if (! Schema::connection($this->connection->getName())->hasTable('business_mirror_table_states')) { + return null; + } + + $row = $this->connection->table('business_mirror_table_states') + ->where('dataset_key', $this->datasetKey()) + ->first(); + + return $row === null ? null : (array) $row; + } + + /** + * @param array $filters + * @return array{ + * data:list, + * total:int, + * summary:array{rows:int,approvals:int,amount_total:float,bank_amount_total:float}, + * status:string, + * last_synced_at:?string, + * scope:string + * } + */ + public function paginate(array $filters, int $page, int $perPage): array + { + if (! $this->ready()) { + throw new RuntimeException('ding_process_detail_mirror_not_ready'); + } + + $page = max($page, 1); + $perPage = min(max($perPage, 1), 100); + $query = $this->filteredQuery($filters); + + $total = (clone $query)->count(); + $summary = [ + 'rows' => $total, + 'approvals' => (clone $query)->distinct()->count('business_id'), + 'amount_total' => (float) ((clone $query)->sum('amount') ?? 0), + 'bank_amount_total' => (float) ((clone $query)->sum('bank_amount') ?? 0), + ]; + $data = $query + ->orderByDesc('business_month') + ->orderByDesc('business_id') + ->orderBy('line_no') + ->forPage($page, $perPage) + ->get() + ->all(); + $state = $this->state(); + + return [ + 'data' => $data, + 'total' => $total, + 'summary' => $summary, + 'status' => (string) ($state['status'] ?? 'unknown'), + 'last_synced_at' => isset($state['last_succeeded_at']) + ? (string) $state['last_succeeded_at'] + : null, + 'scope' => $this->scope(), + ]; + } + + /** @return array{months:list,document_types:list,statuses:list} */ + public function filterOptions(): array + { + if (! Schema::connection($this->connection->getName())->hasTable('ding_process_detail_mirror')) { + return ['months' => [], 'document_types' => [], 'statuses' => []]; + } + + $base = $this->connection->table('ding_process_detail_mirror') + ->where('source_scope', $this->scope()); + + return [ + 'months' => (clone $base) + ->whereNotNull('business_month') + ->where('business_month', '!=', '') + ->distinct() + ->orderByDesc('business_month') + ->pluck('business_month') + ->map(static function (mixed $value): string { + $month = (string) $value; + + return preg_match('/^\d{6}$/', $month) === 1 + ? substr($month, 0, 4) . '-' . substr($month, 4, 2) + : $month; + }) + ->all(), + 'document_types' => (clone $base) + ->whereNotNull('document_type') + ->where('document_type', '!=', '') + ->distinct() + ->orderBy('document_type') + ->pluck('document_type') + ->map(static fn (mixed $value): string => (string) $value) + ->all(), + 'statuses' => (clone $base) + ->whereNotNull('status') + ->where('status', '!=', '') + ->distinct() + ->orderBy('status') + ->pluck('status') + ->map(static fn (mixed $value): string => (string) $value) + ->all(), + ]; + } + + /** @param array $filters */ + public function exportCount(array $filters): int + { + if (! Schema::connection($this->connection->getName())->hasTable('ding_process_detail_mirror')) { + return 0; + } + + return (int) $this->filteredQuery($filters)->count(); + } + + /** + * @param array $filters + * @return \Generator> + */ + public function exportRows(array $filters): \Generator + { + $query = $this->filteredQuery($filters) + ->orderByDesc('business_month') + ->orderByDesc('business_id') + ->orderBy('line_no'); + + foreach ($query->cursor() as $row) { + yield (array) $row; + } + } + + /** @param array $filters */ + private function filteredQuery(array $filters): Builder + { + $query = $this->connection->table('ding_process_detail_mirror') + ->where('source_scope', $this->scope()); + + $month = trim((string) ($filters['month'] ?? '')); + if (preg_match('/^\d{4}-\d{2}$/', $month) === 1) { + $query->where('business_month', str_replace('-', '', $month)); + } + + foreach ([ + 'document_type' => 'document_type', + 'status' => 'status', + ] as $filter => $column) { + $value = trim((string) ($filters[$filter] ?? '')); + if ($value !== '') { + $query->where($column, $value); + } + } + + foreach ([ + 'business_id' => 'business_id', + 'originator_name' => 'originator_name', + 'keyword' => 'purpose', + ] as $filter => $column) { + $value = mb_substr(trim((string) ($filters[$filter] ?? '')), 0, 100); + if ($value !== '') { + $query->where($column, 'like', '%' . $value . '%'); + } + } + + return $query; + } +} diff --git a/modules/EcommerceFinance/Routes/admin.php b/modules/EcommerceFinance/Routes/admin.php index 5a08c09f..d128dda9 100644 --- a/modules/EcommerceFinance/Routes/admin.php +++ b/modules/EcommerceFinance/Routes/admin.php @@ -1,7 +1,25 @@ name('index'); }); + +// 通用 workspace/{section}/{page} 路由在 App\Providers\Route::boot() 中注册; +// 模块路由在 register 阶段先注册,因此这里的精确路由会优先命中。沿用 +// business.pages.show 名称,侧边栏仍能生成与通用页面一致的可访问 URL。 +Route::admin('ecommerce-finance', function (): void { + Route::get('workspace/financial-operations/process-details', [ProcessDetails::class, 'show']) + ->middleware('business.page.viewer') + ->defaults('section', 'financial-operations') + ->defaults('page', 'process-details') + ->name('business.pages.show'); + + Route::get('workspace/financial-operations/process-details/export', [ProcessDetails::class, 'export']) + ->middleware('business.page.viewer') + ->defaults('section', 'financial-operations') + ->defaults('page', 'process-details') + ->name('business.process-details.export'); +}, ['prefix' => '', 'as' => '']); diff --git a/modules/EcommerceFinance/Services/DingProcessDetailMirrorImporter.php b/modules/EcommerceFinance/Services/DingProcessDetailMirrorImporter.php new file mode 100644 index 00000000..34e3b434 --- /dev/null +++ b/modules/EcommerceFinance/Services/DingProcessDetailMirrorImporter.php @@ -0,0 +1,282 @@ +connection = $database->connection( + (string) config('upstream_mirrors.connection', 'business_mirror') + ); + } + + /** + * @return array{status:string,rows:int,invalid:int,placeholders:int,duplicates:int,scope:string,dataset_key:string} + */ + public function import( + string $path, + string $scope = self::DEFAULT_SCOPE, + bool $replace = false, + ): array { + $scope = trim($scope) !== '' ? trim($scope) : self::DEFAULT_SCOPE; + + if (! is_file($path)) { + throw new RuntimeException('流程明细 CSV 文件不存在:' . $path); + } + + [$rows, $invalid, $placeholders, $duplicates] = $this->readCsv($path, $scope); + + if ($rows === []) { + throw new RuntimeException('流程明细 CSV 没有可导入的数据。'); + } + + $now = now(); + $datasetKey = self::DATASET_PREFIX . $scope; + $generation = (string) Str::uuid(); + $upserted = 0; + + $this->connection->transaction(function () use ( + $rows, + $replace, + $scope, + $now, + $generation, + &$upserted, + ): void { + if ($replace) { + $this->connection->table('ding_process_detail_mirror') + ->where('source_scope', $scope) + ->delete(); + } + + foreach (array_chunk($rows, 500) as $chunk) { + $this->connection->table('ding_process_detail_mirror')->upsert( + $chunk, + ['business_id', 'line_no'], + [ + 'business_month', + 'originator_name', + 'status', + 'document_type', + 'purpose', + 'account_code', + 'account_name', + 'amount', + 'bank_account_code', + 'bank_account_name', + 'bank_amount', + 'payment_method', + 'paid_at', + 'source_scope', + 'synced_at', + 'updated_at', + ], + ); + $upserted += count($chunk); + } + }); + + $rowCount = (int) $this->connection->table('ding_process_detail_mirror') + ->where('source_scope', $scope) + ->count(); + $values = [ + 'source_key' => 'dingtalk_oa', + 'source_object' => $scope === self::DEFAULT_SCOPE + ? 'oa approval detail (personal permission scope)' + : 'oa approval detail (' . $scope . ')', + 'target_table' => 'ding_process_detail_mirror', + 'status' => 'succeeded', + 'run_mode' => 'full', + 'generation' => $generation, + 'cursor' => null, + 'high_watermark' => null, + 'window_started_at' => null, + 'window_ends_at' => null, + 'initial_completed_at' => $now, + 'last_full_succeeded_at' => $now, + 'last_attempted_at' => $now, + 'last_succeeded_at' => $now, + 'last_upserted_rows' => $upserted, + 'mirror_row_count' => $rowCount, + 'last_error_code' => null, + 'updated_at' => $now, + ]; + + $this->connection->table('business_mirror_table_states')->updateOrInsert( + ['dataset_key' => $datasetKey], + $values + ['created_at' => $now], + ); + + return [ + 'status' => 'succeeded', + 'rows' => $upserted, + 'invalid' => $invalid, + 'placeholders' => $placeholders, + 'duplicates' => $duplicates, + 'scope' => $scope, + 'dataset_key' => $datasetKey, + ]; + } + + /** + * @return array{0:list>,1:int,2:int,3:int} + */ + private function readCsv(string $path, string $scope): array + { + $handle = fopen($path, 'rb'); + + if ($handle === false) { + throw new RuntimeException('流程明细 CSV 无法打开:' . $path); + } + + try { + $header = fgetcsv($handle); + + if ($header === false) { + throw new RuntimeException('流程明细 CSV 缺少表头。'); + } + + $header[0] = preg_replace('/^\xEF\xBB\xBF/', '', (string) $header[0]); + $header = array_map(static fn (mixed $value): string => trim((string) $value), $header); + $missing = array_values(array_diff(self::HEADERS, $header)); + + if ($missing !== []) { + throw new RuntimeException('流程明细 CSV 缺少列:' . implode('、', $missing)); + } + + $index = array_flip($header); + $rows = []; + $qualities = []; + $invalid = 0; + $placeholders = 0; + $duplicates = 0; + $now = now(); + + while (($data = fgetcsv($handle)) !== false) { + if ($data === [null] || count(array_filter( + $data, + static fn (mixed $value): bool => trim((string) $value) !== '', + )) === 0) { + continue; + } + + $businessId = trim((string) ($data[$index['审批编号']] ?? '')); + $lineNo = trim((string) ($data[$index['单据内行号']] ?? '')); + + if ($businessId === '' || preg_match('/^\d+$/', $lineNo) !== 1) { + $invalid++; + continue; + } + + $accountCode = trim((string) ($data[$index['科目编码']] ?? '')); + $accountName = trim((string) ($data[$index['科目名称']] ?? '')); + $amountRaw = trim((string) ($data[$index['金额(元)']] ?? '')); + + // 历史导入遗留的占位行:用途/科目/银行字段全部是 251,金额为空。 + if ($accountCode === '251' && $accountName === '251' && $amountRaw === '') { + $placeholders++; + continue; + } + + $key = $businessId . '|' . (int) $lineNo; + $candidate = [ + 'business_id' => mb_substr($businessId, 0, 32), + 'line_no' => (int) $lineNo, + 'business_month' => preg_match('/^\d{6}/', $businessId) === 1 + ? substr($businessId, 0, 6) + : '', + 'originator_name' => mb_substr(trim((string) ($data[$index['发起人']] ?? '')), 0, 100), + 'status' => mb_substr(trim((string) ($data[$index['状态']] ?? '')), 0, 20), + 'document_type' => mb_substr(trim((string) ($data[$index['单据类型']] ?? '')), 0, 100), + 'purpose' => trim((string) ($data[$index['用途/摘要']] ?? '')), + 'account_code' => mb_substr($accountCode, 0, 64), + 'account_name' => mb_substr($accountName, 0, 255), + 'amount' => $this->decimal($data[$index['金额(元)']] ?? null), + 'bank_account_code' => mb_substr(trim((string) ($data[$index['银行科目编码']] ?? '')), 0, 255), + 'bank_account_name' => mb_substr(trim((string) ($data[$index['银行科目名称']] ?? '')), 0, 255), + 'bank_amount' => $this->decimal($data[$index['银行付款金额']] ?? null), + 'payment_method' => mb_substr(trim((string) ($data[$index['付款方式']] ?? '')), 0, 50), + 'paid_at' => mb_substr(trim((string) ($data[$index['打款时间']] ?? '')), 0, 50), + 'source_scope' => $scope, + 'synced_at' => $now, + 'created_at' => $now, + 'updated_at' => $now, + ]; + $quality = $this->quality($candidate); + + if (isset($qualities[$key])) { + $duplicates++; + if ($quality < $qualities[$key]) { + continue; + } + } + + $rows[$key] = $candidate; + $qualities[$key] = $quality; + } + + return [array_values($rows), $invalid, $placeholders, $duplicates]; + } finally { + fclose($handle); + } + } + + private function decimal(mixed $value): ?string + { + $value = trim((string) $value); + + if ($value === '' || ! is_numeric($value)) { + return null; + } + + return number_format((float) $value, 2, '.', ''); + } + + /** @param array $row */ + private function quality(array $row): int + { + $score = 0; + $score += trim((string) ($row['purpose'] ?? '')) !== '' + && trim((string) ($row['purpose'] ?? '')) !== '251' ? 1 : 0; + $score += trim((string) ($row['account_name'] ?? '')) !== '' + && trim((string) ($row['account_name'] ?? '')) !== '251' ? 1 : 0; + $score += is_numeric($row['amount'] ?? null) && (float) $row['amount'] !== 0.0 ? 4 : 0; + $score += trim((string) ($row['bank_account_code'] ?? '')) !== '' + && trim((string) ($row['bank_account_code'] ?? '')) !== '251' ? 2 : 0; + $score += is_numeric($row['bank_amount'] ?? null) && (float) $row['bank_amount'] !== 0.0 ? 2 : 0; + $score += trim((string) ($row['paid_at'] ?? '')) !== '' + && trim((string) ($row['paid_at'] ?? '')) !== '251' ? 1 : 0; + + return $score; + } +} diff --git a/resources/views/business/pages/financial-operations/labor-expenses.blade.php b/resources/views/business/pages/financial-operations/labor-expenses.blade.php index fda814df..de293d48 100644 --- a/resources/views/business/pages/financial-operations/labor-expenses.blade.php +++ b/resources/views/business/pages/financial-operations/labor-expenses.blade.php @@ -377,7 +377,7 @@
人工费用测算表 -

表头与公式依据 {{ $laborExpenseTable['source_label'] ?? '工资表' }}。黄色字段用于录入,浅金列按公式实时计算;月度工资税率按月度应纳税所得额、年度税率按全年应纳税所得额匹配税法档位,公式中的 # 表示当前行。

+

表头与公式依据 {{ $laborExpenseTable['source_label'] ?? '工资表' }}。黄色字段用于录入,浅金列按公式实时计算;月度基本减除费用为 5000 元、年度汇算为 60000 元,个税金额、税率、速算扣除数及公积金缴存基数均按对应规则自动匹配,公式中的 # 表示当前行。

{{ count($laborFields) }} 个业务列 · {{ $laborFormulaCount }} 个公式
@@ -506,13 +506,13 @@ const monthlyWageBracket = (income) => { if (income <= 0) return null; - if (income <= 3000) return 0.03; - if (income <= 12000) return 0.1; - if (income <= 25000) return 0.2; - if (income <= 35000) return 0.25; - if (income <= 55000) return 0.3; - if (income <= 80000) return 0.35; - return 0.45; + if (income <= 3000) return { rate: 0.03, deduction: 0 }; + if (income <= 12000) return { rate: 0.1, deduction: 210 }; + if (income <= 25000) return { rate: 0.2, deduction: 1410 }; + if (income <= 35000) return { rate: 0.25, deduction: 2660 }; + if (income <= 55000) return { rate: 0.3, deduction: 4410 }; + if (income <= 80000) return { rate: 0.35, deduction: 7160 }; + return { rate: 0.45, deduction: 15160 }; }; const annualBracket = (income) => { @@ -526,6 +526,14 @@ return { rate: 0.45, deduction: 181920 }; }; + const housingFundBase = (salary) => { + if (salary <= 0) return null; + if (salary <= 8500) return 4952; + if (salary <= 15000) return 8000; + if (salary <= 25000) return 10000; + return 12000; + }; + const calculate = (row) => { const hasNumericInput = fields.some((field) => { if (!numericKinds.has(field.kind)) return false; @@ -539,9 +547,16 @@ } const v = (key) => numeric(row[key]); - const originalTaxable = v('F') - v('G') - v('H') - v('I'); - const originalAnnualTax = v('M') * 12; - const newMonthlyTaxable = v('F') - v('G') - v('I') - v('P') - v('R'); + const monthlyBasicDeduction = 5000; + const originalTaxable = v('F') - v('G') - v('H') - monthlyBasicDeduction; + const newHousingFundBase = housingFundBase(v('F')); + const newEmployerHousingFund = newHousingFundBase === null ? null : newHousingFundBase * 0.12; + const newPersonalHousingFund = newHousingFundBase === null ? null : newHousingFundBase * 0.12; + const excessHousingFundWithholding = newPersonalHousingFund === null + ? null + : newPersonalHousingFund - v('H'); + const newMonthlyTaxable = v('F') - v('G') - monthlyBasicDeduction + - numeric(newEmployerHousingFund) - numeric(excessHousingFundWithholding); const newAnnualTaxable = newMonthlyTaxable * 12; const newAnnualBracket = annualBracket(newAnnualTaxable); const originalRate = newMonthlyTaxable === 0 ? null : newAnnualBracket.rate; @@ -549,12 +564,20 @@ const originalAnnualTaxAmount = originalRate === null || originalDeduction === null ? null : newAnnualTaxable * originalRate - originalDeduction; - const originalMonthlyRate = monthlyWageBracket(originalTaxable); + const originalMonthlyBracket = monthlyWageBracket(originalTaxable); + const originalMonthlyTax = originalMonthlyBracket === null + ? null + : originalTaxable * originalMonthlyBracket.rate - originalMonthlyBracket.deduction; + const originalAnnualTax = originalMonthlyTax === null ? null : originalMonthlyTax * 12; const parttimeSalary = v('AB') + v('AC'); const newSalary = v('F') - parttimeSalary; - const salaryTaxable = newSalary - v('G') - v('I') - v('P') - v('R'); - const newMonthlyRate = monthlyWageBracket(newMonthlyTaxable); - const salaryMonthlyRate = monthlyWageBracket(salaryTaxable); + const salaryTaxable = newSalary - v('G') - monthlyBasicDeduction + - numeric(newEmployerHousingFund) - numeric(excessHousingFundWithholding); + const newMonthlyBracket = monthlyWageBracket(newMonthlyTaxable); + const newMonthlyTax = newMonthlyBracket === null + ? null + : newMonthlyTaxable * newMonthlyBracket.rate - newMonthlyBracket.deduction; + const salaryMonthlyBracket = monthlyWageBracket(salaryTaxable); const salaryAnnualTaxable = salaryTaxable * 12; const salaryBracket = annualBracket(salaryAnnualTaxable); const salaryRate = salaryAnnualTaxable === 0 ? null : salaryBracket.rate; @@ -580,9 +603,11 @@ const salaryIncome = newSalary * 12; const parttimeIncome = monthlyParttime * 12 * 0.8; const totalIncome = salaryIncome + parttimeIncome; - const basicDeduction = 60000; - const socialFundDeduction = (v('G') + v('P') + v('R')) * 12; - const settlementTaxable = totalIncome - basicDeduction - socialFundDeduction; + const annualBasicDeduction = 60000; + const socialFundDeduction = ( + v('G') + numeric(newEmployerHousingFund) + numeric(excessHousingFundWithholding) + ) * 12; + const settlementTaxable = totalIncome - annualBasicDeduction - socialFundDeduction; const settlementBracket = annualBracket(settlementTaxable); const settlementRate = settlementTaxable <= 0 ? null : settlementBracket.rate; const settlementDeduction = settlementTaxable <= 0 ? null : settlementBracket.deduction; @@ -600,19 +625,29 @@ : originalAnnualTaxAmount - settlementTax; Object.assign(result, { + I: monthlyBasicDeduction, J: originalTaxable, + M: originalMonthlyTax, N: originalAnnualTax, + O: newHousingFundBase, + P: newEmployerHousingFund, + Q: newPersonalHousingFund, + R: excessHousingFundWithholding, S: newMonthlyTaxable, + V: newMonthlyTax, W: newAnnualTaxable, X: originalRate, Y: originalDeduction, Z: originalAnnualTaxAmount, - K: originalMonthlyRate, - T: newMonthlyRate, + K: originalMonthlyBracket?.rate ?? null, + L: originalMonthlyBracket?.deduction ?? null, + T: newMonthlyBracket?.rate ?? null, + U: newMonthlyBracket?.deduction ?? null, AD: parttimeSalary, AE: newSalary, AF: salaryTaxable, - AG: salaryMonthlyRate, + AG: salaryMonthlyBracket?.rate ?? null, + AH: salaryMonthlyBracket?.deduction ?? null, AJ: salaryAnnualTaxable, AK: salaryRate, AL: salaryDeduction, @@ -628,7 +663,7 @@ AW: salaryIncome, AX: parttimeIncome, AY: totalIncome, - AZ: basicDeduction, + AZ: annualBasicDeduction, BA: socialFundDeduction, BB: settlementTaxable, BC: settlementRate, diff --git a/resources/views/business/pages/financial-operations/process-details.blade.php b/resources/views/business/pages/financial-operations/process-details.blade.php new file mode 100644 index 00000000..072c75b8 --- /dev/null +++ b/resources/views/business/pages/financial-operations/process-details.blade.php @@ -0,0 +1,456 @@ +@php + $rows = $rows ?? null; + $filters = $filters ?? []; + $summary = $summary ?? []; + $months = $months ?? []; + $documentTypes = $documentTypes ?? []; + $statuses = $statuses ?? []; + $error = $error ?? null; + $scope = $scope ?? 'personal_permission'; + $scopeLabel = $scope === 'personal_permission' ? '当前账号权限范围' : $scope; + $money = static fn (mixed $value): string => $value === null || $value === '' + ? '-' + : number_format((float) $value, 2); + $text = static fn (mixed $value): string => $value === null || trim((string) $value) === '' + ? '-' + : (string) $value; + $statusClass = static fn (string $status): string => match ($status) { + '已完成' => 'is-success', + '审批中' => 'is-warning', + '已终止', '已撤销' => 'is-danger', + default => 'is-neutral', + }; + $pageUrl = route('business.pages.show', [ + 'section' => 'financial-operations', + 'page' => 'process-details', + ]); + $exportFilters = array_filter( + $filters, + static fn (mixed $value): bool => $value !== '' && $value !== null, + ); + $exportUrl = url('/' . company_id() . '/workspace/financial-operations/process-details/export'); + if ($exportFilters !== []) { + $exportUrl .= '?' . http_build_query($exportFilters); + } +@endphp + + + + 流程明细 + + + + + +
+
+ 数据范围:{{ $scopeLabel }} + 镜像状态:{{ $mirrorStatus ?? 'unknown' }} + @if (! empty($mirrorSyncedAt)) + 最近同步:{{ $mirrorSyncedAt }} + @endif +
+ + @if ($error) + + @endif + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
明细行数{{ number_format((int) ($summary['rows'] ?? 0)) }}
+
审批单数{{ number_format((int) ($summary['approvals'] ?? 0)) }}
+
金额合计{{ $money($summary['amount_total'] ?? null) }}
+
银行付款合计{{ $money($summary['bank_amount_total'] ?? null) }}
+
+ +

+ 当前展示的是当前账号权限范围内可读取的钉钉审批流程明细;审批中的金额和行项目仍可能随流程变化。 + 企业级全量数据待领导开通 OA 权限后切换。 +

+ +
+ + + + + + + + + + + + + + + + + + + + + + @forelse ($rows as $row) + + + + + + + + + + + + + + + + + + @empty + + + + @endforelse + +
序号审批编号发起人状态单据类型用途/摘要单据内行号科目编码科目名称金额(元)银行科目编码银行科目名称银行付款金额付款方式打款时间
{{ ($rows->currentPage() - 1) * $rows->perPage() + $loop->iteration }}{{ $row->business_id }}{{ $text($row->originator_name) }} + {{ $text($row->status) }} + {{ $text($row->document_type) }}{{ $text($row->purpose) }}{{ $row->line_no }}{{ $text($row->account_code) }}{{ $text($row->account_name) }}{{ $money($row->amount) }}{{ $text($row->bank_account_code) }}{{ $text($row->bank_account_name) }}{{ $money($row->bank_amount) }}{{ $text($row->payment_method) }}{{ $text($row->paid_at) }}
+ 当前筛选条件没有流程明细。可以调整月份、单据类型、状态或关键词后重试。 +
+
+ + +
+
+
diff --git a/resources/views/business/pages/partials/directory-table.blade.php b/resources/views/business/pages/partials/directory-table.blade.php index 304c64d7..d1780ee3 100644 --- a/resources/views/business/pages/partials/directory-table.blade.php +++ b/resources/views/business/pages/partials/directory-table.blade.php @@ -1418,6 +1418,7 @@ data-directory-user="{{ auth()->id() ?? 'guest' }}" data-directory-section="{{ $section['slug'] ?? '' }}" data-directory-tab="{{ $activeTab['slug'] ?? '' }}" + data-directory-column-preference-version="{{ in_array($directoryPageKey, ['company-management/subject-operating-report', 'store-management/store-report'], true) ? 'empty-month-columns-v1' : '' }}" aria-label="{{ $page['title'] ?? $section['title'] }}" > @if ($directoryUsesFieldQuery) @@ -1915,7 +1916,7 @@ 'tax_type' => ['一般纳税人', '小规模纳税人', '个体工商户', '无税务登记', 'CORP'], 'company_status' => ['正常', '已注销'], 'company_type' => ['个体工商户', '个体户', '二级公司', '人力资源公司', '仓储公司', '其他', '合同公司', '品牌公司', '店铺-国标公司', '店铺-国标商标', '店铺-大店公司', '店铺-普通公司', '母公司', '资产型'], - 'business_registration_type' => ['个人独资企业', '合伙企业', '有限责任公司', '有限责任公司(自然人独资)', '个体工商户', '核定', '其他'], + 'business_registration_type' => ['核定', '个人独资企业', '/'], 'collection_method' => ['查账征收', '核定征收', '定期定额'], 'status' => ['0' => '开店中', '3' => '关店中', '6' => '关店'], 'can_change', 'can_change_entity' => ['是', '否'], @@ -3662,12 +3663,14 @@ const tableKey = tableScope?.dataset.directoryTableKey || section?.dataset.directoryTab || 'table'; const sourceUrl = tableScope?.dataset.directorySourceUrl || window.location.href; const lastPage = Number(tableScope?.dataset.directoryLastPage || section?.dataset.directoryLastPage || 1); + const preferenceVersion = section.dataset.directoryColumnPreferenceVersion || ''; const storageKey = [ 'directory-fields', section.dataset.directoryUser || 'guest', section.dataset.directorySection || 'section', section.dataset.directoryPage || 'page', tableKey, + ...(preferenceVersion ? [preferenceVersion] : []), ].join(':'); const defaultOrder = checks.map((check) => check.value); const orderedChecks = () => [...(picker?.querySelectorAll('[data-directory-field-option]') || [])] @@ -3841,7 +3844,7 @@ const options = [...picker.querySelectorAll('[data-directory-field-option]')]; const byKey = new Map(options.map((option) => [option.querySelector('[data-directory-field-check]').value, option])); defaultOrder.forEach((key) => picker.querySelector('.directory-field-picker__panel').appendChild(byKey.get(key))); - checks.forEach((check) => { check.checked = !['sales_01', 'sales_02', 'sales_03', 'sales_04', 'sales_05', 'sales_06'].includes(check.value); }); + checks.forEach((check) => { check.checked = check.defaultChecked; }); applyColumns(); }; const resetButton = tools.querySelector('[data-directory-reset]'); diff --git a/resources/views/business/pages/partials/installation-fee-summary.blade.php b/resources/views/business/pages/partials/installation-fee-summary.blade.php index b236ce43..83e4aab6 100644 --- a/resources/views/business/pages/partials/installation-fee-summary.blade.php +++ b/resources/views/business/pages/partials/installation-fee-summary.blade.php @@ -5,36 +5,26 @@ .installation-fee-card { position: relative; - display: block; - width: min(100%, 52rem); - min-height: 9.25rem; - padding: 0.95rem 1.15rem 0.8rem 1.25rem; + display: flex; + width: 100%; + height: 8rem; + min-height: 0; + flex-direction: column; + box-sizing: border-box; + padding: 0.7rem 1rem 0 1.15rem; border: 1px solid #d8d2c7; border-left: 3px solid #006395; border-radius: 0.75rem; background: #ffffff; color: #171717; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); - font: inherit; + font-family: "JetBrains Mono", "Microsoft YaHei", "PingFang SC", monospace; text-align: left; - cursor: pointer; - } - - .installation-fee-card:hover, - .installation-fee-card:focus-visible { - border-color: #b9954f; - border-left-color: #006395; - background: #fffdf8; - outline: none; - } - - .installation-fee-card:focus-visible { - box-shadow: 0 0 0 3px rgba(133, 102, 50, 0.2); } .installation-fee-card__top { display: flex; - align-items: flex-start; + align-items: center; justify-content: space-between; gap: 1rem; } @@ -64,15 +54,15 @@ align-items: baseline; gap: 0.35rem; min-width: 0; - margin: 0.35rem 0 0.58rem; + margin: 0.2rem 0 0.3rem; } .installation-fee-card__value { color: #171717; - font-size: 2.625rem; + font-size: 2.5rem; font-weight: 700; - line-height: 1.1; - letter-spacing: -0.035em; + line-height: 1; + letter-spacing: 0; font-variant-numeric: tabular-nums; } @@ -107,9 +97,11 @@ .installation-fee-card__split { display: flex; align-items: center; + justify-content: space-between; gap: 0.45rem; flex-wrap: wrap; - padding-top: 0.55rem; + margin: auto -1rem 0 -1.15rem; + padding: 0.43rem 1rem 0.48rem 1.15rem; border-top: 1px solid #e5e0d7; color: #171717; font-size: 0.75rem; @@ -117,6 +109,14 @@ font-variant-numeric: tabular-nums; } + .installation-fee-card__split-summary { + display: flex; + min-width: 0; + align-items: center; + gap: 0.45rem; + flex-wrap: wrap; + } + .installation-fee-card__split strong { font-weight: 600; } @@ -127,15 +127,52 @@ font-weight: 400; } + .installation-fee-card__split-unit { + margin-left: 0.12rem; + color: #595959; + font-size: 0.6875rem; + font-weight: 400; + } + .installation-fee-card__split-sep { color: #d8d2c7; font-weight: 400; } + .installation-fee-card__detail-button { + display: inline-flex; + min-height: 1.55rem; + align-items: center; + justify-content: center; + gap: 0.25rem; + margin-left: auto; + padding: 0 0.45rem; + border: 0; + border-radius: 0.3rem; + background: transparent; + color: #006395; + cursor: pointer; + font: inherit; + font-size: 0.75rem; + font-weight: 600; + white-space: nowrap; + } + + .installation-fee-card__detail-button:hover { + background: #eef6fa; + } + + .installation-fee-card__detail-button:focus-visible { + background: #eef6fa; + box-shadow: 0 0 0 3px rgba(0, 99, 149, 0.16); + outline: none; + } + @media (max-width: 720px) { .installation-fee-card { - min-height: 0; - padding: 0.9rem 0.95rem 0.8rem 1rem; + height: auto; + min-height: 8rem; + padding: 0.7rem 0.85rem 0 0.95rem; } .installation-fee-card__top { flex-direction: column; @@ -149,7 +186,17 @@ flex-wrap: wrap; } .installation-fee-card__value { - font-size: 2.625rem; + font-size: 2.5rem; + } + .installation-fee-card__split { + margin-right: -0.85rem; + margin-left: -0.95rem; + padding-right: 0.85rem; + padding-left: 0.95rem; + } + .installation-fee-card__detail-button { + width: 100%; + justify-content: flex-end; } } @@ -351,13 +398,9 @@
- - +
@@ -451,9 +503,10 @@