diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index cf7d4413..9c01a07f 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -28,6 +28,7 @@ use App\Models\Business\CourierQuoteSignature; use App\Models\Business\CourierQuoteVersion; use App\Models\Business\CourierSigningSubject; use App\Models\Business\InstallationDetail; +use App\Models\Business\InvoiceBasicDetail; use App\Models\Business\InventoryWarehouseNameMapping; use App\Models\Business\Todo; use App\Business\CourierSurchargeAuditLogRepository; @@ -3937,6 +3938,7 @@ class Pages extends Controller ): array { $descriptor = null; $rows = collect(); + $invoiceBasicDetails = collect(); $tabValue = null; $tabColumn = null; $upstreamError = null; @@ -4099,6 +4101,26 @@ class Pages extends Controller } $rows = $query->orderByDesc('id')->paginate(50)->withQueryString(); + + if (($section['slug'] ?? null) === 'invoice-management' + && ($page['slug'] ?? null) === 'basic-information') { + try { + $pageRows = $rows->getCollection(); + $periods = $pageRows->pluck('period')->filter()->unique()->values(); + $sellers = $pageRows->pluck('store_entity')->filter()->unique()->values(); + + if ($periods->isNotEmpty() && $sellers->isNotEmpty()) { + $invoiceBasicDetails = InvoiceBasicDetail::query() + ->whereIn('period', $periods->all()) + ->whereIn('seller_entity', $sellers->all()) + ->orderByDesc('output_amount') + ->get() + ->groupBy(static fn (InvoiceBasicDetail $detail): string => $detail->seller_entity . '|' . $detail->period); + } + } catch (Throwable $exception) { + report($exception); + } + } } } } @@ -4130,6 +4152,7 @@ class Pages extends Controller 'inventoryUnmappedWarehouseError' => $inventoryUnmappedWarehouseError, 'inventoryWarehouseMappingView' => $inventoryWarehouseMappingView, 'receiptStats' => $receiptStats, + 'invoiceBasicDetails' => $invoiceBasicDetails, 'payablesFinal' => $this->payablesFinalData($section, $page), ]; } diff --git a/app/Models/Business/InvoiceBasicDetail.php b/app/Models/Business/InvoiceBasicDetail.php new file mode 100644 index 00000000..02525555 --- /dev/null +++ b/app/Models/Business/InvoiceBasicDetail.php @@ -0,0 +1,27 @@ + 'integer', + 'invoice_count' => 'integer', + 'output_amount' => 'decimal:2', + 'tax_amount' => 'decimal:2', + 'net_amount' => 'decimal:2', + ]; +} diff --git a/database/migrations/2026_11_10_160000_create_invoice_basic_details_table.php b/database/migrations/2026_11_10_160000_create_invoice_basic_details_table.php new file mode 100644 index 00000000..713fe4a1 --- /dev/null +++ b/database/migrations/2026_11_10_160000_create_invoice_basic_details_table.php @@ -0,0 +1,38 @@ +increments('id'); + $table->unsignedInteger('company_id')->default(1); + $table->string('period', 10)->comment('期间,YYYY-MM'); + $table->string('seller_entity')->comment('销方开票主体'); + $table->string('shop_name')->comment('店铺名称'); + $table->unsignedInteger('invoice_count')->default(0)->comment('成功开票张数'); + $table->decimal('output_amount', 18, 2)->default(0)->comment('销项金额(含税)'); + $table->decimal('tax_amount', 18, 2)->default(0)->comment('税额'); + $table->decimal('net_amount', 18, 2)->default(0)->comment('不含税金额'); + $table->timestamps(); + + $table->unique( + ['company_id', 'period', 'seller_entity', 'shop_name'], + 'invoice_basic_details_unique' + ); + $table->index( + ['company_id', 'period', 'seller_entity'], + 'invoice_basic_details_lookup' + ); + }); + } + + public function down(): void + { + Schema::dropIfExists('ak_biz_invoice_basic_details'); + } +}; diff --git a/resources/views/business/pages/show.blade.php b/resources/views/business/pages/show.blade.php index 6916420d..3a8544a5 100644 --- a/resources/views/business/pages/show.blade.php +++ b/resources/views/business/pages/show.blade.php @@ -9,6 +9,8 @@ && ($page['slug'] ?? null) === 'marketing-account-balance'; $isStoreReceivingAccountsPage = ($section['slug'] ?? null) === 'fund-management' && ($page['slug'] ?? null) === 'store-receiving-accounts'; + $isInvoiceBasicPage = ($section['slug'] ?? null) === 'invoice-management' + && ($page['slug'] ?? null) === 'basic-information'; $isSupplierWorkspace = in_array($section['slug'] ?? null, ['supplier-payables', 'supplier-payables-final'], true); $supplierWorkspaceSection = $section; $isCourierFinalDirectory = ($section['slug'] ?? null) === 'courier-payables-final'; @@ -1054,6 +1056,49 @@ @elseif ($pageView) @include($pageView) @elseif ($descriptor) + @if ($isInvoiceBasicPage) + + @endif
| 店铺名称 | +开票张数 | +销项金额(含税) | +税额 | +不含税金额 | +
|---|---|---|---|---|
| {{ $detail->shop_name }} | +{{ number_format((int) $detail->invoice_count) }} | +{{ number_format((float) $detail->output_amount, 2) }} | +{{ number_format((float) $detail->tax_amount, 2) }} | +{{ number_format((float) $detail->net_amount, 2) }} | +