2009-07-20 16:17:33 +00:00
< ?
2010-04-27 08:09:23 +00:00
if ( ! page_checkParams ()) die ( 'Paramètres incorrects !' );
2009-07-20 16:17:33 +00:00
require_once 'partenaires/classMTva.php' ;
require_once 'partenaires/classMMap.php' ;
require_once 'common/dates.php' ;
2010-05-18 15:46:45 +00:00
require_once 'scoresws/scoresws.php' ;
2009-03-05 16:19:38 +00:00
2010-05-18 15:46:45 +00:00
$etabs = scoresws_etablissements ( $siret , $siren , $idEntreprise );
if ( $etabs === false ) {
exit ;
2009-08-27 07:28:00 +00:00
}
2010-08-11 15:30:07 +00:00
2009-08-27 07:28:00 +00:00
$raisonSociale = $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'raisonSociale' ];
2009-09-14 15:47:52 +00:00
?>
2009-08-27 07:28:00 +00:00
< div id = " center " >
< h1 class = " titre " > LISTE DES & Eacute ; TABLISSEMENTS </ h1 >
2009-07-20 16:17:33 +00:00
2009-08-27 07:28:00 +00:00
< table >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Num & eacute ; 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 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Raison Sociale </ td >
< td width = " 350 " class = " StyleInfoData " >< ? = $raisonSociale ?> </td>
</ tr >
</ table >
< h2 >& Eacute ; tablissements </ h2 >
< table >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td colspan = " 2 " width = " 550 " class = " StyleInfoData " >
< table >
< ? php
foreach ( $etabs as $i => $etab )
{
2010-02-10 17:27:03 +00:00
if ( $etab [ 'Siege' ] == 1 ) $type = 'siège ' ;
2010-08-11 15:12:45 +00:00
else $type = 'établ. ' ;
2009-08-27 07:28:00 +00:00
if ( $etab [ 'Actif' ] == 1 ) $type .= 'actif' ;
else $type .= 'inactif' ;
2010-03-18 16:27:18 +00:00
2009-12-23 14:40:36 +00:00
if ( $etab [ 'Nic' ] * 1 == 0 || $etab [ 'Nic' ] * 1 >= 99990 ) $type .= ' provisoire' ;
2010-03-18 16:27:18 +00:00
2010-02-10 17:27:03 +00:00
$lien = '<a title="Voir la fiche d\'identité" href="/?page=identite&siret=' . $siren . $etab [ 'Nic' ] . '&idEntreprise=' . $idEntreprise . '">' ;
2009-08-27 07:28:00 +00:00
?>
< tr >
2010-08-11 15:12:45 +00:00
< 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/>
2009-08-27 07:28:00 +00:00
< ? php
2010-08-11 15:12:45 +00:00
}
2009-08-27 07:28:00 +00:00
?>
2010-08-11 15:12:45 +00:00
< 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
}
?>
2009-03-05 16:19:38 +00:00
</ td >
2009-08-27 07:28:00 +00:00
</ tr >
< ? php
}
2009-09-14 15:40:12 +00:00
?>
</ table >
</ td >
</ tr >
< tr >
2010-03-18 16:27:18 +00:00
< td width = " 30 " >& nbsp ; </ 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 >
2009-08-27 07:28:00 +00:00
</ tr >
2009-09-14 15:40:12 +00:00
2009-08-27 07:28:00 +00:00
</ table >
2010-04-12 14:49:55 +00:00
< p class = " confidentiel blockh2 " >
< ? php
require_once 'cgu/cgu.php' ;
echo afficheCgu ();
?>
</ p >
2009-08-27 07:28:00 +00:00
</ div >
2009-03-05 16:19:38 +00:00
2010-03-18 16:27:18 +00:00
< ? php
2010-02-10 17:27:03 +00:00
//Exportation des données sous forme de fichier
2009-08-27 07:28:00 +00:00
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
2010-08-11 15:30:07 +00:00
if (( $siret * 1 ) == 0 || ( $siren * 1 ) < 100 ){ $fileName = 'etablissements-' . $idEntreprise ;
} else { $fileName = 'etablissements-' . $siret ; }
2009-07-20 16:17:33 +00:00
2009-08-27 07:28:00 +00:00
if ( count ( $tabForExport ) > 0 ){
require_once 'export.php' ;
2009-03-05 16:19:38 +00:00
2009-08-27 07:28:00 +00:00
$array2csv = new ExportCSV ();
$array2csv -> records = $tabForExport ;
$array2csv -> writeCSV ( $fileName );
2009-03-05 16:19:38 +00:00
2009-08-27 07:28:00 +00:00
$array2xml = new ExportXML ();
$array2xml -> rootName = $page . 's' ;
$array2xml -> defaultTagName = $page ;
$array2xml -> records = $tabForExport ;
$array2xml -> writeXML ( $fileName );
}
2009-03-05 16:19:38 +00:00
?>