From: marina Date: Fri, 13 Dec 2024 07:48:43 +0000 (+0300) Subject: ERP-259 Доработка второго шага передачи смен X-Git-Tag: 1.7~169^2~8 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=29541ab1b863f9a2e185ce5ae492cfdefe2e3e46;p=erp24_rep%2Fyii-erp24%2F.git ERP-259 Доработка второго шага передачи смен --- diff --git a/erp24/controllers/ShiftTransferController.php b/erp24/controllers/ShiftTransferController.php index afe87bea..9f2d0354 100644 --- a/erp24/controllers/ShiftTransferController.php +++ b/erp24/controllers/ShiftTransferController.php @@ -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 index 00000000..cfffb0c6 --- /dev/null +++ b/erp24/migrations/m241212_122541_alter_number_column.php @@ -0,0 +1,77 @@ +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 index 00000000..4823278e --- /dev/null +++ b/erp24/migrations/m241213_072607_delete_deleted_column.php @@ -0,0 +1,41 @@ +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('Удален пользователем')); + } +} diff --git a/erp24/records/ReplacementInvoice.php b/erp24/records/ReplacementInvoice.php index d3022f5f..996de30f 100644 --- a/erp24/records/ReplacementInvoice.php +++ b/erp24/records/ReplacementInvoice.php @@ -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 администратора (удаливший)', ]; } diff --git a/erp24/records/WaybillIncoming.php b/erp24/records/WaybillIncoming.php index b6a7eb6b..3ce7eefb 100644 --- a/erp24/records/WaybillIncoming.php +++ b/erp24/records/WaybillIncoming.php @@ -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()) { diff --git a/erp24/records/WaybillWriteOffs.php b/erp24/records/WaybillWriteOffs.php index 70734efb..9b7a4f3b 100644 --- a/erp24/records/WaybillWriteOffs.php +++ b/erp24/records/WaybillWriteOffs.php @@ -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()) { diff --git a/erp24/views/waybill-incoming/index.php b/erp24/views/waybill-incoming/index.php index 914fd6cb..c3b1fee0 100644 --- a/erp24/views/waybill-incoming/index.php +++ b/erp24/views/waybill-incoming/index.php @@ -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}', diff --git a/erp24/views/waybill-incoming/view.php b/erp24/views/waybill-incoming/view.php index d3cc3c6f..68f72c19 100644 --- a/erp24/views/waybill-incoming/view.php +++ b/erp24/views/waybill-incoming/view.php @@ -46,7 +46,6 @@ $this->params['breadcrumbs'][] = $this->title; ], 'created_at', 'updated_at', - 'deleted_at', ], ]) ?> diff --git a/erp24/views/waybill-write-offs/view.php b/erp24/views/waybill-write-offs/view.php index d665244a..2fd0a2bc 100644 --- a/erp24/views/waybill-write-offs/view.php +++ b/erp24/views/waybill-write-offs/view.php @@ -46,7 +46,6 @@ $this->params['breadcrumbs'][] = $this->title; ], 'created_at', 'updated_at', - 'deleted_at', ], ]) ?>