From a15af47787e9f45764d201f769731722be32bf0d Mon Sep 17 00:00:00 2001 From: fomichev Date: Fri, 11 Apr 2025 17:39:43 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8?= =?utf8?q?=D0=B5=20=D0=B1=D1=83=D0=BA=D0=B5=D1=82=D0=BE=D0=B2=20=D0=B8?= =?utf8?q?=D0=B7=20=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=BD=D1=8B=D1=85=20?= =?utf8?q?=D0=BC=D0=B0=D1=82=D1=80=D0=B8=D1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/BouquetController.php | 11 ++++++++++- erp24/services/StorePlanService.php | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/erp24/controllers/BouquetController.php b/erp24/controllers/BouquetController.php index 86087582..2d23296c 100644 --- a/erp24/controllers/BouquetController.php +++ b/erp24/controllers/BouquetController.php @@ -251,7 +251,16 @@ class BouquetController extends Controller public function actionMonthGoal() { - $bouquets = StorePlanService::getBouqetsByDate(5, 2025, 2); + $matrixTypesIds = StorePlanService::getActiveMatrixTypes(); + // var_dump($matrixTypesIds);die(); + $bouquets = []; + if ($matrixTypesIds) { + foreach ($matrixTypesIds as $matrixTypeId) { + $bouquets[$matrixTypeId] = StorePlanService::getBouqetsByDate(5, 2025, $matrixTypeId); + } + } + + var_dump($bouquets);die(); } diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index 25382b77..a3f1134c 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -6,6 +6,7 @@ use DateTime; use yii\db\Expression; use yii\helpers\ArrayHelper; use yii_app\records\BouquetComposition; +use yii_app\records\BouquetCompositionMatrixTypeHistory; use yii_app\records\CityStore; use yii_app\records\Motivation; use yii_app\records\PricesDynamic; @@ -750,6 +751,15 @@ class StorePlanService ]; } + public static function getActiveMatrixTypes() + { + $matrixTypesIds = BouquetCompositionMatrixTypeHistory::find() + ->select(['matrix_type_id']) + ->where(['is_active' => 1]) + ->column(); + return $matrixTypesIds; + + } public static function getBouqetsByDate($month, $year, $matrix_type = null) { $query = BouquetComposition::find() -- 2.39.5