]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-259 Доработка второго шага передачи смен
authormarina <m.zozirova@gmail.com>
Tue, 10 Dec 2024 11:14:20 +0000 (14:14 +0300)
committermarina <m.zozirova@gmail.com>
Tue, 10 Dec 2024 11:14:20 +0000 (14:14 +0300)
erp24/controllers/ShiftTransferController.php

index ce8298a57578b3334b29484d6095dab0c457ab5d..13825e813d95b96af4e48ac154dc20f92d6382f0 100644 (file)
@@ -255,7 +255,7 @@ class ShiftTransferController extends Controller
             $shiftTransfer = ShiftTransfer::findOne($shiftTransferId);
             $storeId = array_flip(array_map('strval', CityStore::getAllActiveGuidId()))[$shiftTransfer->store_guid];
             $productSelfCost = SelfCostProduct::findOne(['product_guid' => $productGuid, 'date' => $shiftTransfer->date, 'store_id' => $storeId]);
-            $balance = Balances::findOne(['store_id' => $shiftTransfer->store_guid, 'product_id' => $productGuid]);
+            $count = ShiftRemains::findOne(['shift_transfer_id' => $shiftTransferId, 'product_guid' => $productGuid]);
 
             if (!$productPrice) {
                 throw new \Exception('У данного товара нет цены либо замен!');
@@ -265,7 +265,7 @@ class ShiftTransferController extends Controller
                 'success' => true,
                 'product_price' => $productPrice->price,
                 'product_replacement_self_cost' => $productSelfCost->price,
-                'maxQuantity' => $balance->quantity,
+                'maxQuantity' => $count->fact_and_1c_diff,
             ];
 
         } catch (\Throwable $exception) {