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/PHPExcel/PHPExcel/Calculation.php b/PHPExcel/PHPExcel/Calculation.php index b609b0d..ee3c449 100755 --- a/PHPExcel/PHPExcel/Calculation.php +++ b/PHPExcel/PHPExcel/Calculation.php @@ -2183,7 +2183,7 @@ class PHPExcel_Calculation { */ public static function _unwrapResult($value) { if (is_string($value)) { - if ((isset($value{0})) && ($value{0} == '"') && (substr($value,-1) == '"')) { + if ((isset($value[0])) && ($value[0] == '"') && (substr($value,-1) == '"')) { return substr($value,1,-1); } // Convert numeric errors to NaN error @@ -2291,9 +2291,9 @@ class PHPExcel_Calculation { // Basic validation that this is indeed a formula // We return an empty array if not $formula = trim($formula); - if ((!isset($formula{0})) || ($formula{0} != '=')) return array(); + if ((!isset($formula[0])) || ($formula[0] != '=')) return array(); $formula = ltrim(substr($formula,1)); - if (!isset($formula{0})) return array(); + if (!isset($formula[0])) return array(); // Parse the formula and return the token stack return $this->_parseFormula($formula); @@ -2369,9 +2369,9 @@ class PHPExcel_Calculation { // Basic validation that this is indeed a formula // We simply return the cell value if not $formula = trim($formula); - if ($formula{0} != '=') return self::_wrapResult($formula); + if ($formula[0] != '=') return self::_wrapResult($formula); $formula = ltrim(substr($formula,1)); - if (!isset($formula{0})) return self::_wrapResult($formula); + if (!isset($formula[0])) return self::_wrapResult($formula); $pCellParent = ($pCell !== NULL) ? $pCell->getWorksheet() : NULL; $wsTitle = ($pCellParent !== NULL) ? $pCellParent->getTitle() : "\x00Wrk"; @@ -2380,7 +2380,7 @@ class PHPExcel_Calculation { return $cellValue; } - if (($wsTitle{0} !== "\x00") && ($this->_cyclicReferenceStack->onStack($wsTitle.'!'.$cellID))) { + if (($wsTitle[0] !== "\x00") && ($this->_cyclicReferenceStack->onStack($wsTitle.'!'.$cellID))) { if ($this->cyclicFormulaCount <= 0) { return $this->_raiseFormulaError('Cyclic Reference in Formula'); } elseif (($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) && @@ -2629,7 +2629,7 @@ class PHPExcel_Calculation { } else { if ($value == '') { return 'an empty string'; - } elseif ($value{0} == '#') { + } elseif ($value[0] == '#') { return 'a '.$value.' error'; } else { $typeString = 'a string'; @@ -3456,7 +3456,7 @@ class PHPExcel_Calculation { // echo 'Token is a PHPExcel constant: '.$excelConstant.'
'; $stack->push('Constant Value',self::$_ExcelConstants[$excelConstant]); $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->_showTypeDetails(self::$_ExcelConstants[$excelConstant])); - } elseif ((is_numeric($token)) || ($token === NULL) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) { + } elseif ((is_numeric($token)) || ($token === NULL) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) { // echo 'Token is a number, boolean, string, null or an Excel error
'; $stack->push('Value',$token); // if the token is a named range, push the named range name onto the stack @@ -3498,11 +3498,11 @@ class PHPExcel_Calculation { if (is_string($operand)) { // We only need special validations for the operand if it is a string // Start by stripping off the quotation marks we use to identify true excel string values internally - if ($operand > '' && $operand{0} == '"') { $operand = self::_unwrapResult($operand); } + if ($operand > '' && $operand[0] == '"') { $operand = self::_unwrapResult($operand); } // If the string is a numeric value, we treat it as a numeric, so no further testing if (!is_numeric($operand)) { // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations - if ($operand > '' && $operand{0} == '#') { + if ($operand > '' && $operand[0] == '#') { $stack->push('Value', $operand); $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($operand)); return FALSE; @@ -3555,8 +3555,8 @@ class PHPExcel_Calculation { } // Simple validate the two operands if they are string values - if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') { $operand1 = self::_unwrapResult($operand1); } - if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') { $operand2 = self::_unwrapResult($operand2); } + if (is_string($operand1) && $operand1 > '' && $operand1[0] == '"') { $operand1 = self::_unwrapResult($operand1); } + if (is_string($operand2) && $operand2 > '' && $operand2[0] == '"') { $operand2 = self::_unwrapResult($operand2); } // Use case insensitive comparaison if not OpenOffice mode if (PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) 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