fix(顾家对账): 按总额计算灵珊销售金额 #1329
@ -304,10 +304,6 @@ class KukaReconciliationPageData
|
||||
$postingSupplierAmountTotal,
|
||||
$supplierAmount,
|
||||
);
|
||||
$postingSalesAmountTotal = $this->addMoney(
|
||||
$postingSalesAmountTotal,
|
||||
$salesAmount,
|
||||
);
|
||||
}
|
||||
|
||||
if (! isset($inventory[$materialNumber])) {
|
||||
@ -336,6 +332,10 @@ class KukaReconciliationPageData
|
||||
ksort($posting, SORT_NATURAL);
|
||||
ksort($inventory, SORT_NATURAL);
|
||||
$generatedAt = now()->format('Y-m-d H:i:s');
|
||||
$postingSalesAmountTotal = $this->divideMoney(
|
||||
$postingSupplierAmountTotal,
|
||||
self::SALES_MARKUP_DIVISOR,
|
||||
);
|
||||
|
||||
$postingRows = array_map(fn (array $row): array => [
|
||||
$row['year'],
|
||||
|
||||
@ -213,6 +213,27 @@ class KukaReconciliationPageDataTest extends TestCase
|
||||
$this->assertSame('3', $inventory[27]);
|
||||
}
|
||||
|
||||
public function test_virtual_sales_summary_uses_total_supplier_amount(): void
|
||||
{
|
||||
$connection = DB::connection('business_mirror');
|
||||
$connection->table('kuka_posting_base_imports')->insert([
|
||||
'company_id' => 1,
|
||||
'period' => '2026-10',
|
||||
'completed_at' => '2026-11-01 08:00:00',
|
||||
]);
|
||||
$this->insertBaseRow(2, $this->payload('O-1', 'P-1', 'S-1', 'I-1', 'M-1', '1', '0.05'));
|
||||
$this->insertBaseRow(3, $this->payload('O-2', 'P-2', 'S-2', 'I-2', 'M-1', '1', '0.05'));
|
||||
|
||||
$data = app(KukaReconciliationPageData::class)->build(
|
||||
Request::create('/', 'GET', ['period' => '2026-10']),
|
||||
1,
|
||||
);
|
||||
|
||||
$this->assertNull($data['error']);
|
||||
$this->assertSame('0.10', $data['summary']['posting_supplier_amount_total']);
|
||||
$this->assertSame('0.11', $data['summary']['posting_sales_amount_total']);
|
||||
}
|
||||
|
||||
public function test_posting_export_returns_every_material_row_without_pagination(): void
|
||||
{
|
||||
$connection = DB::connection('business_mirror');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user