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', 'Таблица замен успешно перерасчитана');
--- /dev/null
+<?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('Сумма себестоимости'));
+ }
+}
+
--- /dev/null
+<?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('Удален пользователем'));
+ }
+}
* @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}
{
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'],
'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()) {
'comment' => 'Комментарий',
'created_at' => 'Дата создания',
'updated_at' => 'Дата обновления',
- 'deleted_at' => 'Дата удаления',
'send_at' => 'Дата отправки',
- 'active' => 'Активность',
- 'deleted_admin_id' => 'ID администратора (удаливший)',
];
}
* @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}
*/
{
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],
'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',
];
}
$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,
'quantity' => 0,
'summ' => 0,
'summ_self_cost' => 0,
- 'active' => self::INACTIVE,
]);
if ($model->validate()) {
* @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}
{
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],
'summ_self_cost' => 'Сумма себестоимости',
'created_at' => 'Дата создания',
'updated_at' => 'Дата обновления',
- 'deleted_at' => 'Дата удаление',
'send_at' => 'Дата отправления в 1с',
- 'active' => 'Активность',
- 'deleted_admin_id' => 'Удален пользователем',
];
}
$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()) {
'summ_self_cost',
'created_at',
'updated_at',
- 'deleted_at',
'send_at',
- 'active',
- 'deleted_admin_id',
[
'class' => ActionColumn::class,
'template' => '{view}',
],
'created_at',
'updated_at',
- 'deleted_at',
],
]) ?>
],
'created_at',
'updated_at',
- 'deleted_at',
],
]) ?>