]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-256 Сделать отправку документов Пересортица в 1с
authormarina <m.zozirova@gmail.com>
Thu, 19 Dec 2024 13:07:36 +0000 (16:07 +0300)
committermarina <m.zozirova@gmail.com>
Thu, 19 Dec 2024 13:07:36 +0000 (16:07 +0300)
erp24/migrations/m241219_123607_change_waybill_columns.php [new file with mode: 0644]
erp24/records/WaybillIncoming.php
erp24/views/replacement-invoice/view.php
erp24/views/waybill-incoming/index.php
erp24/views/waybill-incoming/view.php
erp24/views/waybill-write-offs/index.php
erp24/views/waybill-write-offs/view.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 (file)
index 0000000..c33ebdc
--- /dev/null
@@ -0,0 +1,47 @@
+<?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с'));
+        }
+    }
+}
+
index ffef3e74c84c0a8f46666af7cfd8cbdfa2946126..cb79c589eeebb546ac9b014b2257266d6561bcb2 100644 (file)
@@ -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']);
+    }
 }
index fea91ded4d61571feded7bcfb6caa8cf4120cce1..e0814254b39ae073c767113b2fc6212b87fb3847 100644 (file)
@@ -22,10 +22,6 @@ $this->params['breadcrumbs'][] = $this->title;
         'attributes' => [
             'id',
             'guid',
-            [
-                'format' => 'raw',
-                'attribute' => 'status',
-            ],
             [
                 'format' => 'raw',
                 'attribute' => 'store_id',
index cca65c6c68da381068b30dd8aceab889af154e17..49bd552036328c688756fc17766e8731f082bd2e 100644 (file)
@@ -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' => 'Ð\9eбновлено Ð\9aем'
+                'attribute' => 'date',
+                'label' => 'Ð\94аÑ\82а Ð\94окÑ\83менÑ\82а'
             ],
             [
                 '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' => 'СÑ\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} '
+            ],
         ],
     ]) ?>
 
index 75f18a75ab6348f2c9d2037152e57cb9e6740c29..4fbd5f6540744d09a3523918603e3bf0d43b650d 100644 (file)
@@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
 ?>
 <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>
 
     <!-- Детали документа -->
@@ -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',
+            ],
         ],
     ]) ?>
 
index 0aaea0526c38d30022a420b2af149abdf574095b..47ae950807d4fc487d4f1005d58ffe4178a1e070 100644 (file)
@@ -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',
             [
index d7d60342a975e22a2dea77b671f2f93addb112e0..885d0e8c3f94fdfa03924e0ff1326efdd889b25f 100644 (file)
@@ -60,6 +60,10 @@ $this->params['breadcrumbs'][] = $this->title;
                             $model->number_1c : '';
                 }
             ],
+            [
+                'label' => 'Отправлено в 1С',
+                'attribute' => 'send_at',
+            ],
             [
                 'label' => 'Создан пользователем',
                 'attribute' => 'created_admin_id',