diff --git a/Controleur/ControleurCreeravenant.php b/Controleur/ControleurCreeravenant.php new file mode 100644 index 0000000..818cb2f --- /dev/null +++ b/Controleur/ControleurCreeravenant.php @@ -0,0 +1,89 @@ +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); + + $oldCodeTypeAvenant = $police['codeTypeAvenant']; + + $typeavenant = $this->typeavenant->getListeSuite($oldCodeTypeAvenant); + + $this->genererVue(array('police' => $police, 'typeavenant' => $typeavenant)); + } + + + 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 + { + $this->police->creeravenant($idPolice, $codeTypeAvenant, $motifavenant, $dateAvenant); + + $this->police->getContexteAjaxPolice($idPolice); + + if($codeTypeAvenant=="INC") + { + /* + if($_SESSION['codeTypeContrat']=="G") + { + $this->rediriger("Importassure"); + } + else + { + $this->rediriger("Listeadherent"); + } + */ + $this->rediriger("Fichepolice"); + } + else + { + $this->rediriger("Fichepolice"); + } + } + } +} \ No newline at end of file diff --git a/Js/fonctions.js b/Js/fonctions.js index 3bf73e2..c18ba48 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -1348,4 +1348,29 @@ function imprimer_cp(lienEtat) { } }); -} \ No newline at end of file +} + +function creer_avenant() +{ + etat=$("#codeEtatPolice_C").val(); + + if (etat=="RE") + { + v_msg="Attention! Police résiliée!"; + v_msgEng="Warning! Terminated policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (etat=="AN") + { + v_msg="Attention! Police annulée!"; + v_msgEng="Warning! Canceled policy!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + window.location.assign($("#racineWeb" ).val()+"Creeravenant/"); +}