]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-259 Доработка второго шага передачи смен feature_zozirova_erp-259_modifications_for_second_stage_shift_transfer
authormarina <m.zozirova@gmail.com>
Fri, 6 Dec 2024 09:16:17 +0000 (12:16 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 6 Dec 2024 09:16:17 +0000 (12:16 +0300)
erp24/records/EqualizationRemains.php

index 87f68da62b55ab2a851c6aea7fcca5561173ceb0..d9f3e8172aab650e89486dcc9872f274e8c1c380 100644 (file)
@@ -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));