]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-259 Доработка второго шага передачи смен
authormarina <m.zozirova@gmail.com>
Tue, 17 Dec 2024 12:43:04 +0000 (15:43 +0300)
committermarina <m.zozirova@gmail.com>
Tue, 17 Dec 2024 12:43:04 +0000 (15:43 +0300)
erp24/records/WaybillIncomingProducts.php
erp24/records/WaybillWriteOffsProducts.php
erp24/views/shift-transfer/_replacement.php

index 5acff155f2028de7228d0ac8fbfc8573d145dcbf..67566bce867955790286e619225cb442f959a9cf 100644 (file)
@@ -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;
             }
index ff7a933d4aa4a865f1e91690fd788e4e0a05202f..2bdd490995dfa1c08b816af246c301e666ca6c9b 100644 (file)
@@ -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']);
     }
 }
index cec108e4a4b53a92a74f022676a56d7fbd710e12..e429a6d3b3494b6504f5ebd4de979f4ced1fcad0 100644 (file)
@@ -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',