Files
le-matelot/client/plugins/statsplus/graphs/graph_ouverture.php
2020-01-27 08:56:08 +01:00

71 lines
2.1 KiB
PHP

<?php
include_once(realpath(dirname(__FILE__)) . "/../../../../fonctions/authplugins.php");
autorisation("statsplus");
?>
<?php
include_once(realpath(dirname(__FILE__)) . "/../../../../classes/Commande.class.php");
include_once(realpath(dirname(__FILE__)) . "/../../../../classes/Venteprod.class.php");
include_once(realpath(dirname(__FILE__)) . "/../calc/calc_ouverture.php");
$mois = date("m");
$annee = date("Y");
$values = array();
$days = array();
$commande = new Commande();
$query_test = "select * from $commande->table where statut>=2 and statut<>5 order by date limit 0,1";
$resul_test = mysql_query($query_test, $commande->link);
$row_test = mysql_fetch_object($resul_test);
$annee = substr($row_test->date, 0, 4);
$query_test = "select * from $commande->table where statut>=2 and statut<>5 order by date desc limit 0,1";
$resul_test = mysql_query($query_test, $commande->link);
$row_test = mysql_fetch_object($resul_test);
$anneefin = substr($row_test->date, 0, 4);
for($i=$annee;$i<=$anneefin;$i++){
$values[] = ca($i, 100, 1);
$days[] = $i;
}
include_once(realpath(dirname(__FILE__)) . "/../../../../lib/artichow/LinePlot.class.php");
$graph = new archiGraph(968, 200);
$graph->border->hide();
$graph->title = new archiLabel("Progression du chiffre d'Affaires par an.",new archiFileFont(ARTICHOW_FONT.'/Arial', 10));
$plot = new archiLinePlot($values);
// $plot->setBackgroundColor(new archiColor(240, 240, 240));
$plot->hideLine(TRUE);
$plot->setFillColor(new archiColor(180, 180, 180, 75));
//$plot->grid->setBackgroundColor(new archiColor(235, 235, 180, 60));
$plot->grid->hideVertical();
$plot->yAxis->setLabelPrecision(2);
$plot->xAxis->setLabelText($days);
$plot->mark->setType(archiMark::IMAGE);
$plot->mark->setImage(new archiFileImage("../gfx/point_graph.png"));
$plot->label->set($values);
$plot->label->setColor(new archiColor(236, 128, 0));
$plot->label->move(0, -12);
$plot->label->setFont(new archiFileFont(ARTICHOW_FONT.'/Arial', 8));
$plot->label->setPadding(3, 1, 1, 0);
$plot->setSpace(2, 2, NULL, NULL);
$graph->add($plot);
$graph->draw();
?>