61 lines
1.6 KiB
PHP
61 lines
1.6 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/Statistique.php';
|
|
|
|
class ControleurAjaxetatfactureexport extends Controleurrequete
|
|
{
|
|
private $cumulprestataire;
|
|
|
|
public function __construct() {
|
|
$this->cumulprestataire = new Statistique();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$factures = $this->cumulprestataire->etatdetailfactureeexport() ;
|
|
|
|
// Excel
|
|
$headerXLS = array
|
|
(
|
|
_('Type Prestataire'),
|
|
_('Prestataire'),
|
|
_('Souscripteur'),
|
|
_('Bénéficiaire'),
|
|
_('Système'),
|
|
_('A payer'),
|
|
_('Payé'),
|
|
_('ID Facture')
|
|
);
|
|
|
|
$dataXLS = array();
|
|
|
|
foreach ($factures as $facture)
|
|
{
|
|
$dataXLS[]=$facture;
|
|
}
|
|
|
|
$classeur = new Spreadsheet();
|
|
$classeur->getProperties()->setCreator("INTER-SANTE");
|
|
$classeur->setActiveSheetIndex(0);
|
|
$feuille=$classeur->getActiveSheet();
|
|
$feuille->setTitle(_('DETAIL DES FACTURES'));
|
|
$feuille->fromArray($headerXLS, NULL, 'A1', true);
|
|
$feuille->fromArray($dataXLS, NULL, 'A2', true);
|
|
|
|
//Forcer le téléchargement vers le navigateur;
|
|
$fichier = 'Temp/TMP_STAT_DETAIL_FACTURES'."_".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();
|
|
}
|
|
} |