diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 33bce9fb17d51..4b89db3f484ee 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 e05a846fd33fa..b3af35d5b3c0a 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Charles-Fr BENKE * * 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 @@ $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 ''; @@ -124,40 +126,105 @@ $statProducts.= ''; $statProducts.= ""; $statProducts.= ""; - $statProducts.= ''; + $statProducts.= ''; $statProducts.= ""; + $statProducts.= ""; + $statProducts.= ''; + $statProducts.= ""; + } if (! empty($conf->service->enabled)) { - $statServices = ""; + $statServices = ""; $statServices.= ''; $statServices.= ""; + $statServices.= ""; + $statServices.= ''; + $statServices.= ""; $statServices.= ""; - $statServices.= ''; + $statServices.= ''; $statServices.= ""; + } $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 ''; print '
'.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).'
'.$langs->trans("ProductsOnSell").''.round($prodser[0][1]).''.$langs->trans("ProductsOnSell").''.round($prodser[0][1]).'
'.$langs->trans("ProductsOnSellAndOnBuy").''.round($prodser[0][2]).'
'.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).'
'.$langs->trans("ServicesOnSell").''.round($prodser[1][1]).'
'.$langs->trans("ServicesOnSell").''.round($prodser[1][1]).''.$langs->trans("ServicesOnSellAndOnBuy").''.round($prodser[1][2]).'
'.$langs->trans("Total").''; print $total; print '
'; - +if (! empty($conf->categorie->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + print '
'; + print ''; + print ''; + print ''; + $total+=$obj->nb; + $i++; + } + } + } + print ''; + print ''; + print '
'.$langs->trans("Categories").'
'; + $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 '
'.$obj->label.''.$obj->nb.'
'.$langs->trans("Total").''; + print $total; + print '
'; +} print '
'; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 1f668008baa95..3cf38a58b90a6 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Charles-Fr Benke * * 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 ''; print ''; +if (! empty($conf->categorie->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $elementtype = 'societe'; + print '
'; + print ''; + print ''; + print ''; + $total+=$obj->nb; + $i++; + } + } + } + print ''; + print ''; + print '
'.$langs->trans("Categories").'
'; + $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 '
'.$obj->label.''.$obj->nb.'
'.$langs->trans("Total").''; + print $total; + print '
'; +} //print ''; print '
';