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

61 lines
2.1 KiB
PHP

<?php
require_once 'Framework/Modele.php';
class Garantiecollege_d extends Modele {
public function getGarBaseCollege($idCollege)
{
$sql = 'select A.*, A.id as idGarantie
from garantiecollege A
join garantie B on (B.codeSociete=A.codeSociete) and (B.codeGarantie=A.codeGarantie)
Where (A.idCollege=?) and (A.optionnelle!="1") order by A.optionnelle, B.ordre';
$garanties = $this->executerRequete($sql, array($idCollege));
return $garanties;
}
public function getGarOptCollege($idCollege)
{
$sql = 'select A.*, IFNULL(B.idCollege,"0") as idCollege
from garantie A
left join garantiecollege B on (B.idCollege=?) and (B.codeSociete=A.codeSociete) and (B.codeGarantie=A.codeGarantie)
Where (A.optionnelle="1") order by A.ordre';
$garanties = $this->executerRequete($sql, array($idCollege));
return $garanties;
}
public function getGarOptCollegeAcq($idCollege)
{
$sql = 'select B.*, B.id as idGarantie
from garantie A
join garantiecollege B on (B.codeSociete=A.codeSociete) and (B.codeGarantie=A.codeGarantie)
Where (B.idCollege=?) and (A.optionnelle="1") order by A.ordre';
$garanties = $this->executerRequete($sql, array($idCollege));
return $garanties;
}
public function ajouter($idCollege, $codeGarantie)
{
$sql = 'insert into garantiecollege (codeSociete, idCollege, numeroPolice, codeGarantie, garantie, garantieEng, optionnelle,
additionnelle, tauxPlafond, forfaitPlafond, ordre, plafondLettre, champApplication)
select A.codeSociete, B.id as idCollege, B.numeroPolice, A.codeGarantie, A.libelle, A.libelleEng, A.optionnelle,
A.additionnelle, A.tauxPlafond,
A.forfaitPlafond, A.ordre, A.plafondLettre, A.champApplication
from garantie A
join police B on (B.codeSociete=A.codeSociete)
where (B.id=?) and (A.codeGarantie=?)';
$this->executerRequete($sql, array($idCollege, $codeGarantie));
}
public function supprimer($id)
{
$sql = 'DELETE FROM garantiecollege WHERE (id=?)';
$this->executerRequete($sql, array($id));
}
}