10 |
jpm |
1 |
<?php
|
|
|
2 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
3 |
// | PHP version 5.1.1 |
|
|
|
4 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
5 |
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
6 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
7 |
// | This file is part of eFlore. |
|
|
|
8 |
// | |
|
|
|
9 |
// | Foobar is free software; you can redistribute it and/or modify |
|
|
|
10 |
// | it under the terms of the GNU General Public License as published by |
|
|
|
11 |
// | the Free Software Foundation; either version 2 of the License, or |
|
|
|
12 |
// | (at your option) any later version. |
|
|
|
13 |
// | |
|
|
|
14 |
// | Foobar is distributed in the hope that it will be useful, |
|
|
|
15 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
16 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
17 |
// | GNU General Public License for more details. |
|
|
|
18 |
// | |
|
|
|
19 |
// | You should have received a copy of the GNU General Public License |
|
|
|
20 |
// | along with Foobar; if not, write to the Free Software |
|
|
|
21 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
22 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
23 |
// CVS : $Id$
|
|
|
24 |
/**
|
|
|
25 |
* Classe NoteFraisLigne
|
|
|
26 |
*
|
|
|
27 |
* Description
|
|
|
28 |
*
|
|
|
29 |
*@package eFlore
|
|
|
30 |
*@subpackage modele
|
|
|
31 |
//Auteur original :
|
|
|
32 |
*@version 3
|
|
|
33 |
*@author Shaheen ABDOOL RAHEEM <shaheenar50@hotmail.com>
|
|
|
34 |
//Autres auteurs :
|
|
|
35 |
*@version 4
|
|
|
36 |
*@author Jean-Pascal MILCENT <jpm@clapas.org>
|
|
|
37 |
*@author aucun
|
|
|
38 |
*@copyright Tela-Botanica 2000-2006
|
|
|
39 |
*@version $Revision$ $Date$
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
*/
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* class NoteFraisLigne : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
|
|
|
45 |
* classe métier
|
|
|
46 |
*/
|
|
|
47 |
class NoteFraisLigne extends aGttSql {
|
|
|
48 |
/*** Constantes : */
|
|
|
49 |
const GNFL_ID = 'NOTEFRAISLIGNE_ID';
|
|
|
50 |
const GNFL_ID_MAX = 'NOTEFRAISLIGNE_ID_MAX';
|
48 |
jpm |
51 |
|
10 |
jpm |
52 |
/*** Attributs : */
|
|
|
53 |
private $id_note_frais_ligne;
|
|
|
54 |
private $ce_note_frais;
|
|
|
55 |
private $date;
|
|
|
56 |
private $montant_ht;
|
|
|
57 |
private $taux_tva;
|
|
|
58 |
private $montant_ttc;
|
48 |
jpm |
59 |
|
10 |
jpm |
60 |
/*** Aggregations : */
|
|
|
61 |
|
|
|
62 |
/*** Constructeur : */
|
|
|
63 |
public function __construct($cmd = null, $parametres = null)
|
|
|
64 |
{
|
|
|
65 |
$this->dao_table_nom = 'gestion_note_frais_ligne';
|
|
|
66 |
$this->dao_correspondance = array(
|
|
|
67 |
'gnfl_id_note_frais_ligne' => 'id_note_frais_ligne',
|
|
|
68 |
'gnfl_ce_note_frais' => 'ce_note_frais',
|
|
|
69 |
'gnfl_date' => 'date',
|
|
|
70 |
'gnfl_montant_ht' => 'montant_ht',
|
|
|
71 |
'gnfl_taux_tva' => 'taux_tva',
|
|
|
72 |
'gnfl_montant_ttc' => 'montant_ttc');
|
48 |
jpm |
73 |
|
10 |
jpm |
74 |
// Si l'on veut remplir l'objet à la création on lance la requete correspondante
|
|
|
75 |
if (!is_null($cmd)) {
|
|
|
76 |
$this->consulter($cmd, $parametres, true);
|
|
|
77 |
}
|
|
|
78 |
}
|
48 |
jpm |
79 |
|
10 |
jpm |
80 |
/*** Accesseurs : */
|
|
|
81 |
// Id Note Frais Ligne
|
|
|
82 |
public function getIdNoteFraisLigne()
|
|
|
83 |
{
|
|
|
84 |
return $this->id_note_frais_ligne;
|
|
|
85 |
}
|
|
|
86 |
public function setIdNoteFraisLigne( $infl )
|
|
|
87 |
{
|
|
|
88 |
$this->id_note_frais_ligne = $infl;
|
|
|
89 |
}
|
48 |
jpm |
90 |
|
10 |
jpm |
91 |
// Ce Note Frais
|
|
|
92 |
public function getCeNoteFrais()
|
|
|
93 |
{
|
|
|
94 |
return $this->ce_note_frais;
|
|
|
95 |
}
|
|
|
96 |
public function setCeNoteFrais( $cnf )
|
|
|
97 |
{
|
|
|
98 |
$this->ce_note_frais = $cnf;
|
|
|
99 |
}
|
48 |
jpm |
100 |
|
10 |
jpm |
101 |
// Date
|
|
|
102 |
public function getDate()
|
|
|
103 |
{
|
|
|
104 |
return $this->date;
|
|
|
105 |
}
|
|
|
106 |
public function setDate( $d )
|
|
|
107 |
{
|
|
|
108 |
$this->date = $d;
|
|
|
109 |
}
|
48 |
jpm |
110 |
|
10 |
jpm |
111 |
// Montant Ht
|
|
|
112 |
public function getMontantHt()
|
|
|
113 |
{
|
|
|
114 |
return $this->montant_ht;
|
|
|
115 |
}
|
|
|
116 |
public function setMontantHt( $mh )
|
|
|
117 |
{
|
|
|
118 |
$this->montant_ht = $mh;
|
|
|
119 |
}
|
48 |
jpm |
120 |
|
10 |
jpm |
121 |
// Taux Tva
|
|
|
122 |
public function getTauxTva()
|
|
|
123 |
{
|
|
|
124 |
return $this->taux_tva;
|
|
|
125 |
}
|
|
|
126 |
public function setTauxTva( $tt )
|
|
|
127 |
{
|
|
|
128 |
$this->taux_tva = $tt;
|
|
|
129 |
}
|
48 |
jpm |
130 |
|
10 |
jpm |
131 |
// Montant Ttc
|
|
|
132 |
public function getMontantTtc()
|
|
|
133 |
{
|
|
|
134 |
return $this->montant_ttc;
|
|
|
135 |
}
|
|
|
136 |
public function setMontantTtc( $mt )
|
|
|
137 |
{
|
|
|
138 |
$this->montant_ttc = $mt;
|
|
|
139 |
}
|
48 |
jpm |
140 |
|
10 |
jpm |
141 |
/*** Méthodes : */
|
|
|
142 |
|
|
|
143 |
/**
|
|
|
144 |
* Consulter la table gestion_note_frais_ligne.
|
|
|
145 |
* @return mixed un tableau d'objets NoteFraisLigne s'il y en a plusieurs, l'objet NoteFraisLigne s'il y en a 1 seul sinon false.
|
|
|
146 |
*/
|
|
|
147 |
public function consulter($cmd = '', $parametres = array(), $instancier = false)
|
|
|
148 |
{
|
48 |
jpm |
149 |
if (!is_array($parametres)) {
|
|
|
150 |
$parametres[0] = $parametres;
|
|
|
151 |
}
|
10 |
jpm |
152 |
switch ($cmd) {
|
|
|
153 |
case NoteFraisLigne::GNFL_ID:
|
|
|
154 |
$requete = 'SELECT * '.
|
|
|
155 |
'FROM gestion_note_frais_ligne '.
|
|
|
156 |
'WHERE gnfl_id_note_frais_ligne = '.$parametres[0].' ';
|
|
|
157 |
break;
|
|
|
158 |
case NoteFraisLigne::GNFL_ID_MAX:
|
|
|
159 |
$requete = 'SELECT MAX(gnfl_id_note_frais_ligne) '.
|
|
|
160 |
'FROM gestion_note_frais_ligne ';
|
|
|
161 |
break;
|
|
|
162 |
default :
|
|
|
163 |
$message = 'Commande '.$cmd.'inconnue!';
|
|
|
164 |
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
|
|
|
165 |
trigger_error($e, E_USER_ERROR);
|
|
|
166 |
}
|
48 |
jpm |
167 |
|
10 |
jpm |
168 |
$resultat = $GLOBALS['db']->query($requete);
|
|
|
169 |
(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
|
|
|
170 |
$tab_resultat = array();
|
|
|
171 |
while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
172 |
$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
|
|
|
173 |
}
|
48 |
jpm |
174 |
|
|
|
175 |
$resultat_nbre = count($tab_resultat);
|
10 |
jpm |
176 |
if ($resultat_nbre > 1) {
|
|
|
177 |
return $tab_resultat;
|
|
|
178 |
} else if ($resultat_nbre == 1) {
|
|
|
179 |
return $tab_resultat[0];
|
|
|
180 |
} else if ($resultat_nbre == 0) {
|
|
|
181 |
return false;
|
|
|
182 |
}
|
|
|
183 |
}
|
48 |
jpm |
184 |
|
10 |
jpm |
185 |
/** Afficher l'objet NoteFraisLigne */
|
|
|
186 |
function afficherNoteFraisLigne()
|
|
|
187 |
{
|
|
|
188 |
echo '<pre>'.print_r($this, true).'</pre>';
|
|
|
189 |
}
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
193 |
*
|
|
|
194 |
* $Log$
|
|
|
195 |
*
|
|
|
196 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
197 |
*/
|
|
|
198 |
?>
|