357 lines
14 KiB
PHP
357 lines
14 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][0];
|
|
$_SESSION['userMail']=$tabTmp[0][1];
|
|
|
|
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 {
|
|
|
|
if (date('Hi')*1<1600 && $_SESSION['userId']<>1 && $_SESSION['userId']<>127) die('Pas de stats avant 16h. Production en cours...');
|
|
|
|
//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é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();
|
|
$tabTmp=$iDb2->select( 'utilisateurs',
|
|
'id, login',
|
|
"idClient=1");
|
|
$tabLogin=array(0=>'Batch');
|
|
foreach ($tabTmp as $user) {
|
|
$tabLogin[$user['id']]=$user['login'];
|
|
}
|
|
|
|
$tabSource=array( 'JS'=>'Collecte JAL',
|
|
'TS'=>'Collecte CCI',
|
|
'GC'=>'Greffes/TC',
|
|
'PC'=>'INPI/RNCS',
|
|
);
|
|
|
|
$vueDetail=false;
|
|
if ($_SESSION['userId']==1 || $_SESSION['userId']==127) {
|
|
$vueDetail=true;
|
|
if (isset($_REQUEST['detail']) && $_REQUEST['detail']==1)
|
|
$vueDetail=true;
|
|
elseif (isset($_REQUEST['detail']) && $_REQUEST['detail']==0)
|
|
$vueDetail=false;
|
|
}
|
|
$vueDetail=true;
|
|
|
|
if (isset($_REQUEST['vue'])) $vue=$_REQUEST['vue'];
|
|
else $vue='';
|
|
|
|
if ($vue=='mois') {
|
|
$strDate1="DATE_FORMAT(dateUpdate,'%Y-%m')";
|
|
$strDate2="DATE_FORMAT(dateInsert,'%Y-%m')";
|
|
$strDate3="DATE_FORMAT(flux,'%Y-%m')";
|
|
$strLibPeriode='mois';
|
|
}
|
|
else {
|
|
$strDate1='DATE(dateUpdate)';
|
|
$strDate2='DATE(dateInsert)';
|
|
$strDate3='DATE(flux)';
|
|
$strLibPeriode='jour';
|
|
}
|
|
if ($vueDetail) {
|
|
$tabBod=$iDb->select( 'bodacc_detail',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, idSirenage",
|
|
'idSirenage>0 GROUP BY idSirenage, Jour ORDER BY Jour DESC, Nb DESC');
|
|
$tabCol=$iDb->select( 'annonces',
|
|
"COUNT(*) as Nb, $strDate2 as Jour, source, idSaisie AS idSirenage, idSaisie",
|
|
"source IN ('JS','TS','GC','PC') GROUP BY Jour, source, idSaisie ORDER BY Jour DESC, Nb ASC");
|
|
$tabAss=$iDb->select( 'asso',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, idSirenage",
|
|
'idSirenage>0 GROUP BY idSirenage, Jour ORDER BY Jour DESC, Nb DESC');
|
|
$tabDir=$iDb->select( 'rncs_dirigeants',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, idSirenage",
|
|
'idSirenage>0 GROUP BY idSirenage, Jour ORDER BY Jour DESC, Nb DESC');
|
|
$tabBom=$iDb->select( 'boamp_lots',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, idSirenage",
|
|
'idSirenage>0 GROUP BY idSirenage, Jour ORDER BY Jour DESC, Nb DESC');
|
|
$tabBoa=$iDb->select( 'boamp_detail',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, idSirenage",
|
|
'idSirenage>0 GROUP BY idSirenage, Jour ORDER BY Jour DESC, Nb DESC');
|
|
} else {
|
|
$tabBod=$iDb->select( 'bodacc_detail',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, 0 AS idSirenage",
|
|
'idSirenage>0 GROUP BY Jour ORDER BY Jour DESC, Nb DESC');
|
|
$tabCol=$iDb->select( 'annonces',
|
|
"COUNT(*) as Nb, $strDate2 as Jour, source, 0 AS idSirenage",
|
|
"source IN ('JS','TS','GC','PC') GROUP BY Jour, source ORDER BY Jour DESC, Nb ASC");
|
|
$tabAss=$iDb->select( 'asso',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, 0 AS idSirenage",
|
|
'idSirenage>0 GROUP BY Jour ORDER BY Jour DESC, Nb DESC');
|
|
$tabDir=$iDb->select( 'rncs_dirigeants',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, 0 AS idSirenage",
|
|
'idSirenage>0 GROUP BY Jour ORDER BY Jour DESC, Nb DESC');
|
|
$tabBom=$iDb->select( 'boamp_lots',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, idSirenage",
|
|
'idSirenage>0 GROUP BY Jour ORDER BY Jour DESC, Nb DESC');
|
|
$tabBoa=$iDb->select( 'boamp_detail',
|
|
"COUNT(*) as Nb, $strDate1 as Jour, idSirenage",
|
|
'idSirenage>0 GROUP BY Jour ORDER BY Jour DESC, Nb DESC');
|
|
|
|
}
|
|
$tabJours=$tabIdSir=array();
|
|
foreach ($tabBod as $tabJour) {
|
|
$tabJours[]=$tabJour['Jour']; $tabIdSir[]=$tabJour['idSirenage'];
|
|
}
|
|
foreach ($tabCol as $tabJour) {
|
|
$tabJours[]=$tabJour['Jour']; $tabIdSir[]=$tabJour['idSirenage'];
|
|
}
|
|
foreach ($tabAss as $tabJour) {
|
|
$tabJours[]=$tabJour['Jour']; $tabIdSir[]=$tabJour['idSirenage'];
|
|
}
|
|
foreach ($tabDir as $tabJour) {
|
|
$tabJours[]=$tabJour['Jour']; $tabIdSir[]=$tabJour['idSirenage'];
|
|
}
|
|
foreach ($tabBom as $tabJour) {
|
|
$tabJours[]=$tabJour['Jour']; $tabIdSir[]=$tabJour['idSirenage'];
|
|
}
|
|
foreach ($tabBoa as $tabJour) {
|
|
$tabJours[]=$tabJour['Jour']; $tabIdSir[]=$tabJour['idSirenage'];
|
|
}
|
|
$tabJours=array_unique($tabJours); rsort($tabJours);
|
|
$tabIdSir=array_unique($tabIdSir); sort($tabIdSir);
|
|
?>
|
|
<h3 align="center">Opérations par <?=$strLibPeriode?></h3>
|
|
<table BgColor="#177AE9" cellspacing="1" cellpadding="2" border="0" align="center" BorderColor="#000020">
|
|
<tr>
|
|
<td align="center"><b><font color="Black">Date</font></b></td>
|
|
<? if ($vueDetail) echo '<td align="center"><b><font color="Black">Login</font></b></td>'; ?>
|
|
<td align="center"><b><font color="Black">Sirenage<br/>Bodacc</font></b></td>
|
|
<td align="center"><b><font color="Black">Sirenage<br/>Associations</font></b></td>
|
|
<td align="center" valign="middle"><b><font color="Black">Collecte</font></b></td>
|
|
<td align="center"><b><font color="Black">Dirigeants<br/>RNCS</font></b></td>
|
|
<td align="center"><b><font color="Black">Avis de marché<br/>du BOAMP</font></b></td>
|
|
<td align="center"><b><font color="Black">Lots attribués<br/>du BOAMP</font></b></td>
|
|
<td align="center" valign="middle"><b><font color="Black">TOTAL</font></b></td>
|
|
</tr>
|
|
<?
|
|
foreach ($tabJours as $jour) {
|
|
|
|
$moisCour=substr($jour,0,7);
|
|
|
|
if ($vue<>'mois') {
|
|
if(WDate::jourFerie($jour,1)) continue;
|
|
|
|
if (isset($moisPre) && $moisPre<>$moisCour) {
|
|
foreach ($tabIdSir as $idSir) {
|
|
if ($vueDetail && !($idSir==127 || $idSir==958 || $idSir==1366)) continue;
|
|
|
|
echo '<tr BgColor="#177AE9"><td><font color="Black">'.$moisPre.'</font></td>';
|
|
if ($vueDetail) echo '<td><font color="Black">'.@$tabLogin[$idSir].' <i>('.$idSir.')</i></font></td>';
|
|
echo '<td align="right"><b><font color="Black">'.@$tot0[$moisPre][$idSir].'</font></b></td>';
|
|
echo '<td align="right"><b><font color="Black">'.@$tot1[$moisPre][$idSir].'</font></b></td>';
|
|
echo '<td align="right"><b><font color="Black">'.@$tot2[$moisPre][$idSir].'</font></b></td>';
|
|
echo '<td align="right"><b><font color="Black">'.@$tot3[$moisPre][$idSir].'</font></b></td>';
|
|
echo '<td align="right"><b><font color="Black">'.@$tot4[$moisPre][$idSir].'</font></b></td>';
|
|
echo '<td align="right"><b><font color="Black">'.@$tot5[$moisPre][$idSir].'</font></b></td>';
|
|
echo '<td align="right"><b><font color="Black">'.@$tabNbSir[$moisPre][$idSir].'</font></b></td>';
|
|
echo "</tr>";
|
|
echo '<tr BgColor="#177AE9"><td><font color="Black"><u>'.$moisPre.'</u></font></td>';
|
|
if ($vueDetail) echo '<td><font color="Black"><u>'.@$tabLogin[$idSir].' <i>('.$idSir.')</i></u></font></td>';
|
|
$nbOp=@round($tabNbSir[$moisPre][$idSir]/$tabJourW[$moisPre][$idSir],1);
|
|
echo '<td colspan=6><font color="Black"><u>'.@$tabNbSir[$moisPre][$idSir].' opérations en '.@$tabJourW[$moisPre][$idSir]." jours ($nbOp op/j)</u></font> <u>";
|
|
if ($nbOp<150) $strPrime='<font color="red"><b>0 €</b></font>';
|
|
elseif ($nbOp<180) $strPrime='<font color="red"><b>80 €</b></font>';
|
|
elseif ($nbOp<200) $strPrime='<font color="red"><b>160 €</b></font>';
|
|
else $strPrime='<font color="red"><b>250 €</b></font>';
|
|
echo " $strPrime</u></td></tr>";
|
|
echo "<tr>";
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($tabIdSir as $idSir) {
|
|
if ($vueDetail && !($idSir==127 || $idSir==958 || $idSir==1366))
|
|
continue;//$idSir=-1;
|
|
/*
|
|
2010-09 mpurcarin (127) 1160 187 123 283 1753
|
|
2010-09 aegasse (282) 38 38
|
|
2010-09 mfuret (873) 22 22
|
|
2010-09 tjactel (958) 743 53 647 1443
|
|
2010-09 lpotiron (1086)
|
|
smestre (1366)
|
|
*/
|
|
echo '<tr BgColor="#E2EEFC"><td>'.$jour.'</td>';
|
|
if ($vueDetail) echo '<td>'.@$tabLogin[$idSir].' <i>('.$idSir.')</i></td>';
|
|
$tot=0;
|
|
|
|
// Nombre d'annonces Bodacc affectées
|
|
echo '<td align="right"> ';
|
|
foreach ($tabBod as $tabJour)
|
|
if ($tabJour['Jour']==$jour && $tabJour['idSirenage']==$idSir) {
|
|
$tot+=$tabJour['Nb'];
|
|
@$tot0[substr($jour,0,7)][$idSir]+=$tabJour['Nb'];
|
|
echo $tabJour['Nb'].' ';
|
|
}
|
|
echo '</td>';
|
|
|
|
// Nombre d'annonces Associations affectées
|
|
echo '<td align="right"> ';
|
|
foreach ($tabAss as $tabJour)
|
|
if ($tabJour['Jour']==$jour && $tabJour['idSirenage']==$idSir) {
|
|
$tot+=$tabJour['Nb'];
|
|
@$tot1[substr($jour,0,7)][$idSir]+=$tabJour['Nb'];
|
|
echo $tabJour['Nb'].' ';
|
|
}
|
|
echo '</td>';
|
|
|
|
// Collecte
|
|
echo '<td align="right"> ';
|
|
$col=0;
|
|
foreach ($tabCol as $tabJour)
|
|
if ($tabJour['Jour']==$jour && $tabJour['idSirenage']==$idSir) {
|
|
$col+=$tabJour['Nb'];
|
|
$tot+=$tabJour['Nb'];
|
|
@$tot2[substr($jour,0,7)][$idSir]+=$tabJour['Nb'];
|
|
}
|
|
echo preg_replace('/^0/','', "$col</td>");
|
|
|
|
// Nombre de dirigeants PM
|
|
echo '<td align="right"> ';
|
|
foreach ($tabDir as $tabJour)
|
|
if ($tabJour['Jour']==$jour && $tabJour['idSirenage']==$idSir) {
|
|
$tot+=$tabJour['Nb'];
|
|
@$tot3[substr($jour,0,7)][$idSir]+=$tabJour['Nb'];
|
|
echo $tabJour['Nb'].' ';
|
|
}
|
|
echo '</td>';
|
|
|
|
// Nombre d'annonces Boamp Avis affectées
|
|
echo '<td align="right"> ';
|
|
foreach ($tabBoa as $tabJour)
|
|
if ($tabJour['Jour']==$jour && $tabJour['idSirenage']==$idSir) {
|
|
$tot+=$tabJour['Nb'];
|
|
@$tot4[substr($jour,0,7)][$idSir]+=$tabJour['Nb'];
|
|
echo $tabJour['Nb'].' ';
|
|
}
|
|
echo '</td>';
|
|
|
|
// Nombre d'annonces Boamp Loys affectées
|
|
echo '<td align="right"> ';
|
|
foreach ($tabBom as $tabJour)
|
|
if ($tabJour['Jour']==$jour && $tabJour['idSirenage']==$idSir) {
|
|
$tot+=$tabJour['Nb'];
|
|
@$tot5[substr($jour,0,7)][$idSir]+=$tabJour['Nb'];
|
|
echo $tabJour['Nb'].' ';
|
|
}
|
|
echo '</td>';
|
|
// TOTAUX de la ligne/période
|
|
if ($tot>=50) {
|
|
echo '<td align="right">'.$tot.'</td>';
|
|
@$tabJourW[substr($jour,0,7)][$idSir]++;
|
|
@$tabNbSir[substr($jour,0,7)][$idSir]+=$tot;//$moisPre=$moisCour;
|
|
}
|
|
elseif ($jour<>date('Y-m-d'))
|
|
echo '<td align="right">Congé</td>';
|
|
else
|
|
echo '<td align="right">-</td>';
|
|
echo '</tr>';
|
|
}
|
|
$moisPre=$moisCour;
|
|
}
|
|
?>
|
|
</table>
|
|
<?php
|
|
|
|
die();
|
|
|
|
?>
|
|
<h3 align="center">Collecte Jugements anté-Bodacc</h3>
|
|
<table BgColor="#177AE9" cellspacing="1" cellpadding="2" border="0" align="center" BorderColor="#000020">
|
|
<tr><td><b><font color="Black">Date</font></b></td><td><b><font color="Black">Source</font></b></td>
|
|
<? if ($_SESSION['userId']<>282 && $_SESSION['userId']<>127 && $_SESSION['userId']<>1 && $_SESSION['userId']<>2) echo '<td><b><font color="Black">Login</font></b></td>'; ?><td><b><font color="Black">Total saisie</font></b></td></tr>
|
|
<?
|
|
foreach ($tabCol as $tabJour) {
|
|
echo '<tr BgColor="#E2EEFC"><td>'.$tabJour['Jour'].'</td><td>'.$tabSource[$tabJour['source']].'</td>';
|
|
if ($vueDetail)
|
|
echo '<td>'.@$tabLogin[$tabJour['idSaisie']].' <i>('.@$tabJour['idSaisie'].')</i></td>';
|
|
echo '<td>'.$tabJour['Nb'].'</td></tr>';
|
|
}
|
|
?>
|
|
</table>
|
|
|
|
|
|
<h3 align="center">Sirenage des annonces JO Associations</h3>
|
|
<table BgColor="#177AE9" cellspacing="1" cellpadding="2" border="0" align="center" BorderColor="#000020">
|
|
<tr><td><b><font color="Black">Date</font></b></td>
|
|
<? if ($_SESSION['userId']<>282 && $_SESSION['userId']<>127 && $_SESSION['userId']<>1 && $_SESSION['userId']<>2) echo '<td><b><font color="Black">Login</font></b></td>'; ?><td><b><font color="Black">Total sirené</font></b></td></tr>
|
|
<?
|
|
// `id` , `Assoc_Nom` , `siren` , `sirenValide` , `nic` , `nicValide` , `idSirenage` , `Waldec` , `Activite` , `codThemes` , `Num_Annonce` , `Date_Parution` , `Num_Parution` , `pageDeb` , `Departement` , `Sous_Prefecture` , `codTribunal` , `Type_Annonce` , `typeAnnonce` , `typeAsso` , `corrNum_Annonce` , `corrDate_Parution` , `corrPage` , `corrNumParution` , `codEven` , `Annonce_Html` , `Assoc_Web` , `Assoc_Mail` , `Assoc_Objet` , `Assoc_Adresse` , `Assoc_AdrNum` , `Assoc_AdrIndRep` , `Assoc_AdrTypVoie` , `Assoc_AdrLibVoie` , `Assoc_AdrCP` , `Assoc_AdrVille` , `Assoc_AdrComp` , `Assoc_NObjet` , `Assoc_AObjet` , `Assoc_NAdresse` , `Assoc_Fusion` , `Assoc_Annulation` , `Assoc_ANom` , `Assoc_NNom` , `Assoc_Commentaire` , `Assoc_Duree` , `Assoc_Dotation` , `Assoc_ProgAction` , `Assoc_Fondateurs` , `Assoc_Date_Declaration` , `Assoc_Date_Declaration2` , `dateInsert`
|
|
|
|
foreach ($tabAss as $tabJour) {
|
|
echo '<tr BgColor="#E2EEFC"><td>'.$tabJour['Jour'].'</td>';
|
|
if ($vueDetail)
|
|
echo '<td>'.@$tabLogin[$tabJour['idSirenage']].' <i>('.@$tabJour['idSirenage'].')</i></td>';
|
|
echo '<td>'.$tabJour['Nb'].'</td></tr>';
|
|
}
|
|
?>
|
|
</table>
|
|
<?
|
|
}
|
|
|
|
?>
|