diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang
index 33bce9fb17d51860d171a893ef7baeea1f7c6470..4b89db3f484ee9c2ff00a80b550aacdb0a1c347c 100644
--- a/htdocs/langs/fr_FR/products.lang
+++ b/htdocs/langs/fr_FR/products.lang
@@ -27,8 +27,10 @@ ProductsAndServicesNotOnSell=Produits et Services hors vente
 ProductsAndServicesStatistics=Statistiques produits et services
 ProductsStatistics=Statistiques produits
 ProductsOnSell=Produits en vente ou en achat
+ProductsOnSellAndOnBuy=Produits en vente et en achat
 ProductsNotOnSell=Produits hors vente et hors achat
 ServicesOnSell=Services en vente ou en achat
+ServicesOnSellAndOnBuy=Services en vente et en achat
 ServicesNotOnSell=Services hors vente et hors achat
 InternalRef=Référence interne
 LastRecorded=Derniers produits/services en vente enregistrés
diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index e05a846fd33fa3e7445c548da507d3a0b4d79baa..b3af35d5b3c0a37544bd7f27d2272e102fa0c770 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -2,6 +2,7 @@
 /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2004-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copyright (C)      2014 Charles-Fr BENKE     <charles.fr@benke.fr>
  *
  * 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
@@ -111,9 +112,10 @@ $sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
 $result = $db->query($sql);
 while ($objp = $db->fetch_object($result))
 {
-	$status=1;
+	$status=2;
 	if (! $objp->tosell && ! $objp->tobuy) $status=0;	// To sell OR to buy
-	$prodser[$objp->fk_product_type][$status]+=$objp->total;
+	if ((! $objp->tosell && $objp->tobuy) || ($objp->tosell && ! $objp->tobuy)) $status=1;
+	$prodser[$objp->fk_product_type][$status]=$objp->total;
 }
 
 print '<table class="noborder" width="100%">';
@@ -124,40 +126,105 @@ if (! empty($conf->product->enabled))
 	$statProducts.= '<td><a href="liste.php?type=0&amp;tosell=0&amp;tobuy=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
 	$statProducts.= "</tr>";
 	$statProducts.= "<tr ".$bc[1].">";
-	$statProducts.= '<td><a href="liste.php?type=0&amp;tosell=1">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
+	$statProducts.= '<td><a href="liste.php?type=0">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
 	$statProducts.= "</tr>";
+	$statProducts.= "<tr ".$bc[0].">";
+	$statProducts.= '<td><a href="liste.php?type=0&amp;tosell=1&amp;tobuy=1">'.$langs->trans("ProductsOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[0][2]).'</td>';
+	$statProducts.= "</tr>";
+
 }
 if (! empty($conf->service->enabled))
 {
-	$statServices = "<tr ".$bc[0].">";
+	$statServices = "<tr ".$bc[1].">";
 	$statServices.= '<td><a href="liste.php?type=1&amp;tosell=0&amp;tobuy=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
 	$statServices.= "</tr>";
+	$statServices.= "<tr ".$bc[0].">";
+	$statServices.= '<td><a href="liste.php?type=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
+	$statServices.= "</tr>";
 	$statServices.= "<tr ".$bc[1].">";
-	$statServices.= '<td><a href="liste.php?type=1&amp;tosell=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
+	$statServices.= '<td><a href="liste.php?type=1&amp;tosell=1&amp;tobuy=1">'.$langs->trans("ServicesOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[1][2]).'</td>';
 	$statServices.= "</tr>";
+
 }
 $total=0;
 if ($type == '0')
 {
 	print $statProducts;
-	$total=round($prodser[0][0])+round($prodser[0][1]);
+	$total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]);
 }
 else if ($type == '1')
 {
 	print $statServices;
-	$total=round($prodser[1][0])+round($prodser[1][1]);
+	$total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2]);
 }
 else
 {
 	print $statProducts.$statServices;
-	$total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[0][0])+round($prodser[0][1]);
+	$total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]);
 }
 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
 print $total;
 print '</td></tr>';
 print '</table>';
 
