backoffice/html/sirenbod/derniers.php
2011-06-21 13:28:10 +00:00

143 lines
6.5 KiB
PHP

<?php
/**
* Inclusion du fichier de configuration des includes Métiers de S&D
*/
include '/var/www/includes/config.php';
/**
* Inclusion du Framework
*/
if( !defined('FWK_PATH') )
include '/var/www/framework/fwk.php';
$t1=microtime_float();
include_once(INCLUDE_PATH.'insee/classMInsee.php');
include_once(INCLUDE_PATH.'bodacc/classMBodacc.php');
include_once(FWK_PATH.'common/dates.php');
$iDb=new WDB('jo');
$iDb2=new WDB('sdv1');
session_start();
$tabSirenPC=array();
$authorized = false;
if(isset($_GET['logout']) && ($_SESSION['auth'])) {
$_SESSION['auth'] = null;
session_destroy();
echo "logging out...";
}
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
$user=addslashes(trim($_SERVER['PHP_AUTH_USER']));
$pwd =addslashes(trim($_SERVER['PHP_AUTH_PW']));
$tabTmp=$iDb2->select( 'utilisateurs',
'id, login, email',
"login='$user' AND password='$pwd' AND idClient=1 AND actif=1 AND deleted=0");
$_SESSION['userId']=$tabTmp[0]['id'];
$_SESSION['userMail']=$tabTmp[0]['login'];
if ( $_SESSION['userId'] ) {//&& $_SESSION['auth']) {
$authorized = true;
}
} else {
//if (isset($_GET["login"]) && (! $authorized)) {
header('WWW-Authenticate: Basic Realm="Login please"');
header('HTTP/1.0 401 Unauthorized');
$_SESSION['auth'] = true;
print('Login now or forever hold your clicks...');
exit;
}
if (!$authorized) {
?><h1>you have <? echo ($authorized) ? '' : 'not'; ?> logged!</h1><?
} else {
//echo '<!--';
$nomAncre='';
if (isset($_POST['envoyer'])) {
foreach ($_POST['envoyer'] as $idEnv=>$env) {
$nomAncre='#n'.$idEnv;
}}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" />
<title>Gestion des informations de la base de donn&eacute;es</title>
<link rel="stylesheet" type="text/css" href="../nonimg/gestion.css" />
<script language='javascript' src='../nonimg/calendar.js'></script>
</head>
<?
$iInsee=new MInsee();
$iBodacc=new MBodacc();
?>
<h3 align="center">Derni&egrave;res annonces Bodacc affect&eacute; par l'&eacute;quipe de production</h3>
<h4 align="center">
<a href="./derniers.php?cj=9">Associations</a>&nbsp;
<a href="./derniers.php?cj=5">Sociétés commerciales</a>&nbsp;
<a href="./derniers.php?cj=1">Personnes physiques</a>&nbsp;
<a href="./derniers.php?cj=A">Autres...</a>&nbsp;
<a href="./derniers.php?cj=0">Toutes formes juridiques</a>&nbsp;
<a href="../">RETOUR</a>
</h4>
<? $strCJ='';
if (isset($_REQUEST['cj']) && trim($_REQUEST['cj'])<>'') {
if ($_REQUEST['cj']==1) $strCJ=' AND e.cj BETWEEN 1000 AND 1999 ';
elseif ($_REQUEST['cj']==5) $strCJ=' AND e.cj BETWEEN 5000 AND 5999 ';
elseif ($_REQUEST['cj']==9) $strCJ=' AND e.cj BETWEEN 9000 AND 9999 ';
elseif ($_REQUEST['cj']=='A') $strCJ=' AND ( e.cj BETWEEN 2000 AND 4999 OR e.cj BETWEEN 6000 AND 8999) ';
elseif ($_REQUEST['cj']==0) $strCJ='';
}
?>
<table BgColor="#177AE9" cellspacing="1" cellpadding="2" border="0" align="center" BorderColor="#000020">
<tr><td><b><font color="Black">Siren</font></b></td>
<td><b><font color="Black">Date Parution</font></b></td>
<td><b><font color="Black">Date Jugement</font></b></td>
<td><b><font color="Black">Type Ev&egrave;nement</font></b></td>
<td><b><font color="Black">raisonSociale</font></b></td>
<td><b><font color="Black">Capital</font></b></td>
<td><b><font color="Black">Adresse</font></b></td>
<td><b><font color="Black">codePostalSiege</font></b></td>
<td><b><font color="Black">villeSiege</font></b></td>
<td><b><font color="Black">activite</font></b></td>
<td><b><font color="Black">Actif Insee</font></b></td>
<td><b><font color="Black">Catégorie Juridique</font></b></td>
<td><b><font color="Black">Effectif Insee</font></b></td>
<td><b><font color="Black">Tranche CA Insee</font></b></td>
</tr>
<?//SELECT b.siren, b.Bodacc_Date_Parution, b.raisonSociale, b.Capital, b.adresseSiege, b.codePostalSiege, b.villeSiege, b.activite, e.cj, e.rang FROM bodacc_detail b, etablissements e WHERE b.idSirenage >0 and b.siren >100 and b.siren = e.siren and e.siege =1 ORDER BY b.Bodacc_Date_Parution DESC;
$tabTmp=$iDb->select( 'bodacc_detail b, etablissements e',
'b.siren, b.Bodacc_Date_Parution, b.dateJugement, b.raisonSociale, b.Capital, b.adresseSiege, b.codePostalSiege, b.villeSiege, b.activite, b.typeEven, e.cj, e.rang',
"b.idSirenage>0 AND b.siren>100 AND b.siren=e.siren AND e.siege=1 $strCJ AND (b.typeEven LIKE '%1100%' OR
b.typeEven LIKE '%1101%' OR b.typeEven LIKE '%1200%' OR b.typeEven LIKE '%1201%' OR b.typeEven LIKE '%1211%' OR
b.typeEven LIKE '%1212%' OR b.typeEven LIKE '%1300%' OR b.typeEven LIKE '%1301%' OR b.typeEven LIKE '%1302%' OR
b.typeEven LIKE '%1303%' OR b.typeEven LIKE '%1304%' OR b.typeEven LIKE '%1305%' OR b.typeEven LIKE '%1306%' OR
b.typeEven LIKE '%1307%' OR b.typeEven LIKE '%1308%' OR b.typeEven LIKE '%1309%' OR b.typeEven LIKE '%1310%' OR
b.typeEven LIKE '%1311%' OR b.typeEven LIKE '%1312%' OR b.typeEven LIKE '%1313%' OR b.typeEven LIKE '%1417%' OR
b.typeEven LIKE '%1418%' OR b.typeEven LIKE '%1419%' OR b.typeEven LIKE '%1504%' OR b.typeEven LIKE '%1600%' OR
b.typeEven LIKE '%1601%' OR b.typeEven LIKE '%1604%' OR b.typeEven LIKE '%1605%' OR b.typeEven LIKE '%1610%' OR
b.typeEven LIKE '%1611%' OR b.typeEven LIKE '%1650%' OR b.typeEven LIKE '%1900%' OR b.typeEven LIKE '%1901%')
ORDER BY b.Bodacc_Date_Parution DESC LIMIT 0,100",false,MYSQL_ASSOC);
$iDb2=new WDB('insee');
foreach ($tabTmp as $tabAnn) {
$tabTmp2=$iDb2->select( 'identite',
'SIREN, ACTIF, CJ, EFF_ENT, TEFF_ENT, TCA',
'SIREN='.$tabAnn['siren'].' AND SIEGE=1 ORDER BY ACTIF DESC, NIC DESC LIMIT 0,1',false,MYSQL_ASSOC);
if (isset($tabTmp2[0])) $iden=$tabTmp2[0];
else $iden=array();
$strSalaries=$iden['EFF_ENT']*1;
if ($strSalaries>19) $bgcolor='#E2E0FC'; else $bgcolor='#E2EEFC';
if ($strSalaries>19) $strSalaries='<b>'.$strSalaries.'&nbsp;salari&eacute;s</b>';
elseif ($strSalaries>1) $strSalaries.='&nbsp;salari&eacute;s';
elseif ($strSalaries==1) $strSalaries.='&nbsp;salari&eacute;';
else $strSalaries='&nbsp;';
echo "<tr BgColor=\"$bgcolor\"><td>".$tabAnn['siren'].'</td><td>'.$tabAnn['Bodacc_Date_Parution'].'</td><td>'.$tabAnn['dateJugement'].'</td><td>'.$iBodacc->getEvenement($tabAnn['typeEven']).' ('.$tabAnn['typeEven'].')</td><td>'.$tabAnn['raisonSociale'].'</td><td>'.$tabAnn['Capital'].'</td><td>'.str_replace('|', '', $tabAnn['adresseSiege']).'</td><td>'.$tabAnn['codePostalSiege'].'</td><td>'.$tabAnn['villeSiege'].'</td><td>'.$tabAnn['activite'].'</td><td>'.$iden['ACTIF'].'</td><td>'.$iden['CJ']."</td><td>$strSalaries</td><td>".$iden['TCA'].'</td></tr>';
}
?>
</table>
<?
}
?>