60 lines
2.0 KiB
PHP
60 lines
2.0 KiB
PHP
<?php
|
|
require_once 'Framework/Modele.php';
|
|
class Garantiepolice extends Modele {
|
|
|
|
public function getGarBasePolice($idPolice)
|
|
{
|
|
$sql = 'select A.*, A.id as idGarantie
|
|
from garantiepolice A
|
|
join garantie B on (B.codeSociete=A.codeSociete) and (B.codeGarantie=A.codeGarantie)
|
|
Where (A.idPolice=?) and (A.optionnelle!="1") order by A.optionnelle, B.ordre';
|
|
|
|
$garanties = $this->executerRequete($sql, array($idPolice));
|
|
return $garanties;
|
|
}
|
|
|
|
|
|
public function getGarOptPolice($idPolice)
|
|
{
|
|
$sql = 'select A.*, IFNULL(B.idPolice,"0") as idPolice
|
|
from garantie A
|
|
left join garantiepolice B on (B.idPolice=?) and (B.codeSociete=A.codeSociete) and (B.codeGarantie=A.codeGarantie)
|
|
Where (A.optionnelle="1") order by A.ordre';
|
|
|
|
$garanties = $this->executerRequete($sql, array($idPolice));
|
|
return $garanties;
|
|
}
|
|
|
|
|
|
public function getGarOptPoliceAcq($idPolice)
|
|
{
|
|
$sql = 'select B.*, B.id as idGarantie
|
|
from garantie A
|
|
join garantiepolice B on (B.codeSociete=A.codeSociete) and (B.codeGarantie=A.codeGarantie)
|
|
Where (B.idPolice=?) and (A.optionnelle="1") order by A.ordre';
|
|
|
|
$garanties = $this->executerRequete($sql, array($idPolice));
|
|
return $garanties;
|
|
}
|
|
|
|
public function ajouter($idPolice, $codeGarantie)
|
|
{
|
|
$sql = 'insert into garantiepolice (codeSociete, idPolice, numeroPolice, codeGarantie, garantie, optionnelle,
|
|
additionnelle, tauxPlafond, forfaitPlafond, ordre, plafondLettre)
|
|
select A.codeSociete, B.id as idPolice, 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($idPolice, $codeGarantie));
|
|
}
|
|
|
|
public function supprimer($id)
|
|
{
|
|
$sql = 'DELETE FROM garantiepolice WHERE (id=?)';
|
|
$this->executerRequete($sql, array($id));
|
|
}
|
|
}
|