From b38ef671815c8036b5f6371f2109339e00c969cb Mon Sep 17 00:00:00 2001 From: marina Date: Fri, 13 Dec 2024 16:49:33 +0300 Subject: [PATCH] =?utf8?q?ERP-259=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?utf8?q?=D1=82=D0=BA=D0=B0=20=D0=B2=D1=82=D0=BE=D1=80=D0=BE=D0=B3=D0=BE?= =?utf8?q?=20=D1=88=D0=B0=D0=B3=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?utf8?q?=D0=B0=D1=87=D0=B8=20=D1=81=D0=BC=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/WaybillIncoming.php | 6 +++--- erp24/views/shift-transfer/_replacement.php | 22 +++++---------------- erp24/views/shift-transfer/_transfer.php | 6 ------ 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/erp24/records/WaybillIncoming.php b/erp24/records/WaybillIncoming.php index 6f115602..f9d45514 100644 --- a/erp24/records/WaybillIncoming.php +++ b/erp24/records/WaybillIncoming.php @@ -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); } } } diff --git a/erp24/views/shift-transfer/_replacement.php b/erp24/views/shift-transfer/_replacement.php index 7d7f4b17..a40f7279 100644 --- a/erp24/views/shift-transfer/_replacement.php +++ b/erp24/views/shift-transfer/_replacement.php @@ -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', 'Недостача: ') . '  ' . Html::tag('b', number_format($writeOffsBalance, 2, '.', ' ')), + 'footer' => Html::tag('b', 'Недостача: ') . '  ' . $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', 'Излишек: ') . '  ' . Html::tag('b', number_format($incomingBalance, 2, '.', ' ')), + 'footer' => Html::tag('b', 'Излишек: ') . '  ' . $incomingBalance, ], ], 'showPageSummary' => true, diff --git a/erp24/views/shift-transfer/_transfer.php b/erp24/views/shift-transfer/_transfer.php index bd721647..94140b34 100644 --- a/erp24/views/shift-transfer/_transfer.php +++ b/erp24/views/shift-transfer/_transfer.php @@ -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}', -- 2.39.5