]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-259 Доработка второго шага передачи смен
authormarina <m.zozirova@gmail.com>
Fri, 13 Dec 2024 13:49:33 +0000 (16:49 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 13 Dec 2024 13:49:33 +0000 (16:49 +0300)
erp24/records/WaybillIncoming.php
erp24/views/shift-transfer/_replacement.php
erp24/views/shift-transfer/_transfer.php

index 6f1156020a7368c6463b00df49a4bdacda5b83f4..f9d4551438b2132776c8b522b839146bf0d3a9c0 100644 (file)
@@ -157,7 +157,7 @@ class WaybillIncoming extends \yii\db\ActiveRecord
             throw new \Exception($exception);
         }
 
-        if ($model->validate()) {
+        try{
             $model->save();
 
             $model->updateAttributes([
@@ -183,8 +183,8 @@ class WaybillIncoming extends \yii\db\ActiveRecord
                     'summ_self_cost' => $summaries['total_summ_self_cost']
                 ]);
             }
-        } else {
-            var_dump($model->getErrors());
+        } catch (\Throwable $exception) {
+            throw new \Exception($exception);
         }
     }
 }
index 7d7f4b17d87ff6df0f845de067bc4d07918fb27a..a40f72797240bee4ee3d4982661648de22206635 100644 (file)
@@ -56,7 +56,7 @@ if (in_array($shiftTransfer->status_id, [ShiftTransfer::STATUS_ID_TRANSFER_ACTIO
                 'title' => 'Заменяемый товар',
                 'type' => Select2::class,
                 'options' => [
-                        'class' => 'readonly-select2',
+                    'class' => 'readonly-select2',
                     'data' => array_merge(
                         ['text' => 'Выберите товар'],
                         $products
@@ -189,7 +189,7 @@ if (in_array($shiftTransfer->status_id, [ShiftTransfer::STATUS_ID_TRANSFER_ACTIO
                 'value' => function ($model) {
                     return $model->product->name;
                 },
-                'pageSummary' => 'Итого:',
+                'pageSummary' => Html::tag('b', 'Итого'),
             ],
             [
                 'attribute' => 'product_price',
@@ -220,7 +220,7 @@ if (in_array($shiftTransfer->status_id, [ShiftTransfer::STATUS_ID_TRANSFER_ACTIO
                 'label' => 'Разница в сумме',
                 'format' => 'raw',
                 'pageSummary' => true,
-                'footer' => Html::tag('b', number_format($totalBalance, 2, '.', ' ')),
+                'footer' => $totalBalance,
             ],
             [
                 'attribute' => 'updated_at',
@@ -265,18 +265,12 @@ if (in_array($shiftTransfer->status_id, [ShiftTransfer::STATUS_ID_TRANSFER_ACTIO
                     [
                         'label' => 'Цена товара',
                         'attribute' => 'product_price',
-                        'value' => function ($data) {
-                            return number_format($data['product_price'] ?? '', 2, '.', ' ');
-                        },
                     ],
                     [
                         'label' => 'Сумма',
                         'attribute' => 'summ',
                         'pageSummary' => true,
-                        'value' => function ($data) {
-                            return number_format($data['summ'] ?? '', 2, '.', ' ');
-                        },
-                        'footer' => Html::tag('b', 'Недостача: ') . '&nbsp;&nbsp;' . Html::tag('b', number_format($writeOffsBalance, 2, '.', ' ')),
+                        'footer' => Html::tag('b', 'Недостача: ') . '&nbsp;&nbsp;' . $writeOffsBalance
                     ],
                 ],
                 'showPageSummary' => true,
@@ -310,18 +304,12 @@ if (in_array($shiftTransfer->status_id, [ShiftTransfer::STATUS_ID_TRANSFER_ACTIO
                 [
                     'label' => 'Цена товара',
                     'attribute' => 'product_price',
-                    'value' => function ($data) {
-                        return number_format($data['product_price'] ?? '', 2, '.', ' ');
-                    },
                 ],
                 [
                     'label' => 'Сумма',
                     'attribute' => 'summ',
                     'pageSummary' => true,
-                    'value' => function ($data) {
-                        return number_format($data['summ'] ?? '', 2, '.', ' ');
-                    },
-                    'footer' => Html::tag('b', 'Излишек: ') . '&nbsp;&nbsp;' . Html::tag('b', number_format($incomingBalance, 2, '.', ' ')),
+                    'footer' => Html::tag('b', 'Излишек: ') . '&nbsp;&nbsp;' . $incomingBalance,
                 ],
             ],
             'showPageSummary' => true,
index bd721647256180081f3ba4b6a887af58942125ae..94140b34d82e88adbd6ba8da7b100f6a77b4a961 100644 (file)
@@ -64,17 +64,11 @@ echo \kartik\grid\GridView::widget([
             'attribute'  => 'remains_summ',
             'label' => 'Сумма остатков (недостача или излишек), руб',
             'pageSummary' => true,
-            'value' => function($data) {
-                return number_format($data['remains_summ'] ?? '', 2, '.', ' ');
-            },
         ],
         [
             'attribute'  => 'self_cost',
             'label' => 'Себестоимость, руб',
             'pageSummary' => true,
-            'value' => function($data) {
-                return number_format($data['self_cost'] ?? '', 2, '.', ' ');
-            },
         ],
     ],
     'layout' => '{items}',