diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index 69e5a13e57b..a3b01cea660 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -32,10 +32,10 @@ $mesg = ''; * */ -if ($id) +if ($_GET["id"]) { $product = new Product($db); - $result = $product->fetch($id); + $result = $product->fetch($_GET["id"]); if ( $result ) { @@ -49,33 +49,51 @@ if ($id) } } - $filenbvente = $dir . "/vente12mois.png"; - $filenbpiece = $dir . "/vendu12mois.png"; + $filenbpropal = $dir . "/propal12mois.png"; + $filenbvente = $dir . "/vente12mois.png"; + $filenbpiece = $dir . "/vendu12mois.png"; - if (! file_exists($filenbvente) or $action == 'recalcul') + if (! file_exists($filenbvente) or $_GET["action"] == 'recalcul') { - $px = new BarGraph(); - $mesg = $px->isGraphKo(); - if (! $mesg) { - $graph_data = $product->get_num_vente(); - $px->draw($filenbvente, $graph_data); - $px = new BarGraph(); - $graph_data = $product->get_nb_vente(); - $px->draw($filenbpiece, $graph_data); - $mesg = "Graphiques générés"; - } + $px = new BarGraph(); + $mesg = $px->isGraphKo(); + if (! $mesg) + { + $graph_data = $product->get_num_vente(); + $px->draw($filenbvente, $graph_data); + + $px = new BarGraph(); + $graph_data = $product->get_nb_vente(); + $px->draw($filenbpiece, $graph_data); + + $px = new BarGraph(); + $graph_data = $product->get_num_propal(); + $px->draw($filenbpropal, $graph_data); + + $mesg = "Graphiques générés"; + } } - print_fiche_titre('Fiche produit : '.$product->ref, $mesg); - + + $head[0][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; + $head[0][1] = 'Fiche'; + + $head[1][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; + $head[1][1] = 'Prix'; + + $head[2][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; + $head[2][1] = 'Statistiques'; + + dolibarr_fiche_head($head, 2, 'Fiche '.$types[$product->type].' : '.$product->ref); + print '
| Référence | '.$product->ref.' | '; print 'Statistiques |
| Libellé | $product->libelle | "; print '';
- print "Propositions commerciales : ".$product->count_propale();
+ print 'Propositions commerciales : '.$product->count_propale();
print " Proposé à ".$product->count_propale_client()." clients"; - print ' Factures : '.$product->count_facture(); + print ' Factures : '.$product->count_facture(); print ' |
| Prix actuel | '.price($product->price).' |
';
print '
';
+
+ print '