账单总金额
This commit is contained in:
@@ -741,4 +741,28 @@ class PurchaseEditTest extends ProcurementTestCase
|
||||
->assertJsonPath('data.count', 0);
|
||||
$this->assertSame(0, PurchaseItemCheckModel::count());
|
||||
}
|
||||
|
||||
/** 采购单列表「应付商品金额」列 = Σ 已生成门店账单的商品金额(未生成账单为 null) */
|
||||
public function test_list_includes_bill_product_amount(): void
|
||||
{
|
||||
[$purchase, , $stores] = $this->buildPurchase();
|
||||
$this->actingAsSysUser();
|
||||
|
||||
// 未生成账单 → null
|
||||
$this->getJson('/purchase/order')
|
||||
->assertJsonPath('data.data.0.bill_product_amount', null);
|
||||
|
||||
// 完成采购单并生成两店账单(各店商品金额 = 数量 × 等级价 10.00)
|
||||
$purchase->update(['status' => PurchaseOrderModel::STATUS_COMPLETED]);
|
||||
$this->postJson("/purchase/order/{$purchase->id}/bill", [
|
||||
'stores' => [
|
||||
['store_id' => $stores[0]->id, 'delivery_fee' => 0, 'box_num' => 0, 'tray_num' => 0],
|
||||
['store_id' => $stores[1]->id, 'delivery_fee' => 0, 'box_num' => 0, 'tray_num' => 0],
|
||||
],
|
||||
])->assertJsonPath('success', true);
|
||||
|
||||
// 列表回显:2×10.00 + 3×10.00 = 50.00
|
||||
$this->getJson('/purchase/order')
|
||||
->assertJsonPath('data.data.0.bill_product_amount', '50.00');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user