Nouveau fichier
This commit is contained in:
parent
352dac766c
commit
6cad63f7e1
64
htdocs/telephonie/script/graph-statistiques-contrats.php
Normal file
64
htdocs/telephonie/script/graph-statistiques-contrats.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 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$
|
||||
*
|
||||
*
|
||||
* Generation des graphiques contrats
|
||||
*
|
||||
*
|
||||
*/
|
||||
require ("../../master.inc.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphContrats.class.php");
|
||||
|
||||
$childrenTotal = 10;
|
||||
$childrenNow = 0;
|
||||
$clientPerChild = 0;
|
||||
|
||||
$sql = "SELECT max(rowid)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$row = $db->fetch_row();
|
||||
$clientPerChild = ceil($row[0] / $childrenTotal);
|
||||
$db->free();
|
||||
}
|
||||
|
||||
while ( $childrenNow < $childrenTotal )
|
||||
{
|
||||
|
||||
$pid = pcntl_fork();
|
||||
|
||||
if ( $pid == -1 )
|
||||
{
|
||||
die( "error\n" );
|
||||
}
|
||||
elseif ( $pid == 0 )
|
||||
{
|
||||
$childrenNow++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$process = new ProcessGraphContrats( $childrenNow, $clientPerChild );
|
||||
$process->go();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
136
htdocs/telephonie/stats/ProcessGraphContrats.class.php
Normal file
136
htdocs/telephonie/stats/ProcessGraphContrats.class.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 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$
|
||||
*
|
||||
*
|
||||
* Generation des graphiques clients
|
||||
*
|
||||
*
|
||||
*/
|
||||
require ("../../master.inc.php");
|
||||
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/ca.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/gain.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/heureappel.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/joursemaine.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camoyen.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/appelsdureemoyenne.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/comm.nbmensuel.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php");
|
||||
|
||||
/*
|
||||
* Process
|
||||
*
|
||||
*/
|
||||
|
||||
class ProcessGraphContrats
|
||||
{
|
||||
var $ident;
|
||||
|
||||
function ProcessGraphContrats( $ident , $cpc)
|
||||
{
|
||||
$this->ident = $ident;
|
||||
$this->cpc = $cpc;
|
||||
$this->db = new DoliDb('','','','','',1);
|
||||
}
|
||||
|
||||
function go()
|
||||
{
|
||||
$min = $this->ident * $this->cpc;
|
||||
$max = ($this->ident + 1 ) * $this->cpc;
|
||||
|
||||
dolibarr_syslog("Deb contrat ".$this->ident . " ($min - $max)");
|
||||
$error = 0;
|
||||
|
||||
/*
|
||||
* Lecture des contrats
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT c.rowid, count(l.ligne) as ligne";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as c";
|
||||
$sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
||||
$sql .= " WHERE l.fk_contrat = c.rowid ";
|
||||
$sql .= " AND c.rowid >= ".$min;
|
||||
$sql .= " AND c.rowid < ".$max;
|
||||
$sql .= " GROUP BY c.rowid";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$contrats = array();
|
||||
|
||||
$num = $this->db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
|
||||
$contrats[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($contrats))
|
||||
{
|
||||
foreach ($contrats as $contrat)
|
||||
{
|
||||
//print ".";
|
||||
|
||||
$img_root = DOL_DATA_ROOT."/graph/".substr($contrat,-1)."/telephonie/contrat/";
|
||||
|
||||
$file = $img_root . $contrat."/graphca.png";
|
||||
$graphca = new GraphCa($this->db, $file);
|
||||
$graphca->contrat = $contrat;
|
||||
$graphca->GraphDraw();
|
||||
|
||||
/*
|
||||
|
||||
$file = $img_root . $client."/graphgain.png";
|
||||
|
||||
$graphgain = new GraphGain ($this->db, $file);
|
||||
$graphgain->client = $client;
|
||||
$graphgain->show_console = 0 ;
|
||||
$graphgain->GraphDraw();
|
||||
|
||||
$file = $img_root . $client."/graphappelsdureemoyenne.png";
|
||||
|
||||
$graphgain = new GraphAppelsDureeMoyenne ($this->db, $file);
|
||||
$graphgain->client = $client;
|
||||
$graphgain->show_console = 0 ;
|
||||
$graphgain->GraphDraw();
|
||||
|
||||
$file = $img_root . $client."/nb-comm-mensuel.png";
|
||||
|
||||
$graphx = new GraphCommNbMensuel ($this->db, $file);
|
||||
$graphx->client = $client;
|
||||
$graphx->show_console = 0 ;
|
||||
$graphx->Graph();
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
dolibarr_syslog("Fin contrat ".$this->ident);
|
||||
|
||||
}
|
||||
}
|
||||
print ".\n";
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user