diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 0973de848b5..c2e232fcec0 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -69,7 +69,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele { $listofsearchfields['search_contact']=array('text'=>'Contact'); } - + if (count($listofsearchfields)) { print '
'; @@ -85,7 +85,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; $i++; } - print ''; + print ''; print '
'; print '
'; } @@ -95,7 +95,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele /* * Statistics area */ - + $third = array( 'customer' => 0, 'prospect' => 0, @@ -131,33 +131,40 @@ print ''."\n"; print ''; if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2)) { - print ''."\n"; } else { if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { - $statstring = ""; + $statstring = ""; $statstring.= ''; $statstring.= ""; } if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) { - $statstring.= ""; + $statstring.= ""; $statstring.= ''; $statstring.= ""; } if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) { - $statstring2 = ""; + $statstring2 = ""; $statstring2.= ''; $statstring2.= ""; } @@ -202,24 +209,36 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS { $obj = $db->fetch_object($result); if ($i < $nbmax) - $dataseries[]=array('label'=>$obj->label,'data'=>round($obj->nb)); + { + $dataseries[]=array($obj->label, 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); + { + $dataseries[]=array($langs->trans("Other"), round($rest)); + } + include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; + $dolgraph = new DolGraph(); + $dolgraph->SetData($dataseries); + $dolgraph->setShowLegend(1); + $dolgraph->setShowPercent(1); + $dolgraph->SetType(array('pie')); + $dolgraph->setWidth('100%'); + $dolgraph->draw('idgraphcateg'); + print $dolgraph->show(); } else { - $var=true; while ($i < $num) { $obj = $db->fetch_object($result); - + print ''; $total+=$obj->nb; $i++; @@ -275,16 +294,10 @@ if ($result) print ''; print ''."\n"; - $var=True; - while ($i < $num) { $objp = $db->fetch_object($result); - - print ''; - // Name - print ''; + // Name + print '\n"; // Type
'.$langs->trans("Statistics").'
'; + print '
'; $dataseries=array(); - if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); - if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Suppliers"),'data'=>round($third['supplier'])); - if (! empty($conf->societe->enabled)) $dataseries[]=array('label'=>$langs->trans("Others"),'data'=>round($third['other'])); - $data=array('series'=>$dataseries); - dol_print_graph('stats',300,180,$data,1,'pie',0,'',0); + if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array($langs->trans("Prospects"), round($third['prospect'])); + if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array($langs->trans("Customers"), round($third['customer'])); + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array($langs->trans("Suppliers"), round($third['supplier'])); + if (! empty($conf->societe->enabled)) $dataseries[]=array($langs->trans("Others"), round($third['other'])); + include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; + $dolgraph = new DolGraph(); + $dolgraph->SetData($dataseries); + $dolgraph->setShowLegend(1); + $dolgraph->setShowPercent(1); + $dolgraph->SetType(array('pie')); + $dolgraph->setWidth('100%'); + $dolgraph->draw('idgraphthirdparties'); + print $dolgraph->show(); print '
'.$langs->trans("Prospects").''.round($third['prospect']).'
'.$langs->trans("Customers").''.round($third['customer']).'
'.$langs->trans("Suppliers").''.round($third['supplier']).'
'.$obj->label.''.$obj->nb.'
'.$langs->trans('Status').'
'; $thirdparty_static->id=$objp->rowid; $thirdparty_static->name=$objp->name; $thirdparty_static->client=$objp->client; @@ -295,6 +308,10 @@ if ($result) $thirdparty_static->code_client = $objp->code_client; $thirdparty_static->code_fournisseur = $objp->code_fournisseur; $thirdparty_static->canvas=$objp->canvas; + + print '
'; print $thirdparty_static->getNomUrl(1); print "