From f62c2b9bb8099e6c0793405c3159a7aefd2cfa36 Mon Sep 17 00:00:00 2001 From: fomichev Date: Wed, 9 Apr 2025 11:58:29 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D0=BE=D0=B4=D1=81=D1=87=D0=B5=D1=82=20?= =?utf8?q?=D1=86=D0=B5=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/StorePlanService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index 75b7fd2f..c8b7f5ca 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -464,7 +464,7 @@ class StorePlanService 'or', ['>=', 'date_to', $monthStart], ['date_to' => '2100-01-01 03:00:00+03'] - ]); + ])->all(); if (CityStore::find()->where(['id' => $storeId])->one()->city_id == 1342) { $region = 52; } elseif (CityStore::find()->where(['id' => $storeId])->one()->city_id == 1) { @@ -472,18 +472,18 @@ class StorePlanService } else { $region = null; } - $priceRecords - //->andWhere(['or',['region_id' => $region],['region_id' => null]]) - ->all(); + + //$priceRecords->andWhere(['or',['region_id' => $region],['region_id' => null]]) + //->all(); if (!empty($priceRecords)) { $totalPrice = 0; - $records = ArrayHelper::toArray($priceRecords); - $count = count($records); + $count = 0; foreach ($priceRecords as $record) { if (isset($record->price)) { $totalPrice += $record->price; + $count += 1; } } $averagePrice = $totalPrice / $count; -- 2.39.5