prestation/Controleur/ControleurAjaxdemandedecompte.php
2025-12-01 18:54:33 +00:00

65 lines
2.2 KiB
PHP

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Demandedecompte.php';
class ControleurAjaxdemandedecompte extends Controleur {
private $reglement;
public function __construct() {
$this->reglement = new Demandedecompte();
}
public function index() {
$this->genererVueAjax(array('regle' => $_SESSION['p_decompteRegle_C']));
}
public function initierdemandedecompte()
{
$codePrestataire = $_SESSION['p_codePrestataire_C'];
$codeExercice = $this->requete->getParametreFormulaire("codeExercice");
$codeMois = $this->requete->getParametreFormulaire("codeMois");
$_SESSION['p_codePrestataire_Dec'] = $codePrestataire;
$_SESSION['p_codeExercice_C'] = $codeExercice;
$_SESSION['p_codeMois_C'] = $codeMois;
$idDemandeDecompte = $this->reglement->get_idDemandeDecompte($codePrestataire, $codeExercice, $codeMois) ;
$_SESSION['p_idDemandeDecompte_C'] = $idDemandeDecompte;
if($idDemandeDecompte==0)
{
// Créer la demande de décompte dans p_demandedecompte
// $this->reglement->initdecompteprestataire();
$this->reglement->initdemandedecompte();
$idDemandeDecompte = $this->reglement->get_idDemandeDecompte($codePrestataire, $codeExercice, $codeMois);
$_SESSION['p_idDemandeDecompte_C'] = $idDemandeDecompte;
}
// Afficher le décompte
$idDemandeDecompte = $_SESSION['p_idDemandeDecompte_C'];
$infosdemandedecompte = $this->reglement->getinfosdemandedecompte($idDemandeDecompte);
$_SESSION['p_decompteRegle_C'] = $infosdemandedecompte['regle'];
$_SESSION['p_numeroDemandeDecompte_C'] = $infosdemandedecompte['numeroDemandeDecompte'];
$this->executerAction("index");
}
public function rechargerdemandedecompte()
{
$idDemandeDecompte = $_SESSION['p_idDemandeDecompte_C'];
$numeroDemandeDecompte = $_SESSION['p_numeroDemandeDecompte_C'];
$codePrestataire = $_SESSION['p_codePrestataire_C'];
$codeExercice = $_SESSION['p_codeExercice_C'];
$codeMois = $_SESSION['p_codeMois_C'];
$this->reglement->rechargerdemandedecompte($idDemandeDecompte, $numeroDemandeDecompte, $codePrestataire, $codeExercice, $codeMois);
}
}