]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Merge branch 'refs/heads/develop' into feature_fomichev_erp_444_OS_autoplannogramm
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 29 Jul 2025 08:07:18 +0000 (11:07 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 29 Jul 2025 08:07:18 +0000 (11:07 +0300)
# Conflicts:
# erp24/services/AutoPlannogrammaService.php

1  2 
erp24/commands/CronController.php
erp24/controllers/AutoPlannogrammaController.php
erp24/services/AutoPlannogrammaService.php

Simple merge
index 04e286c8ad1ac447efa743fc59604d74110d3c15,39751ab9de856b62dfef51cd3f45fdea656f61d4..a580d627d645a300d4f1614cb507ab9213dde126
@@@ -772,11 -846,36 +846,36 @@@ class AutoPlannogrammaServic
      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($datePlan, $filters);
-         $monthCategoryGoal = $this->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters['type']);
+         //$monthCategoryShare = $this->getMonthCategoryShareOrWriteOff($dateFromForCategory, $filters);
+         //$monthCategoryGoal = $this->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters['type']);
+         $monthCategoryGoal = [];
+         $categoryPlan = CategoryPlan::find()
+             ->where(
+             ['year' => date('Y', strtotime($datePlan)),
+                 'month' => date('m', strtotime($datePlan)),
+                 'store_id' => $filters['store_id']])->indexBy('category')
+             ->asArray()
+             ->all();
+         foreach ($categoryPlan as $category) {
+             if ($category['category'] === 'Матрица') {
+                 continue;
+             }
+             if ($filters['type'] == AutoPlannogrammaService::TYPE_SALES) {
+                 $fullGoal  = $category['offline'] + $category['internet_shop'] + $category['marketplace'];
+             } else {
+                 $fullGoal  = $category['write_offs'];
+             }
+             $monthCategoryGoal[] = [
+                 'category' => $category['category'],
+                 'store_id' => $filters['store_id'],
+                 'goal' => $fullGoal
+             ];
  
+         }
          $monthSubcategoryShare = $this->getMonthSubcategoryShareOrWriteOff($datePlan, $filters);
          $monthSubcategoryGoal = $this->getMonthSubcategoryGoal($monthSubcategoryShare, $monthCategoryGoal);