Mdelatte Posted December 27, 2021 Share Posted December 27, 2021 bonjour je ne trouve pas (prestashop 1.7.2.4) dans le module Statistique de base , la possibilité de sortir le chiffre d'affaire réalisé par pays pour une période donnée (l'année en cours m'irait bien) cela existe t il dans le module ? sinon, quelqu'un a la requete SQL qui fait le job ? merci ! Link to comment Share on other sites More sharing options...
Thomas_B Posted February 10, 2022 Share Posted February 10, 2022 (edited) Salut Je cherche la même chose, s'il y a une bonne âme sur le site qui nous entends 😇 Idéalement il faudrait : Total CA / Pays de livraison / à partir de date / jusqu'à date Total TVA / Pays de livraison / à partir de date / jusqu'à date ca permettrait de le faire par mois ainsi qu'à l'année. Edited February 10, 2022 by Thomas_B précisions (see edit history) Link to comment Share on other sites More sharing options...
Thomas_B Posted February 10, 2022 Share Posted February 10, 2022 Bon je me réponds a moi meme car j ai ecrit la solution dans le fichier des stats statsforecast.php dans /modules/statsforecast après la ligne $ca['zones'] = Db::getInstance()->executeS($sql); ajouter $sql = 'SELECT z.name, SUM(o.total_paid_tax_excl / o.conversion_rate) as total, (SUM(o.total_paid_tax_incl / o.conversion_rate) - SUM(o.total_paid_tax_excl / o.conversion_rate)) as taxes, COUNT(*) as nb FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_invoice = a.id_address LEFT JOIN `'._DB_PREFIX_.'country` c ON c.id_country = a.id_country LEFT JOIN `'._DB_PREFIX_.'country_lang` z ON z.id_country = c.id_country AND z.id_lang = 2 WHERE o.valid = 1 AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().' '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' GROUP BY c.id_country ORDER BY total DESC'; $ca['countries'] = Db::getInstance()->executeS($sql); et après la section foreach ($ca['zones'] as $zone) { $this->html .= ' <tr> <td class="text-center">'.(isset($zone['name']) ? $zone['name'] : $this->trans('Undefined', array(), 'Admin.Shopparameters.Feature')).'</td> <td class="text-center">'.(int)($zone['nb']).'</td> <td class="text-right">'.Tools::displayPrice($zone['total'], $currency).'</td> <td class="text-center">'.($ca['ventil']['nb'] ? number_format((100 * $zone['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td> <td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $zone['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td> </tr>'; } ajouter $this->html .= ' </tbody> </table> </div> <div class="row row-margin-bottom"> <h4><i class="icon-map-marker"></i> '.$this->trans('Pays distribution', array(), 'Modules.Statsforecast.Admin').'</h4> <table class="table"> <thead> <tr> <th class="text-center"><span class="title_box active">'.$this->trans('Countries', array(), 'Admin.Global').'</span></th> <th class="text-center"><span class="title_box active">'.$this->trans('Orders', array(), 'Admin.Global').'</span></th> <th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th> <th class="text-center"><span class="title_box active">'.$this->trans('Taxes', array(), 'Modules.Statsforecast.Admin').'</span></th> </tr> </thead> <tbody>'; foreach ($ca['countries'] as $country) { $this->html .= ' <tr> <td class="text-center">'.(isset($country['name']) ? $country['name'] : $this->trans('Undefined', array(), 'Admin.Shopparameters.Feature')).'</td> <td class="text-center">'.(int)($country['nb']).'</td> <td class="text-right">'.Tools::displayPrice($country['total'], $currency).'</td> <td class="text-right">'.Tools::displayPrice($country['taxes'], $currency).'</td> </tr>'; } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now