Merge branches 'main' and 'main' of git.ebene.ovh:ebene/radiantrh

This commit is contained in:
KONE SOREL 2026-01-03 12:51:09 +00:00
commit e9fa3e3c07
11 changed files with 475 additions and 12 deletions

View File

@ -0,0 +1,295 @@
<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Beneficiaire.php';
require_once 'Modele/Avenant.php';
class ControleurAjaximporterlisteassure extends Controleurrequete
{
private $beneficiaire;
private $avenant;
public function __construct()
{
$this->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 =' <div class="alert alert-success"> ';
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
$t_html .=' </div ';
echo $t_html;
exit();
}
public function importermodele()
{
$idAvenant = $this->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 "<BR>";
*/
}
$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();
}
}

View File

@ -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('<div style="padding-top:80px;"><img src="Bootstrap/images/loading.gif"/>&nbsp;&nbsp;<span style="font-size:15pt;">' + 'Veuillez patienter... / Please wait...' + '</span></div>');
$.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)
{
}
});
}

View File

@ -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.'<br />';
$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<br />';
$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)

View File

@ -0,0 +1,102 @@
<div id="div_adherents_importes">
<div class="row">
<div id="div_adherents_importes_1" class="col-xs-6" >
<legend> <?= _("Familles hors du collège") ?> </legend>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style="font-size:8pt;">
<thead>
<tr>
<th colspan="3" style='text-align:center'> <?= _("Catégoerie ou Collège") ?> </th>
<th colspan="2" style='text-align:center'> <?= _("No Famille") ?> </th>
<th colspan="2" style='text-align:center'> <?= _("Familles") ?> </th>
<th style='text-align:center'> => </th>
</tr>
<tr>
<th colspan="3"> <button type="button" style="font-size:10pt;" class="form-control btn btn-primary" onclick="javascript:ajouter_tous_adherent_importe_college();" > <?= _("Ajouter tous") . " ==>" ?> </button> </th>
<th colspan="2"> </th>
<th colspan="3"> <button type="button" style="font-size:10pt;" class="form-control btn btn-warning" onclick="javascript:ajouter_sans_college_adherent_importe_college();" > <?= _("Ajouter les sans collèges"). " ==>" ?> </button> </th>
</tr>
</thead>
<tbody>
<?php foreach ($adherents as $adherent):
$idBeneficiairemodel = $adherent['idBeneficiairemodel'];
$idCollege = $adherent['idCollege'];
?>
<tr valign="top">
<td align='center'><?= $this->nettoyer($adherent['categorie']) ?></td>
<?php if ($idCollege>'0'): ?>
<td align='center'><?= $this->nettoyer($adherent['libelleCollege']) ?></td>
<td align='center'><?= $this->nettoyer($adherent['codeProduit']) ?></td>
<?php else : ?>
<td align='center' style="background-color: yellow;"><?= $this->nettoyer($adherent['libelleCollege']) ?></td>
<td align='center' style="background-color: yellow;"><?= $this->nettoyer($adherent['codeProduit']) ?></td>
<?php endif; ?>
<td align='center'><?= $this->nettoyer($adherent['numeroAdherent']) ?></td>
<td align='center'><?= $this->nettoyer($adherent['noFamille']) ?></td>
<td><?= $this->nettoyer($adherent['nom']) ?></td>
<td><?= $this->nettoyer($adherent['prenoms']) ?></td>
<td align='center'> <input type="button" value="=>" onClick="javascript:ajouter_un_adherent_importe_college('<?=$idBeneficiairemodel?>');" ></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div id="div_adherents_importes_2" class="col-xs-6" >
<legend> <?= _("Familles du collège") ?> </legend>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style="font-size:8pt;">
<thead>
<tr>
<th style='text-align:center'> <= </th>
<th colspan="3" style='text-align:center'> <?= _("Catégoerie ou Collège") ?> </th>
<th colspan="2" style='text-align:center'> <?= _("No Famille") ?> </th>
<th colspan="2" style='text-align:center'> <?= _("Familles") ?> </th>
</tr>
<tr>
<td colspan="8"> <button type="button" style="font-size:10pt;" class="form-control btn btn-danger" onclick="javascript:retirer_tous_adherent_importe_college();" > <?= "<== " . _("Retirer tous les membres de ce collège") ?> </button> </td>
</tr>
</thead>
<tbody>
<?php foreach ($adherents_college as $adherent_college):
$idBeneficiairemodel=$adherent_college['idBeneficiairemodel'];
$idCollege=$adherent_college['idCollege'];
?>
<tr valign="top">
<td align='center'> <input type="button" value="<=" onClick="javascript:retirer_un_adherent_importe_college('<?=$idBeneficiairemodel?>');" ></td>
<td align='center'><?= $this->nettoyer($adherent_college['categorie']) ?></td>
<td align='center'><?= $this->nettoyer($adherent_college['libelleCollege']) ?></td>
<td align='center'><?= $this->nettoyer($adherent_college['codeProduit']) ?></td>
<td align='center'><?= $this->nettoyer($adherent_college['numeroAdherent']) ?></td>
<td align='center'><?= $this->nettoyer($adherent_college['noFamille']) ?></td>
<td><?= $this->nettoyer($adherent_college['nom']) ?></td>
<td><?= $this->nettoyer($adherent_college['prenoms']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
OK ajouterunadherentaucollege

View File

@ -0,0 +1 @@
OK EXCLURE

View File

@ -0,0 +1,4 @@
<div id="div_erreur_excel" class="alert alert-danger" >
<H4> <?= $message_erreur_excel ?> </H4>
<input class="sr-only" type="text" id="succes_impot_execl" name="succes_impot_execl" value="<?= $succes_impot_execl ?>">
</div>

View File

@ -0,0 +1 @@
OK incorpoerassuresimportes

View File

@ -0,0 +1 @@
IMPORT TARIF MEICAMENT

View File

@ -0,0 +1,32 @@
<legend> <?= _("Sélectionner un avenant pour importation OLD") ?> </legend>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style="font-size:10pt;">
<thead>
<tr>
<th style='text-align:center' > <?= _("Numéro") ?> </th>
<th style='text-align:center'> <?= _("Effet") ?> </th>
<th> <?= _("Libellé") ?> </th>
<th> <?= _("Commentaires") ?> </th>
<th> <?= _("Producteur") ?> </th>
<th style='text-align:center'> <?= _("Saisie") ?> </th>
<th style='text-align:center'> <?= _("Importer...") ?> </th>
</tr>
</thead>
<tbody>
<?php
foreach ($avenants as $avenant):
$idAvenant = $avenant['idAvenant'];
?>
<tr valign="top">
<td align='center'><?= $this->nettoyer($avenant['numeroAvenant']) ?></td>
<td align='center'><?= dateLang($this->nettoyer($avenant['dateEffet'])) ?></td>
<td><?= $this->nettoyer($avenant['libelleAvenant']) ?></td>
<td><?= $this->nettoyer($avenant['motifavenant']) ?></td>
<td><?= $this->nettoyer($avenant['utilisateur']) ?></td>
<td align='center'><?= dateheureLang($this->nettoyer($avenant['dateSysteme'])) ?></td>
<td> <button style='font-size:10pt;' type="button" class="form-control btn btn-info" onclick="javascript:importer_modele_assure(<?= $idAvenant ?>);"> <?= _("Importer...") ?> </button> </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

View File

@ -0,0 +1 @@
OK retirerunadherentaucollege