191 lines
8.0 KiB
PHP
191 lines
8.0 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();
|
|
|
|
$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, 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 {
|
|
?>
|
|
|
|
|
|
<h3 align="center">Consommations Mensuelles AMABIS</h3>
|
|
<table BgColor="#177AE9" cellspacing="1" cellpadding="2" border="0" align="center" BorderColor="#000020">
|
|
<tr>
|
|
<td align="center"><b><font color="Black">Mois/Année</font></b></td>
|
|
<td align="center"><b><font color="Black">Requêtes</font></b></td>
|
|
<td align="center"><b><font color="Black">Total HT</font></b></td>
|
|
</tr>
|
|
<?
|
|
$Y=date('Y')-1;
|
|
$m=date('m');
|
|
$tabConsos=$iDb->select( 'zonage',
|
|
"COUNT(*) AS nb, YEAR(dateInsert) AS annee, MONTH(dateInsert) AS mois",
|
|
"dateInsert>='$Y-$m-01' GROUP BY annee, mois", false, MYSQL_ASSOC);
|
|
foreach ($tabConsos as $tabConso) {
|
|
?><tr BgColor="#E2EEFC">
|
|
<td align="center"><?=sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']?></td>
|
|
<td align="right"><?=number_format($tabConso['nb'],0,'.',' ')?></td>
|
|
<td align="right"><?=number_format(150+($tabConso['nb']*0.028),2,'.',' ')?> €</td>
|
|
</tr><?
|
|
}
|
|
?>
|
|
</table><br/>
|
|
<h3 align="center">Consommations Mensuelles Suivi Privilèges (Abonné 00710-00001)</h3>
|
|
<table BgColor="#177AE9" cellspacing="1" cellpadding="2" border="0" align="center" BorderColor="#000020">
|
|
<tr>
|
|
<td align="center"><b><font color="Black">Mois/Année</font></b></td>
|
|
<td align="center"><b><font color="Black">Nb Suivis</font></b></td>
|
|
<td align="center"><b><font color="Black">Total Suivis HT</font></b></td>
|
|
</tr>
|
|
<?
|
|
$tabConsos=$iDb->select('greffes_priv_stock',
|
|
"COUNT(*) AS nb, YEAR(greDateSurvDeb) AS annee, MONTH(greDateSurvDeb) AS mois",
|
|
"greDateSurvDeb>='$Y-$m-01' GROUP BY annee, mois", false, MYSQL_ASSOC);
|
|
foreach ($tabConsos as $tabConso) {
|
|
?><tr BgColor="#E2EEFC">
|
|
<td align="center"><?=sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']?></td>
|
|
<td align="right"><?=number_format($tabConso['nb'],0,'.',' ')?></td>
|
|
<td align="right"><?=number_format($tabConso['nb']*5.2,2,'.',' ')//4.5?> €</td>
|
|
</tr><?
|
|
}
|
|
?>
|
|
</table><br/>
|
|
<h3 align="center">Consommations Mensuelles Kbis/Privilèges (Abonné 00041-02559)</h3>
|
|
<table BgColor="#177AE9" cellspacing="1" cellpadding="2" border="0" align="center" BorderColor="#000020">
|
|
<tr>
|
|
<td align="center"><b><font color="Black">Mois/Année</font></b></td>
|
|
<td align="center"><b><font color="Black">Nb Kbis</font></b></td>
|
|
<td align="center"><b><font color="Black">Nb Priv.</font></b></td>
|
|
<td align="center"><b><font color="Black">Total HT</font></b></td>
|
|
</tr>
|
|
<?
|
|
// KBIS
|
|
$tabConsos=$iDb->select('sdv1.`logs`',
|
|
"date(dateHeure) AS jour, siren, COUNT(*) AS nb, YEAR(dateHeure) AS annee, MONTH(dateHeure) AS mois",
|
|
"dateHeure>='$Y-$m-01' AND page='kbis' GROUP BY jour, siren ORDER BY annee, mois", false, MYSQL_ASSOC);
|
|
foreach ($tabConsos as $tabConso)
|
|
@$tabKbis[''.sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']]++;
|
|
|
|
// Privilèges
|
|
$tabConsos=$iDb->select('sdv1.`logs`',
|
|
"date(dateHeure) AS jour, siren, params, COUNT(*) AS nb, YEAR(dateHeure) AS annee, MONTH(dateHeure) AS mois",
|
|
"dateHeure>='$Y-$m-01' AND page='privileges' AND params<>'' GROUP BY jour, siren, params ORDER BY annee, mois", false, MYSQL_ASSOC);
|
|
foreach ($tabConsos as $tabConso) {
|
|
if (strpos($tabConso['params'], 'declCrea'))
|
|
@$tabPriv[''.sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']]++;
|
|
if (strpos($tabConso['params'], 'nantFond'))
|
|
@$tabPriv[''.sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']]++;
|
|
if (strpos($tabConso['params'], 'nantVend'))
|
|
@$tabPriv[''.sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']]++;
|
|
if (strpos($tabConso['params'], 'privTres'))
|
|
@$tabPriv[''.sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']]++;
|
|
if (strpos($tabConso['params'], 'privSecu'))
|
|
@$tabPriv[''.sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']]++;
|
|
}
|
|
foreach (@$tabKbis as $moisAnnee=>$nb) {
|
|
?><tr BgColor="#E2EEFC">
|
|
<td align="center"><?=$moisAnnee?></td>
|
|
<td align="right"><?=number_format($nb,0,'.',' ')?></td>
|
|
<td align="right"><?=number_format(@$tabPriv[$moisAnnee]*1,0,'.',' ')?></td>
|
|
<td align="right"><?=number_format($nb*4.55+@$tabPriv[$moisAnnee]*4.55,2,'.',' ')//4.5?> €</td>
|
|
</tr><?
|
|
}
|
|
?>
|
|
</table><br/>
|
|
<h3 align="center">Consommations Mensuelles WS Infogreffe (Abonné 08500-00109)</h3>
|
|
<table BgColor="#177AE9" cellspacing="1" cellpadding="2" border="0" align="center" BorderColor="#000020">
|
|
<tr>
|
|
<td align="center"><b><font color="Black">Mois/Année</font></b></td>
|
|
<td align="center"><b><font color="Black">Nb Actes Pdf</font></b></td>
|
|
<td align="center"><b><font color="Black">Nb Bilans Pdf</font></b></td>
|
|
<td align="center"><b><font color="Black">Nb Commandes</font></b></td>
|
|
<td align="center"><b><font color="Black">Nb Bilans Txt</font></b></td>
|
|
<td align="center"><b><font color="Black">Total HT</font></b></td>
|
|
</tr>
|
|
<?
|
|
// WS Infogreffe
|
|
$tabConsos=$iDb->select('sdv1.`logs`',
|
|
"date(dateHeure) AS jour, page, siren, params, COUNT(*) AS nb, YEAR(dateHeure) AS annee, MONTH(dateHeure) AS mois",
|
|
"dateHeure>='$Y-$m-01' AND page IN ('greffe_actes','greffe_bilans','greffe_statuts') AND params<>''
|
|
GROUP BY siren, page, params
|
|
ORDER BY annee, mois", false, MYSQL_ASSOC);
|
|
foreach ($tabConsos as $tabConso) {
|
|
$mois=''.sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee'];
|
|
if (strpos($tabConso['params'], '/G')) @$tabCmd[$mois]++;
|
|
elseif ($tabConso['page']=='greffe_statuts' ||
|
|
$tabConso['page']=='greffe_actes') @$tabAct[$mois]++;
|
|
elseif ($tabConso['page']=='greffe_bilans') @$tabBil[$mois]++;
|
|
}
|
|
$tabConsos=$iDb->select('greffes_requetes',
|
|
"COUNT(*) AS nb, YEAR(dateRequete) AS annee, MONTH(dateRequete) AS mois",
|
|
"dateRequete>='$Y-$m-01' AND `type`='BS' AND `option`<>''
|
|
GROUP BY annee, mois", false, MYSQL_ASSOC);
|
|
foreach ($tabConsos as $tabConso)
|
|
@$tabBiS[''.sprintf('%02s',$tabConso['mois']).'/'.$tabConso['annee']]=$tabConso['nb'];
|
|
|
|
foreach (@$tabAct as $moisAnnee=>$nb) {
|
|
?><tr BgColor="#E2EEFC">
|
|
<td align="center"><?=$moisAnnee?></td>
|
|
<td align="right"><?=number_format($nb,0,'.',' ')?></td>
|
|
<td align="right"><?=number_format(@$tabBil[$moisAnnee]*1,0,'.',' ')?></td>
|
|
<td align="right"><?=number_format(@$tabCmd[$moisAnnee]*1,0,'.',' ')?></td>
|
|
<td align="right"><?=number_format(@$tabBiS[$moisAnnee]*1,0,'.',' ')?></td>
|
|
<td align="right"><?=number_format($nb*3.5+@$tabBil[$moisAnnee]*3.5+@$tabBiS[$moisAnnee]*1.5+@$tabCmd[$moisAnnee]*4.88,2,'.',' ')//4.5?> €</td>
|
|
</tr><?
|
|
}
|
|
/*mail:privSecu-privTres-nantFond-nantVend-declCrea 2010-10-21 10:28:36
|
|
Modifier testPROBTP privileges 478443377 00021 mail:privSecu 2010-10-21 14:38:35
|
|
Modifier ppboch1 privileges 332750017 00029 mail:privSecu-privTres*/
|
|
?>
|
|
</table><br/>
|
|
<?
|
|
}
|
|
?>
|