Nouveau fichier
This commit is contained in:
parent
265c88b34f
commit
40e421c6de
79
htdocs/admin/system/gen-commande.php
Normal file
79
htdocs/admin/system/gen-commande.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?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("./pre.inc.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sql = "SELECT rowid FROM llx_product"; $productsid = array();
|
||||
if ($db->query($sql)) {
|
||||
$num = $db->num_rows(); $i = 0;
|
||||
while ($i < $num) { $row = $db->fetch_row($i); $productsid[$i] = $row[0]; $i++; } }
|
||||
|
||||
$sql = "SELECT idp FROM llx_societe"; $societesid = array();
|
||||
if ($db->query($sql)) { $num = $db->num_rows(); $i = 0;
|
||||
while ($i < $num) { $row = $db->fetch_row($i); $societesid[$i] = $row[0]; $i++; } } else { print "err"; }
|
||||
|
||||
$dates = array (mktime(12,0,0,1,3,2003),
|
||||
mktime(12,0,0,1,9,2003),
|
||||
mktime(12,0,0,2,13,2003),
|
||||
mktime(12,0,0,2,23,2003),
|
||||
mktime(12,0,0,3,30,2003),
|
||||
mktime(12,0,0,4,3,2003),
|
||||
mktime(12,0,0,4,3,2003),
|
||||
mktime(12,0,0,5,9,2003),
|
||||
mktime(12,0,0,5,1,2003),
|
||||
mktime(12,0,0,5,13,2003),
|
||||
mktime(12,0,0,5,19,2003),
|
||||
mktime(12,0,0,5,23,2003),
|
||||
mktime(12,0,0,6,3,2003),
|
||||
mktime(12,0,0,6,19,2003),
|
||||
mktime(12,0,0,6,24,2003),
|
||||
mktime(12,0,0,7,3,2003),
|
||||
mktime(12,0,0,7,9,2003),
|
||||
mktime(12,0,0,7,23,2003),
|
||||
mktime(12,0,0,7,30,2003),
|
||||
mktime(12,0,0,8,9,2003),
|
||||
mktime(12,0,0,9,23,2003),
|
||||
mktime(12,0,0,10,3,2003)
|
||||
);
|
||||
|
||||
require DOL_DOCUMENT_ROOT."/commande/commande.class.php";
|
||||
|
||||
$com = new Commande($db);
|
||||
|
||||
$com->soc_id = 4;
|
||||
$com->date_commande = $dates[rand(1, sizeof($dates)-1)];
|
||||
$com->note = $HTTP_POST_VARS["note"];
|
||||
$com->source = 1;
|
||||
$com->projetid = 0;
|
||||
$com->remise_percent = 0;
|
||||
|
||||
$pidrand = rand(1, sizeof($productsid)-1);
|
||||
$com->add_product($productsid[rand(1, sizeof($productsid)-1)],rand(1,11),rand(1,6),rand(0,20));
|
||||
|
||||
print $com->create($user) . " " . $com->date_commande;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
108
htdocs/product/stats/month.php
Normal file
108
htdocs/product/stats/month.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?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("../commande.class.php");
|
||||
require("../../graph.class.php");
|
||||
require("./commandestats.class.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$mesg = '';
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$stats = new CommandeStats($db);
|
||||
|
||||
$year = $_GET["year"];
|
||||
|
||||
print_fiche_titre('Statistiques commandes '.$year, $mesg);
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT;
|
||||
|
||||
////////////////////////
|
||||
|
||||
$res = $stats->getNbCommandeByMonth($year);
|
||||
|
||||
$data = array();
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$data[$i-1] = array(strftime("%b",mktime(12,12,12,$i,1,$year)), $res[$i]);
|
||||
}
|
||||
|
||||
$filev = "/document/images/commande.png";
|
||||
|
||||
$px = new Graph();
|
||||
$px->SetYLabel("Nombre de commande");
|
||||
$px->draw($dir.$filev, $data, $year);
|
||||
|
||||
$res = $stats->getCommandeAmountByMonth($year);
|
||||
|
||||
$data = array();
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$data[$i-1] = array(strftime("%b",mktime(12,12,12,$i,1,$year)), $res[$i]);
|
||||
}
|
||||
|
||||
$file_amount = "/document/images/commandeamount.png";
|
||||
|
||||
$px = new Graph();
|
||||
$px->SetYLabel("Montant des commande");
|
||||
$px->draw($dir.$file_amount, $data, $year);
|
||||
|
||||
$res = $stats->getCommandeAverageByMonth($year);
|
||||
|
||||
$data = array();
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$data[$i-1] = array(strftime("%b",mktime(12,12,12,$i,1,$year)), $res[$i]);
|
||||
}
|
||||
$file_avg = "/document/images/commandeaverage.png";
|
||||
$px = new Graph();
|
||||
$px->SetYLabel("Montant moyen des commande");
|
||||
$px->draw($dir.$file_avg, $data, $year);
|
||||
|
||||
|
||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr><td align="center">Nombre de commande par mois</td>';
|
||||
print '<td align="center">';
|
||||
print '<img src="'.DOL_URL_ROOT.$filev.'">';
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center">Sommes des commandes</td>';
|
||||
print '<td align="center">';
|
||||
print '<img src="'.DOL_URL_ROOT.$file_amount.'">';
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center">Montant moyen des commande</td>';
|
||||
print '<td align="center">';
|
||||
print '<img src="'.DOL_URL_ROOT.$file_avg.'">';
|
||||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
@ -21,33 +21,17 @@
|
||||
*/
|
||||
require("../../main.inc.php");
|
||||
|
||||
$types[0] = "produit";
|
||||
$types[1] = "service";
|
||||
|
||||
function llxHeader($head = "", $urlp = "")
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/product/index.php?type=0", "Produits");
|
||||
$menu->add_submenu("../liste.php?type=0","Liste");
|
||||
$menu->add_submenu("../fiche.php?action=create&type=0","Nouveau produit");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/product/index.php?amp;type=1", "Services");
|
||||
$menu->add_submenu("../liste.php?type=1","Liste");
|
||||
$menu->add_submenu("../fiche.php?action=create&type=1","Nouveau service");
|
||||
$menu->add(DOL_URL_ROOT."/commande/", "Commandes");
|
||||
|
||||
|
||||
$menu->add("./", "Statistiques");
|
||||
|
||||
$menu->add_submenu("../popuprop.php", "Popularité");
|
||||
|
||||
left_menu($menu->liste);
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user