feat(顾家对账): 增加开票模板汇总卡片 #1344

Merged
chenxi merged 1 commits from feature/chenxi-kuka-invoice-summary into main 2026-11-21 14:57:59 +08:00
5 changed files with 87 additions and 2 deletions

View File

@ -389,6 +389,13 @@ class KukaReconciliationPageData
$virtualRows = $this->virtualRows($lineItems, $generatedAt);
$erpRecipients = $this->loadErpRecipients($companyId);
$erpRows = $this->erpRows($virtualRows, $generatedAt, $erpRecipients);
$invoiceRows = $this->invoiceRows($virtualRows);
$invoiceQuantityTotal = '0';
$invoiceAmountTotal = '0.00';
foreach ($invoiceRows as $invoiceRow) {
$invoiceQuantityTotal = $this->addDecimal($invoiceQuantityTotal, (string) ($invoiceRow[9] ?? '0'));
$invoiceAmountTotal = $this->addMoney($invoiceAmountTotal, (string) ($invoiceRow[10] ?? '0'));
}
$views = [
'posting-data' => $this->paginate(
@ -416,7 +423,7 @@ class KukaReconciliationPageData
),
'erp-product-import' => $this->paginate($erpRows, $page),
'invoice-entry-template' => $this->paginate(
$this->invoiceRows($virtualRows),
$invoiceRows,
$page,
),
'inventory-management-template' => $this->paginate($inventoryRows, $page),
@ -443,6 +450,8 @@ class KukaReconciliationPageData
'erp_amount_rounding_adjustment' => $virtualSalesRoundingAdjustment,
'erp_amount_total' => $postingSalesAmountTotal,
'erp_paid_amount_total' => $postingSalesAmountTotal,
'invoice_quantity_total' => $this->formatQuantity($invoiceQuantityTotal),
'invoice_amount_total' => $invoiceAmountTotal,
'toc_quantity_total' => $this->formatQuantity($postingQuantityTotal),
'order_count' => count($orders),
'skipped_missing_material_rows' => $skippedMissingMaterial,
@ -813,6 +822,8 @@ class KukaReconciliationPageData
'erp_amount_rounding_adjustment' => '0.00',
'erp_amount_total' => '0.00',
'erp_paid_amount_total' => '0.00',
'invoice_quantity_total' => '0',
'invoice_amount_total' => '0.00',
'toc_quantity_total' => '0',
'order_count' => 0,
'skipped_missing_material_rows' => 0,

View File

@ -207,6 +207,12 @@
'roundingAdjustment' => $kukaReconciliation['summary']['erp_amount_rounding_adjustment'] ?? '0.00',
])
@endif
@if ($tab['slug'] === 'invoice-entry-template' && empty($kukaReconciliation['error']))
@include('business.pages.posting-data.partials.kuka-reconciliation-invoice-summary', [
'quantityTotal' => $kukaReconciliation['summary']['invoice_quantity_total'] ?? '0',
'amountTotal' => $kukaReconciliation['summary']['invoice_amount_total'] ?? '0.00',
])
@endif
@if (! empty($tab['headers']))
@include($sourceTable, [
'title' => $tab['title'],
@ -228,7 +234,7 @@
'notice' => $tab['slug'] === 'erp-product-import'
? ($kukaReconciliation['notices']['erp'] ?? null)
: null,
'showHeader' => ! in_array($tab['slug'], ['posting-data', 'toc-orders', 'lingshan-virtual-posting', 'erp-product-import'], true),
'showHeader' => ! in_array($tab['slug'], ['posting-data', 'toc-orders', 'lingshan-virtual-posting', 'erp-product-import', 'invoice-entry-template'], true),
'emptyMessage' => '当前账期没有可生成的过账数据。',
])
@else

View File

