From 5df316135bed2756fc0b261cbbece29b710bdc67 Mon Sep 17 00:00:00 2001 From: marina Date: Thu, 19 Dec 2024 16:07:36 +0300 Subject: [PATCH] =?utf8?q?ERP-256=20=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D1=82?= =?utf8?q?=D1=8C=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D1=83=20?= =?utf8?q?=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20?= =?utf8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=81=D0=BE=D1=80=D1=82=D0=B8=D1=86?= =?utf8?q?=D0=B0=20=D0=B2=201=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../m241219_123607_change_waybill_columns.php | 47 ++++++++++++ erp24/records/WaybillIncoming.php | 4 ++ erp24/views/replacement-invoice/view.php | 4 -- erp24/views/waybill-incoming/index.php | 58 ++++++--------- erp24/views/waybill-incoming/view.php | 71 ++++++++++++++++--- erp24/views/waybill-write-offs/index.php | 11 ++- erp24/views/waybill-write-offs/view.php | 4 ++ 7 files changed, 145 insertions(+), 54 deletions(-) create mode 100644 erp24/migrations/m241219_123607_change_waybill_columns.php diff --git a/erp24/migrations/m241219_123607_change_waybill_columns.php b/erp24/migrations/m241219_123607_change_waybill_columns.php new file mode 100644 index 00000000..c33ebdc0 --- /dev/null +++ b/erp24/migrations/m241219_123607_change_waybill_columns.php @@ -0,0 +1,47 @@ +db->getTableSchema('erp24.waybill_write_offs', true); + $column = $tableSchema->getColumn('number_1c'); + + if ($column && $column->type === 'string' && $column->size === 100) { + $this->alterColumn('erp24.waybill_write_offs', 'number_1c', $this->text()->comment('Название документа в 1с')); + } + + $tableSchema = $this->db->getTableSchema('erp24.waybill_incoming', true); + $column = $tableSchema->getColumn('number_1c'); + + if ($column && $column->type === 'string' && $column->size === 100) { + $this->alterColumn('erp24.waybill_incoming', 'number_1c', $this->text()->comment('Название документа в 1с')); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $tableSchema = $this->db->getTableSchema('erp24.waybill_write_offs', true); + $column = $tableSchema->getColumn('number_1c'); + + if ($column && $column->type === 'text') { + $this->alterColumn('erp24.waybill_write_offs', 'number_1c', $this->string(100)->null()->comment('Название документа в 1с')); + } + + $tableSchema = $this->db->getTableSchema('erp24.waybill_incoming', true); + $column = $tableSchema->getColumn('number_1c'); + + if ($column && $column->type === 'text') { + $this->alterColumn('erp24.waybill_incoming', 'number_1c', $this->string(100)->null()->comment('Название документа в 1с')); + } + } +} + diff --git a/erp24/records/WaybillIncoming.php b/erp24/records/WaybillIncoming.php index ffef3e74..cb79c589 100644 --- a/erp24/records/WaybillIncoming.php +++ b/erp24/records/WaybillIncoming.php @@ -166,4 +166,8 @@ class WaybillIncoming extends \yii\db\ActiveRecord throw new \Exception($exception); } } + + public function getCreatedAdmin() { + return $this->hasOne(Admin::class, ['id' => 'created_admin_id']); + } } diff --git a/erp24/views/replacement-invoice/view.php b/erp24/views/replacement-invoice/view.php index fea91ded..e0814254 100644 --- a/erp24/views/replacement-invoice/view.php +++ b/erp24/views/replacement-invoice/view.php @@ -22,10 +22,6 @@ $this->params['breadcrumbs'][] = $this->title; 'attributes' => [ 'id', 'guid', - [ - 'format' => 'raw', - 'attribute' => 'status', - ], [ 'format' => 'raw', 'attribute' => 'store_id', diff --git a/erp24/views/waybill-incoming/index.php b/erp24/views/waybill-incoming/index.php index cca65c6c..49bd5520 100644 --- a/erp24/views/waybill-incoming/index.php +++ b/erp24/views/waybill-incoming/index.php @@ -38,19 +38,12 @@ use yii_app\records\WaybillIncoming; } ], [ - 'attribute' => 'status', - 'label' => 'Статус', - 'value' => function ($model) { - return \yii_app\records\WriteOffsErp::STATUSES[$model->status]; - } - ], - [ - 'attribute' => 'created_admin_id', - 'label' => 'Создано Кем' + 'attribute' => 'number', + 'label' => 'Название документа' ], [ - 'attribute' => 'updated_admin_id', - 'label' => 'Обновлено Кем' + 'attribute' => 'date', + 'label' => 'Дата Документа' ], [ 'label' => 'Магазин', @@ -60,53 +53,44 @@ use yii_app\records\WaybillIncoming; ->entity_id)->name; } ], - [ - 'attribute' => 'number', - 'label' => 'Название документа' - ], - [ - 'attribute' => 'number_1c', - 'label' => 'Название документа в 1С' - ], - [ - 'attribute' => 'date', - 'label' => 'Дата Документа' - ], - [ - 'attribute' => 'comment', - 'label' => 'Комментарий' - ], [ 'attribute' => 'quantity', 'label' => 'Количество' ], [ 'attribute' => 'summ', - 'label' => 'Сумма розницы' + 'label' => 'Сумма розничная' ], [ 'attribute' => 'summ_self_cost', 'label' => 'Сумма себестоимости' ], [ - 'attribute' => 'created_at', - 'label' => 'Создано в' + 'attribute' => 'status', + 'label' => 'Статус', + 'value' => function ($model) { + return \yii_app\records\WriteOffsErp::STATUSES[$model->status]; + } ], [ - 'attribute' => 'updated_at', - 'label' => 'Обновлено в' + 'attribute' => 'created_at', + 'label' => 'Дата создания' ], [ 'attribute' => 'send_at', - 'label' => 'Отправлено в' + 'label' => 'Дата отправления в 1С' ], [ - 'class' => ActionColumn::class, - 'template' => '{view}', - 'urlCreator' => function ($action, WaybillIncoming $model, $key, $index, $column) { - return Url::toRoute([$action, 'id' => $model->id]); + 'attribute' => 'created_admin_id', + 'label' => 'Создан пользователем', + 'value' => function ($model) { + return $model->createdAdmin->name_full; } ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{view} ' + ], ], ]) ?> diff --git a/erp24/views/waybill-incoming/view.php b/erp24/views/waybill-incoming/view.php index 75f18a75..4fbd5f65 100644 --- a/erp24/views/waybill-incoming/view.php +++ b/erp24/views/waybill-incoming/view.php @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; ?>
- 'btn btn-secondary btn-sm'])?> + 'btn btn-secondary btn-sm']) ?>

