四项全0时加权取两位舍入后的更改价格,修复 72.00495→72.01 偏差
This commit is contained in:
parent
1ab9a45d1d
commit
ffd851fc0c
@ -281,7 +281,8 @@ class ComputeProductMonthlyWeightedAverage extends Command
|
||||
$openingAmount = $adjusted === null ? null : round($openingAmountRaw, 2);
|
||||
$denominator = $openingQuantity + $purchaseQuantity;
|
||||
if ($denominator === 0.0) {
|
||||
$weighted = $adjusted === null ? null : round($adjusted, 4);
|
||||
// 四项全 0:加权平均单价取"更改价格"(按两位舍入后的值)。
|
||||
$weighted = $adjusted === null ? null : round($adjusted, 2);
|
||||
} else {
|
||||
// 先除再舍入:用未舍入的期初金额与入库金额相除,最后统一保留两位。
|
||||
$weighted = round(($openingAmountRaw + $purchaseAmountRaw) / $denominator, 4);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user