->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));