prestation/Modele/Tarifsoptiques.php
2025-12-01 18:54:33 +00:00

69 lines
1.7 KiB
PHP

<?php
require_once 'Framework/Modele.php';
class Tarifsoptiques extends Modele {
public function getListe()
{
if (est_anglophone())
{
$sql = 'SELECT codeTarifOptique as `code`, libelleEng as libelle FROM p_tarifoptique order by libelle';
}
else
{
$sql = 'SELECT codeTarifOptique as `code`, libelle FROM p_tarifoptique order by libelle';
}
$liste = $this->executerRequete($sql);
return $liste->fetchAll(PDO::FETCH_ASSOC);
}
public function creertarifoptiques($libelle, $libelleEng)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_creer_tarif_optiques(?, ?, ?, ?)';
$this->executerRequete($sql, array($codeSociete, $libelle, $libelleEng, $user));
}
public function getListeTarif()
{
$codeSociete = $_SESSION['codeSociete'];
$sql = 'SELECT * FROM p_tarifoptique where codeSociete=? order by libelle';
$liste = $this->executerRequete($sql, array($codeSociete));
return $liste->fetchAll(PDO::FETCH_ASSOC);
}
public function getunptarif($idTarif)
{
$sql = 'call sp_afficher_un_tarif_optiquee(?)';
$resultat = $this->executerRequete($sql, array($idTarif));
return $resultat->fetch(PDO::FETCH_ASSOC);
}
public function enregistrermodif($idTarif, $libelle, $libelleEng)
{
$user = $_SESSION['login'];
$sql = 'call sp_modifier_tarif_optique(?, ?, ?, ?)';
$this->executerRequete($sql, array($idTarif, $libelle, $libelleEng, $user));
}
public function supprimer($idTarif)
{
$user = $_SESSION['login'];
$sql = 'call sp_supprimer_tarif_optique(?, ?)';
$this->executerRequete($sql, array($idTarif, $user));
}
}