Bug #PSCFV-5626 - Amended SQL query to correctly sum the totals for each day.
This commit is contained in:
1 parent
f562cd875d
commit
fc7d36dd89
1 file changed
+3
-3
@@ -374,15 +374,15 @@ class AdminHomeControllerCore extends AdminController
|
|||||||
|
|
||||||
$chart = new Chart();
|
$chart = new Chart();
|
||||||
$chart->getCurve(1)->setType('bars');
|
$chart->getCurve(1)->setType('bars');
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT sum(total_paid / conversion_rate) as total_converted, left(invoice_date, 10) as trimmed_invoice_date
|
||||||
SELECT total_paid / conversion_rate as total_converted, left(invoice_date, 10) as invoice_date
|
|
||||||
FROM '._DB_PREFIX_.'orders o
|
FROM '._DB_PREFIX_.'orders o
|
||||||
WHERE valid = 1
|
WHERE valid = 1
|
||||||
AND invoice_date BETWEEN \''.date('Y-m-d', strtotime('-7 DAYS', time())).' 00:00:00\' AND \''.date('Y-m-d H:i:s').'\'
|
AND invoice_date BETWEEN \''.date('Y-m-d', strtotime('-7 DAYS', time())).' 00:00:00\' AND \''.date('Y-m-d H:i:s').'\'
|
||||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER).'
|
'.Shop::addSqlRestriction(Shop::SHARE_ORDER).'
|
||||||
|
GROUP BY trimmed_invoice_date
|
||||||
');
|
');
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
$chart->getCurve(1)->setPoint(strtotime($row['invoice_date'].' 02:00:00'), $row['total_converted']);
|
$chart->getCurve(1)->setPoint(strtotime($row['trimmed_invoice_date'].' 02:00:00'), $row['total_converted']);
|
||||||
$chart->setSize(580, 170);
|
$chart->setSize(580, 170);
|
||||||
$chart->setTimeMode(strtotime('-7 DAYS', time()), time(), 'd');
|
$chart->setTimeMode(strtotime('-7 DAYS', time()), time(), 'd');
|
||||||
$currency = Tools::setCurrency($this->context->cookie);
|
$currency = Tools::setCurrency($this->context->cookie);
|
||||||
|
|||||||
Reference in new issue
Block a user