title) ?>

@@ -56,6 +56,10 @@ $this->params['breadcrumbs'][] = $this->title; 'attribute' => 'quantity', 'label' => 'Количество', ], + [ + 'attribute' => 'summ', + 'label' => 'Сумма розничная', + ], [ 'attribute' => 'summ_self_cost', 'label' => 'Сумма себестоимости', @@ -67,6 +71,21 @@ $this->params['breadcrumbs'][] = $this->title; return \yii_app\records\WriteOffsErp::STATUSES[$model->status]; } ], + [ + 'label' => 'Текст ошибки', + 'attribute' => 'error_text', + 'value' => function ($model) { + return $model->error_text; + } + ], + [ + 'label' => 'Номер документа в 1С', + 'attribute' => 'number_1c', + ], + [ + 'label' => 'Отправлено в 1С', + 'attribute' => 'send_at', + ], [ 'label' => 'Создан пользователем', 'attribute' => 'created_admin_id', @@ -74,8 +93,14 @@ $this->params['breadcrumbs'][] = $this->title; return Admin::findOne([$model->created_admin_id])->name; } ], - 'created_at', - 'updated_at', + [ + 'label' => 'Дата создания', + 'attribute' => 'created_at', + ], + [ + 'label' => 'Дата обновления', + 'attribute' => 'updated_at', + ], ], ]) ?> @@ -86,14 +111,38 @@ $this->params['breadcrumbs'][] = $this->title; 'dataProvider' => $productsDataProvider, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], - 'name', - 'product_id', - 'product_count', - 'product_price', - 'product_self_cost', - 'summ', - 'summ_self_cost', - 'created_at', + [ + 'label' => 'Название товара', + 'attribute' => 'name', + ], + [ + 'label' => 'ID товара с излишком', + 'attribute' => 'product_id', + ], + [ + 'label' => 'Количество товара с излишком', + 'attribute' => 'product_count', + ], + [ + 'label' => 'Цена товара розничная', + 'attribute' => 'product_price', + ], + [ + 'label' => 'Себестоимость товара', + 'attribute' => 'product_self_cost', + ], + [ + 'label' => 'Сумма розничная', + 'attribute' => 'summ', + ], + [ + 'label' => 'Сумма себестоимости', + 'attribute' => 'summ_self_cost', + ], + [ + 'label' => 'Дата создания', + 'attribute' => 'created_at', + ], ], ]) ?> diff --git a/erp24/views/waybill-write-offs/index.php b/erp24/views/waybill-write-offs/index.php index 0aaea052..47ae9508 100644 --- a/erp24/views/waybill-write-offs/index.php +++ b/erp24/views/waybill-write-offs/index.php @@ -22,7 +22,7 @@ $this->params['breadcrumbs'][] = $this->title; 'columns' => [ ['class' => 'yii\grid\SerialColumn'], - 'id', +// 'id', [ 'attribute' => 'guid', 'value' => function ($model) { @@ -30,7 +30,14 @@ $this->params['breadcrumbs'][] = $this->title; }, 'format' => 'raw', ], - 'shift_transfer_id', + [ + 'attribute' => 'shift_transfer_id', + 'label' => 'Накладная передачи', + 'format' => 'html', + 'value' => function ($model) { + return Html::a($model['shift_transfer_id'], ['/shift-transfer/view', 'id' => $model['shift_transfer_id']], ['class' => 'btn btn-link']); + } + ], 'number', 'date', [ diff --git a/erp24/views/waybill-write-offs/view.php b/erp24/views/waybill-write-offs/view.php index d7d60342..885d0e8c 100644 --- a/erp24/views/waybill-write-offs/view.php +++ b/erp24/views/waybill-write-offs/view.php @@ -60,6 +60,10 @@ $this->params['breadcrumbs'][] = $this->title; $model->number_1c : ''; } ], + [ + 'label' => 'Отправлено в 1С', + 'attribute' => 'send_at', + ], [ 'label' => 'Создан пользователем', 'attribute' => 'created_admin_id', -- 2.39.5