From d3f87b1eaa7e7ef27f652da3df9a1fd4b089398a Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 11 Feb 2025 11:30:16 +0300 Subject: [PATCH] =?utf8?q?ERP-302=20=D0=A0=D0=B5=D0=B4=D0=B0=D0=BA=D1=82?= =?utf8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B1=D1=83?= =?utf8?q?=D0=BA=D0=B5=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/BouquetController.php | 9 ++- ...1_064121_create_bouquet_forecast_table.php | 37 ++++++++++ erp24/records/BouquetForecast.php | 69 +++++++++++++++++++ 3 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 erp24/migrations/m250211_064121_create_bouquet_forecast_table.php create mode 100644 erp24/records/BouquetForecast.php diff --git a/erp24/controllers/BouquetController.php b/erp24/controllers/BouquetController.php index 50257490..4851bc0f 100644 --- a/erp24/controllers/BouquetController.php +++ b/erp24/controllers/BouquetController.php @@ -10,6 +10,7 @@ use yii\web\NotFoundHttpException; use yii\web\UploadedFile; use yii_app\records\BouquetComposition; use yii_app\records\BouquetCompositionProducts; +use yii_app\records\BouquetForecast; use yii_app\records\CityStore; use yii_app\records\Products1c; use yii_app\records\Products1cNomenclature; @@ -25,10 +26,12 @@ class BouquetController extends Controller return $this->render('index'); } - public function actionView() + public function actionView($id) { - $storesTypeList = ArrayHelper::map(StoreType::find()->orderBy('sequence_number')->all(), 'id', 'name'); - $storesList = ArrayHelper::map(CityStore::findAll(['visible' => CityStore::IS_VISIBLE]), 'id', 'name'); + + BouquetForecast::findAll(['bouquet_id' => $id]); + $storesTypeList = ArrayHelper::map(BouquetForecast::findAll(['bouquet_id' => $id]) ?? StoreType::find()->orderBy('sequence_number')->all(), 'id', 'name'); + $storesList = ArrayHelper::map(BouquetForecast::findAll(['bouquet_id' => $id]) ?? CityStore::findAll(['visible' => CityStore::IS_VISIBLE]), 'id', 'name'); return $this->render('view', [ 'storesList' => $storesList, diff --git a/erp24/migrations/m250211_064121_create_bouquet_forecast_table.php b/erp24/migrations/m250211_064121_create_bouquet_forecast_table.php new file mode 100644 index 00000000..4037f70a --- /dev/null +++ b/erp24/migrations/m250211_064121_create_bouquet_forecast_table.php @@ -0,0 +1,37 @@ +createTable('{{%bouquet_forecast}}', [ + 'id' => $this->primaryKey(), + 'bouquet_id' => $this->integer()->comment('ИД букета'), + 'year' => $this->integer()->comment('Год'), + 'month' => $this->integer()->comment('Месяц'), + 'type_sales' => $this->integer()->comment('Тип продаж'), + 'store_sales_id' => $this->integer()->comment('ИД сущности типа продаж'), + 'value' => $this->float('Значение'), + 'created_at' => $this->dateTime()->comment('Дата создания'), + 'updated_at' => $this->dateTime()->comment('Дата обновления'), + 'created_by' => $this->integer()->comment('ID создателя записи'), + 'updated_by' => $this->integer()->comment('ID обновителя записи'), + ]); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropTable('{{%bouquet_forecast}}'); + } +} diff --git a/erp24/records/BouquetForecast.php b/erp24/records/BouquetForecast.php new file mode 100644 index 00000000..be9c4f5b --- /dev/null +++ b/erp24/records/BouquetForecast.php @@ -0,0 +1,69 @@ + 'ID', + 'bouquet_id' => 'ИД букета', + 'year' => 'Год', + 'month' => 'Месяц', + 'type_sales' => 'Тип продаж', + 'store_sales_id' => 'ИД сущности типа продаж', + 'value' => 'Значение', + 'created_at' => 'Дата создания', + 'updated_at' => 'Дата обновления', + 'created_by' => 'ID создателя записи', + 'updated_by' => 'ID обновителя записи', + ]; + } +} -- 2.39.5