[ 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/rapport/ -> AtomePropaleValidee.class.php (source)

   1  <?php
   2  /* Copyright (C) 2004 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: AtomePropaleValidee.class.php,v 1.3 2004/10/20 20:06:50 opensides Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/rapport/AtomePropaleValidee.class.php,v $
  20   *
  21   */
  22  
  23  include_once(DOL_DOCUMENT_ROOT.'/rapport/Atome.class.php');
  24  
  25  class AtomePropaleValidee extends Atome
  26  {
  27    var $id;
  28    var $db;
  29  
  30  
  31    /**
  32     * Initialisation de la classe
  33     *
  34     */
  35    function AtomePropaleValidee($DB,$periode, $daystart)
  36      {
  37        $this->db = $DB ;
  38        $this->AtomeInitialize($periode, 'AtomePropaleValidee', $daystart);
  39      }
  40  
  41    /**
  42     * 
  43     *
  44     *
  45     */
  46    function fetch()
  47      {
  48        $sql = "SELECT date_format(f.datep,'%Y%m'), sum(f.price) as am";
  49        $sql .= " FROM ".MAIN_DB_PREFIX."propal as f";
  50        $sql .= " WHERE f.fk_statut = 2";
  51        
  52        if ($this->year)
  53      {
  54        $sql .= " AND date_format(f.datep,'%Y') = $this->year ";
  55        $sql .= " GROUP BY date_format(f.datep,'%Y%m') ASC ;";
  56      }
  57  
  58        if ($this->db->query($sql) )
  59      {
  60        $i = 0;
  61        $num = $this->db->num_rows();
  62        $arr = array();
  63        while ($i < $num)
  64          {
  65            $row = $this->db->fetch_row($i);
  66            
  67            $arr[$row[0]] = $row[1];
  68  
  69            $i++;
  70          }
  71        return $arr;
  72  
  73        $this->db->free();
  74      }
  75        else
  76      {
  77        print $this->db->error();
  78        return -3;
  79      }    
  80      }  
  81  }
  82  ?>


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