diff --git a/statsbestproducts.php b/statsbestproducts.php index 42cb550..d7872f0 100644 --- a/statsbestproducts.php +++ b/statsbestproducts.php @@ -152,7 +152,7 @@ public function getData() ROUND(AVG(od.unit_price_tax_excl / o.conversion_rate), 2) as avgPriceSold, IFNULL(stock.quantity, 0) as quantity, IFNULL(SUM(od.product_quantity), 0) AS totalQuantitySold, - ROUND(IFNULL(IFNULL(SUM(od.product_quantity), 0) / (1 + LEAST(TO_DAYS(' . $array_date_between[1] . '), TO_DAYS(NOW())) - GREATEST(TO_DAYS(' . $array_date_between[0] . '), TO_DAYS(product_shop.date_add))), 0), 2) as averageQuantitySold, + ROUND(IFNULL(IFNULL(SUM(od.product_quantity), 0) / (1 + LEAST(TO_DAYS(' . $array_date_between[1] . '), TO_DAYS(\'' . date('Y-m-d') . '\')) - GREATEST(TO_DAYS(' . $array_date_between[0] . '), TO_DAYS(product_shop.date_add))), 0), 2) as averageQuantitySold, ROUND(IFNULL(SUM((od.unit_price_tax_excl * od.product_quantity) / o.conversion_rate), 0), 2) AS totalPriceSold, ( SELECT IFNULL(SUM(pv.counter), 0)