From d48acbd597ca0844c8ad6f843489f9697db9722e Mon Sep 17 00:00:00 2001 From: marina Date: Fri, 6 Dec 2024 12:16:17 +0300 Subject: [PATCH] =?utf8?q?ERP-259=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?utf8?q?=D1=82=D0=BA=D0=B0=20=D0=B2=D1=82=D0=BE=D1=80=D0=BE=D0=B3=D0=BE?= =?utf8?q?=20=D1=88=D0=B0=D0=B3=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?utf8?q?=D0=B0=D1=87=D0=B8=20=D1=81=D0=BC=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/EqualizationRemains.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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)); -- 2.39.5