From: marina Date: Fri, 6 Dec 2024 09:16:17 +0000 (+0300) Subject: ERP-259 Доработка второго шага передачи смен X-Git-Tag: 1.7~187^2~9 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=d48acbd597ca0844c8ad6f843489f9697db9722e;p=erp24_rep%2Fyii-erp24%2F.git ERP-259 Доработка второго шага передачи смен --- diff --git a/erp24/records/EqualizationRemains.php b/erp24/records/EqualizationRemains.php index 87f68da6..d9f3e817 100644 --- a/erp24/records/EqualizationRemains.php +++ b/erp24/records/EqualizationRemains.php @@ -137,25 +137,26 @@ class EqualizationRemains extends \yii\db\ActiveRecord ->andWhere(['shift_transfer_id' => $shiftTransfer->id]) ->andWhere(['!=', 'fact_and_1c_diff', 0]) ->andWhere(['>', 'fact_and_1c_diff', 0]) + ->orderBy('retail_price') ->all(); $minus = ArrayHelper::map(ShiftRemains::find() ->andWhere(['shift_transfer_id' => $shiftTransfer->id]) ->andWhere(['!=', 'fact_and_1c_diff', 0]) ->andWhere(['<', 'fact_and_1c_diff', 0]) - ->select(['product_guid_id', 'fact_and_1c_diff', 'retail_price', 'self_cost']) + ->select(['product_guid', 'fact_and_1c_diff', 'retail_price', 'self_cost']) ->asArray() - ->all(), 'product_guid_id', function ($item) { + ->all(), 'product_guid', function ($item) { return ['fact_and_1c_diff' => $item['fact_and_1c_diff'], 'retail_price' => $item['retail_price'], 'self_cost' => $item['self_cost']]; }); - foreach ($plus as $p) { $replacement = Product1cReplacement::find() - ->andWhere(['guid' => $p->product_guid]) - ->select('guid_replacement') + ->andWhere(['guid_replacement' => $p->product_guid]) + ->select('guid') ->column(); + $quanity = $p->fact_and_1c_diff; $intersection = array_intersect_key($minus, array_flip($replacement));