From ffd851fc0c8e3ccb468906f45eabc2aaf5a60c8e Mon Sep 17 00:00:00 2001 From: chenxi Date: Mon, 5 Oct 2026 12:07:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9B=E9=A1=B9=E5=85=A80=E6=97=B6=E5=8A=A0?= =?UTF-8?q?=E6=9D=83=E5=8F=96=E4=B8=A4=E4=BD=8D=E8=88=8D=E5=85=A5=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E6=9B=B4=E6=94=B9=E4=BB=B7=E6=A0=BC=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=2072.00495=E2=86=9272.01=20=E5=81=8F=E5=B7=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/ComputeProductMonthlyWeightedAverage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/ComputeProductMonthlyWeightedAverage.php b/app/Console/Commands/ComputeProductMonthlyWeightedAverage.php index aa103161..16f5e029 100644 --- a/app/Console/Commands/ComputeProductMonthlyWeightedAverage.php +++ b/app/Console/Commands/ComputeProductMonthlyWeightedAverage.php @@ -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);