forked from Wavyzz/dolibarr
nouveau fichier
This commit is contained in:
73
htdocs/graph.class.php
Normal file
73
htdocs/graph.class.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?PHP
|
||||
/* Copyright (c) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
class Graph
|
||||
{
|
||||
var $db;
|
||||
var $errorstr;
|
||||
|
||||
|
||||
Function Graph()
|
||||
{
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT."/includes/phplot/phplot.php");
|
||||
$this->bgcolor = array(235,235,224);
|
||||
$this->bordercolor = array(235,235,224);
|
||||
$this->datacolor = array(array(204,204,179),
|
||||
array(187,187,136),
|
||||
array(235,235,224));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function draw($file, $data)
|
||||
{
|
||||
$w = 400;
|
||||
$h = 200;
|
||||
//Define the object
|
||||
$graph = new PHPlot($w,$h);
|
||||
$graph->SetIsInline(1);
|
||||
$graph->SetPlotType('bars');
|
||||
|
||||
$graph->SetPlotAreaPixels(60,10,$w-10,$h-30) ;
|
||||
|
||||
$graph->SetBackgroundColor($this->bgcolor);
|
||||
|
||||
$graph->SetDataColors($this->datacolor, $this->bordercolor);
|
||||
|
||||
$graph->SetOutputFile($file);
|
||||
|
||||
//Set some data
|
||||
$graph->SetDataValues($data);
|
||||
|
||||
$graph->SetVertTickIncrement(0);
|
||||
|
||||
//Draw it
|
||||
$graph->DrawGraph();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
2663
htdocs/includes/phplot/phplot.php
Normal file
2663
htdocs/includes/phplot/phplot.php
Normal file
File diff suppressed because it is too large
Load Diff
110
htdocs/product/stats/fiche.php
Normal file
110
htdocs/product/stats/fiche.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../../propal.class.php3");
|
||||
require("../../graph.class.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
$mesg = '';
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($id);
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
$dir = DOL_DOCUMENT_ROOT."/document/produit/".$product->id;
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
umask(0);
|
||||
if (! mkdir($dir, 0755))
|
||||
{
|
||||
$mesg = "Impossible de cr<63>er $dir !";
|
||||
}
|
||||
}
|
||||
|
||||
$filev = $dir . "/vente12mois.png";
|
||||
$filenv = $dir . "/vendu12mois.png";
|
||||
|
||||
if (! file_exists($filev) or $action == 'recalcul')
|
||||
{
|
||||
$px = new Graph();
|
||||
$graph_data = $product->get_num_vente();
|
||||
$px->draw($filev, $graph_data);
|
||||
$px = new Graph();
|
||||
$graph_data = $product->get_nb_vente();
|
||||
$px->draw($filenv, $graph_data);
|
||||
$mesg = "Graphiques g<>n<EFBFBD>r<EFBFBD>s";
|
||||
}
|
||||
|
||||
print_fiche_titre('Fiche produit : '.$product->ref, $mesg);
|
||||
|
||||
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print "<tr>";
|
||||
print '<td width="20%">R<>f<EFBFBD>rence</td><td width="40%"><a href="../fiche.php3?id='.$product->id.'">'.$product->ref.'</a></td>';
|
||||
print '<td>Statistiques</td></tr>';
|
||||
print "<td>Libell<6C></td><td>$product->label</td>";
|
||||
print '<td valign="top" rowspan="2">';
|
||||
print "Propositions commerciales : ".$product->count_propale();
|
||||
print "<br>Propos<6F> <20> <b>".$product->count_propale_client()."</b> clients";
|
||||
print "<br>Factures : ".$product->count_facture();
|
||||
print '</td></tr>';
|
||||
print '<tr><td>Prix</td><TD>'.price($product->price).'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
print '<br><table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre"><td width="50%" colspan="2" align="center">Nombre de ventes<br>sur les 12 derniers mois</td>';
|
||||
print '<td align="center" width="50%" colspan="2">Nombre de pi<70>ces vendues</td></tr>';
|
||||
print '<tr><td align="center" colspan="2">';
|
||||
|
||||
print '<img src="'.DOL_URL_ROOT.'/document/produit/'.$product->id.'/vente12mois.png" alt="Ventes sur les 12 derniers mois">';
|
||||
|
||||
print '</td><td align="center" colspan="2">';
|
||||
print '<img src="'.DOL_URL_ROOT.'/document/produit/'.$product->id.'/vendu12mois.png" alt="Ventes sur les 12 derniers mois">';
|
||||
|
||||
print '</td></tr><tr>';
|
||||
print '<td>G<>n<EFBFBD>r<EFBFBD> le '.strftime("%d %b %Y %H:%M:%S",filemtime($filev)).'</td>';
|
||||
print '<td align="center">[<a href="fiche.php?id='.$id.'&action=recalcul">Re-calculer</a>]</td>';
|
||||
print '<td>G<>n<EFBFBD>r<EFBFBD> le '.strftime("%d %b %Y %H:%M:%S",filemtime($filev)).'</td>';
|
||||
print '<td align="center">[<a href="fiche.php?id='.$id.'&action=recalcul">Re-calculer</a>]</td>';
|
||||
print '</tr></table>';
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
49
htdocs/product/stats/pre.inc.php
Normal file
49
htdocs/product/stats/pre.inc.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
require("../../main.inc.php3");
|
||||
|
||||
function llxHeader($head = "", $urlp = "")
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/product/index.php3", "Produits");
|
||||
|
||||
$menu->add_submenu("../fiche.php3?&action=create","Nouveau produit");
|
||||
|
||||
$menu->add_submenu("../popuprop.php", "Popularit<EFBFBD>");
|
||||
|
||||
left_menu($menu->liste);
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user