From: fomichev Date: Fri, 11 Apr 2025 14:39:43 +0000 (+0300) Subject: Получение букетов из активных матриц X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=a15af47787e9f45764d201f769731722be32bf0d;p=erp24_rep%2Fyii-erp24%2F.git Получение букетов из активных матриц --- 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()