Ajout d'un graphique sur les propales
This commit is contained in:
parent
a8029ea7d8
commit
f5b82a8d4f
@ -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 '<table class="border" width="100%" cellspacing="0" cellpadding="4"><tr>';
|
||||
print '<td width="20%">Référence</td><td width="40%"><a href="../fiche.php?id='.$product->id.'">'.$product->ref.'</a></td>';
|
||||
print '<td>Statistiques</td></tr>';
|
||||
print "<tr><td>Libellé</td><td>$product->libelle</td>";
|
||||
print '<td valign="top" rowspan="2">';
|
||||
print "Propositions commerciales : ".$product->count_propale();
|
||||
print '<a href="propal.php?id='.$product->id.'">Propositions commerciales</a> : '.$product->count_propale();
|
||||
print "<br>Proposé à <b>".$product->count_propale_client()."</b> clients";
|
||||
print '<br><a href="facture.php?id='.$id.'">Factures</a> : '.$product->count_facture();
|
||||
print '<br><a href="facture.php?id='.$product->id.'">Factures</a> : '.$product->count_facture();
|
||||
print '</td></tr>';
|
||||
print '<tr><td>Prix actuel</td><td>'.price($product->price).'</td></tr>';
|
||||
print "</table>";
|
||||
@ -91,19 +109,63 @@ if ($id)
|
||||
print '<img src="'.DOL_URL_ROOT.'/document/produit/'.$product->id.'/vendu12mois.png" alt="Ventes sur les 12 derniers mois">';
|
||||
|
||||
print '</td></tr><tr>';
|
||||
if (file_exists($filenbvente) && filemtime($filenbvente)) {
|
||||
print '<td>Généré le '.dolibarr_print_date(filemtime($filenbvente),"%d %b %Y %H:%M:%S").'</td>';
|
||||
} else {
|
||||
print '<td>Graphique non généré</td>';
|
||||
}
|
||||
print '<td align="center">[<a href="fiche.php?id='.$id.'&action=recalcul">Re-calculer</a>]</td>';
|
||||
if (file_exists($filenbpiece) && filemtime($filenbpiece)) {
|
||||
print '<td>Généré le '.dolibarr_print_date(filemtime($filenbpiece),"%d %b %Y %H:%M:%S").'</td>';
|
||||
} else {
|
||||
print '<td>Graphique non généré</td>';
|
||||
}
|
||||
print '<td align="center">[<a href="fiche.php?id='.$id.'&action=recalcul">Re-calculer</a>]</td>';
|
||||
print '</tr></table>';
|
||||
if (file_exists($filenbvente) && filemtime($filenbvente))
|
||||
{
|
||||
print '<td>Généré le '.dolibarr_print_date(filemtime($filenbvente),"%d %b %Y %H:%M:%S").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>Graphique non généré</td>';
|
||||
}
|
||||
print '<td align="center">[<a href="fiche.php?id='.$product->id.'&action=recalcul">Re-calculer</a>]</td>';
|
||||
if (file_exists($filenbpiece) && filemtime($filenbpiece))
|
||||
{
|
||||
print '<td>Généré le '.dolibarr_print_date(filemtime($filenbpiece),"%d %b %Y %H:%M:%S").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>Graphique non généré</td>';
|
||||
}
|
||||
print '<td align="center">[<a href="fiche.php?id='.$product->id.'&action=recalcul">Re-calculer</a>]</td></tr>';
|
||||
print '<tr><td colspan="4">Statistiques effectuées sur les factures payées uniquement</td></tr>';
|
||||
|
||||
print '<tr class="liste_titre"><td width="50%" colspan="2" align="center">Nombre de propositions commerciales<br>sur les 12 derniers mois</td>';
|
||||
print '<td align="center" width="50%" colspan="2">-</td></tr>';
|
||||
print '<tr><td align="center" colspan="2">';
|
||||
|
||||
print '<img src="'.DOL_URL_ROOT.'/document/produit/'.$product->id.'/propal12mois.png" alt="Propales sur les 12 derniers mois">';
|
||||
|
||||
print '</td><td align="center" colspan="2">TODO AUTRE GRAPHIQUE';
|
||||
|
||||
|
||||
print '</td></tr><tr>';
|
||||
if (file_exists($filenbpropal) && filemtime($filenbpropal))
|
||||
{
|
||||
print '<td>Généré le '.dolibarr_print_date(filemtime($filenbpropal),"%d %b %Y %H:%M:%S").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>Graphique non généré</td>';
|
||||
}
|
||||
print '<td align="center">[<a href="fiche.php?id='.$product->id.'&action=recalcul">Re-calculer</a>]</td>';
|
||||
if (file_exists($filenbpiece) && filemtime($filenbpiece33))
|
||||
{
|
||||
print '<td>Généré le '.dolibarr_print_date(filemtime($filenbpiece),"%d %b %Y %H:%M:%S").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>Graphique non généré</td>';
|
||||
}
|
||||
print '<td align="center">[<a href="fiche.php?id='.$product->id.'&action=recalcul">Re-calculer</a>]</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user