| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
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: AtomeFactureValidee.class.php,v 1.3 2004/10/20 20:06:50 opensides Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/rapport/AtomeFactureValidee.class.php,v $ 20 * 21 */ 22 23 include_once(DOL_DOCUMENT_ROOT.'/rapport/Atome.class.php'); 24 25 class AtomeFactureValidee extends Atome 26 { 27 var $id; 28 var $db; 29 var $periode; 30 31 /** 32 * Initialisation de la classe 33 * 34 */ 35 function AtomeFactureValidee($DB, $periode, $daystart) 36 { 37 $this->db = $DB ; 38 $this->name = 'AtomeFactureValidee'; 39 $this->AtomeInitialize($periode,'AtomeFactureValidee', $daystart); 40 $this->datas = array(); 41 } 42 43 /** 44 * 45 * 46 * 47 */ 48 function fetch() 49 { 50 if ($this->periode == 'year') 51 { 52 $sql = "SELECT date_format(f.datef,'%Y%m'), sum(f.amount) as am"; 53 $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; 54 $sql .= " WHERE f.fk_statut = 1"; 55 56 $sql .= " AND date_format(f.datef,'%Y') = $this->year "; 57 $sql .= " GROUP BY date_format(f.datef,'%Y%m') ASC ;"; 58 } 59 60 if ($this->periode == 'month') 61 { 62 $sql = "SELECT date_format(f.datef,'%Y%m%d'), sum(f.amount) as am"; 63 $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; 64 $sql .= " WHERE f.fk_statut = 1"; 65 $sql .= " AND date_format(f.datef,'%Y%m') = ".$this->year.$this->month; 66 $sql .= " GROUP BY date_format(f.datef,'%Y%m%d') ASC ;"; 67 } 68 69 if ($this->db->query($sql) ) 70 { 71 $i = 0; 72 $num = $this->db->num_rows(); 73 $arr = array(); 74 while ($i < $num) 75 { 76 $row = $this->db->fetch_row($i); 77 78 $arr[$row[0]] = $row[1]; 79 //print $row[0] .'-'.$row[1]. '<br>'; 80 $i++; 81 } 82 83 $this->db->free(); 84 $this->datas = $arr; 85 return $arr; 86 } 87 else 88 { 89 print $this->db->error(); 90 print "<br>$sql"; 91 return -3; 92 } 93 } 94 } 95 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
|