]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Таблица для хранения себестоимости feature_filippov_erp-131-1_self_cost origin/feature_filippov_erp-131-1_self_cost
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Mon, 26 Aug 2024 12:00:10 +0000 (15:00 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Mon, 26 Aug 2024 12:00:10 +0000 (15:00 +0300)
erp24/migrations/m240826_113149_create_table_self_cost.php [new file with mode: 0755]
erp24/records/SelfCostProduct.php [new file with mode: 0644]

diff --git a/erp24/migrations/m240826_113149_create_table_self_cost.php b/erp24/migrations/m240826_113149_create_table_self_cost.php
new file mode 100755 (executable)
index 0000000..20a6d6b
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m240826_113149_create_table_self_cost
+ */
+class m240826_113149_create_table_self_cost extends Migration
+{
+    const TABLE_NAME = "erp24.self_cost_product";
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->createTable(self::TABLE_NAME, [
+            'id' => $this->primaryKey(),
+            'date' => $this->date()->notNull()->comment('Дата'),
+            'store_id' => $this->integer()->notNull()->comment('store id'),
+            'product_guid' => $this->string()->notNull()->comment('product guid'),
+            'price' => $this->float()->notNull()->comment('price'),
+            'updated_at' => $this->datetime()->null()->comment('Дата внесения записи'),
+        ]);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropTable(self::TABLE_NAME);
+    }
+}
diff --git a/erp24/records/SelfCostProduct.php b/erp24/records/SelfCostProduct.php
new file mode 100644 (file)
index 0000000..db86f5d
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+
+namespace app\records;
+
+
+/**
+ * This is the model class for table "self_cost_product".
+ *
+ * @property int $id
+ * @property string $date Дата
+ * @property int $store_id store id
+ * @property string $product_guid product guid
+ * @property float $price price
+ * @property string|null $updated_at Дата внесения записи
+ */
+class SelfCostProduct extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'self_cost_product';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['date', 'store_id', 'product_guid', 'price'], 'required'],
+            [['date', 'updated_at'], 'safe'],
+            [['store_id'], 'default', 'value' => null],
+            [['store_id'], 'integer'],
+            [['price'], 'number'],
+            [['product_guid'], 'string', 'max' => 255],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'date' => 'Date',
+            'store_id' => 'Store ID',
+            'product_guid' => 'Product Guid',
+            'price' => 'Price',
+            'updated_at' => 'Updated At',
+        ];
+    }
+}