From: fomichev Date: Wed, 9 Apr 2025 07:13:05 +0000 (+0300) Subject: Вычисление средней цены X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=202d646ca83f4111f2c958690337cdf992a0926b;p=erp24_rep%2Fyii-erp24%2F.git Вычисление средней цены --- diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index 71512d1b..2ffb6b3e 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -478,9 +478,11 @@ class StorePlanService if (!empty($priceRecords)) { $totalPrice = 0; $records = ArrayHelper::getColumn((array)$priceRecords, 'price'); - $count = count((array)$priceRecords); + $count = count($records); foreach ($priceRecords as $record) { - $totalPrice += $record->price; + if ($record->price) { + $totalPrice += $record->price; + } } $averagePrice = $totalPrice / $count; } else {