From 241e6537dee3a9fc06899b0b58a24e004841aa0a Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Mon, 14 Oct 2024 12:27:22 +0300 Subject: [PATCH] =?utf8?q?[ERP-220]=20=D0=B4=D0=B5=D1=84=D0=B5=D0=BA=D1=82?= =?utf8?q?=20=D1=81=20=D0=BF=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=BA=D0=B8=20?= =?utf8?q?=D1=86=D0=B5=D0=BB=D0=B8=D0=BA=D0=BE=D0=BC=20=D0=B8=D0=B4=D1=91?= =?utf8?q?=D1=82=20=D0=BD=D0=B0=20=D0=90=D1=8D=D1=80=D0=BE=D0=B4=D1=80?= =?utf8?q?=D0=BE=D0=BC=D0=BD=D1=83=D1=8E,=20=D0=BE=D1=81=D1=82=D0=B0=D0=B2?= =?utf8?q?=D0=BB=D1=8F=D1=8F=20=D0=BE=D1=81=D1=82=D0=B0=D0=BB=D1=8C=D0=BD?= =?utf8?q?=D1=8B=D0=B5=20=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD=D1=8B?= =?utf8?q?=20=D0=BF=D1=83=D1=81=D1=82=D1=8B=D0=BC=D0=B8=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index ef9d8f8d..1b8427ce 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -495,7 +495,7 @@ class MotivationService foreach (MotivationCostsItem::getWriteOffsItems() as $key) { if ($key == WriteOffsErp::WRITE_OFFS_TYPE_DELIVERY_BRAK) { - if ($store_id == 4) { + if ($store_id == 4 /* Аэродромная */ ) { $writeOffsResult = 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]) @@ -1335,8 +1335,21 @@ class MotivationService } foreach (MotivationCostsItem::writeOffsToMotivationItemArray() as $key => $motivationItemType) { + if ($key == WriteOffsErp::WRITE_OFFS_TYPE_DELIVERY_BRAK) { + if ($store_id == 4 /* Аэродромная */) { + $writeOffsResult = $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]) + ->asArray()->all(); + } else { + $writeOffsResult = []; + } + } else { + $writeOffsResult = $writeOffs; + } + $sum = 0; - foreach($writeOffs as $data) { + foreach($writeOffsResult as $data) { if (($data['type'] ?? '') == $key) { $value = ($selfCostProductMap[date("Y-m-d", strtotime($data['date']))][$data['product_id']] ?? 0) * ($data['quantity'] ?? 0); -- 2.39.5