diff --git a/Controleur/ControleurAjaxsppolice.php b/Controleur/ControleurAjaxsppolice.php index ce13821..bfd3bdc 100644 --- a/Controleur/ControleurAjaxsppolice.php +++ b/Controleur/ControleurAjaxsppolice.php @@ -22,8 +22,9 @@ class ControleurAjaxsppolice extends Controleur $dj = date("Y-m-d"); $sppolice = $this->sppolice->getRapportSpPolicePol($idPolice, $dj); + $limiteConsommation = get_limite_consommation_police($idPolice); - $this->genererVueAjax(array('sppolice' => $sppolice)); + $this->genererVueAjax(array('sppolice' => $sppolice, 'limiteConsommation' => $limiteConsommation)); } public function categorie() @@ -33,8 +34,9 @@ class ControleurAjaxsppolice extends Controleur $dj = date("Y-m-d"); $sppolices = $this->sppolice->getRapportSpPoliceCat($idPolice, $dj); + $limiteConsommation = get_limite_consommation_police($idPolice); - $this->genererVueAjax(array('sppolices' => $sppolices)); + $this->genererVueAjax(array('sppolices' => $sppolices, 'limiteConsommation' => $limiteConsommation)); } public function college() @@ -44,7 +46,8 @@ class ControleurAjaxsppolice extends Controleur $dj = date("Y-m-d"); $sppolices = $this->sppolice->getRapportSpPoliceCol($idPolice, $dj); + $limiteConsommation = get_limite_consommation_police($idPolice); - $this->genererVueAjax(array('sppolices' => $sppolices)); + $this->genererVueAjax(array('sppolices' => $sppolices, 'limiteConsommation' => $limiteConsommation)); } } \ No newline at end of file diff --git a/Modele/Police.php b/Modele/Police.php index a2bf386..8205801 100644 --- a/Modele/Police.php +++ b/Modele/Police.php @@ -981,4 +981,14 @@ class Police extends Modele { return $liste->fetch(PDO::FETCH_ASSOC); } + + public function get_limite_consommation_police($idPolice) + { + $sql = 'SELECT fn_limite_consommation_police(?) AS limite_consommation'; + $resultat = $this->executerRequete($sql, array($idPolice)); + + $ligne = $resultat->fetch(PDO::FETCH_ASSOC); + + return $ligne['limite_consommation']; + } } \ No newline at end of file diff --git a/Vue/Ajaxsppolice/categorie.php b/Vue/Ajaxsppolice/categorie.php index 0c7e5bb..7a9af20 100644 --- a/Vue/Ajaxsppolice/categorie.php +++ b/Vue/Ajaxsppolice/categorie.php @@ -15,7 +15,9 @@