[ 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: client.class.php,v 1.4 2005/08/25 20:27:17 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/client.class.php,v $ 20 * 21 */ 22 23 /** 24 \file htdocs/client.class.php 25 \ingroup societe 26 \brief Fichier de la classe des clients 27 \version $Revision: 1.4 $ 28 */ 29 30 31 /** 32 \class Client 33 \brief Classe permettant la gestion des clients 34 */ 35 36 include_once (DOL_DOCUMENT_ROOT."/societe.class.php"); 37 38 39 class Client extends Societe 40 { 41 var $db; 42 43 44 /** 45 * \brief Constructeur de la classe 46 * \param DB handler accès base de données 47 * \param id id societe (0 par defaut) 48 */ 49 function Client($DB, $id=0) 50 { 51 global $config; 52 53 $this->db = $DB; 54 $this->id = $id; 55 $this->factures = array(); 56 57 return 0; 58 } 59 60 function read_factures() 61 { 62 $sql = "SELECT rowid, facnumber"; 63 $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; 64 $sql .= " WHERE f.fk_soc = ".$this->id; 65 $sql .= " ORDER BY datef DESC"; 66 67 $result = $this->db->query($sql) ; 68 $i = 0; 69 if ( $result ) 70 { 71 $num = $this->db->num_rows(); 72 73 while ($i < $num ) 74 { 75 $row = $this->db->fetch_row(); 76 77 $this->factures[$i][0] = $row[0]; 78 $this->factures[$i][1] = $row[1]; 79 80 $i++; 81 } 82 } 83 return $result; 84 } 85 86 87 /** 88 * \brief Charge indicateurs this->nb de tableau de bord 89 * \return int <0 si ko, >0 si ok 90 */ 91 function load_state_board() 92 { 93 global $conf; 94 95 $this->nb=array(); 96 97 $sql = "SELECT count(s.idp) as nb, s.client"; 98 $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; 99 $sql.= " WHERE s.client in (1,2)"; 100 $sql.= " GROUP BY s.client"; 101 $resql=$this->db->query($sql); 102 if ($resql) 103 { 104 while ($obj=$this->db->fetch_object($resql)) 105 { 106 if ($obj->client == 1) $this->nb["customers"]=$obj->nb; 107 if ($obj->client == 2) $this->nb["prospects"]=$obj->nb; 108 } 109 return 1; 110 } 111 else 112 { 113 dolibarr_print_error($this->db); 114 $this->error=$this->db->error(); 115 return -1; 116 } 117 118 } 119 120 } 121 ?>
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 |
![]() |