|
|
|
|
|
|
|
|
$res = Yii::$app->db->createCommand("SELECT product.name, SUM(product_order.quantity) AS quantity, SUM(product_order.price * product_order.quantity) AS total |
|
|
$res = Yii::$app->db->createCommand("SELECT product.name, SUM(product_order.quantity) AS quantity, SUM(product_order.price * product_order.quantity) AS total |
|
|
FROM `order`, product_order, product |
|
|
FROM `order`, product_order, product |
|
|
WHERE `order`.id = product_order.id_order |
|
|
WHERE `order`.id = product_order.id_order |
|
|
|
|
|
AND product.id_producer = ".((int) Producer::getId())." |
|
|
AND product_order.id_product = product.id |
|
|
AND product_order.id_product = product.id |
|
|
AND `order`.date_delete IS NULL |
|
|
AND `order`.date_delete IS NULL |
|
|
".$conditionUsers." |
|
|
".$conditionUsers." |