From 40660482d4163d20bdc1eeb3371a377a932eb789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 15 Aug 2012 07:30:28 +0200 Subject: [PATCH] Fixed more average amount graph stats. They include: * Customer's orders * Supplier's orders * Customer's invoices * Trips and expense Conflicts: htdocs/commande/stats/index.php --- htdocs/commande/stats/index.php | 12 ++++-------- htdocs/compta/deplacement/stats/index.php | 11 +++-------- htdocs/compta/facture/stats/index.php | 11 +++-------- 3 files changed, 10 insertions(+), 24 deletions(-) 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;