122 lines
3.2 KiB
PHP
122 lines
3.2 KiB
PHP
<?php
|
|
require_once 'vendor/autoload.php';
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
|
require_once 'Framework/Controleurrequete.php'; // OK
|
|
require_once 'Modele/Prestataire.php';
|
|
|
|
class ControleurAjaximprimerdlisteprestataireparametrageexport extends Controleurrequete
|
|
{
|
|
private $prestataire;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->prestataire = new Prestataire();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$codeTypePrestataire = $this->requete->getParametreFormulaire("codeTypePrestataire");
|
|
$codeReseau = $this->requete->getParametreFormulaire("codeReseau");
|
|
$libelle = $this->requete->getParametreFormulaire("libelle");
|
|
|
|
$prestataires = $this->prestataire->getprestataireparametrageexport($codeTypePrestataire, $codeReseau, $libelle) ;
|
|
|
|
// Excel
|
|
|
|
$headerXLS = array
|
|
(
|
|
_('Nom'),
|
|
"Code",
|
|
_('Adresse Géo'),
|
|
_('Signature'),
|
|
_('District'),
|
|
_('Province'),
|
|
"E-mail",
|
|
"Tel",
|
|
"type",
|
|
_("Réseau"),
|
|
_("Actif")
|
|
);
|
|
|
|
$dataXLS = array();
|
|
|
|
foreach ($prestataires as $prestataire)
|
|
{
|
|
$dataXLS[]=$prestataire;
|
|
}
|
|
|
|
$classeur = new Spreadsheet();
|
|
$classeur->getProperties()->setCreator("INTER-SANTE");
|
|
$classeur->setActiveSheetIndex(0);
|
|
$feuille=$classeur->getActiveSheet();
|
|
$feuille->setTitle(_('LISTE DES PRESTATAIRES'));
|
|
$feuille->fromArray($headerXLS, NULL, 'A1', true);
|
|
$feuille->fromArray($dataXLS, NULL, 'A2', true);
|
|
|
|
$fichier = 'Temp/TEMP_LISTE_PRESTATAIRES'."_".uniqid().".xlsx";
|
|
|
|
$writer = new Xlsx($classeur);
|
|
$writer->save($fichier);
|
|
|
|
$t_html =' <div id ="div_liste_prestataire" class="alert alert-info"> ';
|
|
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
|
|
$t_html .=' </div ';
|
|
echo $t_html;
|
|
|
|
exit();
|
|
}
|
|
|
|
public function actif()
|
|
{
|
|
$codeTypePrestataire = $this->requete->getParametreFormulaire("codeTypePrestataire");
|
|
$codeReseau = $this->requete->getParametreFormulaire("codeReseau");
|
|
$libelle = $this->requete->getParametreFormulaire("libelle");
|
|
|
|
$prestataires = $this->prestataire->getprestataireactifparametrageexport($codeTypePrestataire, $codeReseau, $libelle) ;
|
|
|
|
// Excel
|
|
|
|
$headerXLS = array
|
|
(
|
|
_('Nom'),
|
|
"Code",
|
|
_('Adresse Géo'),
|
|
_('Signature'),
|
|
_('District'),
|
|
_('Province'),
|
|
"E-mail",
|
|
"Tel",
|
|
"type",
|
|
_("Réseau")
|
|
);
|
|
|
|
$dataXLS = array();
|
|
|
|
foreach ($prestataires as $prestataire)
|
|
{
|
|
$dataXLS[]=$prestataire;
|
|
}
|
|
|
|
$classeur = new Spreadsheet();
|
|
$classeur->getProperties()->setCreator("INTER-SANTE");
|
|
$classeur->setActiveSheetIndex(0);
|
|
$feuille=$classeur->getActiveSheet();
|
|
$feuille->setTitle(_('LISTE DES PRESTATAIRES'));
|
|
$feuille->fromArray($headerXLS, NULL, 'A1', true);
|
|
$feuille->fromArray($dataXLS, NULL, 'A2', true);
|
|
|
|
$fichier = 'Temp/TEMP_LISTE_PRESTATAIRES'."_".uniqid().".xlsx";
|
|
|
|
$writer = new Xlsx($classeur);
|
|
$writer->save($fichier);
|
|
|
|
$t_html =' <div id ="div_liste_prestataire" class="alert alert-info"> ';
|
|
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
|
|
$t_html .=' </div ';
|
|
echo $t_html;
|
|
|
|
exit();
|
|
}
|
|
|
|
} |