*
* 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: releve.php,v 1.1 2005/07/24 12:14:25 rodolphe Exp $
* $Source: /srv/cvs/sources/dolibarr/dolibarr/htdocs/energie/Attic/releve.php,v $
*
*/
/**
\file htdocs/energie/compteur.php
\ingroup energie
\brief Fiche compteur
\version $Revision: 1.1 $
*/
require("./pre.inc.php");
/*
*
*/
if ($_GET["action"] == 'delete')
{
if ($_GET["rowid"] > 0)
{
$compteur = new EnergieCompteur($db, $user);
if ( $compteur->fetch($_GET["id"]) == 0)
{
$compteur->DeleteReleve($_GET["rowid"]);
}
}
}
/*
*
*/
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
if ($_GET["id"] > 0)
{
$compteur = new EnergieCompteur($db, $user);
if ( $compteur->fetch($_GET["id"]) == 0)
{
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
$head[0][1] = "Compteur";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
$head[$h][1] = "Graph";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
$head[$h][1] = "Relevés";
$h++;
$a = 2;
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
$head[$h][1] = "Groupe";
$h++;
dolibarr_fiche_head($head, $a, $soc->nom);
print '
';
print "".$langs->trans("Compteur")." | ";
print '';
print $compteur->libelle;
print " |
";
print "
";
print '';
$page = $_GET["page"];
$limit = $conf->liste_limit;
$offset = $limit * $page ;
$sql = "SELECT ".$db->pdate("date_releve")." as date_releve, valeur, rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr";
$sql .= " WHERE ecr.fk_compteur = '".$compteur->id."'";
$sql .= " ORDER BY ecr.date_releve DESC";
$sql .= $db->plimit($limit + 1 ,$offset);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=True;
print_barre_liste("Relevés", $page, "", "&id=".$compteur->id, $sortfield, $sortorder,'',$num);
print '';
print ''.$langs->trans("Date").' | ';
print ''.$langs->trans("Relevé").' |
';
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$var=!$var;
print "";
print strftime("%a %e %B %Y",$obj->date_releve);
print ' | '.$obj->valeur.' | ';
print '';
print img_delete().' |
';
$i++;
}
}
print '
';
print "
\n";
}
else
{
/* Commande non trouvée */
print "Compteur inexistant";
}
}
else
{
print "Compteur inexistant";
}
$db->close();
llxFooter("Dernière modification $Date: 2005/07/24 12:14:25 $ révision $Revision: 1.1 $");
?>