From 3d0f7cf150fcaecf9fe421a76569a790323eea79 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Wed, 20 Aug 2025 16:34:49 +0300 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5?= =?utf8?q?=D0=BC=20=D0=B0=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?utf8?q?=D1=81=D1=82=D1=8C=20=D0=B2=20=D1=80=D0=B0=D1=81=D1=87=D0=B5?= =?utf8?q?=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/AutoPlannogrammaService.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/erp24/services/AutoPlannogrammaService.php b/erp24/services/AutoPlannogrammaService.php index 39751ab9..e5a6c946 100644 --- a/erp24/services/AutoPlannogrammaService.php +++ b/erp24/services/AutoPlannogrammaService.php @@ -17,6 +17,7 @@ use yii_app\records\CityStoreParams; use yii_app\records\ExportImportTable; use yii_app\records\MatrixBouquetForecast; use yii_app\records\Products1c; +use yii_app\records\Products1cNomenclatureActuality; use yii_app\records\Sales; use yii_app\records\SalesProducts; use yii_app\records\SalesWriteOffsPlan; @@ -3050,6 +3051,17 @@ class AutoPlannogrammaService ); $date = $year . '-' . str_pad($month, 2, '0', STR_PAD_LEFT) . '-01'; + $df = (new \DateTime($date)) + ->setTime(0, 0, 0)->format('Y-m-d H:i:s'); + $dt = (new \DateTime($date)) + ->modify('last day of this month')->setTime(23, 59, 59) + ->format('Y-m-d H:i:s'); + $actualProducts = Products1cNomenclatureActuality::find() + ->select(['guid']) + ->where(['<=', 'date_from', $df]) + ->andWhere(['>=', 'date_to', $dt]) + ->asArray() + ->column(); $result = StorePlanService::getBouquetSpiecesMonthGoalFromForecast($month, $year, $storeId, $matrixGroups); $weekShares = $this->getHistoricalSpeciesShareByWeek($date); @@ -3124,6 +3136,9 @@ class AutoPlannogrammaService foreach ($weeklyForecasts as $item) { $storeItem = (int)$item['store_id']; $guid = (string)$item['product_guid']; + if (!in_array($guid, $actualProducts)) { + continue; + } $group = (string)$item['matrix_group']; $type = (string)$item['type']; $forecastValue = (float)$item['week_forecast']; -- 2.39.5