From d79e8a385d17186dbb807de658b1b15c016d7c1c Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 17 Dec 2024 15:43:04 +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/WaybillIncomingProducts.php | 6 +++--- erp24/records/WaybillWriteOffsProducts.php | 19 +++++++++++-------- erp24/views/shift-transfer/_replacement.php | 4 +++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/erp24/records/WaybillIncomingProducts.php b/erp24/records/WaybillIncomingProducts.php index 5acff155..67566bce 100644 --- a/erp24/records/WaybillIncomingProducts.php +++ b/erp24/records/WaybillIncomingProducts.php @@ -77,16 +77,16 @@ class WaybillIncomingProducts extends \yii\db\ActiveRecord ->select('SUM(product_replacement_count) as sum') ->scalar(); - $count = 0; if ($er) { if ($er == $itemCount) { continue; } - if ($itemCount > $er) { $count = $itemCount - $er; + if ($count == 0) { + continue; + } } - } else { $count = $itemCount; } diff --git a/erp24/records/WaybillWriteOffsProducts.php b/erp24/records/WaybillWriteOffsProducts.php index ff7a933d..2bdd4909 100644 --- a/erp24/records/WaybillWriteOffsProducts.php +++ b/erp24/records/WaybillWriteOffsProducts.php @@ -73,21 +73,23 @@ class WaybillWriteOffsProducts extends \yii\db\ActiveRecord foreach ($items as $item) { $itemCount = abs($item->fact_and_1c_diff); $er = EqualizationRemains::find() - ->andWhere(['shift_transfer_id' => $shiftTransfer->id]) - ->andWhere(['product_id' => $item->product_guid]) - ->select('SUM(product_replacement_count) as sum') - ->scalar(); - - $count = $itemCount; + ->andWhere(['shift_transfer_id' => $shiftTransfer->id]) + ->andWhere(['product_id' => $item->product_guid]) + ->select('SUM(product_replacement_count) as sum') + ->scalar(); if ($er) { if ($er == $itemCount) { continue; } - if ($itemCount > $er) { $count = $itemCount - $er; + if ($count == 0) { + continue; + } } + } else { + $count = $itemCount; } $model = new self(); @@ -141,7 +143,8 @@ class WaybillWriteOffsProducts extends \yii\db\ActiveRecord return $this->hasOne(WaybillWriteOffs::class, ['id' => 'waybill_write_offs_id']); } - public function getProduct() { + public function getProduct() + { return $this->hasOne(Products1c::class, ['id' => 'product_id']); } } diff --git a/erp24/views/shift-transfer/_replacement.php b/erp24/views/shift-transfer/_replacement.php index cec108e4..e429a6d3 100644 --- a/erp24/views/shift-transfer/_replacement.php +++ b/erp24/views/shift-transfer/_replacement.php @@ -231,7 +231,9 @@ if (in_array($shiftTransfer->status_id, [ShiftTransfer::STATUS_ID_TRANSFER_ACTIO 'label' => 'Количество товара', 'format' => 'raw', 'pageSummary' => true, - 'footer' => Html::tag('b', $totalBalance < 0 ? 'Недостача: ' : 'Избыток: ') + 'footer' => Html::tag('b', + $totalBalance < 0 ? 'Недостача: ' : ($totalBalance == 0 ? '' : 'Избыток: ')) + ], [ 'attribute' => 'balance', -- 2.39.5