Ajout d'un graph sur les commandes en utilisant artichow
This commit is contained in:
parent
ca7b72519a
commit
949263f0a7
@ -124,12 +124,22 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
}
|
}
|
||||||
|
|
||||||
$graphfiles=array(
|
$graphfiles=array(
|
||||||
'propal' =>array('modulepart'=>'productstats_proposals', 'file' => $product->id.'/propal12m.png', 'label' => $langs->trans("Nombre propal sur les 12 derniers mois")),
|
'propal' =>array('modulepart'=>'productstats_proposals',
|
||||||
// 'orders' =>array('modulepart'=>'productstats_orders', 'file' => $product->id.'/orders12m.png', 'label' => $langs->trans("Nombre commande clients sur les 12 derniers mois")),
|
'file' => $product->id.'/propal12m.png',
|
||||||
// 'orderssuppliers' =>array('modulepart'=>'productstats_orderssuppliers', 'file' => $product->id.'/orderssuppliers12m.png', 'label' => $langs->trans("Nombre commande fournisseurs sur les 12 derniers mois")),
|
'label' => $langs->trans("Nombre propal sur les 12 derniers mois")),
|
||||||
// 'contracts' =>array('modulepart'=>'productstats_contracts', 'file' => $product->id.'/contracts12m.png', 'label' => $langs->trans("Nombre contrats sur les 12 derniers mois")),
|
'orders' =>array('modulepart'=>'productstats_orders',
|
||||||
'invoices' =>array('modulepart'=>'productstats_invoices', 'file' => $product->id.'/invoices12m.png', 'label' => $langs->trans("Nombre facture clients sur les 12 derniers mois")),
|
'file' => $product->id.'/orders12m.png',
|
||||||
'invoicessuppliers'=>array('modulepart'=>'productstats_invoicessuppliers', 'file' => $product->id.'/invoicessuppliers12m.png', 'label' => $langs->trans("Nombre facture fournisseurs sur les 12 derniers mois")),
|
'label' => $langs->trans("Nombre commande clients sur les 12 derniers mois")),
|
||||||
|
'invoices' =>array('modulepart'=>'productstats_invoices',
|
||||||
|
'file' => $product->id.'/invoices12m.png',
|
||||||
|
'label' => $langs->trans("Nombre facture clients sur les 12 derniers mois")),
|
||||||
|
'invoicessuppliers'=>array('modulepart'=>'productstats_invoicessuppliers',
|
||||||
|
'file' => $product->id.'/invoicessuppliers12m.png',
|
||||||
|
'label' => $langs->trans("Nombre facture fournisseurs sur les 12 derniers mois")),
|
||||||
|
|
||||||
|
// 'orderssuppliers' =>array('modulepart'=>'productstats_orderssuppliers', 'file' => $product->id.'/orderssuppliers12m.png', 'label' => $langs->trans("Nombre commande fournisseurs sur les 12 derniers mois")),
|
||||||
|
// 'contracts' =>array('modulepart'=>'productstats_contracts', 'file' => $product->id.'/contracts12m.png', 'label' => $langs->trans("Nombre contrats sur les 12 derniers mois")),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$px = new DolGraph();
|
$px = new DolGraph();
|
||||||
@ -144,6 +154,7 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
|
|
||||||
// \todo Test si deja existant et recent, on ne genere pas
|
// \todo Test si deja existant et recent, on ne genere pas
|
||||||
if ($key == 'propal') $graph_data = $product->get_nb_propal($socid);
|
if ($key == 'propal') $graph_data = $product->get_nb_propal($socid);
|
||||||
|
if ($key == 'orders') $graph_data = $product->get_nb_order($socid);
|
||||||
if ($key == 'invoices') $graph_data = $product->get_nb_vente($socid);
|
if ($key == 'invoices') $graph_data = $product->get_nb_vente($socid);
|
||||||
if ($key == 'invoicessuppliers') $graph_data = $product->get_nb_achat($socid);
|
if ($key == 'invoicessuppliers') $graph_data = $product->get_nb_achat($socid);
|
||||||
if (is_array($graph_data))
|
if (is_array($graph_data))
|
||||||
@ -157,6 +168,16 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
$px->SetPrecisionY(0);
|
$px->SetPrecisionY(0);
|
||||||
$px->SetShading(5);
|
$px->SetShading(5);
|
||||||
//print 'x '.$key.' '.$graphfiles[$key]['file'];
|
//print 'x '.$key.' '.$graphfiles[$key]['file'];
|
||||||
|
|
||||||
|
if ($key == 'orders')
|
||||||
|
{
|
||||||
|
$px->library = 'artichow';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$px->library = 'phplot';
|
||||||
|
}
|
||||||
|
|
||||||
$px->draw($dir."/".$graphfiles[$key]['file']);
|
$px->draw($dir."/".$graphfiles[$key]['file']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -175,6 +196,7 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
if (! $graphfiles[$key]['file']) continue;
|
if (! $graphfiles[$key]['file']) continue;
|
||||||
|
|
||||||
if ($graphfiles == 'propal' && ! $user->right->propale->lire) continue;
|
if ($graphfiles == 'propal' && ! $user->right->propale->lire) continue;
|
||||||
|
if ($graphfiles == 'order' && ! $user->right->commande->lire) continue;
|
||||||
if ($graphfiles == 'invoices' && ! $user->right->facture->lire) continue;
|
if ($graphfiles == 'invoices' && ! $user->right->facture->lire) continue;
|
||||||
if ($graphfiles == 'invoices_suppliers' && ! $user->right->fournisseur->facture->lire) continue;
|
if ($graphfiles == 'invoices_suppliers' && ! $user->right->fournisseur->facture->lire) continue;
|
||||||
|
|
||||||
@ -219,10 +241,8 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
|
|
||||||
if ($i % 2 == 1) print '<td> </td></tr>';
|
if ($i % 2 == 1) print '<td> </td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent en fin de page
|
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent en fin de page
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user