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 1/3] 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; From c8851cfca6412f34824407b18dfc5bb786d5da63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Tue, 14 Aug 2012 21:23:50 +0200 Subject: [PATCH 2/3] Fixed a problem with supplier's orders stats They were showing orders even if they were not approved or ordered --- htdocs/commande/class/commandestats.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index d531c5da6c5..88875f1d08f 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (c) 2005 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 @@ -73,7 +74,7 @@ class CommandeStats extends Stats $this->from = MAIN_DB_PREFIX.$object->table_element." as c"; $this->from.= ", ".MAIN_DB_PREFIX."societe as s"; $this->field='total_ht'; - $this->where.= " c.fk_statut > 0"; // Not draft and not cancelled + $this->where.= " c.fk_statut > 2"; // Only approved & ordered } $this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; From 37332ee0408d38ba37cb85543457f4d9a02454d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 15 Aug 2012 01:20:53 +0200 Subject: [PATCH 3/3] Forgot to rename the variable --- htdocs/compta/deplacement/stats/index.php | 2 +- htdocs/compta/facture/stats/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 7f4ba7a4681..a5aa5ccf864 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -138,7 +138,7 @@ if (! $mesg) } -$res = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 36923cdf7ca..9ba9672b176 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -149,7 +149,7 @@ if (! $mesg) } -$res = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) {