]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Таблица для данных из 1с Бухгалтерии
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 21 Aug 2024 08:39:50 +0000 (11:39 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 21 Aug 2024 08:39:50 +0000 (11:39 +0300)
erp24/migrations/m240820_150742_create_table_motivation_buh.php [new file with mode: 0755]
erp24/records/MotivationBuh.php [new file with mode: 0644]
erp24/records/MotivationBuhValue.php [new file with mode: 0644]

diff --git a/erp24/migrations/m240820_150742_create_table_motivation_buh.php b/erp24/migrations/m240820_150742_create_table_motivation_buh.php
new file mode 100755 (executable)
index 0000000..acde269
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m240820_150742_create_table_motivation_buh
+ */
+class m240820_150742_create_table_motivation_buh extends Migration
+{
+    const TABLE_NAME = "erp24.motivation_buh";
+    const TABLE_NAME2 = "erp24.motivation_buh_value";
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->createTable(self::TABLE_NAME, [
+            'id' => $this->primaryKey(),
+            'inn' => $this->integer()->notNull()->comment('ИНН фирмы источника данных'),
+            'year' => $this->integer()->notNull()->comment('Год'),
+            'month' => $this->integer()->notNull()->comment('Месяц'),
+            'updated_at' => $this->datetime()->notNull()->comment('Дата изменения записи'),
+            'created_at' => $this->datetime()->notNull()->comment('Дата создания записи'),
+        ]);
+
+        $this->createTable(self::TABLE_NAME2, [
+            'id' => $this->primaryKey(),
+            'motivation_buh_id' => $this->integer()->notNull()->comment('id motivation buh'),
+            'store_id' => $this->integer()->notNull()->comment('ID магазина'),
+            'motivation_group_id' => $this->integer()->notNull()->comment('group id motivation'),
+            'value_id' => $this->integer()->notNull()->comment('value id'),
+            'value_type' => $this->string(10)->notNull()->comment('тип значения'),
+            'value_int' => $this->integer()->null()->comment('value int'),
+            'value_float' => $this->float()->null()->comment('value float'),
+            'value_string' => $this->string()->null()->comment('value string'),
+        ]);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropTable(self::TABLE_NAME2);
+        $this->dropTable(self::TABLE_NAME);
+    }
+}
diff --git a/erp24/records/MotivationBuh.php b/erp24/records/MotivationBuh.php
new file mode 100644 (file)
index 0000000..d13ba33
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+namespace app\records;
+
+
+/**
+ * This is the model class for table "motivation_buh".
+ *
+ * @property int $id
+ * @property int $inn ИНН фирмы источника данных
+ * @property int $year Год
+ * @property int $month Месяц
+ * @property string $updated_at Дата изменения записи
+ * @property string $created_at Дата создания записи
+ */
+class MotivationBuh extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'motivation_buh';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['inn', 'year', 'month'], 'required'],
+            [['inn', 'year', 'month'], 'default', 'value' => null],
+            [['inn', 'year', 'month'], 'integer'],
+            [['updated_at', 'created_at'], 'safe'],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'inn' => 'Inn',
+            'year' => 'Year',
+            'month' => 'Month',
+            'updated_at' => 'Updated At',
+            'created_at' => 'Created At',
+        ];
+    }
+}
\ No newline at end of file
diff --git a/erp24/records/MotivationBuhValue.php b/erp24/records/MotivationBuhValue.php
new file mode 100644 (file)
index 0000000..eb4978a
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+
+namespace app\records;
+
+use yii\db\ActiveRecord;
+
+/**
+ * This is the model class for table "motivation_buh_value".
+ *
+ * @property int $id
+ * @property int $motivation_buh_id id motivation buh
+ * @property int $store_id ID магазина
+ * @property int $motivation_group_id group id motivation
+ * @property int $value_id value id
+ * @property string $value_type тип значения
+ * @property int|null $value_int value int
+ * @property float|null $value_float value float
+ * @property string|null $value_string value string
+ */
+class MotivationBuhValue extends ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'motivation_buh_value';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['motivation_buh_id', 'store_id', 'motivation_group_id', 'value_id', 'value_type'], 'required'],
+            [['motivation_buh_id', 'store_id', 'motivation_group_id', 'value_id', 'value_int'], 'default', 'value' => null],
+            [['motivation_buh_id', 'store_id', 'motivation_group_id', 'value_id', 'value_int'], 'integer'],
+            [['value_float'], 'number'],
+            [['value_type'], 'string', 'max' => 10],
+            [['value_string'], 'string', 'max' => 255],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'motivation_buh_id' => 'Motivation Buh ID',
+            'store_id' => 'Store ID',
+            'motivation_group_id' => 'Motivation Group ID',
+            'value_id' => 'Value ID',
+            'value_type' => 'Value Type',
+            'value_int' => 'Value Int',
+            'value_float' => 'Value Float',
+            'value_string' => 'Value String',
+        ];
+    }
+}
\ No newline at end of file