|
|
@@ -48,6 +48,7 @@ class StatController extends BaseController
|
|
|
$cover = imgUtil::groupImg($shortCover);
|
|
|
$num = $waste->itemNum ?? 0;
|
|
|
$cost = $waste->itemCost ?? 0;
|
|
|
+ $currentCost = bcmul($cost, $num, 2);
|
|
|
$productId = $waste->productId ?? 0;
|
|
|
if (isset($stat[$productId]) == false) {
|
|
|
$stat[$productId]['name'] = $name;
|
|
|
@@ -56,9 +57,8 @@ class StatController extends BaseController
|
|
|
$stat[$productId]['amount'] = 0;
|
|
|
}
|
|
|
$stat[$productId]['num'] = bcadd($stat[$productId]['num'], $num, 2);
|
|
|
- $stat[$productId]['amount'] = bcadd($stat[$productId]['amount'], $cost, 2);
|
|
|
+ $stat[$productId]['amount'] = bcadd($stat[$productId]['amount'], $currentCost, 2);
|
|
|
$totalNum = bcadd($totalNum, $num, 2);
|
|
|
- $currentCost = bcmul($cost, $num, 2);
|
|
|
$totalCost = bcadd($totalCost, $currentCost, 2);
|
|
|
}
|
|
|
$stat = array_values($stat);
|