From: marina Date: Tue, 11 Feb 2025 08:30:16 +0000 (+0300) Subject: ERP-302 Редактирование букета X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=d3f87b1eaa7e7ef27f652da3df9a1fd4b089398a;p=erp24_rep%2Fyii-erp24%2F.git ERP-302 Редактирование букета --- 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 обновителя записи', + ]; + } +}