]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-413 Обработка ОС Планограмма (месяц)
authormarina <m.zozirova@gmail.com>
Mon, 12 May 2025 12:35:46 +0000 (15:35 +0300)
committermarina <m.zozirova@gmail.com>
Mon, 12 May 2025 12:35:46 +0000 (15:35 +0300)
erp24/services/AutoPlannogrammaService.php

index 9477ff328b237f7b4d86828d0bfce741adabef74..70f6a2cce10ff03ad63668dd6b3a0fd518c2737c 100644 (file)
@@ -160,8 +160,8 @@ class AutoPlannogrammaService
                     ->leftJoin($productTableJoin, $productTableJoinCondition)
                     ->leftJoin('products_1c_nomenclature p1c', "p1c.id = $productJoinCondition")
                     ->leftJoin('export_import_table ex', $storeJoinCondition)
-                    ->where(['<=', key($fromTable) . '.date', $dateFrom])
-                    ->andWhere(['>=', key($fromTable) . '.date',(new \DateTime($dateFrom))->modify('-' . self::CATEGORY_LOOKBACK_MONTHS . ' months')->format('Y-m-d')])
+                    ->andWhere(['<=', key($fromTable) . '.date',(new \DateTime($dateFrom))->modify('-' . (self::LOOKBACK_MONTHS) . ' months')->format('Y-m-d')])
+                    ->andWhere(['>=', key($fromTable) . '.date',(new \DateTime($dateFrom))->modify('-' . (self::LOOKBACK_MONTHS + self::CATEGORY_LOOKBACK_MONTHS) . ' months')->format('Y-m-d')])
                     ->andWhere(['ex.entity_id' => $storeIds])
                     ->andWhere(['<>', 'p1c.category', ''])
                     ->groupBy(['ex.entity_id', 'p1c.category']),
@@ -177,7 +177,8 @@ class AutoPlannogrammaService
                     ->leftJoin('products_1c_nomenclature p1c', "p1c.id = $productJoinCondition")
                     ->leftJoin('export_import_table ex', $storeJoinCondition)
                     ->where(['<=', key($fromTable) . '.date', $dateFrom])
-                    ->andWhere(['>=', key($fromTable) . '.date',(new \DateTime($dateFrom))->modify('-' . self::CATEGORY_LOOKBACK_MONTHS . ' months')->format('Y-m-d')])
+                    ->andWhere(['<=', key($fromTable) . '.date',(new \DateTime($dateFrom))->modify('-' . (self::LOOKBACK_MONTHS) . ' months')->format('Y-m-d')])
+                    ->andWhere(['>=', key($fromTable) . '.date',(new \DateTime($dateFrom))->modify('-' . (self::LOOKBACK_MONTHS + self::CATEGORY_LOOKBACK_MONTHS) . ' months')->format('Y-m-d')])
                     ->andWhere(['ex.entity_id' => $storeIds])
                     ->andWhere(['<>', 'p1c.category', ''])
                     ->groupBy(['ex.entity_id'])],
@@ -197,7 +198,7 @@ class AutoPlannogrammaService
                 'type' => $row['type'],
             ];
         }
-        
+
         return $result;
     }