Subversion Repositories Applications.gtt

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/classes_metier/gtt_frais.class.php
New file
0,0 → 1,153
<?php
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
 
// |@author ABDOOL RAHEEM shaheen shaheenar50@hotmail.com |
// |@version 3 |
 
 
class Frais
{
 
/**Attributes: */
 
var $_id_frais; /*identifiant du frais equivalent au numero du plan comptable*/
var $_libelle_frais;/*libelle du plan comptable */
var $_date_frais;/*date des frais */
var $_utilisateur;/*utilisateur ayant occasioné la note de frais */
 
/*constructeur */
function Frais($id)
{
$this->_id_frais=$id;
}
/*
*construit un frais a partir d'un tableau
*/
function ConstruireFrais($tableau)
{
$this->_id_frais =$tableau[GEST_CHAMPS_ID_FRAIS];
$this->_libelle_frais = $tableau[ GEST_CHAMPS_LIBELLE_FRAIS];
$this->_date_frais = $tableau[GEST_CHAMPS_DATE_FRAIS];
$this->_utilisateur = $tableau[GEST_CHAMPS_ID_UTILISATEUR];
}
/*accesseur */
function getIdFrais()
{
return $this->_id_frais;
}
function getUtilisateur()
{
return $this->_utilisateur;
}
function getDateFrais()
{
return $this->_date_frais;
}
/**enregistrer les frais dans la base de donnees
*enreigistre que l'identifiant et le libelle dans la table gestion_note_frais
*/
 
function enregistrerFrais()
{
$table = GEST_FRAIS;
$champs = array(
GEST_CHAMPS_ID_FRAIS => $this_id_frais,
GEST_CHAMPS_LIBELLE_FRAIS => "$this->_libelle_frais"
);
$resultat = $GLOBALS['db']->autoExecute($table, $champs, DB_AUTOQUERY_INSERT);
if (DB::isError($resultat)) {
die($resultat->getMessage());
}
}
 
/**recuperer un frais de la base de donnees
*pour pouvoir instancier l'objet frais
*ne recupere que l'identifiant et le libelle*/
 
function recupererFrais()
{
$requete = "SELECT * FROM ".GEST_FRAIS.
" WHERE ".GEST_CHAMPS_ID_FRAIS." = $this->_id_frais";
$ligne = $GLOBALS['db']->query($requete);
$resultat = $ligne->fetchRow(DB_FETCHMODE_ASSOC);
(DB::isError($resultat)) ?
die (BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
/*construction d'un nouvel entité frais */
$nb_ligne_recupere= $resultat->numRows();
if ($nb_ligne_recupere==1)
{
$nouveau_frais = new Frais ($resultat);
return $nouveau_frais;
}
else
{
echo "frais inexistant ";
return -1;
}
}
 
/*supprimer un frais de la base de donnees */
function supprimerFrais()
{
$requete= "DELETE FROM ".GEST_FRAIS." WHERE ".GEST_CHAMPS_ID_FRAIS." = $this->_id_frais";
$resultat = $GLOBALS['db'] ->query($requete);
(DB::isError($resultat)) ?
die (BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
/*destruction de l'instance de l'objet */
}
 
/*afficher un frais */
function afficheFrais()
{
echo "frais : \n";
echo " $this->_id_frais \n ";
echo " $this->_libelle_frais \n";
echo " $this->_date_frais \n";
echo " $this->_utilisateur \n ";
}
 
}
?>
Property changes:
Added: svn:executable