$returnSalesIds = ArrayHelper::getColumn($returnSales, 'sales_check');
// Ищем продукты из категории services
- $salesProduct = SalesProducts::find()->alias('p')
- ->select(['SUM(p.summ) as total'])
- ->leftJoin('sales s', 's.id = p.check_id')
+ $salesProduct = SalesProducts::find()
+ ->select(['SUM(summ) as total'])
->where(['check_id' => $salesIds])
->andWhere(['NOT IN', 'check_id', $returnSalesIds])
->andWhere(['product_id' => array_keys($products1c)])
- ->andWhere(['s.store_id' => $store_id])
->asArray()->one();
$correction = self::getMotivationValue($motivations[$store_id]->id, 8, self::CODE_ASSEMBLY_SERVICES);
$returnSalesIdsDelivery = ArrayHelper::getColumn($returnSalesDelivery, 'sales_check');
// Ищем продукты из категории services_delivery
- $salesProductDelivery = SalesProducts::find()->alias('p')
- ->select(['SUM(p.summ) as total'])
- ->leftJoin('sales s', 's.id = p.check_id')
+ $salesProductDelivery = SalesProducts::find()
+ ->select(['SUM(summ) as total'])
->where(['check_id' => $salesIdsDelivery])
->andWhere(['NOT IN', 'check_id', $returnSalesIdsDelivery])
->andWhere(['product_id' => array_keys($products1cDelivery)])
- ->andWhere(['s.store_id' => $store_id])
->asArray()->one();
$correctionDelivery = self::getMotivationValue($motivations[$store_id]->id, 8, self::CODE_DELIVERY_SERVICES);