diff --git a/Controleur/ControleurAjaxavenantretrait.php b/Controleur/ControleurAjaxavenantretrait.php index 9af36804..29cee193 100644 --- a/Controleur/ControleurAjaxavenantretrait.php +++ b/Controleur/ControleurAjaxavenantretrait.php @@ -4,23 +4,27 @@ require_once 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; require_once 'Framework/Controleurrequete.php'; // OK -require_once 'Modele/Police.php'; +// require_once 'Modele/Police.php'; +require_once 'Modele/Avenant.php'; class ControleurAjaxavenantretrait extends Controleurrequete { - private $police; + // private $police; + private $avenant; public function __construct() { - $this->police = new Police(); + // $this->police = new Police(); + $this->avenant = new Avenant(); } public function index() { - $idPolice = $_SESSION['idPolice_C']; + // $idPolice = $_SESSION['idPolice_C']; $idAvenant = $this->requete->getParametreFormulaire("idAvenant"); - $entetecp = $this->police->getEnteteCP($idPolice); + // $entetecp = $this->police->getEnteteCP($idPolice); + $entetecp = $this->avenant->getUnAvenant($idAvenant); /* $collegecps = $this->police->getCollegesCP($idPolice); @@ -45,7 +49,7 @@ class ControleurAjaxavenantretrait extends Controleurrequete $pdf->SetFont(''); - // $pdf->Ln(15); + $pdf->Ln(10); $pdf->SetFont('Arial','', 9); @@ -53,6 +57,16 @@ class ControleurAjaxavenantretrait extends Controleurrequete We are pleased to confirm that they have been removed from the current policy in accordance with the agreed contractual terms and conditions. Below is the related premium to be refunded calculated on prorated basis in consideration of the unearned period and agreed percentage: "); $pdf->MultiCell(0, $ht, $text); + $pdf->Ln(10); + + $pdf->SetFont('Arial','B', 10); + + $pdf->SetFont('Arial','BU', 10); + + $pdf->Cell(0,$ht,convertirc("Effective Date :".$entetecp['dateEffetAvenant']),0,0,'L',false); + + $pdf->Cell(0,$ht,convertirc("End Date:".$entetecp['dateEcheance']),0,1,'R',false); + /* $pdf->Ln(5); diff --git a/Modele/Avenant.php b/Modele/Avenant.php index 76730b93..9e8d5179 100644 --- a/Modele/Avenant.php +++ b/Modele/Avenant.php @@ -81,4 +81,14 @@ class Avenant extends Modele { $liste = $this->executerRequete($sql, array($idPolice)); return $liste->fetchAll(PDO::FETCH_ASSOC); } + + public function getUnAvenant($idAvenant) + { + $sql = 'call sp_get_un_avenant(?);'; + + $entete = $this->executerRequete($sql, array($idAvenant)); + + return $entete->fetch(PDO::FETCH_ASSOC); + } + }