148 lines
3.8 KiB
PHP
148 lines
3.8 KiB
PHP
<?
|
|
if (!page_checkParams()) die('Paramètres incorrects !');
|
|
|
|
require_once 'partenaires/classMTva.php';
|
|
require_once 'partenaires/classMMap.php';
|
|
require_once 'common/dates.php';
|
|
require_once 'scoresws/scoresws.php';
|
|
|
|
$etabs = scoresws_etablissements($siret, $siren, $idEntreprise);
|
|
if ($etabs === false) {
|
|
exit;
|
|
}
|
|
|
|
$raisonSociale = $_SESSION['tabInfo']['entrep']['raisonSociale'];
|
|
|
|
?>
|
|
<div id="center">
|
|
<h1 class="titre">LISTE DES ÉTABLISSEMENTS</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>Établissements</h2>
|
|
<table>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td colspan="2" width="550" class="StyleInfoData">
|
|
<table>
|
|
<?php
|
|
foreach ($etabs as $i => $etab)
|
|
{
|
|
if ($etab['Siege']==1) $type='siège ';
|
|
else $type='établ. ';
|
|
if ($etab['Actif']==1) $type.='actif';
|
|
else $type.='inactif';
|
|
|
|
if($etab['Nic']*1==0 || $etab['Nic']*1>=99990) $type.=' provisoire';
|
|
|
|
$lien='<a title="Voir la fiche d\'identité" href="/?page=identite&siret='.$siren.$etab['Nic'].'&idEntreprise='.$idEntreprise.'">';
|
|
?>
|
|
<tr>
|
|
<td class="StyleInfoData" width="30">
|
|
<b><a title="Voir la fiche d'identité" href="/?page=identite&siret=<?=$siren.$etab['Nic']?>&idEntreprise=<?=$idEntreprise?>"><?=$lien.$etab['Nic']?></a></b>
|
|
</td>
|
|
<td class="StyleInfoData" width="80"><?=$type?></td>
|
|
<td class="StyleInfoData" width="190">
|
|
<?php
|
|
if ($etab['Enseigne']!='') {
|
|
?>
|
|
<b><?=$etab['Enseigne']?></b><br/>
|
|
<?php
|
|
}
|
|
?>
|
|
<?=$etab['Adresse']?><br/>
|
|
<?php
|
|
if ($etab['Adresse2']!='') {?>
|
|
<?=$etab['Adresse2']?><br/>
|
|
<?php
|
|
}
|
|
?>
|
|
<b><?=$etab['CP']?> <?=$etab['Ville']?></b>
|
|
<?php
|
|
if ($etab['Tel']!='') echo '<br/><i>Tél : '.$etab['Tel'].'</i> ';
|
|
if ($etab['Fax']!='') echo '<br/><i>Fax : '.$etab['Fax'].'</i>';
|
|
?>
|
|
</td>
|
|
<td class="StyleInfoData" width="260">
|
|
<?=$etab['NafEtab'].' : '.$etab['NafEtabLib']?>
|
|
<?php
|
|
if ($etab['Actif']==1 &&
|
|
isset($etab['EffEtTrLib']) &&
|
|
isset($etab['EffEtTr']) &&
|
|
!in_array($etab['EffEtTr'], array('N/C', 'NN', 0)) ){
|
|
?>
|
|
<br/><i><?=$etab['EffEtTrLib']?></i>
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td colspan="2" width="506" class="StyleInfoData">
|
|
|
|
<?php
|
|
if (count($etabs) == 0) {
|
|
print 'Aucun établissement n\'est présent dans notre base';
|
|
} else if (preg_match('/\bCARTES\b/i', $_SESSION['tabInfo']['pref'])) {
|
|
print '<iframe src="/?page=carte&siret='.$siren.
|
|
'" width=506 height=505 marginheight="1" marginwidth="1"'.
|
|
' scrolling="No" frameborder=0></iframe>';
|
|
}
|
|
?>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<p class="confidentiel blockh2">
|
|
<?php
|
|
require_once 'cgu/cgu.php';
|
|
echo afficheCgu();
|
|
?>
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
//Exportation des donné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;
|
|
}
|
|
$tabForExport = htmldecode($etabs);
|
|
//@TODO a tester
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = 'etablissements-'.$idEntreprise;
|
|
}else{ $fileName = 'etablissements-'.$siret; }
|
|
|
|
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);
|
|
}
|
|
?>
|