diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 722a8a3f35f..f12d5bb309d 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -1,6 +1,8 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -168,12 +170,7 @@ if (! $mesg) } -$res = $stats->getAverageByMonth($year); -$data = array(); -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -193,8 +190,7 @@ $mesg = $px3->isGraphKo(); if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index d07f816f1bc..7f4ba7a4681 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -1,6 +1,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2012 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -137,12 +138,7 @@ if (! $mesg) } -$res = $stats->getAverageByMonth($year); -$data = array(); -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} +$res = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -162,8 +158,7 @@ $mesg = $px3->isGraphKo(); if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i = $startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 510091c4832..36923cdf7ca 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -1,6 +1,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2012 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -148,12 +149,7 @@ if (! $mesg) } -$res = $stats->getAverageByMonth($year); -$data = array(); -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} +$res = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -173,8 +169,7 @@ $mesg = $px3->isGraphKo(); if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i = $startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i;