From f5b82a8d4f4871300c49425faea929bda0705f7e Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 13 Jul 2004 13:59:09 +0000 Subject: [PATCH] Ajout d'un graphique sur les propales --- htdocs/product/stats/fiche.php | 126 ++++++++++++++++++++++++--------- 1 file changed, 94 insertions(+), 32 deletions(-) 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 ''; print ''; print ''; print ""; print ''; print ''; print "
Référence'.$product->ref.'Statistiques
Libellé$product->libelle'; - 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).'
"; @@ -91,19 +109,63 @@ if ($id) print 'Ventes sur les 12 derniers mois'; print ''; - if (file_exists($filenbvente) && filemtime($filenbvente)) { - print 'Généré le '.dolibarr_print_date(filemtime($filenbvente),"%d %b %Y %H:%M:%S").''; - } else { - print 'Graphique non généré'; - } - print '[Re-calculer]'; - if (file_exists($filenbpiece) && filemtime($filenbpiece)) { - print 'Généré le '.dolibarr_print_date(filemtime($filenbpiece),"%d %b %Y %H:%M:%S").''; - } else { - print 'Graphique non généré'; - } - print '[Re-calculer]'; - print ''; + if (file_exists($filenbvente) && filemtime($filenbvente)) + { + print 'Généré le '.dolibarr_print_date(filemtime($filenbvente),"%d %b %Y %H:%M:%S").''; + } + else + { + print 'Graphique non généré'; + } + print '[Re-calculer]'; + if (file_exists($filenbpiece) && filemtime($filenbpiece)) + { + print 'Généré le '.dolibarr_print_date(filemtime($filenbpiece),"%d %b %Y %H:%M:%S").''; + } + else + { + print 'Graphique non généré'; + } + print '[Re-calculer]'; + print 'Statistiques effectuées sur les factures payées uniquement'; + + print 'Nombre de propositions commerciales
sur les 12 derniers mois'; + print '-'; + print ''; + + print 'Propales sur les 12 derniers mois'; + + print 'TODO AUTRE GRAPHIQUE'; + + + print ''; + if (file_exists($filenbpropal) && filemtime($filenbpropal)) + { + print 'Généré le '.dolibarr_print_date(filemtime($filenbpropal),"%d %b %Y %H:%M:%S").''; + } + else + { + print 'Graphique non généré'; + } + print '[Re-calculer]'; + if (file_exists($filenbpiece) && filemtime($filenbpiece33)) + { + print 'Généré le '.dolibarr_print_date(filemtime($filenbpiece),"%d %b %Y %H:%M:%S").''; + } + else + { + print 'Graphique non généré'; + } + print '[Re-calculer]'; + + print ''; + + + + + + + } }