]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-130] изменена формула себестоимости feature_smirnov_erp-130_write_offs_for_motivation_NEW origin/feature_smirnov_erp-130_write_offs_for_motivation_NEW
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 4 Sep 2024 13:56:03 +0000 (16:56 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 4 Sep 2024 13:56:03 +0000 (16:56 +0300)
erp24/services/MotivationService.php

index 9abba21656327d33a693142695d5d60583141f1b..90a9a6a5eb2549fb067cf799d9d1c0b9edbcf5c5 100644 (file)
@@ -459,7 +459,7 @@ class MotivationService
             }
 
             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', $weekStart, $weekEnd])
                     ->andWhere(['wo.store_id' => $exportImportTable->export_val])
@@ -482,7 +482,7 @@ class MotivationService
                             continue;
                         }
                         $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);
                     }
 
                     $motivationItemType = MotivationCostsItem::writeOffsToMotivationItemMap($key);