From 3e8e11841433e0584f1baed2093901273fa17a59 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Wed, 23 Jul 2025 19:06:15 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?utf8?q?=D0=BE=20=D1=80=D0=B0=D1=81=D1=87=D0=B5=D1=82=D1=83=20=D0=BF?= =?utf8?q?=D1=80=D0=BE=D0=B4=D0=B0=D0=B6=20=D1=82=D0=BE=D0=B2=D0=B0=D1=80?= =?utf8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/AutoPlannogrammaService.php | 4 ++-- erp24/services/StorePlanService.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/erp24/services/AutoPlannogrammaService.php b/erp24/services/AutoPlannogrammaService.php index 052b814b..927a24d8 100644 --- a/erp24/services/AutoPlannogrammaService.php +++ b/erp24/services/AutoPlannogrammaService.php @@ -772,9 +772,9 @@ class AutoPlannogrammaService public function calculateFullGoalChain(array $filters): array { $datePlan = $filters['plan_date']; - $dateFromForCategory = (new \DateTime($datePlan))->modify('-' . (self::CATEGORY_LOOKBACK_MONTHS + self::LOOKBACK_MONTHS) . ' months')->format('Y-m-d'); + //$dateFromForCategory = (new \DateTime($datePlan))->modify('-' . (self::CATEGORY_LOOKBACK_MONTHS + self::LOOKBACK_MONTHS) . ' months')->format('Y-m-d'); - $monthCategoryShare = $this->getMonthCategoryShareOrWriteOff($dateFromForCategory, $filters); + $monthCategoryShare = $this->getMonthCategoryShareOrWriteOff($datePlan, $filters); $monthCategoryGoal = $this->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters['type']); $monthSubcategoryShare = $this->getMonthSubcategoryShareOrWriteOff($datePlan, $filters); diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index bf9a12c3..2b70bf21 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -323,7 +323,7 @@ class StorePlanService * * @return array */ - private static function getSalesHistory($storeId, $periods, $category = null, $subcategory = null, $species = null) + public static function getSalesHistory($storeId, $periods, $category = null, $subcategory = null, $species = null) { $salesHistory = []; @@ -338,7 +338,7 @@ class StorePlanService $query = Sales::find()->alias('s') ->select([ 'p1c.id as product_guid', - 'COUNT(*) as sales_count', + 'SUM(sp.quantity) as sales_count', 'p1c.category', 'p1c.subcategory', 'p1c.species', @@ -349,7 +349,7 @@ class StorePlanService ->where(['s.store_id' => $storeId]) ->andWhere(['between', 's.date', $dateStart, $dateEnd]) ->andWhere(['order_id' => ['', '0']]) - ->andWhere(['p1.components' => '']) + //->andWhere(['p1.components' => '']) ->andWhere(['not in', 'p1c.category', ['', 'букет', 'сборка', 'сервис']]) ->andFilterWhere(['p1c.category' => $category]) ->andFilterWhere(['p1c.subcategory' => $subcategory]) -- 2.39.5