Qual: Remove deprecated files
This commit is contained in:
parent
522863549c
commit
b6d8b648d9
@ -26,6 +26,7 @@
|
||||
|
||||
require("../../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/stats/facturestats.class.php");
|
||||
|
||||
$WIDTH=500;
|
||||
$HEIGHT=200;
|
||||
|
||||
@ -1,122 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/rapport/Atome.class.php
|
||||
* \brief Fichier de la classe mere Atome de generation de rapports
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/dolgraph.class.php';
|
||||
|
||||
|
||||
/**
|
||||
\class Atome
|
||||
\brief Classe m<EFBFBD>re des classes de g<EFBFBD>n<EFBFBD>ration des images de rapports
|
||||
*/
|
||||
|
||||
class Atome
|
||||
{
|
||||
var $id;
|
||||
var $db;
|
||||
var $name;
|
||||
var $periode;
|
||||
var $graph_values;
|
||||
|
||||
/**
|
||||
* Initialisation de la classe
|
||||
*
|
||||
*/
|
||||
function AtomeInitialize($periode, $name, $daystart)
|
||||
{
|
||||
$this->year = strftime("%Y", $daystart);
|
||||
$this->month = strftime("%m", $daystart);
|
||||
$this->periode = $periode;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function ShowGraph()
|
||||
{
|
||||
$dir = DOL_DATA_ROOT.'/rapport/images/';
|
||||
if (! is_dir($dir)) create_exdir($dir);
|
||||
|
||||
$this->graph_values = array();
|
||||
|
||||
if ($this->periode == 'year')
|
||||
{
|
||||
$filename = $dir . $this->name.$this->year.'.png';
|
||||
|
||||
for ($i = 0 ; $i < 12 ; $i++)
|
||||
{
|
||||
$index = $this->year . substr('00'.($i+1),-2);
|
||||
$value = 0;
|
||||
if ($this->datas[$index])
|
||||
{
|
||||
$value = $this->datas[$index];
|
||||
}
|
||||
|
||||
$libelle = ucfirst(strftime("%b", dol_mktime(12,0,0,($i+1),1,2004)));
|
||||
|
||||
$this->graph_values[$i] = array($libelle, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->periode == 'month')
|
||||
{
|
||||
$filename = $dir . $this->name.$this->year.$this->month.'.png';
|
||||
|
||||
$datex = mktime(12,0,0,$this->month, 1, $this->year);
|
||||
$i = 0;
|
||||
while (strftime("%Y%m", $datex) == $this->year.$this->month)
|
||||
{
|
||||
|
||||
$index = $this->year . $this->month . substr('00'.($i+1),-2);
|
||||
$value = 0;
|
||||
if ($this->datas[$index])
|
||||
{
|
||||
$value = $this->datas[$index];
|
||||
}
|
||||
|
||||
$libelle = ($i+1);
|
||||
|
||||
$this->graph_values[$i] = array($libelle, $value);
|
||||
|
||||
$i++;
|
||||
$datex = $datex + 86400;
|
||||
}
|
||||
}
|
||||
|
||||
// var_dump($this->graph_values);
|
||||
|
||||
|
||||
$bgraph = new DolGraph();
|
||||
$bgraph->SetData($this->graph_values);
|
||||
$bgraph->bgcolor = array(255,255,255);
|
||||
$bgraph->SetWidth(600);
|
||||
$bgraph->SetHeight(400);
|
||||
$bgraph->draw($filename);
|
||||
|
||||
return $filename;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -1,93 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 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$
|
||||
*/
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/rapport/Atome.class.php');
|
||||
|
||||
class AtomeFactureValidee extends Atome
|
||||
{
|
||||
var $id;
|
||||
var $db;
|
||||
var $periode;
|
||||
|
||||
/**
|
||||
* Initialisation de la classe
|
||||
*
|
||||
*/
|
||||
function AtomeFactureValidee($DB, $periode, $daystart)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->name = 'AtomeFactureValidee';
|
||||
$this->AtomeInitialize($periode,'AtomeFactureValidee', $daystart);
|
||||
$this->datas = array();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch()
|
||||
{
|
||||
if ($this->periode == 'year')
|
||||
{
|
||||
$sql = "SELECT date_format(f.datef,'%Y%m'), sum(f.amount) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
|
||||
$sql .= " AND date_format(f.datef,'%Y') = $this->year ";
|
||||
$sql .= " GROUP BY date_format(f.datef,'%Y%m') ASC ;";
|
||||
}
|
||||
|
||||
if ($this->periode == 'month')
|
||||
{
|
||||
$sql = "SELECT date_format(f.datef,'%Y%m%d'), sum(f.amount) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.fk_statut = 1";
|
||||
$sql .= " AND date_format(f.datef,'%Y%m') = ".$this->year.$this->month;
|
||||
$sql .= " GROUP BY date_format(f.datef,'%Y%m%d') ASC ;";
|
||||
}
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows();
|
||||
$arr = array();
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($i);
|
||||
|
||||
$arr[$row[0]] = $row[1];
|
||||
//print $row[0] .'-'.$row[1]. '<br>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free();
|
||||
$this->datas = $arr;
|
||||
return $arr;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
print "<br>$sql";
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -1,80 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 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$
|
||||
*/
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/rapport/Atome.class.php');
|
||||
|
||||
class AtomePropaleValidee extends Atome
|
||||
{
|
||||
var $id;
|
||||
var $db;
|
||||
|
||||
|
||||
/**
|
||||
* Initialisation de la classe
|
||||
*
|
||||
*/
|
||||
function AtomePropaleValidee($DB,$periode, $daystart)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->AtomeInitialize($periode, 'AtomePropaleValidee', $daystart);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch()
|
||||
{
|
||||
$sql = "SELECT date_format(f.datep,'%Y%m'), sum(f.price) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as f";
|
||||
$sql .= " WHERE f.fk_statut = 2";
|
||||
|
||||
if ($this->year)
|
||||
{
|
||||
$sql .= " AND date_format(f.datep,'%Y') = $this->year ";
|
||||
$sql .= " GROUP BY date_format(f.datep,'%Y%m') ASC ;";
|
||||
}
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows();
|
||||
$arr = array();
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($i);
|
||||
|
||||
$arr[$row[0]] = $row[1];
|
||||
|
||||
$i++;
|
||||
}
|
||||
return $arr;
|
||||
|
||||
$this->db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -1,100 +0,0 @@
|
||||
<?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$
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
|
||||
require("./AtomeFactureValidee.class.php");
|
||||
require("./AtomePropaleValidee.class.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre("Rapports");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Initialisation d'un atome
|
||||
*
|
||||
* Parametre
|
||||
* - id de connexion <EFBFBD> la bdd
|
||||
* - p<EFBFBD>riode 'year' ou 'month' (Reste <EFBFBD> faire les hebdo)
|
||||
* - une date dans la p<EFBFBD>riode voulue
|
||||
* -> retourne un objet
|
||||
*
|
||||
*/
|
||||
$x = new AtomeFactureValidee($db,'year', time());
|
||||
|
||||
/*
|
||||
* Lecture des donn<EFBFBD>es
|
||||
* -> retourne un tableau
|
||||
*/
|
||||
$arr = $x->fetch();
|
||||
/*
|
||||
* Cr<EFBFBD>ation du graph
|
||||
* -> retounre le nom du fichier
|
||||
*/
|
||||
$img = $x->ShowGraph();
|
||||
print $img."<br>";
|
||||
|
||||
|
||||
//
|
||||
|
||||
$x = new AtomeFactureValidee($db,'year', mktime(12,0,0,1,12,2003));
|
||||
$arr = $x->fetch('year');
|
||||
|
||||
$img = $x->ShowGraph();
|
||||
print $img."<br>";
|
||||
for ($i = 1 ; $i < 5; $i++)
|
||||
{
|
||||
$x = new AtomeFactureValidee($db,'month', mktime(12,0,0,$i,12,2003));
|
||||
$x->periode = 'month';
|
||||
|
||||
$arr = $x->fetch('month');
|
||||
|
||||
|
||||
$img = $x->ShowGraph();
|
||||
print $img."<br>";
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
$x = new AtomePropaleValidee($db,'year',mktime(12,0,0,1,12,2003));
|
||||
|
||||
$arr = $x->fetch();
|
||||
|
||||
var_dump($arr);
|
||||
|
||||
$img = $x->ShowGraph();
|
||||
print $img."<br>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user