diff --git a/htdocs/energie/releve.php b/htdocs/energie/releve.php new file mode 100644 index 00000000000..26316856ff7 --- /dev/null +++ b/htdocs/energie/releve.php @@ -0,0 +1,141 @@ + + * + * 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$ + * + */ + +/** + \file htdocs/energie/compteur.php + \ingroup energie + \brief Fiche compteur + \version $Revision$ +*/ + +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 ""; + print '"; + print "
".$langs->trans("Compteur")."'; + print $compteur->libelle; + 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 ''; + print ''; + + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var=!$var; + print "'; + print ''; + $i++; + } + } + print '
'.$langs->trans("Date").''.$langs->trans("Relevé").'
"; + print strftime("%a %e %B %Y",$obj->date_releve); + print ''.$obj->valeur.''; + print img_delete().'
'; + print "
\n"; + } + else + { + /* Commande non trouvée */ + print "Compteur inexistant"; + } +} +else +{ + print "Compteur inexistant"; +} + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>