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;
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,
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%bouquet_forecast}}`.
+ */
+class m250211_064121_create_bouquet_forecast_table extends Migration
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $this->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}}');
+ }
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+use yii\db\ActiveRecord;
+
+/**
+ * This is the model class for table "bouquet_forecast".
+ *
+ * @property int $id
+ * @property int|null $bouquet_id ИД букета
+ * @property int|null $year Год
+ * @property int|null $month Месяц
+ * @property int|null $type_sales Тип продаж
+ * @property int|null $store_sales_id ИД сущности типа продаж
+ * @property float|null $value Значение
+ * @property string|null $created_at Дата создания
+ * @property string|null $updated_at Дата обновления
+ * @property int|null $created_by ID создателя записи
+ * @property int|null $updated_by ID обновителя записи
+ */
+class BouquetForecast extends ActiveRecord
+{
+
+ public const OFFLINE_STORES = 1;
+ public const ONLINE_STORES = 2;
+ public const MARKETPLACE = 3;
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return '{{%bouquet_forecast}}';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['bouquet_id', 'year', 'month', 'type_sales', 'store_sales_id', 'created_by', 'updated_by'], 'integer'],
+ [['value'], 'number'],
+ [['created_at', 'updated_at'], 'safe'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID',
+ 'bouquet_id' => 'ИД букета',
+ 'year' => 'Год',
+ 'month' => 'Месяц',
+ 'type_sales' => 'Тип продаж',
+ 'store_sales_id' => 'ИД сущности типа продаж',
+ 'value' => 'Значение',
+ 'created_at' => 'Дата создания',
+ 'updated_at' => 'Дата обновления',
+ 'created_by' => 'ID создателя записи',
+ 'updated_by' => 'ID обновителя записи',
+ ];
+ }
+}