--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+class m250828_065539_add_type_and_type_id_fields_to_write_offs_tables extends Migration
+{
+ const TABLE_NAME = 'erp24.write_offs';
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $table = $this->db->schema->getTableSchema(self::TABLE_NAME);
+ if ($table === null) {
+ return;
+ }
+
+ if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('type_id')) {
+ $this->addColumn(
+ self::TABLE_NAME,
+ 'type_id',
+ $this->integer()->null()->comment('id типа списания')
+ );
+ }
+ if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('type_guid')) {
+ $this->addColumn(
+ self::TABLE_NAME,
+ 'type_guid',
+ $this->string()->null()->comment('guid типа списания')
+ );
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('type_id')) {
+ $this->dropColumn(self::TABLE_NAME, 'type_id');
+ }
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('type_guid')) {
+ $this->dropColumn(self::TABLE_NAME, 'type_guid');
+ }
+ }
+
+ /*
+ // Use up()/down() to run migration code without a transaction.
+ public function up()
+ {
+
+ }
+
+ public function down()
+ {
+ echo "m250828_065539_add_type_and_type_id_fields_to_write_offs_tables cannot be reverted.\n";
+
+ return false;
+ }
+ */
+}
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+class m250828_080450_add_type_and_type_id_fields_to_write_offs_erp_tables extends Migration
+{
+ const TABLE_NAME = 'erp24.write_offs_erp';
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $table = $this->db->schema->getTableSchema(self::TABLE_NAME);
+ if ($table === null) {
+ return;
+ }
+
+ if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('type_id')) {
+ $this->addColumn(
+ self::TABLE_NAME,
+ 'type_id',
+ $this->integer()->null()->comment('id типа списания')
+ );
+ }
+ if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('type_guid')) {
+ $this->addColumn(
+ self::TABLE_NAME,
+ 'type_guid',
+ $this->string()->null()->comment('guid типа списания')
+ );
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('type_id')) {
+ $this->dropColumn(self::TABLE_NAME, 'type_id');
+ }
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('type_guid')) {
+ $this->dropColumn(self::TABLE_NAME, 'type_guid');
+ }
+ }
+
+ /*
+ // Use up()/down() to run migration code without a transaction.
+ public function up()
+ {
+
+ }
+
+ public function down()
+ {
+ echo "m250828_080450_add_type_and_type_id_fields_to_write_offs_erp_tables cannot be reverted.\n";
+
+ return false;
+ }
+ */
+}
* @property string $items
* @property float $summ
* @property float $summ_retail
+ * @property integer|null $type_id id типа списания
+ * @property string|null $type_guid guid типа списания
*/
class WriteOffs extends \yii\db\ActiveRecord
{
[['id', 'store_id', 'number', 'date', 'type', /*'comment',*/ 'items', 'summ'], 'required'],
[['date', 'summ_retail', 'based_on', 'cause'], 'safe'],
[['based_on', 'cause', 'comment', 'items', 'write_downs'], 'string'],
- [['summ', 'summ_retail', 'status_id'], 'number'],
+ [['summ', 'summ_retail', 'status_id', 'type_id'], 'number'],
[['id', 'store_id'], 'string', 'max' => 36],
- [['number', 'type'], 'string', 'max' => 255],
+ [['number', 'type', 'type_guid'], 'string', 'max' => 255],
[['id'], 'unique'],
];
}
'summ_retail' => 'summ_retail',
'status_id' => 'status_id',
'write_downs' => 'write_downs',
+ 'type_id' => 'id типа списания',
+ 'type_guid' => 'guid типа списания',
];
}
* @property string|null $send_at Дата создания
* @property array|null $modelsProducts Дата изменения
* @property float $quantity количество
- *
+ * @property integer|null $type_id id типа списания
+ * @property string|null $type_guid guid типа списания
* @property WriteOffsProductsErp[] $writeOffsProductsErps
*/
class WriteOffsErp extends \yii\db\ActiveRecord
[['status', 'created_admin_id', 'updated_admin_id', 'cause_id', 'confirm_admin_id', 'cause_group_id', 'store_id', 'active', 'deleted_admin_id'], 'integer'],
[['date', 'created_at', 'send_at', 'updated_at', 'confirm_at', 'deleted_at', 'modelsProducts'], 'safe'],
[['based_on', 'comment', 'error_text', 'write_offs_type'], 'string'],
- [['summ', 'summ_retail', 'quantity'], 'number'],
- [['guid', 'store_guid', 'number', 'number_1c', 'date', 'based_on', 'write_offs_type', 'created_at', 'updated_at', 'deleted_at', 'confirm_at', 'send_at'], 'string', 'max' => 100],
+ [['summ', 'summ_retail', 'quantity', 'type_id'], 'number'],
+ [['guid', 'store_guid', 'type_guid', 'number', 'number_1c', 'date', 'based_on', 'write_offs_type', 'created_at', 'updated_at', 'deleted_at', 'confirm_at', 'send_at'], 'string', 'max' => 100],
[['guid'], 'unique'],
];
}
'active' => 'Активность',
'quantity' => 'Количество',
'summ_retail' => 'Summ Retail',
+ 'type_id' => 'id типа списания',
+ 'type_guid' => 'guid типа списания',
'send_at' => 'Дата отправки в 1с',
'created_at' => 'Created At',
'updated_at' => 'Updated At',