diff --git a/Controleur/ControleurAjaximporterlisteassure.php b/Controleur/ControleurAjaximporterlisteassure.php new file mode 100644 index 0000000..e23b06a --- /dev/null +++ b/Controleur/ControleurAjaximporterlisteassure.php @@ -0,0 +1,295 @@ +beneficiaire = new Beneficiaire(); + $this->avenant = new Avenant(); + } + + public function index() + { + } + + public function initimportermodele() + { + $idPolice = $_SESSION['idPolice_C']; + $avenants = $this->avenant->getAvenant($idPolice); + + $this->genererVueAjax(array('avenants' => $avenants)); + } + + + public function exportermodele() + { + $beneficiaires = $this->beneficiaire->getModeleAssures(); + + // Excel + $headerXLS = array + ( + _('Catégorie'), + _('No Adhérent'), + _('No Famille'), + _('Nom'), + _('Prénoms'), + _('Lien Parenté'), + _('Nature Pièce'), + _('No Pièce'), + "Sex", + _('Groupe Sang'), + _('Naissance'), + _('Tél Portable'), + 'email' + ); + + $dataXLS = array(); + + + foreach ($beneficiaires as $beneficiaire) + { + $dataXLS[]=$beneficiaire; + } + + $classeur = new PHPExcel(); + $classeur->getProperties()->setCreator("INTER-SANTE"); + $classeur->setActiveSheetIndex(0); + $feuille=$classeur->getActiveSheet(); + $feuille->setTitle(_('MODELE ASSURES')); + $feuille->fromArray($headerXLS, NULL, 'A1', true); + $feuille->fromArray($dataXLS, NULL, 'A2', true); + + //Forcer le téléchargement vers le navigateur; + $fichier = 'Temp/TEMPLATE_LISTE_ASSURE'."_".uniqid().".xlsx"; + + $writer = new PHPExcel_Writer_Excel2007($classeur); + $writer->save($fichier); + + $t_html ='
'; + $t_html .=' '._("TELECHARGER").' '; + $t_html .='
requete->getParametreFormulaire("idAvenant"); + $cheminFichier = $this->requete->getParametreFormulaire("cheminFichier"); + + $_SESSION['idAvenant_C'] = $idAvenant; + + $this->beneficiaire->initIinsererLigneModeleAssure(); + + $dataXLS = array(); + + $fichier = "Temp/import/".$cheminFichier; + + if (!file_exists($fichier)) + { + $this->genererVueAjax(array('message_erreur_excel' => "Fichier introubable sur le serveur !", 'succes_impot_execl' => "0")); + exit(); + } + + $docXLS = new PHPExcel_Reader_Excel2007(); + + $Excel = $docXLS->load($fichier); + + $Excel->setActiveSheetIndex(0); + + $feuille=$Excel->getActiveSheet(); + + $derniereLigne = $feuille->getHighestRow(); + $derniereColonne = $feuille->getHighestColumn(); + + $tableauExcel = $feuille->toArray(null, true, true, true); + + for ($i = 2; $i <= $derniereLigne; $i++) + { + $categorie = trim($tableauExcel[$i]['A']); + $numeroAdherent = trim($tableauExcel[$i]['B']); + + $noFamille = trim($tableauExcel[$i]['C']); + if ($noFamille<=" ") + { + $noFamille = "0"; + } + + $nom = trim($tableauExcel[$i]['D']); + $prenoms = trim($tableauExcel[$i]['E']); + + $codeLienParente = trim($tableauExcel[$i]['F']); + + $codeNaturePiece = trim($tableauExcel[$i]['G']); + $numeroPiece = trim($tableauExcel[$i]['H']); + $sexe = trim($tableauExcel[$i]['I']); + $codeGroupeSanguin = trim($tableauExcel[$i]['J']); + $dateNaissance = trim($tableauExcel[$i]['K']); + $telephonePortable = trim($tableauExcel[$i]['L']); + $email = trim($tableauExcel[$i]['M']); + + $nomComplet = $nom . " " . $prenoms; + + if ( ($categorie<=" ") && ($codeLienParente=="A")) + { + $this->genererVueAjax(array('message_erreur_excel' => $nomComplet . " => Pas de catégorie!", 'succes_impot_execl' => "0")); + exit(); + } + + $liste_liens = array("A", "C", "E", "O"); + if (!in_array($codeLienParente, $liste_liens)) + { + $this->genererVueAjax(array('message_erreur_excel' => $nomComplet . " => Revoir lien de parenté!", 'succes_impot_execl' => "0")); + exit(); + } + + $liste_sexes = array("M", "F"); + if (!in_array($sexe, $liste_sexes)) + { + $this->genererVueAjax(array('message_erreur_excel' => $nomComplet . " => Revoir le sexe!", 'succes_impot_execl' => "0")); + exit(); + } + + // Penser à gérer les erreurs de date + + $this->beneficiaire->insererLigneModeleAssure($idAvenant, $categorie, $numeroAdherent, + $noFamille, $nom, $prenoms, $codeLienParente, $codeNaturePiece, $numeroPiece, $sexe, + $codeGroupeSanguin, $dateNaissance, $telephonePortable, $email); + + /* + echo "Ligne ". $i . " => OK"; + echo "
"; + */ + } + + $this->beneficiaire->gererIncorporationSurFamExistante(); + + // Vérification de certaines erreurs : + // 1 => Si nouvelle famille sans Adhérent + $noFamilleSansAdherent = $this->beneficiaire->getadhimpfamillesansadherent(); + if ($noFamilleSansAdherent>"0") + { + $this->genererVueAjax(array('message_erreur_excel' => "Famille " . $noFamilleSansAdherent . " => Adherent Principal manquant !", 'succes_impot_execl' => "0")); + exit(); + } + + // 2 => Si plus d'1 Adhérent dans une même famille + $noFamillePlusieursAdherent = $this->beneficiaire->getadhimpfamilleplusieursadherent(); + if ($noFamillePlusieursAdherent>"0") + { + $this->genererVueAjax(array('message_erreur_excel' => "Famille " . $noFamillePlusieursAdherent . " => Plusieurs Adherents Principaux !", 'succes_impot_execl' => "0")); + exit(); + } + + // 3 => Incorporation sur une ancienne famille introuvable dans la police + $noFamilleExistantSansAdherent = $this->beneficiaire->getadhimpfamilleexistantsansadherent(); + if ($noFamilleExistantSansAdherent>"0") + { + $this->genererVueAjax(array('message_erreur_excel' => "Famille " . $noFamilleExistantSansAdherent . " => Ancienne famille introuvable !", 'succes_impot_execl' => "0")); + exit(); + } + + $this->genererVueAjax(array('message_erreur_excel' => "Fichier temporaire extrait du serveur avec succes!", 'succes_impot_execl' => "1")); + + exit(); + } + + // + public function traiterlignesimportees() + { + $idPolice = $_SESSION['idPolice_C']; + $avenants = $this->avenant->getAvenant($idPolice); + + $this->genererVueAjax(array('avenants' => $avenants)); + } + + public function exclureligneimportee() + { + $idBeneficiairemodel = $this->requete->getParametreFormulaire("idBeneficiairemodel"); + $exclure = $this->requete->getParametreFormulaire("exclure"); + + $this->beneficiaire->exclureligneimportee($idBeneficiairemodel, $exclure); + + // $this->genererVueAjax(); + } + + public function calculerprimeimportee() + { + $this->beneficiaire->calculerprimeimportee(); + } + + public function afficheradherentimportee() + { + $idCollege = $this->requete->getParametreFormulaire("idCollege"); + + $adherents = $this->beneficiaire->getListeAdherentImportes($idCollege); + + $adherents_college = $this->beneficiaire->getListeAdherentImportesCollege($idCollege); + + $this->genererVueAjax(array('adherents' => $adherents, 'adherents_college' => $adherents_college)); + } + + public function ajouterunadherentaucollege() + { + $idBeneficiairemodel = $this->requete->getParametreFormulaire("idBeneficiairemodel"); + $idCollege = $this->requete->getParametreFormulaire("idCollege"); + + $this->beneficiaire->ajouterunadherentaucollege($idBeneficiairemodel, $idCollege); + + // $this->genererVueAjax(); + } + + + public function retirerunadherentaucollege() + { + $idBeneficiairemodel = $this->requete->getParametreFormulaire("idBeneficiairemodel"); + + $this->beneficiaire->retirerunadherentaucollege($idBeneficiairemodel); + + // $this->genererVueAjax(); + } + + public function incorpoerassuresimportes() + { + $this->beneficiaire->incorpoerassuresimportes(); + } + + public function ajoutertousadherentaucollege() + { + $idCollege = $this->requete->getParametreFormulaire("idCollege"); + + $this->beneficiaire->ajoutertousadherentaucollege($idCollege); + + // $this->genererVueAjax(); + } + + public function ajoutersanscollegeadherentaucollege() + { + $idCollege = $this->requete->getParametreFormulaire("idCollege"); + + $this->beneficiaire->ajoutersanscollegeadherentaucollege($idCollege); + + // $this->genererVueAjax(); + } + + public function retirertousadherentaucollege() + { + $idCollege = $this->requete->getParametreFormulaire("idCollege"); + + $this->beneficiaire->retirertousadherentaucollege($idCollege); + + // $this->genererVueAjax(); + } + + public function majetape() + { + $this->beneficiaire->majetape(); + } +} \ No newline at end of file diff --git a/Js/fonctions.js b/Js/fonctions.js index 8eb51f6..13172e4 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -1594,3 +1594,28 @@ function init_import_assures() window.location.assign($("#racineWeb" ).val()+"Importassure/"); } + +function exporter_modele_assure() +{ + $('#div_form_upload').hide(); + + var div_export = $('#div_exporter_liste_assures'); + + div_export.html('
  ' + 'Veuillez patienter... / Please wait...' + '
'); + + $.ajax({ + url: $("#racineWeb").val()+"Ajaximporterlisteassure/exportermodele/", + type: 'POST', + // data: donnees, + success: function(data) + { + div_export.html(data); + }, + error : function(resultat, statut, erreur) + { + }, + complete: function(data) + { + } + }); +} diff --git a/Vue/Ajaximporterlisteassure/afficheradherentimportee.php b/Vue/Ajaximporterlisteassure/afficheradherentimportee.php new file mode 100644 index 0000000..44d6bb3 --- /dev/null +++ b/Vue/Ajaximporterlisteassure/afficheradherentimportee.php @@ -0,0 +1,102 @@ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + '0'): ?> + + + + + + + + + + + + + + + + + + +
=>
nettoyer($adherent['categorie']) ?>nettoyer($adherent['libelleCollege']) ?>nettoyer($adherent['codeProduit']) ?>nettoyer($adherent['libelleCollege']) ?>nettoyer($adherent['codeProduit']) ?>nettoyer($adherent['numeroAdherent']) ?>nettoyer($adherent['noFamille']) ?>nettoyer($adherent['nom']) ?>nettoyer($adherent['prenoms']) ?>
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<=
nettoyer($adherent_college['categorie']) ?>nettoyer($adherent_college['libelleCollege']) ?>nettoyer($adherent_college['codeProduit']) ?>nettoyer($adherent_college['numeroAdherent']) ?>nettoyer($adherent_college['noFamille']) ?>nettoyer($adherent_college['nom']) ?>nettoyer($adherent_college['prenoms']) ?>
+
+
+ +
diff --git a/Vue/Ajaximporterlisteassure/ajouterunadherentaucollege.php b/Vue/Ajaximporterlisteassure/ajouterunadherentaucollege.php new file mode 100644 index 0000000..c72c434 --- /dev/null +++ b/Vue/Ajaximporterlisteassure/ajouterunadherentaucollege.php @@ -0,0 +1 @@ +OK ajouterunadherentaucollege \ No newline at end of file diff --git a/Vue/Ajaximporterlisteassure/exclureligneimportee.php b/Vue/Ajaximporterlisteassure/exclureligneimportee.php new file mode 100644 index 0000000..1734551 --- /dev/null +++ b/Vue/Ajaximporterlisteassure/exclureligneimportee.php @@ -0,0 +1 @@ +OK EXCLURE \ No newline at end of file diff --git a/Vue/Ajaximporterlisteassure/importermodele.php b/Vue/Ajaximporterlisteassure/importermodele.php new file mode 100644 index 0000000..36c8fc4 --- /dev/null +++ b/Vue/Ajaximporterlisteassure/importermodele.php @@ -0,0 +1,4 @@ +
+

+ +
diff --git a/Vue/Ajaximporterlisteassure/incorpoerassuresimportes.php b/Vue/Ajaximporterlisteassure/incorpoerassuresimportes.php new file mode 100644 index 0000000..79abd6c --- /dev/null +++ b/Vue/Ajaximporterlisteassure/incorpoerassuresimportes.php @@ -0,0 +1 @@ +OK incorpoerassuresimportes \ No newline at end of file diff --git a/Vue/Ajaximporterlisteassure/index.php b/Vue/Ajaximporterlisteassure/index.php new file mode 100644 index 0000000..ae893f7 --- /dev/null +++ b/Vue/Ajaximporterlisteassure/index.php @@ -0,0 +1 @@ +IMPORT TARIF MEICAMENT \ No newline at end of file diff --git a/Vue/Ajaximporterlisteassure/initimportermodele.php b/Vue/Ajaximporterlisteassure/initimportermodele.php new file mode 100644 index 0000000..a900efc --- /dev/null +++ b/Vue/Ajaximporterlisteassure/initimportermodele.php @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nettoyer($avenant['numeroAvenant']) ?>nettoyer($avenant['dateEffet'])) ?>nettoyer($avenant['libelleAvenant']) ?>nettoyer($avenant['motifavenant']) ?>nettoyer($avenant['utilisateur']) ?>nettoyer($avenant['dateSysteme'])) ?>
diff --git a/Vue/Ajaximporterlisteassure/retirerunadherentaucollege.php b/Vue/Ajaximporterlisteassure/retirerunadherentaucollege.php new file mode 100644 index 0000000..e074f94 --- /dev/null +++ b/Vue/Ajaximporterlisteassure/retirerunadherentaucollege.php @@ -0,0 +1 @@ +OK retirerunadherentaucollege \ No newline at end of file diff --git a/Vue/gabarit.php b/Vue/gabarit.php index 86dcb52..565932d 100755 --- a/Vue/gabarit.php +++ b/Vue/gabarit.php @@ -595,7 +595,7 @@ $activeChildId = $menuData['child']; - +