';
print '| 0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.' | ';
print ''.$val['nb'].' | ';
+ print ''.round($val['nb_diff']).' | ';
print ''.price(price2num($val['total'],'MT'),1).' | ';
+ print ''.round($val['total_diff']).' | ';
print ''.price(price2num($val['avg'],'MT'),1).' | ';
+ print ''.round($val['avg_diff']).' | ';
print '
';
$oldyear=$year;
}
diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php
index 71558be0e57..fd384524597 100644
--- a/htdocs/commande/stats/index.php
+++ b/htdocs/commande/stats/index.php
@@ -279,8 +279,11 @@ print '';
print '';
print '| '.$langs->trans("Year").' | ';
print ''.$langs->trans("NbOfOrders").' | ';
+print '% | ';
print ''.$langs->trans("AmountTotal").' | ';
+print '% | ';
print ''.$langs->trans("AmountAverage").' | ';
+print '% | ';
print '
';
$oldyear=0;
@@ -302,8 +305,11 @@ foreach ($data as $val)
print '';
print '| 0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.' | ';
print ''.$val['nb'].' | ';
+ print ''.round($val['nb_diff']).' | ';
print ''.price(price2num($val['total'],'MT'),1).' | ';
+ print ''.round($val['total_diff']).' | ';
print ''.price(price2num($val['avg'],'MT'),1).' | ';
+ print ''.round($val['avg_diff']).' | ';
print '
';
$oldyear=$year;
}
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index 4eeea76abc0..afd17ed2f17 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -263,8 +263,11 @@ print '';
print '';
print '| '.$langs->trans("Year").' | ';
print ''.$langs->trans("NumberOfBills").' | ';
+print '% | ';
print ''.$langs->trans("AmountTotal").' | ';
+print '% | ';
print ''.$langs->trans("AmountAverage").' | ';
+print '% | ';
print '
';
$oldyear=0;
@@ -284,8 +287,11 @@ foreach ($data as $val)
print '';
print '| 0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.' | ';
print ''.$val['nb'].' | ';
+ print ''.round($val['nb_diff']).' | ';
print ''.price(price2num($val['total'],'MT'),1).' | ';
+ print ''.round($val['total_diff']).' | ';
print ''.price(price2num($val['avg'],'MT'),1).' | ';
+ print ''.round($val['avg_diff']).' | ';
print '
';
$oldyear=$year;
}
diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php
index 9a459f33e41..8ef77f3d282 100644
--- a/htdocs/core/class/stats.class.php
+++ b/htdocs/core/class/stats.class.php
@@ -383,8 +383,11 @@ abstract class Stats
$row = $this->db->fetch_object($resql);
$result[$i]['year'] = $row->year;
$result[$i]['nb'] = $row->nb;
+ if($i>0) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
$result[$i]['total'] = $row->total;
+ if($i>0) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
$result[$i]['avg'] = $row->avg;
+ if($i>0) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
$i++;
}
$this->db->free($resql);