]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-259 Доработка второго шага передачи смен
authormarina <m.zozirova@gmail.com>
Fri, 13 Dec 2024 07:48:43 +0000 (10:48 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 13 Dec 2024 07:48:43 +0000 (10:48 +0300)
erp24/controllers/ShiftTransferController.php
erp24/migrations/m241212_122541_alter_number_column.php [new file with mode: 0644]
erp24/migrations/m241213_072607_delete_deleted_column.php [new file with mode: 0644]
erp24/records/ReplacementInvoice.php
erp24/records/WaybillIncoming.php
erp24/records/WaybillWriteOffs.php
erp24/views/waybill-incoming/index.php
erp24/views/waybill-incoming/view.php
erp24/views/waybill-write-offs/view.php

index afe87bea28e17f9f6b93a7322b1263e26c0143ff..9f2d035430730e9a52ff9e789016bc66f0825d3a 100644 (file)
@@ -253,7 +253,6 @@ class ShiftTransferController extends Controller
                 StoreBalance::setData($model);
             } elseif ($action === 'save') {
                 $model->updateAttributes(['status_id' => ShiftTransfer::STATUS_ID_READY_TO_ACCEPT]);
-                WaybillWriteOffs::updateAll(['active' => WaybillWriteOffs::INACTIVE, 'shift_transfer_id' => $model->id]);
             } elseif ($action == 'recalculate') {
                 EqualizationRemains::setData($model);
                 Yii::$app->session->setFlash('success', 'Таблица замен успешно перерасчитана');
diff --git a/erp24/migrations/m241212_122541_alter_number_column.php b/erp24/migrations/m241212_122541_alter_number_column.php
new file mode 100644 (file)
index 0000000..cfffb0c
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m241212_122541_alter_number_column
+ */
+class m241212_122541_alter_number_column extends Migration
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->alterColumn('erp24.waybill_write_offs', 'number', $this->string(100)->comment('Название документа'));
+        $this->alterColumn('erp24.waybill_incoming', 'number', $this->string(100)->comment('Название документа'));
+        $this->alterColumn('erp24.waybill_write_offs', 'quantity', $this->float()->comment('Количество'));
+        $this->alterColumn('erp24.waybill_incoming', 'quantity', $this->float()->comment('Количество'));
+        $this->alterColumn('erp24.waybill_write_offs', 'summ', $this->float()->comment('Сумма розничная'));
+        $this->alterColumn('erp24.waybill_incoming', 'summ', $this->float()->comment('Сумма розничная'));
+        $this->alterColumn('erp24.waybill_write_offs', 'summ_self_cost', $this->float()->comment('Сумма себестоимости'));
+        $this->alterColumn('erp24.waybill_incoming', 'summ_self_cost', $this->float()->comment('Сумма себестоимости'));
+
+
+        $this->dropForeignKey('fk-waybill_write_offs_id', 'erp24.waybill_write_offs_products',);
+        $this->dropForeignKey('fk-waybill_incoming_id', 'erp24.waybill_incoming_products');
+        $this->addForeignKey(
+            'fk-waybill_write_offs_id',
+            'erp24.waybill_write_offs_products',
+            'waybill_write_offs_id',
+            'erp24.waybill_write_offs',
+            'id',
+            'CASCADE'
+        );
+        $this->addForeignKey(
+            'fk-waybill_incoming_id',
+            'erp24.waybill_incoming_products',
+            'waybill_incoming_id',
+            'erp24.waybill_incoming',
+            'id',
+            'CASCADE'
+        );
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropForeignKey('fk-waybill_write_offs_id', 'erp24.waybill_write_offs_products',);
+        $this->dropForeignKey('fk-waybill_incoming_id', 'erp24.waybill_incoming_products');
+        $this->addForeignKey(
+            'fk-waybill_write_offs_id',
+            'erp24.waybill_write_offs_products',
+            'waybill_write_offs_id',
+            'erp24.waybill_write_offs',
+            'id',
+        );
+        $this->addForeignKey(
+            'fk-waybill_incoming_id',
+            'erp24.waybill_incoming_products',
+            'waybill_incoming_id',
+            'erp24.waybill_incoming',
+            'id',
+        );
+
+        $this->alterColumn('erp24.waybill_write_offs', 'number', $this->string(100)->notNull()->comment('Название документа'));
+        $this->alterColumn('erp24.waybill_incoming', 'number', $this->string(100)->notNull()->comment('Название документа'));
+        $this->alterColumn('erp24.waybill_write_offs', 'quantity', $this->float()->notNull()->comment('Количество'));
+        $this->alterColumn('erp24.waybill_incoming', 'quantity', $this->float()->notNull()->comment('Количество'));
+        $this->alterColumn('erp24.waybill_write_offs', 'summ', $this->float()->notNull()->comment('Сумма розничная'));
+        $this->alterColumn('erp24.waybill_incoming', 'summ', $this->float()->notNull()->comment('Сумма розничная'));
+        $this->alterColumn('erp24.waybill_write_offs', 'summ_self_cost', $this->float()->notNull()->comment('Сумма себестоимости'));
+        $this->alterColumn('erp24.waybill_incoming', 'summ_self_cost', $this->float()->notNull()->comment('Сумма себестоимости'));
+    }
+}
+
diff --git a/erp24/migrations/m241213_072607_delete_deleted_column.php b/erp24/migrations/m241213_072607_delete_deleted_column.php
new file mode 100644 (file)
index 0000000..4823278
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m241213_072607_delete_deleted_column
+ */
+class m241213_072607_delete_deleted_column extends Migration
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->dropColumn('waybill_incoming', 'deleted_admin_id');
+        $this->dropColumn('waybill_incoming', 'active');
+        $this->dropColumn('waybill_incoming', 'deleted_at');
+        $this->dropColumn('waybill_write_offs', 'deleted_at');
+        $this->dropColumn('waybill_write_offs', 'active');
+        $this->dropColumn('waybill_write_offs', 'deleted_admin_id');
+        $this->dropColumn('replacement_invoice', 'deleted_at');
+        $this->dropColumn('replacement_invoice', 'active');
+        $this->dropColumn('replacement_invoice', 'deleted_admin_id');
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->addColumn('waybill_write_offs', 'deleted_at', $this->dateTime()->null()->comment('Дата удаление'));
+        $this->addColumn('waybill_write_offs', 'active', $this->tinyInteger()->notNull()->defaultValue(1)->comment('Активность'));
+        $this->addColumn('waybill_write_offs', 'deleted_at',   $this->integer()->null()->comment('Удален пользователем'));
+        $this->addColumn('waybill_incoming', 'deleted_admin_id', $this->dateTime()->null()->comment('Дата удаление'));
+        $this->addColumn('waybill_incoming', 'active', $this->tinyInteger()->notNull()->defaultValue(1)->comment('Активность'));
+        $this->addColumn('waybill_incoming', 'deleted_admin_id',   $this->integer()->null()->comment('Удален пользователем'));
+        $this->addColumn('replacement_invoice', 'deleted_at', $this->dateTime()->null()->comment('Дата удаление'),);
+        $this->addColumn('replacement_invoice', 'active',  $this->tinyInteger()->notNull()->defaultValue(1)->comment('Активность'));
+        $this->addColumn('replacement_invoice', 'deleted_admin_id', $this->integer()->null()->comment('Удален пользователем'));
+    }
+}
index d3022f5f6f3efcc1a8177768a1cee9665ec73995..996de30f0e03469bccd81a0119756aef22ef89e1 100644 (file)
@@ -25,15 +25,10 @@ use yii_app\helpers\DataHelper;
  * @property string|null $comment Комментарий
  * @property string $created_at Дата создания
  * @property string|null $updated_at Дата обновления
