From 824ab74c1a5482e582d6cd3de7e8eb2b292c15d1 Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Fri, 4 Dec 2026 17:47:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BF=AB=E9=80=92=E8=A1=A5=E6=AC=BE?= =?UTF-8?q?=E6=8C=89=E9=80=80=E5=9B=9E=E8=A7=84=E5=88=99=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=AE=A1=E5=85=A5=E5=B0=8F=E6=B1=87=E6=80=BB=20(#1739)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Business/CourierBillController.php | 3 +- app/Support/CourierBills/Rebooks.php | 68 ++++++++++++++++++- .../CourierBills/StatementExporter.php | 19 ++++-- .../courier-bills/statement.blade.php | 2 +- .../Business/CourierBillRebooksTest.php | 2 +- .../CourierRebookReturnReviewTest.php | 66 ++++++++++++++++-- 6 files changed, 143 insertions(+), 17 deletions(-) diff --git a/app/Http/Controllers/Business/CourierBillController.php b/app/Http/Controllers/Business/CourierBillController.php index 63a9109de..70bb6cf4e 100644 --- a/app/Http/Controllers/Business/CourierBillController.php +++ b/app/Http/Controllers/Business/CourierBillController.php @@ -122,6 +122,7 @@ final class CourierBillController extends Controller } $items = $db->table('courier_bill_summary_items')->where('statement_id', $statement->id)->orderBy('sort')->get(); $items=app(\App\Support\CourierBills\SurchargeSettlementMatcher::class)->summaryItems((int)$statement->id,$items); + $items=app(Rebooks::class)->summaryItems((int)$statement->id,$items); $fileIds = $db->table('courier_bill_lines')->where('statement_id', $statement->id)->distinct()->pluck('file_id'); $files = $db->table('courier_bill_files')->where(fn ($q) => $q->where('statement_id', $statement->id)->orWhereIn('id', $fileIds))->orderBy('id')->get(); $shippingSync = null; @@ -156,7 +157,7 @@ final class CourierBillController extends Controller return ['months' => $plan['months'], 'source' => $plan['source'], 'window' => $plan['window'], 'count' => $rows->where('amount', '>', 0)->count(), 'amount' => round((float) $rows->sum('amount'), 2), - 'pending' => $rows->where('status', '待复核')->count(), 'done' => $rows->filter(fn ($r) => str_starts_with($r['status'], '已补'))->count()]; + 'pending' => $rows->where('status', '资料缺失待核对')->count(), 'done' => $rows->filter(fn ($r) => str_starts_with($r['status'], '已补'))->count()]; } private function detailsData(Request $request, string $month): array diff --git a/app/Support/CourierBills/Rebooks.php b/app/Support/CourierBills/Rebooks.php index 796027fef..2083ffadb 100644 --- a/app/Support/CourierBills/Rebooks.php +++ b/app/Support/CourierBills/Rebooks.php @@ -15,7 +15,7 @@ use RuntimeException; * - 补哪几个月:对账分组里设(不补 / 补上月 / 补前两个月),没设就按上月小汇总里的补记账类目识别 * (「补9月记账」「补8月记账」→ 补前两个月;「2026.8-9月记账补款」→ 补前两个月;「补记账」「9月记账补款」→ 补上月)。最多补两个月,超期不补。 * - 当时扣的:记账明细里那个扣款月份这单的「结算记账」合计。 - * - 现在应扣:复核记账(财务每月导入;逻辑定下来后换成系统算)。没复核的单先不补。 + * - 现在应扣:优先采用人工复核;否则按原未退回行的退回匹配和原因自动计算,资料缺失先不补。 * - 本期补款 = 当时扣的 − 现在应扣;补记账台账里补过的单不再补。 * - 对账单确认时,这期补的单记进补记账台账;取消确认就撤掉。 */ @@ -132,7 +132,7 @@ final class Rebooks } /** - * 一张对账单的补记账明细(含还没复核、已经补过的,金额为 0 的不补)。 + * 一张对账单的补记账明细(含资料缺失、已经补过的,金额为 0 的不补)。 * * @return array{months:int,source:string,window:list,rows:list>} */ @@ -231,15 +231,26 @@ final class Rebooks $k = strtoupper($d['waybill']) . '|' . $d['deduct_month']; $deducted = round((float) $d['deducted'], 2); $current = $reviews[$k] ?? null; + $automatic = false; + $missingData = false; + foreach ($d['sources'] as $source) { + $missingData = $missingData || str_contains((string) ($source['_return_status'] ?? ''), '缺失'); + } + if ($current === null) { + $current = self::returnedAmount($d['sources']); + $automatic = $current !== null; + } $done = $refunded[$k] ?? null; [$status, $amount] = match (true) { $done !== null => ['已补(' . $done['month'] . ')', 0.0], $deducted <= 0 => ['没扣', 0.0], - $current === null => ['待复核', 0.0], + $current === null && $missingData => ['资料缺失待核对', 0.0], + $current === null => ['无新增退回,不补', 0.0], $current >= $deducted => ['仍应扣,不补', 0.0], default => ['本期补款', round($deducted - $current, 2)], }; $d['info']['_rebook_sources'] = $d['sources']; + $d['info']['_automatic_current'] = $automatic; $rows[] = ['deduct_month' => $d['deduct_month'], 'waybill' => $d['waybill'], 'carrier' => $d['carrier'], 'deducted' => $deducted, 'refunded' => $done === null ? null : round($done['amount'], 2), 'current' => $current, 'amount' => $amount, 'status' => $status, 'info' => $d['info']]; @@ -249,6 +260,51 @@ final class Rebooks return $rows; } + /** 只重算有退回证据的原未退回行;同单其他行沿用原应扣,缺少任一行金额则整单暂缓。 */ + private static function returnedAmount(array $sources): ?float + { + $matched = false; + $amount = '0'; + foreach ($sources as $source) { + if (str_contains((string) ($source['_return_status'] ?? ''), '缺失')) { + return null; + } + $matched = $matched || isset($source['_return_current']); + $amount = bcadd($amount, (string) ($source['_return_current'] ?? (($source['settle_bookkeeping'] ?? '') ?: '0')), 4); + } + + return $matched ? round((float) $amount, 2) : null; + } + + /** 页面、导出共用自动补款金额;人工填写的小汇总不覆盖,已确认账单不重算。 */ + public function summaryItems(int $statementId, iterable $items, ?array $plan = null): \Illuminate\Support\Collection + { + $items = collect($items); + $plan ??= $this->forStatement($statementId); + if ($plan['source'] === 'confirmed') return $items; + $automaticMonths = []; + foreach ($plan['rows'] as $row) { + if ($row['info']['_automatic_current'] ?? false) $automaticMonths[$row['deduct_month']] = true; + } + if ($automaticMonths === []) return $items; + $totals = self::totals($plan['rows']); + $allocated = []; + $affected = []; + foreach ($plan['window'] as $month) { + $item = $items->first(fn ($item) => SummaryTemplate::normalize($item->label) === self::label($month)) + ?? $items->first(fn ($item) => self::labelCovers($item->label, (int) substr($month, 5, 2))); + if ($item === null || $item->manual) continue; + $allocated[$item->id] = round(($allocated[$item->id] ?? 0) + ($totals[$month] ?? 0), 2); + if (isset($automaticMonths[$month])) $affected[$item->id] = true; + } + + return $items->map(function ($item) use ($allocated, $affected) { + $copy = clone $item; + if (isset($affected[$item->id])) $copy->self_amount = $allocated[$item->id]; + return $copy; + }); + } + /** 各扣款月份本期补款合计(只算要补的)。 @param list> $rows @return array */ public static function totals(array $rows): array { @@ -287,6 +343,12 @@ final class Rebooks { $statement = self::db()->table('courier_bill_statements')->find($statementId); $plan = $this->forStatement($statementId); + $items = self::db()->table('courier_bill_summary_items')->where('statement_id', $statementId)->orderBy('sort')->get(); + foreach ($this->summaryItems($statementId, $items, $plan) as $item) { + if ($item->self_amount !== $items->firstWhere('id', $item->id)->self_amount) { + self::db()->table('courier_bill_summary_items')->where('id', $item->id)->update(['self_amount' => $item->self_amount]); + } + } $this->assertSummaryMatches($statementId, $plan['rows']); $now = now(); $buffer = []; diff --git a/app/Support/CourierBills/StatementExporter.php b/app/Support/CourierBills/StatementExporter.php index aa6bd938b..49a1e8642 100644 --- a/app/Support/CourierBills/StatementExporter.php +++ b/app/Support/CourierBills/StatementExporter.php @@ -92,7 +92,8 @@ final class StatementExporter $book->row('汇总', [$group->name . ' ' . $statement->bill_month, '快递提供金额', '自算金额', '差异'], true); $bill = 0.0; $self = 0.0; - foreach (app(SurchargeSettlementMatcher::class)->summaryItems($id,$db->table('courier_bill_summary_items')->where('statement_id', $id)->orderBy('sort')->get()) as $item) { + $items = app(SurchargeSettlementMatcher::class)->summaryItems($id,$db->table('courier_bill_summary_items')->where('statement_id', $id)->orderBy('sort')->get()); + foreach (app(Rebooks::class)->summaryItems($id, $items) as $item) { $b = $item->bill_amount === null ? null : (float) $item->bill_amount; $s = $item->self_amount === null ? null : (float) $item->self_amount; $book->row('汇总', [$item->label, $b, $s, round((float) $b - (float) $s, 2)]); @@ -235,15 +236,24 @@ final class StatementExporter $remainingCurrent = (float) ($r['current'] ?? $r['deducted']); $remainingRefund = (float) $r['amount']; $last = array_key_last($sources); + $automatic = $r['info']['_automatic_current'] ?? false; + $weights = []; + foreach ($sources as $index => $source) { + $old = (float) ($source['settle_bookkeeping'] ?? $r['deducted']); + $weights[$index] = $automatic ? max(0, round($old - (float) ($source['_return_current'] ?? $old), 2)) : max(0, $old); + } + $totalWeight = array_sum($weights); + $lastRefund = array_key_last(array_filter($weights, static fn ($weight) => $weight > 0)); $historyWritten = false; foreach ($sources as $index => $source) { $rowNumber++; $values = $source; $old = (float) ($source['settle_bookkeeping'] ?? $r['deducted']); $share = $r['deducted'] > 0 ? $old / $r['deducted'] : 0; - $current = $r['current'] === null ? (float) ($source['_return_current'] ?? $old) + $current = $automatic || $r['current'] === null ? (float) ($source['_return_current'] ?? $old) : ($index === $last ? $remainingCurrent : round((float) $r['current'] * $share, 2)); - $payable = $index === $last ? $remainingRefund : round((float) $r['amount'] * $share, 2); + $payable = $weights[$index] <= 0 || $totalWeight <= 0 ? 0.0 + : ($index === $lastRefund ? $remainingRefund : round((float) $r['amount'] * $weights[$index] / $totalWeight, 2)); $remainingCurrent = round($remainingCurrent - $current, 2); $remainingRefund = round($remainingRefund - $payable, 2); $values['summary_month'] = $r['deduct_month']; @@ -263,8 +273,7 @@ final class StatementExporter $values['return_match'] = $source['_return_method'] ?? ''; $values['matched_return'] = $source['_matched_return_no'] ?? ''; $values['received_at'] = $source['_return_received_at'] ?? ''; - $values['refund_status'] = $r['status'] === '待复核' && isset($source['_return_current']) - ? '已退回待复核,暂未计入补款' : $r['status']; + $values['refund_status'] = $r['status']; $values['refunded'] = $historyWritten ? null : $r['refunded']; $historyWritten = true; $values['payable_refund'] = $payable; diff --git a/resources/views/business/pages/courier-payables/courier-bills/statement.blade.php b/resources/views/business/pages/courier-payables/courier-bills/statement.blade.php index a1b26cddb..1f0dd1300 100644 --- a/resources/views/business/pages/courier-payables/courier-bills/statement.blade.php +++ b/resources/views/business/pages/courier-payables/courier-bills/statement.blade.php @@ -64,7 +64,7 @@ 补记账:{{ \App\Support\CourierBills\Rebooks::RULES[$cbRebook['months']] ?? '' }}({{ match ($cbRebook['source']) { 'group' => '对账分组里设的', 'confirmed' => '按确认时记录', default => '按上月小汇总识别' } }}) @if ($cbRebook['window'] !== []) · 扣款月份 {{ implode('、', $cbRebook['window']) }} · 本期补 {{ number_format($cbRebook['count']) }} 单 {{ $money($cbRebook['amount']) }} - @if ($cbRebook['pending'] > 0) · {{ number_format($cbRebook['pending']) }} 单还没复核,先不补(在「结算台账」导入复核记账)@endif + @if ($cbRebook['pending'] > 0) · {{ number_format($cbRebook['pending']) }} 单缺少成本或结算运费,暂不计入补款 @endif @if ($cbRebook['done'] > 0) · {{ number_format($cbRebook['done']) }} 单以前补过,不再补@endif @endif

diff --git a/tests/Feature/Business/CourierBillRebooksTest.php b/tests/Feature/Business/CourierBillRebooksTest.php index ee4ae90b3..e4564a3c1 100644 --- a/tests/Feature/Business/CourierBillRebooksTest.php +++ b/tests/Feature/Business/CourierBillRebooksTest.php @@ -93,7 +93,7 @@ final class CourierBillRebooksTest extends FeatureTestCase $status = collect($plan['rows'])->mapWithKeys(fn ($r) => [$r['waybill'] => [$r['status'], $r['amount']]])->all(); $this->assertSame([ 'YT0001' => ['本期补款', 100.0], 'YT0002' => ['仍应扣,不补', 0.0], 'YT0006' => ['已补(2026-10)', 0.0], - 'YT0007' => ['待复核', 0.0], 'YT0003' => ['本期补款', 60.0], + 'YT0007' => ['无新增退回,不补', 0.0], 'YT0003' => ['本期补款', 60.0], ], $status); $this->assertSame(['2026-09' => 100.0, '2026-10' => 60.0], Rebooks::totals($plan['rows'])); diff --git a/tests/Feature/Business/CourierRebookReturnReviewTest.php b/tests/Feature/Business/CourierRebookReturnReviewTest.php index 1fa67b04d..e0aa4c62a 100644 --- a/tests/Feature/Business/CourierRebookReturnReviewTest.php +++ b/tests/Feature/Business/CourierRebookReturnReviewTest.php @@ -45,11 +45,6 @@ final class CourierRebookReturnReviewTest extends FeatureTestCase } $db->table('courier_bill_rebooks')->insert(['waybill_no' => $nums[0], 'deduct_month' => '2026-10', 'refund_month' => '2026-10', 'amount' => 85, 'source' => 'import', 'created_at' => now()]); - // 结算仍由已复核金额驱动;退回匹配不能擅自把其他分组未复核金额计入应付。 - foreach ([0 => 15, 1 => 15, 2 => 0] as $i => $amount) { - $db->table('courier_bill_rebook_reviews')->insert(['waybill_no' => $nums[$i], 'deduct_month' => '2026-10', - 'current_amount' => $amount, 'updated_at' => now()]); - } $id = $db->table('courier_bill_statements')->insertGetId(['group_id' => $group, 'bill_month' => '2026-11', 'status' => 'open', 'created_at' => now(), 'updated_at' => now()]); $plan = app(Rebooks::class)->forStatement($id); @@ -58,7 +53,7 @@ final class CourierRebookReturnReviewTest extends FeatureTestCase $this->assertSame(200.0, $rows[$nums[0]]['deducted']); $this->assertCount(2, $rows[$nums[0]]['info']['_rebook_sources']); $this->assertSame(0.0, $rows[$nums[0]]['amount']); - $this->assertSame(15.0, $rows[$nums[0]]['current']); + $this->assertSame(30.0, $rows[$nums[0]]['current']); $this->assertSame(85.0, $rows[$nums[1]]['amount']); $this->assertSame('模糊匹配(格式或T前缀)', $rows[$nums[1]]['info']['_rebook_sources'][0]['_return_method']); $this->assertSame(100.0, $rows[$nums[2]]['amount']); @@ -76,5 +71,64 @@ final class CourierRebookReturnReviewTest extends FeatureTestCase $this->assertArrayNotHasKey('_return_current', $annotated[0]); $this->assertSame('已退回,记账损耗+运费', $annotated[1]['analysis']); $this->assertArrayNotHasKey('_return_analysis', $annotated[1]); + + $db->table('courier_bill_summary_items')->insert(['statement_id' => $id, 'label' => '2026.9-10月记账补款', 'self_amount' => 0, 'manual' => false, 'sort' => 1]); + $items = $db->table('courier_bill_summary_items')->where('statement_id', $id)->get(); + $this->assertEquals(185, app(Rebooks::class)->summaryItems($id, $items)->first()->self_amount); + $this->assertEquals(0, $db->table('courier_bill_summary_items')->where('statement_id', $id)->value('self_amount')); + app(CourierBillStore::class)->confirm($id, 'tester'); + $this->assertEquals(185, $db->table('courier_bill_summary_items')->where('statement_id', $id)->value('self_amount')); + $this->assertEquals(185, $db->table('courier_bill_rebooks')->where('statement_id', $id)->sum('amount')); + $this->assertCount(2, app(Rebooks::class)->forStatement($id)['rows']); + } + + public function test_automatic_refund_preserves_per_product_costs_and_holds_missing_costs(): void + { + \Illuminate\Support\Facades\Storage::fake('local'); + $db = Rebooks::db(); + if (! Schema::connection($db->getName())->hasTable('courier_returned_parcels')) { + Schema::connection($db->getName())->create('courier_returned_parcels', function ($table): void { + $table->unsignedBigInteger('source_id')->primary();$table->string('waybill');$table->dateTime('received_at');$table->decimal('returned_qty', 12, 4); + }); + } + $group = app(CourierBillStore::class)->saveGroup(null, ['name' => '自动核对', 'express_names' => ['自动核对'], 'rebook_months' => 1]); + $source = DB::connection(config('database.supplier_payable_maintenance_connection')); + foreach ([[100,40,7],[50,20,3],[100,null,7],[50,20,3],[5,40,7]] as $i => [$old,$cost,$freight]) { + $wb = $i < 2 ? '100100100100' : ($i < 4 ? '100100100101' : '100100100102'); + $source->table('supplier_payable_overrides')->insert(['company_id' => $this->company->id, 'dataset' => Rebooks::BOOKKEEPING_DATASET, + 'record_key' => 'automatic-'.$i, 'values' => json_encode(['summary_month' => '2026-10', 'tracking_no' => $wb, 'carrier' => '自动核对', 'analysis' => '未退回', + 'bookkeeping_reason' => '快递丢件', 'settle_bookkeeping' => $old, 'cost' => $cost, 'settle_freight' => $freight]), 'created_at' => now(), 'updated_at' => now()]); + } + foreach (['100100100100','100100100101','100100100102'] as $i => $wb) { + $return = ['source_id' => 5000+$i, 'waybill' => $wb, 'received_at' => now(), 'returned_qty' => 1]; + if (Schema::connection($db->getName())->hasColumn('courier_returned_parcels', 'generation')) $return += ['generation' => 'test', 'synced_at' => now()]; + $db->table('courier_returned_parcels')->insert($return); + } + $id = $db->table('courier_bill_statements')->insertGetId(['group_id' => $group, 'bill_month' => '2026-11', 'status' => 'open', 'created_at' => now(), 'updated_at' => now()]); + $db->table('courier_bill_summary_items')->insert(['statement_id' => $id, 'label' => '补10月记账', 'self_amount' => 0, 'manual' => false, 'sort' => 1]); + $plan = app(Rebooks::class)->forStatement($id);$rows = collect($plan['rows'])->keyBy('waybill'); + $this->assertSame(22.0, $rows['100100100100']['current']); + $this->assertSame(128.0, $rows['100100100100']['amount']); + $this->assertNull($rows['100100100101']['current']); + $this->assertSame(0.0, $rows['100100100101']['amount']); + $this->assertSame(0.0, $rows['100100100102']['amount']); + $items = $db->table('courier_bill_summary_items')->where('statement_id', $id)->get(); + $this->assertEquals(128, app(Rebooks::class)->summaryItems($id, $items)->first()->self_amount); + $items->first()->manual = true;$items->first()->self_amount = 90; + $this->assertEquals(90, app(Rebooks::class)->summaryItems($id, $items)->first()->self_amount); + $path = tempnam(sys_get_temp_dir(), 'auto-refund-'); + try { + $fp=fopen($path,'wb');try { app(\App\Support\CourierBills\StatementExporter::class)->export($id,$fp); } finally { fclose($fp); } + $book=\PhpOffice\PhpSpreadsheet\IOFactory::load($path); + try { + $sheet=$book->getSheetByName('补10月记账');$values=$sheet->toArray(null,true,false); + $this->assertEquals([100,15,85],array_slice($values[1],28,3)); + $this->assertEquals([50,7,43],array_slice($values[2],28,3)); + $index=array_search('本期补款金额',$values[0],true); + $this->assertEquals(128,array_sum(array_column(array_slice($values,1),$index))); + $summary=$book->getSheetByName('汇总')->toArray(null,true,false); + $this->assertEquals(128,$summary[1][2]); + } finally { $book->disconnectWorksheets(); } + } finally { @unlink($path); } } } From 43bd01493ba18755259b051b24fa02b5661ef565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E6=9C=A8?= <594326199@qq.com> Date: Fri, 4 Dec 2026 18:02:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(=E4=BE=9B=E5=BA=94=E5=95=86=E5=AF=B9?= =?UTF-8?q?=E8=B4=A6):=20=E5=88=86=E7=A6=BB=E5=BD=93=E6=9C=88=E5=8E=82?= =?UTF-8?q?=E5=AE=B6=E4=B8=8E=E5=85=8D=E4=B8=8A=E4=BC=A0=E5=8E=82=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当月厂家完整展示,订单合同及现结厂家独立成卡,其余进度仍按应上传范围统计。 Co-authored-by: 苏木 <594326199@qq.com> Co-committed-by: 苏木 <594326199@qq.com> --- .../View/SupplierReconciliationPageData.php | 11 +++++++---- .../finance-data.blade.php | 17 +++++++++++++---- .../SupplierStatementUploadEligibilityTest.php | 8 +++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/modules/EcommerceFinance/View/SupplierReconciliationPageData.php b/modules/EcommerceFinance/View/SupplierReconciliationPageData.php index cffc5c790..e915691c4 100644 --- a/modules/EcommerceFinance/View/SupplierReconciliationPageData.php +++ b/modules/EcommerceFinance/View/SupplierReconciliationPageData.php @@ -277,6 +277,7 @@ class SupplierReconciliationPageData * @return array{ * month:string, * total:array{count:int,suppliers:list}, + * exempt:array{count:int,suppliers:list}, * confirmed:array{count:int,suppliers:list}, * difference:array{count:int,suppliers:list}, * not_uploaded:array{count:int,suppliers:list} @@ -296,12 +297,13 @@ class SupplierReconciliationPageData $reconciler, ); $supplierScope = array_fill_keys($supplierNames, true); - $reconciliationSuppliers = array_values(array_filter( + $allReconciliationSuppliers = array_values(array_filter( array_keys($mineTotals), static fn (string $supplier): bool => isset($supplierScope[$supplier]), )); - $reconciliationSuppliers = $this->statementUploadEligibility - ->classify($reconciliationSuppliers, $month)['required']; + $eligibility = $this->statementUploadEligibility + ->classify($allReconciliationSuppliers, $month); + $reconciliationSuppliers = $eligibility['required']; $statementTotals = $this->statements->totalsBySupplierForMonth($month, $companyId); $sentSuppliers = array_fill_keys( @@ -341,7 +343,8 @@ class SupplierReconciliationPageData return [ 'month' => $month, - 'total' => $payload($reconciliationSuppliers), + 'total' => $payload($allReconciliationSuppliers), + 'exempt' => $payload($eligibility['exempt']), 'confirmed' => $payload($confirmed), 'difference' => $payload($differences), 'not_uploaded' => $payload($notUploaded), diff --git a/resources/views/business/pages/supplier-reconciliation/finance-data.blade.php b/resources/views/business/pages/supplier-reconciliation/finance-data.blade.php index ba0f44435..9e8730578 100644 --- a/resources/views/business/pages/supplier-reconciliation/finance-data.blade.php +++ b/resources/views/business/pages/supplier-reconciliation/finance-data.blade.php @@ -20,7 +20,7 @@ .supplier-reconciliation-page .sr-button.is-small { height: 26px; padding: 0 9px; font-size: .75rem; } .supplier-reconciliation-page .sr-list-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; } .supplier-reconciliation-page .sr-list-actions form { margin: 0; } - .supplier-reconciliation-page .sr-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; } + .supplier-reconciliation-page .sr-overview { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr) repeat(3, minmax(0, 1fr)); gap: 8px; } .supplier-reconciliation-page .sr-overview-stat { min-width: 0; border: 1px solid var(--vip-border, #D8D2C7); border-radius: 8px; background: #fff; } .supplier-reconciliation-page .sr-overview-stat summary { display: grid; gap: 3px; padding: 10px 12px; cursor: pointer; list-style: none; } .supplier-reconciliation-page .sr-overview-stat summary::-webkit-details-marker { display: none; } @@ -30,6 +30,9 @@ .supplier-reconciliation-page .sr-overview-stat.is-difference summary { border-top: 3px solid #935F07; } .supplier-reconciliation-page .sr-overview-stat.is-missing summary { border-top: 3px solid #006395; } .supplier-reconciliation-page .sr-overview-stat.is-total summary { border-top: 3px solid var(--vip-content-accent, #B9954F); } + .supplier-reconciliation-page .sr-overview-stat.is-exempt { border-color: #D7CEBA; background: #FCFAF5; } + .supplier-reconciliation-page .sr-overview-stat.is-exempt summary { border-top: 3px solid #7A6A4F; padding: 8px 10px; } + .supplier-reconciliation-page .sr-overview-stat.is-exempt .sr-overview-value { font-size: 1.25rem; } .supplier-reconciliation-page .sr-overview-label { color: #5B5343; font-size: .75rem; font-weight: 600; } .supplier-reconciliation-page .sr-overview-value { color: var(--vip-content-ink, #171717); font-size: 1.375rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; } .supplier-reconciliation-page .sr-overview-detail { max-height: 18rem; overflow: auto; padding: 9px 12px 12px; border-top: 1px solid #EFEAE0; } @@ -412,10 +415,16 @@ $overviewCards = [ [ 'key' => 'total', - 'label' => '需要对账厂家', + 'label' => '当月所有厂家', 'className' => 'is-total', 'data' => $reconciliationOverview['total'], ], + [ + 'key' => 'exempt', + 'label' => '订单合同/现结厂家', + 'className' => 'is-exempt', + 'data' => $reconciliationOverview['exempt'], + ], [ 'key' => 'confirmed', 'label' => '已确认(发送即计入)', @@ -465,8 +474,8 @@ @endforeach

