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