[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/energie/ -> releve.php (source)

   1  <?php
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: releve.php,v 1.1 2005/07/24 12:14:25 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/energie/releve.php,v $
  20   *
  21   */
  22  
  23  /**
  24     \file       htdocs/energie/compteur.php
  25     \ingroup    energie
  26     \brief      Fiche compteur
  27     \version    $Revision: 1.1 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  /*
  33   *
  34   */    
  35  
  36  if ($_GET["action"] == 'delete')
  37  {
  38    if ($_GET["rowid"] > 0)
  39      {
  40        $compteur = new EnergieCompteur($db, $user);
  41        if ( $compteur->fetch($_GET["id"]) == 0)
  42      {
  43        $compteur->DeleteReleve($_GET["rowid"]);
  44      }
  45      }
  46  }
  47  /*
  48   *
  49   */    
  50  
  51  llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
  52  
  53  
  54  if ($_GET["id"] > 0)
  55  {
  56    $compteur = new EnergieCompteur($db, $user);
  57    if ( $compteur->fetch($_GET["id"]) == 0)
  58      {      
  59        
  60        $head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
  61        $head[0][1] = "Compteur";
  62        $h++;
  63        
  64        $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
  65        $head[$h][1] = "Graph";
  66        $h++;
  67        
  68        $head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
  69        $head[$h][1] = "Relevés";
  70        $h++;
  71        $a = 2;
  72  
  73        $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
  74        $head[$h][1] = "Groupe";
  75        $h++;
  76        
  77        dolibarr_fiche_head($head, $a, $soc->nom);
  78        
  79        print '<table class="border" width="100%">';
  80        print "<tr><td>".$langs->trans("Compteur")."</td>";
  81        print '<td width="50%">';
  82        print $compteur->libelle;
  83        print "</td></tr>";            
  84        print "</table><br>";
  85        print '</div>';
  86        
  87        $page = $_GET["page"];      
  88        $limit = $conf->liste_limit;
  89        $offset = $limit * $page ;
  90        
  91        $sql = "SELECT ".$db->pdate("date_releve")." as date_releve, valeur, rowid";
  92        $sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr";
  93        $sql .= " WHERE ecr.fk_compteur = '".$compteur->id."'";
  94        
  95        $sql .= " ORDER BY ecr.date_releve DESC";
  96        $sql .= $db->plimit($limit + 1 ,$offset);
  97        
  98        $resql = $db->query($sql);
  99        if ($resql)
 100      {
 101        $num = $db->num_rows($resql);
 102        $i = 0;
 103        $var=True;
 104        
 105        print_barre_liste("Relevés", $page, "", "&amp;id=".$compteur->id, $sortfield, $sortorder,'',$num);
 106        
 107        print '<table class="noborder" width="100%">';
 108        print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>';
 109        print '<td colspan="2">'.$langs->trans("Relevé").'</td></tr>';
 110        
 111        while ($i < $num)
 112          {
 113            $obj = $db->fetch_object($resql);
 114            $var=!$var;
 115            print "<tr $bc[$var]><td>";
 116            print strftime("%a %e %B %Y",$obj->date_releve);
 117            print '</td><td>'.$obj->valeur.'</td>';
 118            print '<td><a href="releve.php?id='.$compteur->id.'&amp;action=delete&amp;rowid='.$obj->rowid.'&amp;page='.$page.'">';
 119            print img_delete().'</a></td></tr>';
 120            $i++;
 121          }
 122      }
 123        print '</table>';
 124        print "<br>\n";
 125      }
 126    else
 127      {
 128        /* Commande non trouvée */
 129        print "Compteur inexistant";
 130      }
 131  }  
 132  else
 133  {
 134    print "Compteur inexistant";
 135  }
 136  
 137  
 138  $db->close();
 139  
 140  llxFooter("<em>Derni&egrave;re modification $Date: 2005/07/24 12:14:25 $ r&eacute;vision $Revision: 1.1 $</em>");
 141  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics