60 lines
2.0 KiB
PHP
60 lines
2.0 KiB
PHP
<?php
|
|
require_once 'Framework/Modele.php';
|
|
class Garantiecollege 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, optionnelle,
|
|
additionnelle, tauxPlafond, forfaitPlafond, ordre, plafondLettre)
|
|
select A.codeSociete, B.id as idCollege, B.numeroPolice, A.codeGarantie, A.libelle, A.optionnelle,
|
|
A.additionnelle, A.tauxPlafond,
|
|
A.forfaitPlafond, A.ordre, A.plafondLettre
|
|
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));
|
|
}
|
|
}
|