prestation/Controleur/ControleurCreeradherent.php
2025-12-05 10:42:46 +00:00

146 lines
6.0 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Adherent.php';
require_once 'Modele/Collegepolice.php';
require_once 'Modele/Menuvueutilisateur.php';
require_once 'Modele/Beneficiaire.php';
require_once 'Modele/Naturepiece.php';
require_once 'Modele/Sexe.php';
require_once 'Modele/Pays.php';
require_once 'Modele/Situationfamille.php';
require_once 'Modele/Groupesanguin.php';
require_once 'Modele/Avenant.php';
require_once 'Modele/Ouinon.php';
require_once 'Modele/Ville.php';
require_once 'Modele/Localite.php';
require_once 'Modele/Client.php';
require_once 'Societes/'.$_SESSION['codeSociete'].'/Tarifs/Modele/Tarif.php';
class ControleurCreeradherent extends Controleur {
private $menuvue;
private $adherent;
private $beneficiaire;
private $naturepiece;
private $sexe;
private $pays;
private $situationfamille;
private $groupesanguin;
private $tarif;
private $college;
private $avenant;
private $ouinon;
private $client;
private $ville;
private $localite;
public function __construct()
{
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuVue('Creeradherent');
$this->adherent = new Adherent();
$this->beneficiaire = new Beneficiaire();
$this->naturepiece = (new Naturepiece())->getListe();
$this->sexe = (new Sexe())->getListe();
$this->situationfamille = (new Situationfamille())->getListe();
// $this->pays = (new Pays())->getListe($_SESSION['codePaysSociete']);
$this->pays = new Pays();
$this->groupesanguin = (new Groupesanguin())->getListe();
$this->tarif = new Tarif();
$this->college = (new Collegepolice())->getListe($_SESSION['idPolice_C']);
$this->avenant = (new Avenant())->getListeEnCours($_SESSION['idPolice_C']);
$this->ouinonprorata = (new Ouinon())->getListe();
$this->ville = new Ville();
$this->localite = new Localite();
$this->client = new Client();
}
public function index()
{
$idClient = $_SESSION['idClient_C'];
$client = $this->client->getClientId($idClient);
$codeSociete = $_SESSION['codeSociete'];
$codePays = $client['codePays'];
$codeVille = $client['codeVille'];
$codeLocalite = $client['codeLocalite'];
$pays = $this->pays->getListe($codePays);
$ville = $this->ville->getListe($codePays);
$localite = $this->localite->getListe($codePays, $codeVille);
$idPolice = $_SESSION['idPolice_C'];
$ville = $this->ville->getListe($codePays);
$localite = $this->localite->getListe($codePays, $codeVille);
$this->genererVue(array('college' => $this->college, 'naturepiece' => $this->naturepiece, 'sexe' => $this->sexe,
'pays' => $pays, 'situationfamille' => $this->situationfamille, 'groupesanguin' => $this->groupesanguin,
'avenant' => $this->avenant, 'ouinonprorata' => $this->ouinonprorata, 'ville' => $ville, 'localite' => $localite,
'codePays' => $codePays, 'codeVille' => $codeVille, 'codeLocalite' => $codeLocalite));
}
public function ajouteradherent()
{
$idPolice = $_SESSION['idPolice_C'];
$racineNoAdherent = $this->requete->getSession()->getAttribut('racineNoAdherent');
$codeSociete = $this->requete->getSession()->getAttribut('codeSociete');
$idCollege = $this->requete->getParametre("idCollege");
$numeroPolice = $this->requete->getParametre("numeroPolice");
$nom = $this->requete->getParametreFormulaire("nom");
$prenoms = $this->requete->getParametreFormulaire("prenoms");
$codeNaturePiece = $this->requete->getParametreFormulaire("codeNaturePiece");
$numeroPiece = strtoupper($this->requete->getParametreFormulaire("numeroPiece"));
$sexe = $this->requete->getParametreFormulaire("sexe");
$dateNaissance = $this->requete->getParametreDate("dateNaissance");
$codeGroupeSanguin = $this->requete->getParametreFormulaire("codeGroupeSanguin");
$codeSituationFamille = $this->requete->getParametreFormulaire("codeSituationFamille");
$nombreEnfants = $this->requete->getParametreFormulaire("nombreEnfants");
$adresseGeo = $this->requete->getParametreFormulaire("adresseGeo");
$adressePostale = $this->requete->getParametreFormulaire("adressePostale");
$codePays = $this->requete->getParametreFormulaire("codePays");
$codeVille = $this->requete->getParametreFormulaire("codeVille");
$codeLocalite = $this->requete->getParametreFormulaire("codeLocalite");
$telephonFixe = $this->requete->getParametreFormulaire("telephonFixe");
$telephonePortable = $this->requete->getParametreFormulaire("telephonePortable");
$email = $this->requete->getParametreFormulaire("email");
$dateEntree = $this->requete->getParametreDate("dateEntree");
$idAvenant = $this->requete->getParametre("idAvenant");
$numeroCmu = strtoupper($this->requete->getParametreFormulaire("numeroCmu"));
$numeroMatricule = strtoupper($this->requete->getParametreFormulaire("numeroMatricule"));
$user = $this->requete->getSession()->getAttribut('login');
$dateCre = date("Y-m-d");
$nom = strtoupper($nom);
$prenoms = strtoupper($prenoms);
$dernierIdAdherent = $this->adherent->ajouteradherent($idPolice, $idCollege, $nom, $prenoms, $codeNaturePiece, $numeroPiece, $sexe,
$dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale, $codePays, $codeVille,
$telephonFixe, $telephonePortable, $email, $dateEntree, $user, $idAvenant, $codeLocalite, $numeroCmu, $numeroMatricule) ;
$idBeneficiaire = $this->beneficiaire->ajouterAdherent($dernierIdAdherent);
// On va calculuer la prime
$codeLienParente = "A";
$idAdherent = $dernierIdAdherent;
$_SESSION['idAdherent_C'] = $idAdherent;
$_SESSION['idBeneficiaire_C'] = $idBeneficiaire;
// On actualise le contexte : NbAdh et NbAss
$idPolice = $_SESSION['idPolice_C'];
$this->adherent->getNbassure($idPolice);
$this->rediriger("Ficheadherent/".$idAdherent);
}
}