@ -0,0 +1,58 @@
<div class="kuka-invoice-summary" role="region" aria-label="开票填写模板汇总">
<article class="kuka-invoice-summary__card" data-kuka-invoice-summary-card="quantity">
<span class="kuka-invoice-summary__label">
<span class="material-icons-outlined" aria-hidden="true">inventory_2</span>
开票数量
</span>
<strong>{{ number_format((float) $quantityTotal, 0, '.', ',') }}</strong>
</article>
<article class="kuka-invoice-summary__card" data-kuka-invoice-summary-card="amount">
<span class="kuka-invoice-summary__label">
<span class="material-icons-outlined" aria-hidden="true">receipt_long</span>
开票金额(含税)
</span>
<strong>{{ number_format((float) $amountTotal, 2, '.', ',') }}</strong>
</article>
</div>
<style>
.kuka-invoice-summary {
display: grid;
min-width: 0;
grid-template-columns: repeat(2, minmax(12rem, 1fr));
gap: 12px;
}
.kuka-invoice-summary__card {
display: grid;
min-width: 0;
gap: 7px;
padding: 13px 16px;
border: 1px solid var(--vip-border, #d8d2c7);
border-radius: 12px;
background: var(--vip-surface, #fff);
}
.kuka-invoice-summary__label {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--vip-content-muted, #595959);
font-size: 11px;
font-weight: 500;
}
.kuka-invoice-summary__label .material-icons-outlined {
color: var(--vip-content-accent-dark, #856632);
font-size: 16px;
}
.kuka-invoice-summary__card strong {
color: var(--vip-content-ink, #171717);
font-size: 22px;
font-variant-numeric: tabular-nums;
font-weight: 700;
line-height: 1.2;
}
@media (max-width: 720px) {
.kuka-invoice-summary {
grid-template-columns: 1fr;
}
}
</style>

View File

@ -49,6 +49,8 @@ class KukaReconciliationPageTest extends FeatureTestCase
->assertSee('data-kuka-erp-summary-card="quantity"', false)
->assertSee('data-kuka-erp-summary-card="amount"', false)
->assertSee('data-kuka-erp-summary-card="paid-amount"', false)
->assertSee('data-kuka-invoice-summary-card="quantity"', false)
->assertSee('data-kuka-invoice-summary-card="amount"', false)
->assertDontSeeText('有效物料行')
->assertSeeText('供货商金额')
->assertSeeText('N单号')
@ -101,6 +103,12 @@ class KukaReconciliationPageTest extends FeatureTestCase
$this->assertNotFalse($erpPanelEnd);
$erpPanel = substr($html, $erpPanelStart, $erpPanelEnd - $erpPanelStart);
$this->assertStringNotContainsString('<header class="kuka-source-table__header">', $erpPanel);
$invoicePanelStart = strpos($html, 'data-kuka-reconciliation-panel="invoice-entry-template"');
$invoicePanelEnd = strpos($html, 'data-kuka-reconciliation-panel="', $invoicePanelStart + 20);
$this->assertNotFalse($invoicePanelStart);
$this->assertNotFalse($invoicePanelEnd);
$invoicePanel = substr($html, $invoicePanelStart, $invoicePanelEnd - $invoicePanelStart);
$this->assertStringNotContainsString('<header class="kuka-source-table__header">', $invoicePanel);
}
public function test_kuka_reconciliation_tab_can_open_directly_from_the_url(): void

View File

@ -194,6 +194,8 @@ class KukaReconciliationPageDataTest extends TestCase
$this->assertSame('2', $data['summary']['erp_quantity_total']);
$this->assertSame('22.22', $data['summary']['erp_amount_total']);
$this->assertSame('22.22', $data['summary']['erp_paid_amount_total']);
$this->assertSame('2', $data['summary']['invoice_quantity_total']);
$this->assertSame('22.22', $data['summary']['invoice_amount_total']);
$this->assertSame('2', $data['summary']['toc_quantity_total']);
$this->assertSame(1, $data['summary']['skipped_missing_material_rows']);
$this->assertSame(1, $data['summary']['skipped_zero_quantity_rows']);