- * @property string|null $deleted_at Дата удаление
  * @property string|null $send_at Дата отправления в 1с
- * @property int $active Активность
- * @property int|null $deleted_admin_id Удален пользователем
  */
 class ReplacementInvoice extends \yii\db\ActiveRecord
 {
-    public const ACTIVE = 1;
-    public const DELETE = 0;
     public const REPLACEMENT_ACTIONS = 2;
     /**
      * {@inheritdoc}
@@ -67,9 +62,9 @@ class ReplacementInvoice extends \yii\db\ActiveRecord
     {
         return [
             [['guid', 'created_admin_id', 'store_id', 'store_guid', 'date', 'created_at'], 'required'],
-            [['status', 'created_admin_id', 'updated_admin_id', 'confirm_admin_id', 'store_id', 'active', 'deleted_admin_id'], 'default', 'value' => null],
-            [['status', 'created_admin_id', 'updated_admin_id', 'confirm_admin_id', 'store_id', 'active', 'deleted_admin_id'], 'integer'],
-            [['date', 'created_at', 'updated_at', 'deleted_at', 'send_at'], 'safe'],
+            [['status', 'created_admin_id', 'updated_admin_id', 'confirm_admin_id', 'store_id'], 'default', 'value' => null],
+            [['status', 'created_admin_id', 'updated_admin_id', 'confirm_admin_id', 'store_id'], 'integer'],
+            [['date', 'created_at', 'updated_at', 'send_at'], 'safe'],
             [['comment'], 'string'],
             [['guid', 'store_guid', 'number', 'number_1c'], 'string', 'max' => 100],
             [['guid'], 'unique'],
@@ -91,8 +86,7 @@ class ReplacementInvoice extends \yii\db\ActiveRecord
             'store_guid' => $shiftTransfer->store_guid,
             'date' => $shiftTransfer->date,
             'comment' => $shiftTransfer->comment,
-            'created_at' => $shiftTransfer->date_start,
-            'active' => self::ACTIVE,
+            'created_at' => $shiftTransfer->date_start
         ]);
 
         if ($model->validate()) {
@@ -124,10 +118,7 @@ class ReplacementInvoice extends \yii\db\ActiveRecord
             'comment' => 'Комментарий',
             'created_at' => 'Дата создания',
             'updated_at' => 'Дата обновления',
-            'deleted_at' => 'Дата удаления',
             'send_at' => 'Дата отправки',
-            'active' => 'Активность',
-            'deleted_admin_id' => 'ID администратора (удаливший)',
         ];
     }
 
index b6a7eb6b2c7ab6d81733f1c13d41108a5a4b2445..3ce7eefba08b479561ef191609aad79e7095c0ac 100644 (file)
@@ -28,16 +28,11 @@ use yii_app\helpers\DataHelper;
  * @property float|null $summ_self_cost Сумма себестоимости
  * @property string $created_at Дата создания
  * @property string|null $updated_at Дата обновления
- * @property string|null $deleted_at Дата удаление
  * @property string|null $send_at Дата отправления в 1с
- * @property int $active Активность
- * @property int|null $deleted_admin_id Удален пользователем
  */
 class WaybillIncoming extends \yii\db\ActiveRecord
 {
-    public const ACTIVE = 1;
-    public const INACTIVE = 2;
-    public const NEW = 1;
+    public const STATUS_NEW = 1;
     /**
      * {@inheritdoc}
      */
@@ -53,9 +48,9 @@ class WaybillIncoming extends \yii\db\ActiveRecord
     {
         return [
             [['guid', 'store_id', 'store_guid', 'date', 'quantity', 'summ'], 'required'],
-            [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id', 'number', 'active', 'deleted_admin_id'], 'default', 'value' => null],
-            [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id', 'active', 'deleted_admin_id'], 'integer'],
-            [['date', 'created_at', 'updated_at', 'deleted_at', 'send_at'], 'safe'],
+            [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id', 'number'], 'default', 'value' => null],
+            [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id'], 'integer'],
+            [['date', 'created_at', 'updated_at', 'send_at'], 'safe'],
             [['comment'], 'string'],
             [['quantity', 'summ', 'summ_self_cost'], 'number'],
             [['guid', 'store_guid', 'number', 'number_1c'], 'string', 'max' => 100],
@@ -105,10 +100,7 @@ class WaybillIncoming extends \yii\db\ActiveRecord
             'summ_self_cost' => 'Summ Self Cost',
             'created_at' => 'Created At',
             'updated_at' => 'Updated At',
-            'deleted_at' => 'Deleted At',
             'send_at' => 'Send At',
-            'active' => 'Active',
-            'deleted_admin_id' => 'Deleted Admin ID',
         ];
     }
 
@@ -124,7 +116,7 @@ class WaybillIncoming extends \yii\db\ActiveRecord
         $model->setAttributes([
             'guid' =>  DataHelper::createGuidMy(),
             'shift_transfer_id' => $shiftTransfer->id,
-            'status' => self::NEW,
+            'status' => self::STATUS_NEW,
             'store_id' => array_flip(array_map('strval', CityStore::getAllActiveGuidId()))[$shiftTransfer->store_guid],
             'store_guid' => $shiftTransfer->store_guid,
             'date' => $shiftTransfer->date,
@@ -132,7 +124,6 @@ class WaybillIncoming extends \yii\db\ActiveRecord
             'quantity' => 0,
             'summ' => 0,
             'summ_self_cost' => 0,
-            'active' => self::INACTIVE,
         ]);
 
         if ($model->validate()) {
index 70734efb880333c120f5711306fe318739c2374e..9b7a4f3bc4156e78d1618961342f4e49bb7d8645 100644 (file)
@@ -29,20 +29,14 @@ use yii_app\helpers\DataHelper;
  * @property float|null $summ_self_cost Сумма себестоимости
  * @property string $created_at Дата создания
  * @property string|null $updated_at Дата обновления
- * @property string|null $deleted_at Дата удаление
-
  * @property string|null $send_at Дата отправления в 1с
- * @property int $active Активность
- * @property int|null $deleted_admin_id Удален пользователем
- *
+
  * @property ShiftTransfer $shiftTransfer
  * @property WaybillWriteOffsProducts[] $waybillWriteOffsProducts
  */
 class WaybillWriteOffs extends \yii\db\ActiveRecord
 {
-    public const ACTIVE = 1;
-    public const INACTIVE = 2;
-    public const NEW = 1;
+    public const STATUS_NEW = 1;
 
     /**
      * {@inheritdoc}
@@ -59,9 +53,9 @@ class WaybillWriteOffs extends \yii\db\ActiveRecord
     {
         return [
             [['guid', 'store_id', 'store_guid', 'date', 'quantity', 'summ'], 'required'],
-            [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id', 'active', 'deleted_admin_id'], 'default', 'value' => null],
-            [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id', 'active', 'deleted_admin_id'], 'integer'],
-            [['date', 'created_at', 'updated_at', 'deleted_at', 'send_at'], 'safe'],
+            [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id'], 'default', 'value' => null],
+            [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id'], 'integer'],
+            [['date', 'created_at', 'updated_at', 'send_at'], 'safe'],
             [['comment'], 'string'],
             [['quantity', 'summ', 'summ_self_cost'], 'number'],
             [['guid', 'store_guid', 'number', 'number_1c'], 'string', 'max' => 100],
@@ -110,10 +104,7 @@ class WaybillWriteOffs extends \yii\db\ActiveRecord
             'summ_self_cost' => 'Сумма себестоимости',
             'created_at' => 'Дата создания',
             'updated_at' => 'Дата обновления',
-            'deleted_at' => 'Дата удаление',
             'send_at' => 'Дата отправления в 1с',
-            'active' => 'Активность',
-            'deleted_admin_id' => 'Удален пользователем',
         ];
     }
 
@@ -124,15 +115,14 @@ class WaybillWriteOffs extends \yii\db\ActiveRecord
         $model->setAttributes([
             'guid' =>  DataHelper::createGuidMy(),
             'shift_transfer_id' => $shiftTransfer->id,
-            'status' => self::NEW,
+            'status' => self::STATUS_NEW,
             'store_id' => array_flip(array_map('strval', CityStore::getAllActiveGuidId()))[$shiftTransfer->store_guid],
             'store_guid' => $shiftTransfer->store_guid,
             'date' => $shiftTransfer->date,
             'comment' => $shiftTransfer->comment,
             'quantity' => 0,
             'summ' => 0,
-            'summ_self_cost' => 0,
-            'active' => self::INACTIVE,
+            'summ_self_cost' => 0
         ]);
 
         if ($model->validate()) {
index 914fd6cbc2eefc3752702cf5e628f025e73b5f14..c3b1fee06810d55b66712bfe6d0015913957b69c 100644 (file)
@@ -49,10 +49,7 @@ use yii_app\records\WaybillIncoming;
             'summ_self_cost',
             'created_at',
             'updated_at',
-            'deleted_at',
             'send_at',
-            'active',
-            'deleted_admin_id',
             [
                 'class' => ActionColumn::class,
                 'template' => '{view}',
index d3cc3c6fcb106773495ed890b928f35e335a9c35..68f72c199b28028a79e43c917e53498d7948e057 100644 (file)
@@ -46,7 +46,6 @@ $this->params['breadcrumbs'][] = $this->title;
             ],
             'created_at',
             'updated_at',
-            'deleted_at',
         ],
     ]) ?>
 
index d665244a9aafa46d909a861880f800266664f448..2fd0a2bcf7bca58bda5eb0d924ad0a161ca55a2c 100644 (file)
@@ -46,7 +46,6 @@ $this->params['breadcrumbs'][] = $this->title;
             ],
             'created_at',
             'updated_at',
-            'deleted_at',
         ],
     ]) ?>