-
+if (! empty($conf->categorie->enabled))
+{
+	require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+	print '<br>';
+	print '<table class="noborder" width="100%">';
+	print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
+	print '<tr><td align="center">';
+	$sql = "SELECT c.label, count(*) as nb";
+	$sql.= " FROM ".MAIN_DB_PREFIX."categorie_product as cs";
+	$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
+	$sql.= " WHERE c.type = 0";
+	$sql.= " AND c.entity IN (".getEntity('category',1).")";
+	$sql.= " GROUP BY c.label";
+	$total=0;
+	$result = $db->query($sql);
+	if ($result)
+	{
+		$num = $db->num_rows($result);
+		$i=0;
+		if (! empty($conf->use_javascript_ajax))
+		{
+			$dataseries=array();
+			$rest=0;
+			$nbmax=10;
+			while ($i < $num)
+			{
+				$obj = $db->fetch_object($result);
+				if ($i < $nbmax)
+					$dataseries[]=array('label'=>$obj->label,'data'=>round($obj->nb));
+				else
+					$rest+=$obj->nb;
+				$total+=$obj->nb;
+				$i++;
+			}
+			if ($i > $nbmax)
+				$dataseries[]=array('label'=>$langs->trans("Other"),'data'=>round($rest));
+			$data=array('series'=>$dataseries);
+			dol_print_graph('statscategproduct',300,180,$data,1,'pie',0);
+		}
+		else
+		{
+			$var=true;
+			while ($i < $num)
+			{
+				$obj = $db->fetch_object($result);
+				$var=!$var;
+				print '<tr $bc[$var]><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
+				$total+=$obj->nb;
+				$i++;
+			}
+		}
+	}
+	print '</td></tr>';
+	print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
+	print $total;
+	print '</td></tr>';
+	print '</table>';
+}
 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
 
 
diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php
index 1f668008baa95564ff4115747c88d21d1b657018..3cf38a58b90a63d283608a750e166a5acf1dc77d 100644
--- a/htdocs/societe/index.php
+++ b/htdocs/societe/index.php
@@ -2,6 +2,7 @@
 /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2004-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copyright (C)      2014 Charles-Fr Benke	<charles.fr@benke.fr>
  *
  * 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
@@ -158,6 +159,66 @@ print $total;
 print '</td></tr>';
 print '</table>';
 
+if (! empty($conf->categorie->enabled))
+{
+	require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+	$elementtype = 'societe';
+	print '<br>';
+	print '<table class="noborder" width="100%">';
+	print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
+	print '<tr><td align="center">';
+	$sql = "SELECT c.label, count(*) as nb";
+	$sql.= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
+	$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
+	$sql.= " WHERE c.type = 2";
+	$sql.= " AND c.entity IN (".getEntity('category',1).")";
+	$sql.= " GROUP BY c.label";
+	$total=0;
+	$result = $db->query($sql);
+	if ($result)
+	{
+		$num = $db->num_rows($result);
+		$i=0;
+		if (! empty($conf->use_javascript_ajax) )
+		{
+			$dataseries=array();
+			$rest=0;
+			$nbmax=10;
+
+			while ($i < $num)
+			{
+				$obj = $db->fetch_object($result);
+				if ($i < $nbmax)
+					$dataseries[]=array('label'=>$obj->label,'data'=>round($obj->nb));
+				else
+					$rest+=$obj->nb;
+				$total+=$obj->nb;
+				$i++;
+			}
+			if ($i > $nbmax)
+				$dataseries[]=array('label'=>$langs->trans("Other"),'data'=>round($rest));
+			$data=array('series'=>$dataseries);
+			dol_print_graph('statscategclient',300,180,$data,1,'pie',0);
+		}
+		else
+		{
+			$var=true;
+			while ($i < $num)
+			{
+				$obj = $db->fetch_object($result);
+				$var=!$var;
+				print '<tr $bc[$var]><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
+				$total+=$obj->nb;
+				$i++;
+			}
+		}
+	}
+	print '</td></tr>';
+	print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
+	print $total;
+	print '</td></tr>';
+	print '</table>';
+}
 
 //print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';