$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('У данного товара нет цены либо замен!');
'success' => true,
'product_price' => $productPrice->price,
'product_replacement_self_cost' => $productSelfCost->price,
- 'maxQuantity' => $balance->quantity,
+ 'maxQuantity' => $count->fact_and_1c_diff,
];
} catch (\Throwable $exception) {