detailsp = new Statistique(); $this->college = new Collegepolice(); $this->statAdherent = new ControleurAjaxstatsmaladiefichetechniqueadherentpdf(); $this->police = new Police(); $this->police_societe = new Police_sodciete(); } public function index() { //////////////////////////////////////////// $codeGcAssureur = $this->requete->getParametreFormulaire("codeGcAssureur"); $idPolice = $this->requete->getParametreFormulaire("idPolice"); if( $idPolice==""){ $idPolice=null; } $idCollege = $this->requete->getParametreFormulaire("idCollege"); if( $idCollege ==""){ $idCollege = null; } $Chargement = $this->requete->getParametreFormulaire("Chargement"); $debutStat = $this->requete->getParametreDate("debutStat"); $finStat = $this->requete->getParametreDate("finStat"); $depenses = $this->requete->getParametreFormulaire("depenses","numerique"); $_SESSION['debutStat'] = $debutStat; $_SESSION['finStat'] = $finStat; $_SESSION['depenses'] = $depenses; $policeGarants = $this->police->getPoliceGarantStat($codeGcAssureur, $idPolice); foreach ($policeGarants as $key => $policeGarant) { if($policeGarant['dateFin']<=$_SESSION['finStat'] && $policeGarant['dateFin']>=$_SESSION['debutStat'] ){ $p_datefin =$policeGarant['dateFin']; $finStat =$policeGarant['dateFin']; }else { $p_datefin =$_SESSION['finStat']; } $debutStat =$policeGarant['dateEffet']; $p_datedebut =$policeGarant['dateEffet']; // $p_datefin =$_SESSION['finStat']; $p_garant = $codeGcAssureur; $p_id = $policeGarant['id'] ; $p_limite = $_SESSION['depenses']; $p_id_college = $idCollege; $p_id_clients = null; $p_apporteur = null; $chargeravantapres = $this->requete->getParametreFormulaire("chargeravantapres"); // $pdfone = new FPDF_Merge(); $pdfone = new FPDF_Protection(); $pdfone->SetAuthor('EBENE SOLUTIONS INFORMATIQUES'); $userPassword = ''; $ownerPassword = null; $pdfone->SetProtection(['print'], $userPassword, $ownerPassword); $p_factures = $this->detailsp->getdepenseparcontratrp($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin); $caractere = array(" ","/"); $nomdedossier =str_replace($caractere,"_",$policeGarant['libellePolice']); $nomdedossier ="Temp/STATISTIQUES/".$nomdedossier; if(!empty($p_factures) && !is_dir($nomdedossier)){ $fichier = $this->statAdherent->statsparticulier($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$depenses,$chargeravantapres ); } $pdfone->add($fichier); } $fichierall="Temp/TMP_KIT_STATISTIQUES"."_".uniqid().".pdf"; $pdfone->Output($fichierall); $t_html ='
'; $t_html .=' '._("TELECHARGER").' '; $t_html .=' '; $t_html .=' '; $t_html .='
'; echo $t_html; } public function envoiewhatsapp() { $idPolice = $this->requete->getParametreFormulaire("idPolice"); $idCollege = $this->requete->getParametreFormulaire("idCollege"); if( $idCollege ==""){ $idCollege = null; } $codeGcAssureur = $this->requete->getParametreFormulaire("codeGcAssureur"); $Chargement = $this->requete->getParametreFormulaire("Chargement"); $debutStat = $this->requete->getParametreDate("debutStat"); $finStat = $this->requete->getParametreDate("finStat"); $depenses = $this->requete->getParametreFormulaire("depenses","numerique"); $chargeravantapres = $this->requete->getParametreFormulaire("chargeravantapres"); $entete = $this->detailsp->detailrapportspperiodepdfentete($idPolice); $p_datedebut = $_SESSION['debutStat']; $p_datefin =$_SESSION['finStat']; $p_garant = $codeGcAssureur; $p_id = $entete['idPolice'] ; $p_limite = $_SESSION['depenses']; $p_id_college = $idCollege; $p_id_clients = null; $p_apporteur = null; if(empty($entete) && !empty($idPolice)){ $police = $this->police->getPoliceId($idPolice); $t_html ='
'; $t_html .=' '._("La période d'éffet de cette police est du ").dateLang($police['dateEffet'], $_SESSION['lang'])." au ".dateLang($police['dateFin'], $_SESSION['lang']).' '; $t_html .='
'; echo $t_html; exit(); } $tousadherents = $this->detailsp->detaildepensefamilleass($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin, $p_limite); foreach($tousadherents as $statsAdherent){ $famille =$statsAdherent['adherent']; $numeroAdherent =$statsAdherent['numeroAdherent']; $fichier="Temp/TMP_KIT_STATISTIQUES_FAMILLE"."_".$famille.".pdf"; if(is_file($fichier)){ $fichier="https://gestionnaire.vitalis-ci.com/Temp/TMP_KIT_STATISTIQUES_FAMILLE"."_".$famille.".pdf"; $params=array( 'token' => '5ujfcrqcc9qykwdq', 'to' => '2250152706497,', 'filename' => 'TMP_KIT_STATISTIQUES.pdf', 'document' => $fichier, 'caption' => 'Statistiques des consommations', 'priority' => '', 'referenceId' => '', 'nocache' => '', 'msgId' => '', 'mentions' => '' ); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.ultramsg.com/instance72717/messages/document", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => http_build_query($params), CURLOPT_HTTPHEADER => array( "content-type: application/x-www-form-urlencoded" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } } } $t_html ='
'; $t_html .=' '._("Traitement terminé avec succes").' '; $t_html .='
'; echo $t_html; } }