a
This commit is contained in:
91
Controleur/ControleurAjaxsyntheseconsopolice.php
Normal file
91
Controleur/ControleurAjaxsyntheseconsopolice.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
require_once 'Framework/Controleurrequete.php'; // OK
|
||||
require_once 'Modele/Police.php';
|
||||
|
||||
class ControleurAjaxsyntheseconsopolice extends Controleurrequete
|
||||
{
|
||||
private $police;
|
||||
|
||||
public function __construct() {
|
||||
$this->police = new Police();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$conommations = $this->police->getsyntheseconsopolice() ;
|
||||
|
||||
$this->genererVueAjax(array('conommations' => $conommations));
|
||||
}
|
||||
|
||||
public function exportxls()
|
||||
{
|
||||
|
||||
$conommations = $this->police->getsyntheseconsopolice() ;
|
||||
|
||||
// Excel
|
||||
$headerXLS = array
|
||||
(
|
||||
"dateReference",
|
||||
"idAderent",
|
||||
_('No Adhérent'),
|
||||
_('Adhérent'),
|
||||
"primeStat",
|
||||
"primeTtc",
|
||||
|
||||
"plafond_OUT",
|
||||
"consommation_OUT",
|
||||
"solde_OUT",
|
||||
|
||||
"plafond_INP",
|
||||
"consommation_INP",
|
||||
"solde_INP",
|
||||
|
||||
"plafond_OPT",
|
||||
"consommation_OPT",
|
||||
"solde_OPT",
|
||||
|
||||
"plafond_MON",
|
||||
"consommation_MON",
|
||||
"solde_MON",
|
||||
|
||||
"plafond_DEN",
|
||||
"consommation_DEN",
|
||||
"solde_DEN",
|
||||
|
||||
"plafond_FUN",
|
||||
"consommation_FUN",
|
||||
"solde_FUN",
|
||||
"consommation_ALL"
|
||||
);
|
||||
|
||||
$dataXLS = array();
|
||||
|
||||
|
||||
foreach ($conommations as $conommation)
|
||||
{
|
||||
$dataXLS[]=$conommation;
|
||||
}
|
||||
|
||||
$classeur = new PHPExcel();
|
||||
$classeur->getProperties()->setCreator("INTER-SANTE");
|
||||
$classeur->setActiveSheetIndex(0);
|
||||
$feuille=$classeur->getActiveSheet();
|
||||
$feuille->setTitle(_('SYNTHESE CONSOMMATIONS'));
|
||||
$feuille->fromArray($headerXLS, NULL, 'A1', true);
|
||||
$feuille->fromArray($dataXLS, NULL, 'A2', true);
|
||||
|
||||
//Forcer le téléchargement vers le navigateur;
|
||||
$fichier = 'Temp/TMP_SYNTHESE_CONS'."_".uniqid().".xlsx";
|
||||
|
||||
$writer = new PHPExcel_Writer_Excel2007($classeur);
|
||||
$writer->save($fichier);
|
||||
|
||||
$t_html =' <div id ="div_detail_exp" class="alert alert-info"> ';
|
||||
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
|
||||
$t_html .=' </div ';
|
||||
echo $t_html;
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
26
Controleur/ControleurSyntheseconsopolice.php
Normal file
26
Controleur/ControleurSyntheseconsopolice.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
require_once 'Framework/Controleur.php';
|
||||
require_once 'Modele/Police.php';
|
||||
require_once 'Modele/Menuvueutilisateur.php';
|
||||
|
||||
class ControleurSyntheseconsopolice extends Controleur {
|
||||
private $sppolice;
|
||||
|
||||
|
||||
public function __construct() {
|
||||
$this->menuvue = new Menuvueutilisateur();
|
||||
$this->menuvue->getMenuVue("Syntheseconsopolice");
|
||||
|
||||
$this->sppolice = new Police();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$idPolice = $_SESSION['idPolice_C'];
|
||||
|
||||
$dj = date("Y-m-d");
|
||||
|
||||
$sppoliceentete = $this->sppolice->getRapportSpPoliceEntete($idPolice, $dj);
|
||||
|
||||
$this->genererVue(array('sppoliceentete' => $sppoliceentete));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user