- 统计跟随月份和对账人筛选;需要对账厂家按当前账期我方货款对账数据统计,“有差异”按双方数量或金额合计不一致统计, - “未上传账单”按账单业务日期所属月份判断;已确认按“货款确认已成功发送”计数,厂家后续是否点击确认不影响这里。 + 统计跟随月份和对账人筛选;“当月所有厂家”按当前账期我方货款对账数据统计,其中“订单合同/现结厂家”无需上传,也不进入群催办。 + “已确认”“有差异”“未上传账单”只统计剩余应上传厂家;未上传按账单业务日期所属月份判断,已确认按“货款确认已成功发送”计数。 同一厂家可同时出现在“已确认”和“有差异”中,表示确认发送后对账数据又发生变化。

assertOk(); $html = (string) $response->getContent(); + $this->assertStringContainsString('当月所有厂家', $html); + $this->assertStringContainsString('订单合同/现结厂家', $html); $section = static function (string $key) use ($html): string { preg_match( '/
(.*?)<\/details>/s', @@ -119,8 +121,12 @@ class SupplierStatementUploadEligibilityTest extends FeatureTestCase return (string) ($matches[1] ?? ''); }; - $this->assertStringContainsString('1 家', $section('total')); + $this->assertStringContainsString('4 家', $section('total')); + $this->assertStringContainsString('3 家', $section('exempt')); $this->assertStringContainsString('1 家', $section('not_uploaded')); + $this->assertStringContainsString('博曼特', $section('total')); + $this->assertStringContainsString('动态订单合同', $section('exempt')); + $this->assertStringContainsString('动态现结', $section('exempt')); $this->assertStringContainsString('动态月结', $section('not_uploaded')); $this->assertStringNotContainsString('博曼特', $section('not_uploaded')); $this->assertStringNotContainsString('动态订单合同', $section('not_uploaded'));