From 3460821e51a59f6f511894f9058092d104fe76fe Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 21 Feb 2013 11:30:13 +0100 Subject: [PATCH] [-] BO : fixed payment distribution #PSCFV-7398 --- modules/statsforecast/statsforecast.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/statsforecast/statsforecast.php b/modules/statsforecast/statsforecast.php index d27f8c756..015a5c1b2 100644 --- a/modules/statsforecast/statsforecast.php +++ b/modules/statsforecast/statsforecast.php @@ -348,9 +348,9 @@ class StatsForecast extends Module foreach ($ca['payment'] as $payment) $this->_html .= ' - '.$payment['module'].' - '.(int)$payment['nb'].'
'.($ca['ventil']['nb'] ? number_format((100 * $payment['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').' % - '.Tools::displayPrice($payment['total'], $currency).'
'.((int)$ca['ventil']['total'] ? number_format((100 * $payment['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').' % + '.$payment['payment_method'].' + '.(int)$payment['nb'].' + '.Tools::displayPrice($payment['total'], $currency).' '.Tools::displayPrice($payment['cart'], $currency).' '; $this->_html .= ' @@ -518,14 +518,15 @@ class StatsForecast extends Module $ca['langprev'] = array(); } - $sql = 'SELECT module, SUM(total_paid_tax_incl / o.conversion_rate) as total, COUNT(*) as nb, AVG(total_paid_tax_incl / o.conversion_rate) as cart + $sql = 'SELECT op.payment_method, SUM(amount / o.conversion_rate) as total, COUNT(*) as nb, AVG(amount / o.conversion_rate) as cart FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_payment` op ON o.reference = op.order_reference '.$join.' WHERE o.valid = 1 AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().' '.$where.' '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' - GROUP BY o.module + GROUP BY op.payment_method ORDER BY total DESC'; $ca['payment'] = Db::getInstance()->executeS($sql);