--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m241219_123607_change_waybill_columns
+ */
+class m241219_123607_change_waybill_columns extends Migration
+{
+ public function safeUp()
+ {
+ $tableSchema = $this->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с'));
+ }
+ }
+}
+
throw new \Exception($exception);
}
}
+
+ public function getCreatedAdmin() {
+ return $this->hasOne(Admin::class, ['id' => 'created_admin_id']);
+ }
}
'attributes' => [
'id',
'guid',
- [
- 'format' => 'raw',
- 'attribute' => 'status',
- ],
[
'format' => 'raw',
'attribute' => 'store_id',
}
],
[
- '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' => 'Ð\9eбновлено Ð\9aем'
+ 'attribute' => 'date',
+ 'label' => 'Ð\94аÑ\82а Ð\94окÑ\83менÑ\82а'
],
[
'label' => 'Магазин',
->entity_id)->name;
}
],
- [
- 'attribute' => 'number',
- 'label' => 'Название документа'
- ],
- [
- 'attribute' => 'number_1c',
- 'label' => 'Название документа в 1С'
- ],
- [
- 'attribute' => 'date',
- 'label' => 'Дата Документа'
- ],
- [
- 'attribute' => 'comment',
- 'label' => 'Комментарий'
- ],
[
'attribute' => 'quantity',
'label' => 'Количество'
],
[
'attribute' => 'summ',
- 'label' => 'СÑ\83мма Ñ\80озниÑ\86Ñ\8b'
+ 'label' => 'СÑ\83мма Ñ\80озниÑ\87наÑ\8f'
],
[
'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' => 'Ð\9eбновлено в'
+ 'attribute' => 'created_at',
+ 'label' => 'Ð\94аÑ\82а Ñ\81озданиÑ\8f'
],
[
'attribute' => 'send_at',
- 'label' => 'Ð\9eÑ\82пÑ\80авлено в'
+ 'label' => 'Ð\94аÑ\82а оÑ\82пÑ\80авлениÑ\8f в 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} '
+ ],
],
]) ?>
?>
<div class="waybill-write-offs-view p-4">
- <?= Html::a('Назад', ['/waybill-incoming'], ['class' => 'btn btn-secondary btn-sm'])?>
+ <?= Html::a('Назад', ['/waybill-incoming'], ['class' => 'btn btn-secondary btn-sm']) ?>
<h1><?= Html::encode($this->title) ?></h1>
<!-- Детали документа -->
'attribute' => 'quantity',
'label' => 'Количество',
],
+ [
+ 'attribute' => 'summ',
+ 'label' => 'Сумма розничная',
+ ],
[
'attribute' => 'summ_self_cost',
'label' => 'Сумма себестоимости',
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',
return Admin::findOne([$model->created_admin_id])->name;
}
],
- 'created_at',
- 'updated_at',
+ [
+ 'label' => 'Дата создания',
+ 'attribute' => 'created_at',
+ ],
+ [
+ 'label' => 'Дата обновления',
+ 'attribute' => 'updated_at',
+ ],
],
]) ?>
'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',
+ ],
],
]) ?>
'columns' => [
['class' => 'yii\grid\SerialColumn'],
- 'id',
+// 'id',
[
'attribute' => 'guid',
'value' => function ($model) {
},
'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',
[
$model->number_1c : '';
}
],
+ [
+ 'label' => 'Отправлено в 1С',
+ 'attribute' => 'send_at',
+ ],
[
'label' => 'Создан пользователем',
'attribute' => 'created_admin_id',