From: marina Date: Thu, 19 Dec 2024 13:07:36 +0000 (+0300) Subject: ERP-256 Сделать отправку документов Пересортица в 1с X-Git-Tag: 1.7~123^2~1 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=5df316135bed2756fc0b261cbbece29b710bdc67;p=erp24_rep%2Fyii-erp24%2F.git ERP-256 Сделать отправку документов Пересортица в 1с --- 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',