production/Controleur/ControleurCreeravenant.php
2025-12-02 11:29:44 +00:00

142 lines
3.7 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Police.php';
require_once 'Modele/Typeavenant.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurCreeravenant extends Controleur {
private $menuvue;
private $police;
private $typeavenant;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuVue("Creeravenant");
$this->police = new Police();
$this->typeavenant = new Typeavenant;
}
public function index() {
$idPolice = $_SESSION['idPolice_C'];
$this->police->getContextePoliceId($idPolice);
$police = $this->police->getPoliceId($idPolice);
$nomGarant = $this->police->getNomGarant($police['codeGcAssureur']);
$_SESSION['nomGcAssureur_C'] = $nomGarant;
$oldCodeTypeAvenant = $police['codeTypeAvenant'];
$typeavenant = $this->typeavenant->getListeSuite($oldCodeTypeAvenant);
$idBeneficiaireFacture = $this->police->getIdBeneficiairefacture($idPolice);
$idCollegeFacture = $this->police->getcollegeavenantfacturation($idPolice);
$chemin = $this->menuvue->getChemin('Creeravenant');
//var_dump($idBeneficiaireFacture); die();
$this->genererVue(array('police' => $police, 'typeavenant' => $typeavenant,
'idBeneficiaireFacture' => $idBeneficiaireFacture, 'chemin' => $chemin,
'idCollegeFacture' => $idCollegeFacture));
}
public function enregistrer()
{
$idPolice = $_SESSION['idPolice_C'];
$codeTypeAvenant = $this->requete->getParametreFormulaire("codeTypeAvenant");
$motifAvenant = $this->requete->getParametreFormulaire("motifAvenant");
$dateAvenant = $this->requete->getParametreDate("dateAvenant");
$_SESSION['dateAvenant_C'] = $dateAvenant;
$_SESSION['motifAvenant_C'] = $motifAvenant;
if($codeTypeAvenant=="RES")
{
$this->rediriger("Ficheresiliation");
}
else
if($codeTypeAvenant=="RET")
{
$this->rediriger("Ficheretrait");
}
else
if($codeTypeAvenant=="REN")
{
$dateEcheanceRen = $this->requete->getParametreDate("dateEcheanceRen");
$_SESSION['dateEcheanceRen_C'] = $dateEcheanceRen;
$this->rediriger("Ficherenouvellement");
}
else
if($codeTypeAvenant=="ADL")
{
$this->rediriger("Fichelimiteadditionnelle");
}
else
if($codeTypeAvenant=="CHC")
{
$this->rediriger("Fichechangementcollege");
}
else
if($codeTypeAvenant=="QTM")
{
$this->police->creeravenant($idPolice, $codeTypeAvenant, $motifAvenant, $dateAvenant);
$this->rediriger("Fichequittancemanuelle");
}else
if($codeTypeAvenant=="SUA")
{
$this->rediriger("Suspensionassure");
}else
if($codeTypeAvenant=="RVA")
{
$this->rediriger("Remiseenvigueurassure");
}else
if($codeTypeAvenant=="ING")
{
$this->rediriger("Incorporationgarantie");
}else
if($codeTypeAvenant=="INA")
{
$this->rediriger("Incorporationacte");
}else
if($codeTypeAvenant=="REG")
{
$this->rediriger("Retraitgarantie");
}else
if($codeTypeAvenant=="REA")
{
$this->rediriger("Retraitacte");
}else
if($codeTypeAvenant=="AJP")
{
$this->rediriger("Ajustementprime");
}
else
{
$this->police->creeravenant($idPolice, $codeTypeAvenant, $motifAvenant, $dateAvenant);
$this->police->getContexteAjaxPolice($idPolice);
if($codeTypeAvenant=="INC")
{
$this->rediriger("Listeadherent");
}else
if($codeTypeAvenant=="CHE")
{
$this->rediriger("Listeavenant");
}else
if($codeTypeAvenant=="RVP")
{
$this->rediriger("Listeavenant");
}else
if($codeTypeAvenant=="SUS")
{
$this->rediriger("Listeavenant");
}
else
{
$this->rediriger("Fichepolice");
}
}
}
}