From: marina Date: Fri, 13 Dec 2024 13:49:33 +0000 (+0300) Subject: ERP-259 Доработка второго шага передачи смен X-Git-Tag: 1.7~160^2~11 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b38ef671815c8036b5f6371f2109339e00c969cb;p=erp24_rep%2Fyii-erp24%2F.git ERP-259 Доработка второго шага передачи смен --- 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}',