From 764c0a50cd9d11735372ecaf39246d147cec37d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Tue, 14 Aug 2012 21:23:14 +0200 Subject: [PATCH] Fixed more average amount graph stats. They include: * Customer's orders * Supplier's orders * Customer's invoices * Trips and expense --- htdocs/commande/stats/index.php | 11 +++-------- htdocs/compta/deplacement/stats/index.php | 11 +++-------- htdocs/compta/facture/stats/index.php | 11 +++-------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index eb659e2db44..dff729f34e9 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * 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 @@ -169,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) { @@ -194,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;