128 lines
4.1 KiB
PHP
128 lines
4.1 KiB
PHP
|
<?
|
|||
|
if (!$_SESSION['connected']) die();
|
|||
|
|
|||
|
require_once 'partenaires/classMTva.php';
|
|||
|
require_once 'partenaires/classMMap.php';
|
|||
|
require_once 'common/dates.php';
|
|||
|
require_once 'cache/cache.php';
|
|||
|
|
|||
|
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
|
|||
|
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Param<61>tres incorrects !');
|
|||
|
|
|||
|
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; // Si id=0 alors non communiqu<71>
|
|||
|
if (($siret*1)==0 && $idEntreprise==0) die('Param<61>tres incorrects !');
|
|||
|
$siren=substr($siret,0,9);
|
|||
|
$mil=false;
|
|||
|
$raisonSociale=$tabInfo['entrep']['raisonSociale'];
|
|||
|
?>
|
|||
|
<div id="center">
|
|||
|
<h1 class="titre">LISTE DES ÉVÉNEMENTS</h1>
|
|||
|
<table>
|
|||
|
<tr>
|
|||
|
<td width="30"> </td>
|
|||
|
<td width="200" class="StyleInfoLib">Numéro identifiant Siren</td>
|
|||
|
<td width="350" class="StyleInfoData"><?=substr($siren,0,3).' '.substr($siren,3,3).' '.substr($siren,6,3)?></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td width="30"> </td>
|
|||
|
<td width="200" class="StyleInfoLib">Raison Sociale</td>
|
|||
|
<td width="350" class="StyleInfoData"><?=$raisonSociale?></td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
|
|||
|
<h2>Év<EFBFBD>nements INSEE</h2>
|
|||
|
<table>
|
|||
|
<tr>
|
|||
|
<td width="30"> </td>
|
|||
|
<td colspan="2" width="550" class="StyleInfoData">
|
|||
|
<?php
|
|||
|
//G<>n<EFBFBD>rer un nom de fichier pour le cache et l'export des fichiers
|
|||
|
if (($siret*1)==0 && ($siren*1)<100){
|
|||
|
$fileName = $page2.'-'.$idEntreprise;
|
|||
|
}else{
|
|||
|
$fileName = $page2.'-'.$siret;
|
|||
|
}
|
|||
|
cache_filename($fileName);
|
|||
|
if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
|
|||
|
{
|
|||
|
$evens = cache_get('evens');
|
|||
|
//Affichage d'un message d'erreur
|
|||
|
if($evens === FALSE) exit;
|
|||
|
}else{
|
|||
|
try {
|
|||
|
$O = $client->getListeEvenements($siren);
|
|||
|
$evens = $O['result'];
|
|||
|
cache_delete();
|
|||
|
cache_add('evens', $evens);
|
|||
|
} catch (SoapFault $fault) {
|
|||
|
require_once 'soaperror.php';
|
|||
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|||
|
die();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
?>
|
|||
|
<table>
|
|||
|
<?php
|
|||
|
foreach ($evens as $i=>$even)
|
|||
|
{
|
|||
|
if ($even['Siege']==1) $type='si<73>ge';
|
|||
|
else $type='<27>tablissement';
|
|||
|
$lien='<a title="Voir la fiche d\'identit<69>" href="/?page=identite&siret='.$siren.$even['Nic'].'&idEntreprise='.$idEntreprise.'">';
|
|||
|
$lien2='<a title="Voir la fiche d\'identit<69>" href="/?page=identite&siret='.$even['SiretAss'].'&idEntreprise='.$idEntreprise.'">';
|
|||
|
?>
|
|||
|
<tr>
|
|||
|
<td class="StyleInfoLib" width="60"><?=WDate::dateT('Ymd','d/m/Y',$even['DateInfo'])?></td>
|
|||
|
<td class="StyleInfoData" width="480"><b><?=$even['EvenLib']?></b> <i> - NIC <?=$lien.$even['Nic'].'</a>'?> le <?=WDate::dateT('Ymd','d/m/Y',$even['EvenDate'])?></i>
|
|||
|
<?
|
|||
|
if (trim($even['EvenLibDet'])<>'') echo '<br/>'.str_replace(', ','<br/>', $even['EvenLibDet']);
|
|||
|
if ($even['SiretAss']*1<>0 && $even['TypeSiretAss']<>'') echo '<br/>Siret du '.$even['TypeSiretAss'].' : '.$lien2.substr($even['SiretAss'],0,9).' '.substr($even['SiretAss'],9,5).'</a>';
|
|||
|
elseif ($even['SiretAss']*1<>0 && $even['TypeSiretAss']=='') echo '<br/>Siret associé : '.$lien2.substr($even['SiretAss'],0,9).' '.substr($even['SiretAss'],9,5).'</a>';
|
|||
|
?>
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<?
|
|||
|
}
|
|||
|
if (count($evens)==0)
|
|||
|
echo '<tr><td class="StyleInfoData" width="580"> Aucun évènement n\'est présent dans notre base</td></tr>';
|
|||
|
?>
|
|||
|
</table>
|
|||
|
<?php
|
|||
|
//Exportation des donn<6E>es sous forme de fichier
|
|||
|
function htmldecode($value){
|
|||
|
$value = is_array($value) ? array_map('htmldecode', $value) : html_entity_decode($value, ENT_QUOTES, 'UTF-8');
|
|||
|
return $value;
|
|||
|
}
|
|||
|
|
|||
|
//$firephp->log($evens, 'Evenements');
|
|||
|
$tabForExport = htmldecode($evens);
|
|||
|
//$firephp->log($tabForExport, 'tabForExport');
|
|||
|
|
|||
|
if(count($tabForExport)>0)
|
|||
|
{
|
|||
|
require_once 'export.php';
|
|||
|
|
|||
|
$array2csv = new ExportCSV();
|
|||
|
$array2csv->records = $tabForExport;
|
|||
|
$array2csv->writeCSV($fileName);
|
|||
|
|
|||
|
$array2xml = new ExportXML();
|
|||
|
$array2xml->rootName = $page.'s';
|
|||
|
$array2xml->defaultTagName = $page;
|
|||
|
$array2xml->records = $tabForExport;
|
|||
|
$array2xml->writeXML($fileName);
|
|||
|
}
|
|||
|
?>
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td width="30"> </td>
|
|||
|
<td colspan="3" width="550" class="StyleInfoData">
|
|||
|
<?php
|
|||
|
require_once 'surveillance/surveillance.php';
|
|||
|
print getSurveillance($page, $siret);
|
|||
|
?>
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
</div>
|