89 lines
2.8 KiB
PHP
Executable File
89 lines
2.8 KiB
PHP
Executable File
<?php
|
|
require_once 'vendor/autoload.php';
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
|
require_once 'Framework/Controleurrequete.php'; // OK
|
|
require_once 'Modele/Statistique.php';
|
|
|
|
class ControleurAjaxdetailrapportspgarantieadhperiode extends Controleur
|
|
{
|
|
private $detailsp;
|
|
|
|
public function __construct() {
|
|
$this->detailsp = new Statistique();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$idAdherent = $this->requete->getParametreFormulaire("idAdherent");
|
|
|
|
$entete = $this->detailsp->detailrapportspadhperiodepdfentete($idAdherent);
|
|
|
|
$detailsps = $this->detailsp->detailrapportspgarantieadhperiode($idAdherent);
|
|
|
|
// Excel
|
|
$headerXLS = array
|
|
(
|
|
_('Matricule'),
|
|
_('Beneficiaire'),
|
|
_('Date'),
|
|
_('Prestataire'),
|
|
_('No Fact'),
|
|
_('Garantie'),
|
|
_('Montant')
|
|
);
|
|
|
|
$dataXLS = array();
|
|
|
|
|
|
foreach ($detailsps as $detailsp)
|
|
{
|
|
$dataXLS[]=$detailsp;
|
|
}
|
|
|
|
|
|
$classeur = new Spreadsheet();
|
|
$classeur->getProperties()->setCreator("INTER-SANTE");
|
|
$classeur->setActiveSheetIndex(0);
|
|
$feuille=$classeur->getActiveSheet();
|
|
$feuille->setTitle(_('DETAIL GARANTIES FAMILLE'));
|
|
|
|
$feuille->setCellValue('A1', convertirc($entete['nomAssureur']));
|
|
$feuille->setCellValue('B1', convertirc(_("RAPPORT SINISTRE A PRIME PAR FAMILLE")));
|
|
|
|
$feuille->setCellValue('A2', convertirc(_('Garant').' : '));
|
|
$feuille->setCellValue('B2', convertirc($entete['garant']));
|
|
|
|
$feuille->setCellValue('A3', convertirc(_('Souscripteur').' : '));
|
|
$feuille->setCellValue('B3', convertirc($entete['souscripteur']));
|
|
|
|
$feuille->setCellValue('A4', convertirc(_('Police').' No: '));
|
|
$feuille->setCellValue('B4', convertirc($entete['numeroPolice']).' / '.$entete['libellePolice']);
|
|
|
|
$feuille->setCellValue('A5', convertirc(_('Adherent').' Mle: '));
|
|
$feuille->setCellValue('B5', convertirc($entete['numeroAdherent']).' / '.$entete['adherent']);
|
|
|
|
|
|
$feuille->setCellValue('A6', convertirc(_('Couverture').' : '));
|
|
$feuille->setCellValue('B6', convertirc($entete['dateEffetAdherent']." To ".$entete['dateFinAdherent']));
|
|
|
|
$feuille->setCellValue('A7', convertirc(_('Periode').' : '));
|
|
$feuille->setCellValue('B7', convertirc($entete['debutAnalyse']." To ".$entete['finAnalyse']));
|
|
|
|
$feuille->fromArray($headerXLS, NULL, 'A9', true);
|
|
$feuille->fromArray($dataXLS, NULL, 'A10', true);
|
|
|
|
$fichier = 'Temp/DETAIL_GARANTIES_FAMILLE'."_".uniqid().".xlsx";
|
|
|
|
$writer = new Xlsx($classeur);
|
|
$writer->save($fichier);
|
|
|
|
$t_html =' <div id ="div_export_a" class="alert alert-info"> ';
|
|
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
|
|
$t_html .=' </div ';
|
|
echo $t_html;
|
|
|
|
exit();
|
|
}
|
|
|
|
} |