diff --git a/core/lib/Thelia/Model/OrderQuery.php b/core/lib/Thelia/Model/OrderQuery.php index a2741bac1..ac52218a9 100644 --- a/core/lib/Thelia/Model/OrderQuery.php +++ b/core/lib/Thelia/Model/OrderQuery.php @@ -31,14 +31,11 @@ class OrderQuery extends BaseOrderQuery $stats = array(); for($day=1; $day<=$numberOfDay; $day++) { - $dayAmount = 0; - foreach(self::create() - ->filterByStatusId(array(2,3,4), Criteria::IN) - ->filterByCreatedAt(sprintf("%s-%s-%s 00:00:00", $year, $month, $day), Criteria::GREATER_EQUAL) - ->filterByCreatedAt(sprintf("%s-%s-%s 23:59:59", $year, $month, $day), Criteria::LESS_EQUAL) - ->find() as $dayOrders) { - $dayAmount += $dayOrders->getTotalAmount(); - } + $dayAmount = self::getSaleStats( + new \DateTime(sprintf('%s-%s-%s', $year, $month, $day)), + new \DateTime(sprintf('%s-%s-%s', $year, $month, $day)), + true + ); $stats[] = array($day-1, $dayAmount); } diff --git a/templates/backOffice/default/home.html b/templates/backOffice/default/home.html index e943e05c8..0204fe4c7 100644 --- a/templates/backOffice/default/home.html +++ b/templates/backOffice/default/home.html @@ -336,7 +336,6 @@ jQuery(function($){ }); function retrieveJQPlotJson(month, year, callback) { - console.log(month, year); $.getJSON(url, {month: month, year: year}) .done(function(data) { @@ -386,17 +385,12 @@ jQuery(function($){ // Init jQPlot var series = initJqplotData(jQplotData); - console.log('END_INIT', series); - // Start jQPlot if(jQPlotInstance) { jQPlotInstance.destroy(); - console.log('OLD_DELETED'); } jQPlotInstance = $.jqplot("jqplot", series, jQPlotsOptions); - console.log('END_LAUNCH'); - $(window).bind('resize', function(event, ui) { jQPlotInstance.replot( { resetAxes: true } ); });