production/Modele/Adherent.php
2025-12-01 16:12:12 +00:00

1221 lines
40 KiB
PHP
Executable File

<?php
require_once 'Framework/Modele.php';
class Adherent extends Modele {
public function getAdherentSimple($idAdherent) {
$sql = 'CALL sp_get_Adherent_Simple(?);';
$adherent = $this->executerRequete($sql, array($idAdherent));
return $adherent->fetch(PDO::FETCH_ASSOC);
}
public function getAllAderents() {
$sql = 'select * from adherent';
$adherent = $this->executerRequete($sql);
// return $adherent->fetch(PDO::FETCH_ASSOC);
return $adherent->fetchAll(PDO::FETCH_ASSOC);
}
public function getAdherents($noadherentsearch=null, $noPiecesearch=null, $emailsearch=null,
$nomsearch=null, $prenomsearch=null, $telsearch=null) {
$noadherentsearch = contruireParamLike($noadherentsearch);
$noPiecesearch = contruireParamLike($noPiecesearch);
$emailsearch = contruireParamLike($emailsearch);
$nomsearch = contruireParamLike($nomsearch);
$prenomsearch = contruireParamLike($prenomsearch);
$telsearch = contruireParamLike($telsearch);
$sql = 'CALL sp_get_Adherents(?,?,?,?,?,?);';
$adherent = $this->executerRequete($sql, array($_SESSION['codeSociete'], $noadherentsearch, $noPiecesearch, $emailsearch,$nomsearch, $prenomsearch, $telsearch));
return $adherent->fetchAll(PDO::FETCH_ASSOC);
}
public function getAdherent($numeroAdherent) {
$sql = 'CALL sp_get_Adherent(?,?);';
$adherent = $this->executerRequete($sql, array($_SESSION['codeSociete'], $numeroAdherent));
return $adherent;
}
public function getAdherentId($idAdherent) {
$sql = 'call sp_get_adherent_id(?);';
$adherent = $this->executerRequete($sql, array($idAdherent));
return $adherent->fetch(PDO::FETCH_ASSOC);
}
public function getAdherentIdConso($idAdherent)
{
$sql = 'call sp_get_adherent_id_conso(?);';
$adherent = $this->executerRequete($sql, array($idAdherent));
return $adherent->fetch(PDO::FETCH_ASSOC);
}
public function getNombreAdherents()
{
$sql = 'CALL sp_get_Nombre_Adherents(?);';
$resultat = $this->executerRequete($sql, array($_SESSION['codeSociete']));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['nbAdherents'];
}
public function getIdAdherent($numeroAdherent) {
$sql = 'CALL sp_get_Id_Adherent(?,?);';
$resultat = $this->executerRequete($sql, array($_SESSION['codeSociete'], $numeroAdherent));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['id'];
}
public function getContexteAdherentId($idAdherent) {
$sql = 'call sp_get_contexte_adherent_id(?);';
$resultat = $this->executerRequete($sql, array($idAdherent));
// $context = $resultat->fetch(PDO::FETCH_ASSOC);
$context = $resultat->fetch(PDO::FETCH_ASSOC);
$_SESSION['idClient_C'] = $context['idClient'];
$_SESSION['numeroClient_C'] = $context['numeroClient'];
$_SESSION['nomClient_C'] = $context['nomClient'];
$_SESSION['codeLangueClient'] = $context['codeLangueClient'];
$_SESSION['codeLangueAdherent'] = $context['codeLangueAdherent'];
$_SESSION['idPolice_C'] = $context['idPolice'];
$_SESSION['numeroPolice_C'] = $context['numeroPolice'];
$_SESSION['idAdherent_C'] = $context['idAdherent'];
$_SESSION['numeroAdherent_C'] = $context['numeroAdherent'];
$_SESSION['nomAdherent_C'] = $context['nomAdherent'];
$_SESSION['adherent_C'] = $context['adherent'];
$_SESSION['codeProduit_C'] = $context['codeProduit'];
$_SESSION['idCollege_C'] = $context['idCollege'];
$_SESSION['rachatTmAdh_C'] = $context['rachatTm'];
$_SESSION['codeEtatAdherent_C'] = $context['codeEtatAdherent'];
$_SESSION['email_C'] = $context['email'];
$_SESSION['telephonePortable_C'] = $context['telephonePortable'];
$_SESSION['garantieArchive_C'] = $context['garantieArchive'];
$_SESSION['exercieReference_C'] = $context['exercieReference'];
$_SESSION['idEntetecontrat'] = $context['idEntetecontrat'];
$_SESSION['codeLocalite'] = $context['codeLocalite'];
$_SESSION['dateEffetAdherent_C'] = $context['dateEffetAdherent'];
$_SESSION['idBeneficiaire_C'] = "";
$_SESSION['numeroBeneficiaire_C'] = "";
$_SESSION['nomBeneficiaire_C'] = "";
$_SESSION['lienPhoto_C'] = "";
$_SESSION['beneficiaire_C'] = "";
$_SESSION['enVigueur_C'] = "";
$_SESSION['decede_C'] = "0";
$_SESSION['dateDeces_C'] = "";
$_SESSION['fraisFuneraireDemande_C'] = "0";
$_SESSION['fraisFunerairePaye_C'] = "0";
return $context;
}
public function getContexteAdherentIdConso($idAdherent) {
$sql = 'call sp_get_contexte_adherent_id_conso(?);';
$resultat = $this->executerRequete($sql, array($idAdherent));
$context = $resultat->fetch(PDO::FETCH_ASSOC);
$_SESSION['idClient_C'] = $context['idClient'];
$_SESSION['numeroClient_C'] = $context['numeroClient'];
$_SESSION['nomClient_C'] = $context['nomClient'];
$_SESSION['codeLangueClient'] = $context['codeLangueClient'];
$_SESSION['codeLangueAdherent'] = $context['codeLangueAdherent'];
$_SESSION['idPolice_C'] = $context['idPolice'];
$_SESSION['numeroPolice_C'] = $context['numeroPolice'];
$_SESSION['idAdherent_C'] = $context['idAdherent'];
$_SESSION['numeroAdherent_C'] = $context['numeroAdherent'];
$_SESSION['nomAdherent_C'] = $context['nomAdherent'];
$_SESSION['codeProduit_C'] = $context['codeProduit'];
$_SESSION['idCollege_C'] = $context['idCollege'];
$_SESSION['rachatTmAdh_C'] = $context['rachatTm'];
$_SESSION['codeEtatAdherent_C'] = $context['codeEtatAdherent'];
$_SESSION['email_C'] = $context['email'];
$_SESSION['telephonePortable_C'] = $context['telephonePortable'];
$_SESSION['exercieReference_C'] = $context['exercieReference'];
$_SESSION['idEntetecontrat'] = $context['idEntetecontrat'];
$_SESSION['codeLocalite'] = $context['codeLocalite'];
$_SESSION['idBeneficiaire_C'] = "";
$_SESSION['numeroBeneficiaire_C'] = "";
$_SESSION['nomBeneficiaire_C'] = "";
$_SESSION['lienPhoto_C'] = "";
$_SESSION['beneficiaire_C'] = "";
$_SESSION['enVigueur_C'] = "";
$_SESSION['decede_C'] = "0";
$_SESSION['dateDeces_C'] = "";
$_SESSION['fraisFuneraireDemande_C'] = "0";
$_SESSION['fraisFunerairePaye_C'] = "0";
return $context;
}
public function existeligne($numeroAdherent) {
$sql = 'CALL sp_existe_ligne(?,?);';
$resultat = $this->executerRequete($sql, array($_SESSION['codeSociete'],$numeroAdherent));
return ($resultat->rowCount() > 0);
}
public function getDenierNumeroAdherent()
{
$sql = 'CALL sp_get_Denier_Numero_Adherent(?);';
$resultat = $this->executerRequete($sql, array($_SESSION['codeSociete']));
if ($resultat->rowCount() == 0)
{
$sql = 'INSERT INTO numerotationadherent (codeSociete, racineNoAdherent, dernierNumeroAdherent) values (?,?,?)';
$this->executerRequete($sql, array($_SESSION['codeSociete'], $_SESSION['racineNoAdherent'], "1"));
return "0";
} else
{
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['dernierNumeroAdherent'];
}
}
public function setDenierNumeroAdherent($numeroAdherent)
{
$sql = 'CALL sp_set_Denier_Numero_Adherent(?,?);';
$this->executerRequete($sql, array($numeroAdherent, $_SESSION['codeSociete']));
}
public function ajouter($idCollege, $numeroAdherent, $nom, $prenoms, $codeNaturePiece, $numeroPiece, $sexe,
$dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale,
$codePays, $telephonFixe, $telephonePortable, $email, $dateEntree, $dateCre, $user, $idAvenant)
{
//$dernierNumeroBeneficiaire = '1';
$sql = 'CALL sp_ajouter_adherent(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);';
$resultat = $this->executerRequete($sql, array($_SESSION['codeSociete'],$numeroAdherent, $nom, $prenoms, $codeNaturePiece, $numeroPiece, $sexe,
$dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale,
$codePays, $telephonFixe, $telephonePortable, $email, $dateEntree, $dateCre, $user, $idAvenant, $idCollege))->fetch(PDO::FETCH_ASSOC);
return $resultat['dernierId'];
}
public function getIdBeneficiaireAdherent($idAdherent)
{
$sql = 'CALL sp_get_Id_Beneficiaire_Adherent(?);';
$resultat = $this->executerRequete($sql, array($idAdherent))->fetch(PDO::FETCH_ASSOC);
return $resultat['id'];
}
public function modifier($id, $nom, $prenoms, $codeNaturePiece, $numeroPiece, $sexe, $dateNaissance, $codeGroupeSanguin,
$codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale, $codePays, $telephonFixe, $telephonePortable, $email,
$codeLocalite, $numeroCmu, $numeroMatricule, $codeTarifActe, $dateSouscription, $vip, $seuilRdAdherent, $ancienNumeroAssure,
$numeroBs, $codeTypeRemboursement, $prefixePaiementMobile, $mobilePaiement)
{
$sql = 'CALL sp_modifier_adherent(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);';
$this->executerRequete($sql, array($nom, $prenoms, $codeNaturePiece, $numeroPiece, $sexe, $dateNaissance, $codeGroupeSanguin,
$codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale, $codePays, $telephonFixe, $telephonePortable, $email, $codeLocalite,
$numeroCmu, $numeroMatricule, $numeroMatricule, $codeTarifActe, $dateSouscription, $vip, $id, $seuilRdAdherent, $ancienNumeroAssure,
$numeroBs, $codeTypeRemboursement, $prefixePaiementMobile, $mobilePaiement));
$idBeneficiaire = $this->getIdBeneficiaireAdherent($id);
$user = $_SESSION['login'];
$sql = 'CALL sp_update_beneficiaire_principal(?);';
$this->executerRequete($sql, array($id));
$sql = 'CALL sp_modifier_beneficiaireprime(?, ?);';
$this->executerRequete($sql, array($idBeneficiaire, $user));
}
public function supprimer($idAdherent)
{
$user = $_SESSION['login'];
$sql = 'call sp_supprimer_adherent(?, ?)';
$resultat = $this->executerRequete($sql, array($idAdherent, $user));
$idPolice = $_SESSION['idPolice_C'];
$this->getNbassure($idPolice);
}
public function formaterNumeroAdherent($racineNoAdherent,$numeroAdherent)
{
$idPolice = $_SESSION['idPolice_C'];
$sql = 'call sp_formater_numero_adherent(?)';
$resultat = $this->executerRequete($sql, array($idPolice));
$adh = $resultat->fetch(PDO::FETCH_ASSOC);
$numeroAdherent = $adh['numeroAdherent'];
return $numeroAdherent;
}
public function getAdherentsSimple($idPolice)
{
$sql = 'CALL sp_get_Adherents_Simple(?,?)';
$adherents = $this->executerRequete($sql, array($_SESSION['codeSociete'], $idPolice));
return $adherents;
}
public function getNbassure($idPolice) {
// nb famille et de dépendants
$sql = 'CALL sp_popoulation_police(?);';
$resultat = $this->executerRequete($sql, array($idPolice));
// $effectif = $resultat->fetch(PDO::FETCH_ASSOC);
$effectif = $resultat->fetch(PDO::FETCH_ASSOC);
$_SESSION['ndAdh_C'] = $effectif['ndAdh'];
$_SESSION['ndDep_C'] = $effectif['ndDep'];
$_SESSION['ndActif_C'] = $effectif['ndActif'];
}
public function getRapportSpAdherent($idAdherent, $dateReference)
{
$sql = 'call sp_rapport_sp_adherent(?, ?)';
$sppolice = $this->executerRequete($sql, array($idAdherent, $dateReference));
return $sppolice->fetch(PDO::FETCH_ASSOC);
}
public function changeretat($idAdherent, $codeEtatAdherent, $motifEtat, $dateEtat)
{
$user = $_SESSION['login'];
$sql = 'call sp_changer_etat_adherent(?, ?, ?, ?, ?)';
$this->executerRequete($sql, array($idAdherent, $codeEtatAdherent, $motifEtat, $dateEtat, $user));
}
public function initLimiteAdditionnelle($idAdherent)
{
$user = $_SESSION['login'];
$sql = 'call sp_init_limite_add_adherent(?, ?)';
$this->executerRequete($sql, array($idAdherent, $user));
}
public function getGarAddCollege()
{
$user = $_SESSION['login'];
$sql = 'CALL sp_get_GarAddCollege(?);';
$garanties = $this->executerRequete($sql, array($user));
return $garanties;
}
public function majplafondadd($idGarantie, $plafond)
{
$sql = 'CALL sp_majplafondadd(?,?)';
$this->executerRequete($sql, array($plafond, $idGarantie));
}
public function changerlimite($idAdherent)
{
$user = $_SESSION['login'];
$sql = 'call sp_changer_limite_adherent(?, ?)';
$this->executerRequete($sql, array($idAdherent, $user));
}
public function recalculersoldefamille()
{
$idAdherent = $_SESSION['idAdherent_C'];
$user = $_SESSION['login'];
$sql = 'call sp_recalcul_solde_famille(?, ?)';
$this->executerRequete($sql, array($idAdherent, $user));
}
public function initremplacementadherent($idPolice, $idAdherent, $dateSortie , $dateRemplacement, $user,
$motifAvenant, $fraisCarte)
{
$sql = 'call sp_init_remplacement_adherent(?, ?, ?, ?, ?, ?, ?)';
$this->executerRequete($sql, array($idPolice, $idAdherent, $dateSortie , $dateRemplacement, $user, $motifAvenant, $fraisCarte));
}
public function getbeneficiairearemplacer()
{
$idAdherent = $_SESSION['idAdherent_C'];
$user = $_SESSION['login'];
$sql = 'call sp_get_beneficiaire_a_remplacer(?, ?)';
$resultat = $this->executerRequete($sql, array($idAdherent, $user));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getadherentremplacanttemp()
{
$idAdherent = $_SESSION['idAdherent_C'];
$user = $_SESSION['login'];
$sql = 'call sp_get_adherent_remplacant_temp(?, ?)';
$resultat = $this->executerRequete($sql, array($idAdherent, $user));
return $resultat->fetch(PDO::FETCH_ASSOC);
}
public function getremplacementadherent_temp()
{
$idAdherent = $_SESSION['idAdherent_C'];
$user = $_SESSION['login'];
$sql = 'call sp_get_remplacementadherent_temp(?, ?)';
$resultat = $this->executerRequete($sql, array($idAdherent, $user));
return $resultat->fetch(PDO::FETCH_ASSOC);
}
public function enregistrerremplacementadherent($nom, $prenoms, $codeNaturePiece, $numeroPiece, $sexe,
$dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale,
$codePays, $telephonFixe, $telephonePortable, $email, $fraisCarte)
{
$idPolice = $_SESSION['idPolice_C'];
$idAdherent = $_SESSION['idAdherent_C'];
$user = $_SESSION['login'];
$sql = 'call sp_enregistrer_remplacement_adherent(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
$this->executerRequete($sql, array($idPolice, $idAdherent, $user, $nom, $prenoms, $codeNaturePiece, $numeroPiece,
$sexe, $dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale,
$codePays, $telephonFixe, $telephonePortable, $email, $fraisCarte));
}
public function getremplacementadherent($idAdherent)
{
$sql = 'call sp_get_remplacementadherent_id_remplace(?);';
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetch(PDO::FETCH_ASSOC);
}
public function getgarantieremplacementadherent($idAdherent)
{
$sql = 'call sp_get_garantieremplacementadherent(?);';
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getbeneficiaireremplacementadherent($idRemplacementadherent)
{
$sql = 'call sp_get_beneficiairerremplacementadherent(?);';
$resultat = $this->executerRequete($sql, array($idRemplacementadherent));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getAdherentIdRempl($idAdherent)
{
$sql = 'call sp_get_adherent_id_rempl(?);';
$adherent = $this->executerRequete($sql, array($idAdherent));
return $adherent->fetch(PDO::FETCH_ASSOC);
}
public function getlisteassuresexo($idPolice)
{
$sql = 'call sp_liste_assures_exo(?)';
$resultat = $this->executerRequete($sql, array($idPolice));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function reinitpaswd($idAdherent)
{
$sql = 'call sp_r_reinit_utilisateur_adh(?, ?)';
$this->executerRequete($sql, array($_SESSION['codeSociete'], $idAdherent));
}
public function desactiver($idAdherent)
{
$sql = 'call sp_r_desactiver_utilisateur_adh(?)';
$this->executerRequete($sql, array($idAdherent));
}
public function activer($idAdherent)
{
$sql = 'call sp_r_activer_utilisateur_adh(?)';
$this->executerRequete($sql, array($idAdherent));
}
public function ajouteradherent($idPolice, $idCollege, $nom, $prenoms, $codeNaturePiece, $numeroPiece,
$sexe, $dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale,
$codePays, $codeVille, $telephonFixe, $telephonePortable, $email, $dateEntree, $user, $idAvenant, $codeLocalite, $numeroCmu,
$numeroMatricule, $codeTarifActe, $dateSouscription, $vip, $seuilRdAdherent, $numeroBs, $ancienNumeroAssure, $beneficiaireReglement,
$codeLienBeneficiaire, $codeModePaiement, $enVigueur, $telephoneMobile, $rib, $codeTypeRemboursement, $prefixePaiementMobile, $mobilePaiement)
{
$sql = 'call sp_enregistrer_nouvel_adherent(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idPolice, $idCollege, $nom, $prenoms, $codeNaturePiece, $numeroPiece, $sexe,
$dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale, $codePays, $codeVille,
$telephonFixe, $telephonePortable, $email, $dateEntree, $user, $idAvenant, $codeLocalite, $numeroCmu, $numeroMatricule, $codeTarifActe,
$dateSouscription, $vip, $seuilRdAdherent, $numeroBs, $ancienNumeroAssure, $beneficiaireReglement, $codeLienBeneficiaire, $codeModePaiement,
$enVigueur, $telephoneMobile, $rib, $codeTypeRemboursement, $prefixePaiementMobile, $mobilePaiement));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
$dernierIdAdherent = $ligne['dernierIdAdherent'];
return $dernierIdAdherent;
}
public function getlisteexo($idAdherent)
{
$sql = 'call sp_get_exercices_adherent(?)';
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getadherentlocalitein($codeLocalite)
{
$idPolice = $_SESSION['idPolice_C'];
$sql = 'call sp_r_get_adherent_localite_in(?, ?);';
$resultat = $this->executerRequete($sql, array($idPolice, $codeLocalite));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getadherentlocaliteout($codeLocalite)
{
$idPolice = $_SESSION['idPolice_C'];
$sql = 'call sp_r_get_adherent_localite_out(?, ?);';
$resultat = $this->executerRequete($sql, array($idPolice, $codeLocalite));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function ajouteradherentlocalitetous($codeLocalite)
{
$idPolice = $_SESSION['idPolice_C'];
$sql = 'call sp_r_ajouter_adherent_localite_tous(?, ?);';
$this->executerRequete($sql, array($idPolice, $codeLocalite));
}
public function ajouterunadherentlocalite($idAherent, $codeLocalite)
{
$sql = 'call sp_r_ajouter_un_adherent_localite(?, ?);';
$this->executerRequete($sql, array($idAherent, $codeLocalite));
}
public function getadherentlocaliteexport()
{
$idPolice = $_SESSION['idPolice_C'];
$sql = 'call sp_r_get_adherent_localite_export(?);';
$resultat = $this->executerRequete($sql, array($idPolice));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getlisteentetecontrat($idAdherent)
{
$sql = 'call sp_get_entete_contrat_adherent(?)';
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getlisteentetecontratadherent($idAdherent)
{
$sql = 'call sp_get_entete_contrat_adherent(?)';
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getlisteentetecontratbeneficiaire($idBeneficiaire)
{
$sql = 'call sp_get_entete_contrat_beneficiaire(?)';
$resultat = $this->executerRequete($sql, array($idBeneficiaire));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getentetecontrat($idEntetecontrat)
{
$sql = 'SELECT * FROM entetecontrat WHERE id=? limit 1;';
$resultat = $this->executerRequete($sql, array($idEntetecontrat));
return $resultat->fetch(PDO::FETCH_ASSOC);
}
public function controlerplafondadherentannuel($idAdherent)
{
$sql = 'select fn_control_plafond_adherent_courant(?) as controlerPlafondAdherent;';
$resultat = $this->executerRequete($sql, array($idAdherent));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
$_SESSION['controlerPlafondAdherent'] = $ligne['controlerPlafondAdherent'];
}
public function getlisteadherentsBascules($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege)
{
$sql = 'CALL sp_get_liste_adherents_Bascules(?,?,?,?);';
//var_dump($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege);
//die();
$resultat = $this->executerRequete($sql, array($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function ajouterAdherentBascules($codeGcAssureur, $codeProduit, $idPolice, $idCollege, $idOption, $numeroAdherent, $dateEffet)
{
$user = $_SESSION['login'];
$sql = 'call sp_ajouter_adherent_bascule(?, ?, ?, ?, ?, ?, ?, ?);';
//var_dump($codeGcAssureur, $codeProduit, $idPolice, $idCollege, $idOption, $numeroAdherent, $dateEffet, $user);
//die();
$this->executerRequete($sql, array($codeGcAssureur, $codeProduit, $idPolice, $idCollege, $idOption, $dateEffet, $numeroAdherent, $user));
}
public function ajouterTousAdherentBascules($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege, $idOption, $dateEffet, $idCollegePolice)
{
$user = $_SESSION['login'];
$idPolice = $_SESSION['idPolice_C'];
if ($idCollegePolice > "0") {
$sql = 'call sp_ajouter_tousadherents_college_bascule(?, ?, ?, ?, ?, ?, ?, ?, ?);';
/*
var_dump($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege, $idOption, $dateEffet, $user, $idPolice, $idCollegePolice);
die();
*/
$this->executerRequete($sql, array($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege, $idOption, $dateEffet, $user, $idPolice, $idCollegePolice));
}else{
$sql = 'call sp_ajouter_tousadherents_bascule(?, ?, ?, ?, ?, ?, ?, ?);';
/*
var_dump($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege, $idOption, $dateEffet, $user, $idPolice);
die();
*/
$this->executerRequete($sql, array($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege, $idOption, $dateEffet, $user, $idPolice));
}
}
public function getlisteassuresabasculer($idPolice)
{
$sql = 'call sp_liste_assures_a_basuler(?)';
$resultat = $this->executerRequete($sql, array($idPolice));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getlisteassurescollegeabasculer($idPolice, $idCollegePolice)
{
$sql = 'call sp_liste_assures_college_a_basuler(?, ?)';
$resultat = $this->executerRequete($sql, array($idPolice, $idCollegePolice));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function retirerAdherentBascules($numeroAdherent)
{
$user = $_SESSION['login'];
$sql = 'call sp_retirer_adherent_bascule(?, ?);';
$this->executerRequete($sql, array($numeroAdherent, $user));
}
public function retirerTousAdherentBascules($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege)
{
$user = $_SESSION['login'];
$sql = 'call sp_retirer_tousadherents_bascule(?, ?, ?, ?, ?);';
$this->executerRequete($sql, array($codeGcAssureur, $codeProduit, $idPoliceBascule, $idCollege, $user));
}
// 23-01-2023
public function getlisteassuresparcollege($idPolice, $idCollegePolice)
{
$sql = 'call sp_liste_assures_par_college(?, ?)';
$resultat = $this->executerRequete($sql, array($idPolice, $idCollegePolice));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
//30-03-2023
public function getListeLimiteAdherent($idAdherent)
{
$sql = 'call sp_liste_limiteadherent_newversion(?)';
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function majPlafondAdherent($idLimite, $plafond, $motif)
{
$user = $_SESSION['login'];
$sql ="CALL sp_majplafondadherent(?, ?, ?, ?);";
$this->executerRequete($sql, array($idLimite, $plafond, $motif, $user));
}
//15-05-2023
public function getConsosAdherent($idAdherent)
{
$datePrestation = date('Y-m-d');
$sql = 'call sp_consos_adherent_newversion(?, ?)';
$resultat = $this->executerRequete($sql, array($idAdherent, $datePrestation));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getConsosTotalAdherent($idAdherent)
{
$datePrestation = date('Y-m-d');
$sql = 'call sp_consos_total_adherent_newversion(?, ?)';
$resultat = $this->executerRequete($sql, array($idAdherent, $datePrestation));
return $resultat->fetch(PDO::FETCH_ASSOC);
}
//25-05-2023
public function getadherentvide() {
$sql = 'call sp_adherent_vide();';
$resultat = $this->executerRequete($sql);
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function trouverAdherent($numero)
{
$numero = contruireParamLikeDebut($numero);
$sql = 'call sp_get_adherent_newversion(?)';
/*var_dump($codeTarifActe, $codePrestataire, $idAdherent, $delaiCarenceBeneficiaire, $anciennete, $libelle, $numeroFeuilleMaladie);
die();*/
$resultat = $this->executerRequete($sql, array($numero));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function trouverAdherentId($idAdherent)
{
$sql = 'call sp_get_adherent_id_newversion(?)';
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetch(PDO::FETCH_ASSOC);
}
//27-05-2023
public function getVerifieExistance($nom, $prenoms, $sexe, $dateNaissance, $idCollege)
{
$sql = 'SELECT fn_verifier_existance_adherent(?, ?, ?, ?, ?) AS existe;';
$resultat = $this->executerRequete($sql, array($nom, $prenoms, $sexe, $dateNaissance, $idCollege))->fetch(PDO::FETCH_ASSOC);
return $resultat['existe'];
}
//16-06-2023
public function getTmadherent()
{
$sql = 'CALL sp_gettmadherent();';
$resultat = $this->executerRequete($sql);
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function insererTmadherent($idAdherent, $dateEffet, $tm)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_inserertmadherent(?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idAdherent, $dateEffet, $tm, $user));
}
public function getMaxDateEffetTmAdherent($idAdherent){
$sql="CALL sp_getmaxdateeffet_tmadherent(?)";
$resultat = $this->executerRequete($sql, array($idAdherent))->fetch(PDO::FETCH_ASSOC);
return $resultat['maxDateEffetGarantie'];
}
public function supprimerTmadherent($idTm)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_supprimer_tmadherent(?, ?);';
$this->executerRequete($sql, array($idTm, $user));
}
//20-06-2023
public function insererTmadherentacte($idAdherent, $dateEffet, $tm, $codeActe, $codeGarantie)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_inserertmadherent_acte(?, ?, ?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idAdherent, $dateEffet, $tm, $user, $codeActe, $codeGarantie));
}
public function getTmadherentacte()
{
$sql = 'CALL sp_gettmadherent_acte();';
$resultat = $this->executerRequete($sql);
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
//
public function getMaxDateEffetTmAdherentacte($idAdherent, $codeActe, $codeGarantie){
$sql="CALL sp_getmaxdateeffet_tmadherentacte(?, ?, ?)";
$resultat = $this->executerRequete($sql, array($idAdherent, $codeActe, $codeGarantie))->fetch(PDO::FETCH_ASSOC);
return $resultat['maxDateEffetGarantie'];
}
//21-06-2023
public function supprimerTmadherentacte($idTm)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_supprimer_tmadherentacte(?, ?);';
$this->executerRequete($sql, array($idTm, $user));
}
public function getTmadherentacteprestataire()
{
$sql = 'CALL sp_gettmadherent_acte_prestataire();';
$resultat = $this->executerRequete($sql);
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getMaxDateEffetTmAdherentacteprestataire($idAdherent, $codeActe, $codePrestataire, $codeGarantie){
$sql="CALL sp_getmaxdateeffet_tmadherentacteprestataire(?, ?, ?, ?)";
$resultat = $this->executerRequete($sql, array($idAdherent, $codeActe, $codePrestataire, $codeGarantie))->fetch(PDO::FETCH_ASSOC);
return $resultat['maxDateEffetGarantie'];
}
public function insererTmadherentacteprestataire($idAdherent, $dateEffet, $tm, $codeActe, $codePrestataire, $codeGarantie)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_inserertmadherent_acte_prestataire(?, ?, ?, ?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idAdherent, $dateEffet, $tm, $user, $codeActe, $codePrestataire, $codeGarantie));
}
public function supprimerTmadherentacteprestataire($idTm)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_supprimer_tmadherentacteprestataire(?, ?);';
$this->executerRequete($sql, array($idTm, $user));
}
//26-06-2023
public function getTmadherentgarantie()
{
$sql = 'CALL sp_gettmadherent_garantie();';
$resultat = $this->executerRequete($sql);
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getgarantie()
{
$sql = 'SELECT codeGarantie AS `code`,
libelle
FROM garantie;';
$resultat = $this->executerRequete($sql);
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function insererTmadherentgarantie($idAdherent, $dateEffet, $tm, $codeGarantie)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_inserertmadherent_garantie(?, ?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idAdherent, $dateEffet, $tm, $user, $codeGarantie));
}
public function getMaxDateEffetTmAdherentgarantie($idAdherent, $codeGarantie){
$sql="CALL sp_getmaxdateeffet_tmadherentgarantie(?, ?)";
$resultat = $this->executerRequete($sql, array($idAdherent, $codeGarantie))->fetch(PDO::FETCH_ASSOC);
return $resultat['maxDateEffetGarantie'];
}
public function supprimerTmadherentgarantie($idTm)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_supprimer_tmadherentgarantie(?, ?);';
$this->executerRequete($sql, array($idTm, $user));
}
public function getTmadherentgarantieprestataire()
{
$sql = 'CALL sp_gettmadherent_garantie_prestataire();';
$resultat = $this->executerRequete($sql);
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function insererTmadherentgarantieprestataire($idAdherent, $dateEffet, $tm, $codeGarantie, $codePrestataire)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_inserertmadherent_garantie_prestataire(?, ?, ?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idAdherent, $dateEffet, $tm, $user, $codeGarantie, $codePrestataire));
}
public function getMaxDateEffetTmAdherentgarantieprestataire($idAdherent, $codeGarantie, $codePrestataire){
$sql="CALL sp_getmaxdateeffet_tmadherentgarantieprestataire(?, ?, ?)";
$resultat = $this->executerRequete($sql, array($idAdherent, $codeGarantie, $codePrestataire))->fetch(PDO::FETCH_ASSOC);
return $resultat['maxDateEffetGarantie'];
}
public function supprimerTmadherentgarantieprestataire($idTm)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_supprimer_tmadherentgarantieprestataire(?, ?);';
$this->executerRequete($sql, array($idTm, $user));
}
//
public function getTmadherentprestataire()
{
$sql = 'CALL sp_gettmadherent_prestataire();';
$resultat = $this->executerRequete($sql);
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function insererTmadherentprestataire($idAdherent, $dateEffet, $tm, $codePrestataire)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_inserertmadherent_prestataire(?, ?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idAdherent, $dateEffet, $tm, $user, $codePrestataire));
}
public function getMaxDateEffetTmAdherentprestataire($idAdherent, $codePrestataire){
$sql="CALL sp_getmaxdateeffet_tmadherentprestataire(?, ?)";
$resultat = $this->executerRequete($sql, array($idAdherent, $codePrestataire))->fetch(PDO::FETCH_ASSOC);
return $resultat['maxDateEffetGarantie'];
}
public function supprimerTmadherentprestataire($idTm)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_supprimer_tmadherentprestataire(?, ?);';
$this->executerRequete($sql, array($idTm, $user));
}
public function getgarantiehospit($codeGarantie)
{
$sql = 'SELECT codeGarantie AS `code`,
libelle
FROM garantie
WHERE codeGarantie=?;';
$resultat = $this->executerRequete($sql, array($codeGarantie));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getBeneficiairesRemboursement($idAdherent) {
$sql = 'SELECT A.*, B.libelle AS lienBeneficiaire,
B.libelleEng AS lienBeneficiaireEng,
C.libelle AS modepaiement,
C.libelleEng AS modepaiementEng
FROM beneficiaireremboursement A
JOIN p_lienbeneficiaire B ON (A.codeLienBeneficiaire = B.codeLienBeneficiaire)
JOIN p_modepaiement C ON (A.codeModePaiement = C.codeModePaiement)
WHERE A.idAdherent=? ORDER BY A.id desc;';
$adherent = $this->executerRequete($sql, array($idAdherent));
return $adherent->fetchAll(PDO::FETCH_ASSOC);
}
public function ajouterbeneficiaireremboursement($idAdherent,$beneficiaireReglement,
$codeLienBeneficiaire,$codeModePaiement,$enVigueur,$telephoneMobile,$rib)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'CALL sp_ajouter_beneficiaire_remboursement(?,?,?,?,?,?,?,?,?);';
$this->executerRequete($sql, array($codeSociete,$idAdherent,$beneficiaireReglement,
$codeLienBeneficiaire,$codeModePaiement,$enVigueur,$telephoneMobile,$rib,$user));
}
public function getBeneficiaireRemboursementId($idData)
{
$sql = 'SELECT * FROM beneficiaireremboursement WHERE (id=?)';
$resultat = $this->executerRequete($sql, array($idData));
return $resultat->fetch(PDO::FETCH_ASSOC);
}
public function enregistrerbeneficiaireremboursement($idData,$idAdherent,$beneficiaireReglement,
$codeLienBeneficiaire,$codeModePaiement,$enVigueur,$telephoneMobile,$rib)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'CALL sp_enregistrer_beneficiaire_remboursement(?,?,?,?,?,?,?,?,?,?);';
$this->executerRequete($sql, array($codeSociete,$idAdherent,$beneficiaireReglement,
$codeLienBeneficiaire,$codeModePaiement,$enVigueur,$telephoneMobile,$rib,$user,$idData));
}
public function getMandantaireRemboursement($idAdherent) {
$sql = 'CALL sp_afficher_beneficiaire_remboursement_direct(?);';
$adherent = $this->executerRequete($sql, array($idAdherent));
return $adherent->fetch(PDO::FETCH_ASSOC);
}
public function getagemaxlienparente($idCollege, $codeLienParente)
{
$sql = 'select fn_age_max_lien_parente(?, ?) as ageMax;';
$resultat = $this->executerRequete($sql, array($idCollege, $codeLienParente));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['ageMax'];
}
public function getcollegeavenantfacturation($idPolice)
{
$sql = 'SELECT fn_college_avenant_facturation(?) AS idCollege;';
$resultat = $this->executerRequete($sql, array($idPolice));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['idCollege'];
}
public function getdateeffetpolice($idPolice)
{
$sql = 'SELECT fn_date_effet_police(?) AS dateEffet;';
$resultat = $this->executerRequete($sql, array($idPolice));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['dateEffet'];
}
public function initavenantfacturationadherent_temp($idCollege,$dateEntree,$user,$prorata)
{
$sql = 'CALL sp_init_adherent(?, ?, ?, ?);';
$this->executerRequete($sql, array($idCollege,$dateEntree,$user,$prorata));
}
public function ajouteradherentfacturation($idPolice, $idCollege, $nom, $prenoms, $codeNaturePiece, $numeroPiece,
$sexe, $dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale,
$codePays, $codeVille, $telephonFixe, $telephonePortable, $email, $dateEntree, $user, $idAvenant, $codeLocalite, $numeroCmu,
$numeroMatricule, $codeTarifActe, $dateSouscription, $vip, $seuilRdAdherent, $numeroBs, $ancienNumeroAssure, $beneficiaireReglement,
$codeLienBeneficiaire, $codeModePaiement, $enVigueur, $telephoneMobile, $rib, $codeTypeRemboursement)
{
$sql = 'call sp_ajouter_adherent_facturation(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);';
$resultat = $this->executerRequete($sql, array($idPolice, $idCollege, $nom, $prenoms, $codeNaturePiece, $numeroPiece, $sexe,
$dateNaissance, $codeGroupeSanguin, $codeSituationFamille, $nombreEnfants, $adresseGeo, $adressePostale, $codePays, $codeVille,
$telephonFixe, $telephonePortable, $email, $dateEntree, $user, $idAvenant, $codeLocalite, $numeroCmu, $numeroMatricule, $codeTarifActe,
$dateSouscription, $vip, $seuilRdAdherent, $numeroBs, $ancienNumeroAssure, $beneficiaireReglement, $codeLienBeneficiaire, $codeModePaiement,
$enVigueur, $telephoneMobile, $rib, $codeTypeRemboursement));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
$dernierIdAdherent = $ligne['dernierIdAdherent'];
return $dernierIdAdherent;
}
public function aBeneficiaireRemboursement($idAdherent)
{
$sql = 'select fn_a_beneficiaire_remboursement(?) as aBen;';
$resultat = $this->executerRequete($sql, array($idAdherent));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['aBen'];
}
public function addBeneficiaireRembAuto($idAdherent)
{
$user = $_SESSION['login'];
$sql = 'CALL sp_ajouter_beneficiaire_remboursement_auto(?, ?);';
$this->executerRequete($sql, array($idAdherent, $user));
}
public function getPrestationsmensuelles($idAdherent){
if (isset($_SESSION['lang']) && $_SESSION['lang']=="en_US"){
$sql = 'call prestations_mensuelles_famille_eng(?)';
}else{
$sql = 'call prestations_mensuelles_famille(?)';
}
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getPrestationsLiensParente($idAdherent){
if (isset($_SESSION['lang']) && $_SESSION['lang']=="en_US"){
$sql = 'call prestations_lienparente_famille_eng(?)';
}else{
$sql = 'call prestations_lienparente_famille(?)';
}
$resultat = $this->executerRequete($sql, array($idAdherent));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
}