From a35058a31dfdaa9623fafcfba758de5836fe7997 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Wed, 4 Sep 2024 17:02:03 +0300 Subject: [PATCH] =?utf8?q?[ERP-140]=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?utf8?q?=D0=BD=D0=B0=20=D1=84=D0=BE=D1=80=D0=BC=D1=83=D0=BB=D0=B0=20?= =?utf8?q?=D1=81=D0=B5=D0=B1=D0=B5=D1=81=D1=82=D0=BE=D0=B8=D0=BC=D0=BE?= =?utf8?q?=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 848a7a5c..91c9feb1 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -1279,7 +1279,7 @@ class MotivationService foreach ($exportImportTables as $store_id => $store_guid) { if (isset($motivations[$store_id])) { - $writeOffs = WriteOffs::find()->alias('wo')->select(['wo.type', 'wo.date', 'wop.product_id', 'wop.quantity', 'wop.summ']) + $writeOffs = WriteOffs::find()->alias('wo')->select(['wo.type', 'wo.date', 'wop.product_id', 'wop.quantity', 'wop.price']) ->rightJoin('write_offs_products wop', 'wop.write_offs_id = wo.id') ->where(['between', 'wo.date', $monthStart, $monthEnd]) ->andWhere(['wo.store_id' => $store_guid]) @@ -1301,7 +1301,7 @@ class MotivationService if (($data['type'] ?? '') == $key) { $value = ($selfCostProductMap[date("Y-m-d", strtotime($data['date']))][$data['product_id']] ?? 0) * ($data['quantity'] ?? 0); - $sum += $value > 0 ? $value : ($data['summ'] ?? 0); + $sum += $value > 0 ? $value : ($data['price'] ?? 0) * ($data['quantity'] ?? 0); } } @@ -1864,7 +1864,7 @@ class MotivationService $exportImportTable = ExportImportTable::find()->select(['export_val'])->where(['entity' => 'city_store', 'entity_id' => $storeId, 'export_id' => 1])->one(); if ($exportImportTable) { - $writeOffs = WriteOffs::find()->alias('wo')->select(['wo.type', 'wo.date', 'wop.product_id', 'wop.quantity', 'wop.summ']) + $writeOffs = WriteOffs::find()->alias('wo')->select(['wo.type', 'wo.date', 'wop.product_id', 'wop.quantity', 'wop.price']) ->rightJoin('write_offs_products wop', 'wop.write_offs_id = wo.id') ->where(['between', 'wo.date', $startDate, $endDate]) ->andWhere(['wo.store_id' => $exportImportTable->export_val]) @@ -1885,7 +1885,7 @@ class MotivationService foreach($writeOffs as $data) { $value = ($selfCostProductMap[date("Y-m-d", strtotime($data['date']))][$data['product_id']] ?? 0) * ($data['quantity'] ?? 0); - $sum += $value > 0 ? $value : ($data['summ'] ?? 0); + $sum += $value > 0 ? $value : ($data['price'] ?? 0) * ($data['quantity'] ?? 0); } return $sum; -- 2.39.5