<?php
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.1.1                                                                                    |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of eFlore.                                                                         |
// |                                                                                                      |
// | Foobar is free software; you can redistribute it and/or modify                                       |
// | it under the terms of the GNU General Public License as published by                                 |
// | the Free Software Foundation; either version 2 of the License, or                                    |
// | (at your option) any later version.                                                                  |
// |                                                                                                      |
// | Foobar 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 General Public License for more details.                                                         |
// |                                                                                                      |
// | You should have received a copy of the GNU General Public License                                    |
// | along with Foobar; if not, write to the Free Software                                                |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Classe FraisKm
*
* Description
*
*@package eFlore
*@subpackage modele
//Auteur original :
*@version 3
*@author        Shaheen ABDOOL RAHEEM <shaheenar50@hotmail.com>
//Autres auteurs :
*@version 4
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
*@author        aucun
*@copyright     Tela-Botanica 2000-2006
*@version       $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/

/**
* class FraisKm : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
* classe métier
*/
class FraisKm extends aGttSql {
	/*** Constantes : */
	const GFK_ID = 'FRAISKM_ID';
	const GFK_ID_MAX = 'FRAISKM_ID_MAX';

	/*** Attributs : */
	private $id_frais_km;
	private $gfkt_id_frais_km_taux;
	private $ce_utilisateur;
	private $date;
	private $nbre_km;
	private $objet;
	private $trajet;
	private $montant_total;

	/*** Aggregations : */

	/*** Constructeur : */
	public function __construct($cmd = null, $parametres = null)
	{
		$this->dao_table_nom = GTT_BDD_PREFIXE . 'gestion_frais_km';
		$this->dao_correspondance = array(
			'gfk_id_frais_km'	=> 'id_frais_km',
			'gfkt_id_frais_km_taux'	=> 'gfkt_id_frais_km_taux',
			'gfk_ce_utilisateur'	=> 'ce_utilisateur',
			'gfk_date'	=> 'date',
			'gfk_nbre_km'	=> 'nbre_km',
			'gfk_objet'	=> 'objet',
			'gfk_trajet'	=> 'trajet',
			'gfk_montant_total'	=> 'montant_total');

		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
		if (!is_null($cmd)) {
			$this->consulter($cmd, $parametres, true);
		}
	}

	/*** Accesseurs : */
	// Id Frais Km
	public function getIdFraisKm()
	{
		return $this->id_frais_km;
	}
	public function setIdFraisKm( $ifk )
	{
		$this->id_frais_km = $ifk;
	}

	// Gfkt Id Frais Km Taux
	public function getGfktIdFraisKmTaux()
	{
		return $this->gfkt_id_frais_km_taux;
	}
	public function setGfktIdFraisKmTaux( $gifkt )
	{
		$this->gfkt_id_frais_km_taux = $gifkt;
	}

	// Ce Utilisateur
	public function getCeUtilisateur()
	{
		return $this->ce_utilisateur;
	}
	public function setCeUtilisateur( $cu )
	{
		$this->ce_utilisateur = $cu;
	}

	// Date
	public function getDate()
	{
		return $this->date;
	}
	public function setDate( $d )
	{
		$this->date = $d;
	}

	// Nbre Km
	public function getNbreKm()
	{
		return $this->nbre_km;
	}
	public function setNbreKm( $nk )
	{
		$this->nbre_km = $nk;
	}

	// Objet
	public function getObjet()
	{
		return $this->objet;
	}
	public function setObjet( $o )
	{
		$this->objet = $o;
	}

	// Trajet
	public function getTrajet()
	{
		return $this->trajet;
	}
	public function setTrajet( $t )
	{
		$this->trajet = $t;
	}

	// Montant Total
	public function getMontantTotal()
	{
		return $this->montant_total;
	}
	public function setMontantTotal( $mt )
	{
		$this->montant_total = $mt;
	}

	/*** Méthodes : */

	/**
	* Consulter la table gestion_frais_km.
	* @return mixed un tableau d'objets FraisKm s'il y en a plusieurs, l'objet FraisKm s'il y en a 1 seul sinon false.
	*/
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
	{
		switch ($cmd) {
			case FraisKm::GFK_ID:
				$requete = 	'SELECT * '.
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_frais_km '.
							'WHERE gfk_id_frais_km = #0 ';
				break;
			case FraisKm::GFK_ID_MAX:
				$requete =	'SELECT MAX(gfk_id_frais_km) '.
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_frais_km ';
				break;
			default :
				$message = 'Commande '.$cmd.'inconnue!';
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
    			trigger_error($e, E_USER_ERROR);
		}
		return parent::consulter($requete, $parametres, $instancier);
	}
}

/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>