332 lines
14 KiB
PHP
332 lines
14 KiB
PHP
<?php
|
|
if (!$_SESSION['connected']) die();
|
|
$tabInfo = $_SESSION['tabInfo'];
|
|
|
|
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
|
|
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Paramètres incorrects !');
|
|
|
|
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; // Si id=0 alors non communiqué
|
|
if (($siret*1)==0 && $idEntreprise==0) die('Paramètres incorrects !');
|
|
$siren=substr($siret,0,9);
|
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
|
|
}else{ $fileName = $page2.'-'.$siret; }
|
|
|
|
require_once 'cache.php';
|
|
$cache = new Cache();
|
|
//Forcer la création de la page dans le cache lorsque l'utilisateur a le mode saisie
|
|
$firephp->log($_SESSION,'SESSION');
|
|
if( preg_match('/saisie/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ){
|
|
$cache->disable = TRUE;
|
|
}
|
|
if ( $cache->startCapture($fileName.'.html') == FALSE){
|
|
print $cache->displayCache();
|
|
}else{
|
|
|
|
$ratiosEntrep = array();
|
|
$ratiosInfos = array();
|
|
$bilansInfos = array();
|
|
$rationsEntrepEvol = array();
|
|
|
|
try {
|
|
$O = $client->getRatios($siren, 'synthese');
|
|
//$firephp->log((array)$O,'getRatios');
|
|
print '<!--';
|
|
//print_r($O['result']);
|
|
print '-->';
|
|
$bilansInfos = $O['result']['BilansInfos'];
|
|
$ratiosInfos = $O['result']['RatiosInfos'];
|
|
$ratiosEntrep = $O['result']['RatiosEntrep'];
|
|
$ratiosEntrepEvol = $O['result']['RatiosEntrepEvol'];
|
|
|
|
}catch (SoapFault $fault) {
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$tabInfo);
|
|
die();
|
|
}
|
|
|
|
require_once 'ratios/functions.php';
|
|
|
|
$nbrAnnees=count($bilansInfos)-1;
|
|
$i=0;
|
|
foreach($bilansInfos as $dateCloture){
|
|
//Données pour le graphique
|
|
if(isset($dateCloture['dateCloture'])){
|
|
$dataGraph[$i]['date'] = $dateCloture['dateCloture'];
|
|
$dataGraph[$i]['r236'] = $ratiosEntrep[$i]['r236']/1000;
|
|
$dataGraph[$i]['r235'] = $ratiosEntrep[$i]['r235']/1000;
|
|
$dataGraph[$i]['r6'] = $ratiosEntrep[$i]['r6']/1000;
|
|
$dataGraph[$i]['r146'] = $ratiosEntrep[$i]['r146']/1000;
|
|
}
|
|
if(isset($bilansInfos[$nbrAnnees-$i]['dateCloture'])){
|
|
//Données pour les graphiques évolutions
|
|
$evol_r5[] = array( 'date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r6']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r6']/1000 : 0 )
|
|
);
|
|
|
|
$evol_r7[] = array( 'date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r8']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r8']/1000 : 0 )
|
|
);
|
|
|
|
$evol_r10[] = array('date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r11']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r11']/1000 : 0 )
|
|
);
|
|
|
|
$evol_r18[] = array('date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r19']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r19']/1000 : 0 )
|
|
);
|
|
|
|
$evol_r22[] = array('date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r23']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r23']/1000 : 0 )
|
|
);
|
|
|
|
$evol_r231[] = array( 'date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r235']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r235']/1000 : 0 )
|
|
);
|
|
|
|
$evol_r232[] = array( 'date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r236']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r236']/1000 : 0 )
|
|
);
|
|
|
|
$evol_r63[] = array('date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r64']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r64']/1000 : 0 )
|
|
);
|
|
|
|
$evol_r24[] = array('date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i]['r24']!='NS') ? $ratiosEntrep[$nbrAnnees-$i]['r24'] : 0 )
|
|
);
|
|
|
|
}
|
|
|
|
|
|
$i++;
|
|
}
|
|
|
|
//Création du fichier image
|
|
$path = '../cache/';
|
|
file_put_contents($path.$fileName.'-graph-linecompare.tmp', serialize($dataGraph));
|
|
|
|
|
|
?>
|
|
<script type="text/javascript" src="./js/jquery.qtip.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function()
|
|
{
|
|
$('#synthese a[tooltip]').each(function()
|
|
{
|
|
$(this).qtip({
|
|
content: $(this).attr('tooltip'),
|
|
style: { width: 500, name: 'dark' },
|
|
position: { corner: { target: 'bottomMiddle', tooltip: 'topMiddle' } }
|
|
});
|
|
});
|
|
|
|
$('.jTip').each(function()
|
|
{
|
|
$(this).qtip(
|
|
{
|
|
content: {
|
|
text: 'Chargement...',
|
|
url: $(this).attr('href'),
|
|
title: {
|
|
text: 'Evolution - ' + $(this).attr('name'),
|
|
}
|
|
},
|
|
position: {
|
|
corner: {
|
|
target: 'leftMiddle',
|
|
tooltip: 'rightMiddle'
|
|
},
|
|
},
|
|
show: { solo: true},
|
|
style: {
|
|
tip: true,
|
|
border: {
|
|
width: 1,
|
|
radius: 0
|
|
},
|
|
name: 'light',
|
|
width: 400
|
|
}
|
|
})
|
|
});
|
|
});
|
|
</script>
|
|
<link rel="stylesheet" type="text/css" href="./css/jtip.css" />
|
|
<style>
|
|
#container { width: 580px; background-color: #FFFFFF; }
|
|
#synthese { clear:both; font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size: 12px; margin: 10px 0 0 0; width: 580px; text-align: left; border-collapse: collapse; }
|
|
#synthese th { padding: 4px; font-weight: normal; font-size: 13px; color: #039; background: #b9c9fe; border: 1px solid #fff; }
|
|
#synthese th.date { font-size: 11px; }
|
|
#synthese td { padding: 4px; background: #e8edff; border: 1px solid #fff; color: #669; }
|
|
#synthese td.right { text-align: right; }
|
|
#synthese tbody tr:hover td { background: #d0dafd; }
|
|
#entete { margin:1px; }
|
|
#synthese .head { font-weight:bold; }
|
|
#graphInfo { font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; margin-left:10px; }
|
|
|
|
p, label{font-size: 12px;}
|
|
|
|
ul{list-style: none;}
|
|
ul li{padding-top:3px;}
|
|
.qtip-title {font-size:11px;}
|
|
.qtip-content {font-size:12px;}
|
|
</style>
|
|
|
|
<div id="container">
|
|
<div><img id="entete" src="./img/rub_synthese.png" width="577" height="36"></div>
|
|
|
|
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
|
|
<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"><?=$tabInfo['entrep']['raisonSociale'];?></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<?php
|
|
if (count($ratiosEntrep)==0 || !isset($ratiosEntrep)){
|
|
?>
|
|
<table>
|
|
<tr><td width="30"> </td><td><b>Aucun bilan disponible pour cette entreprise !</b></td></tr>
|
|
</table>
|
|
<?php
|
|
}else{
|
|
?>
|
|
|
|
<table id="synthese">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th class="date">
|
|
<?php
|
|
if(isset($bilansInfos[2]['dateCloture'])) {
|
|
print substr($bilansInfos[2]['dateCloture'],6,2).'/'.substr($bilansInfos[2]['dateCloture'],4,2).'/'.substr($bilansInfos[2]['dateCloture'],0,4);?><br/><?php print $bilansInfos[2]['duree']; ?> mois
|
|
<?php }else{ print '-'; } ?>
|
|
</th>
|
|
<th class="date">
|
|
<?php
|
|
if(isset($bilansInfos[1]['dateCloture'])) {
|
|
print substr($bilansInfos[1]['dateCloture'],6,2).'/'.substr($bilansInfos[1]['dateCloture'],4,2).'/'.substr($bilansInfos[1]['dateCloture'],0,4);?><br/><?php print $bilansInfos[1]['duree']; ?> mois
|
|
<?php }else{ print '-'; } ?>
|
|
</th>
|
|
<th class="date">Evolution</th>
|
|
<th class="date">
|
|
<?php
|
|
if(isset($bilansInfos[0]['dateCloture'])) {
|
|
print substr($bilansInfos[0]['dateCloture'],6,2).'/'.substr($bilansInfos[0]['dateCloture'],4,2).'/'.substr($bilansInfos[0]['dateCloture'],0,4);?><br/><?php print $bilansInfos[0]['duree']; ?> mois
|
|
<?php }else{ print '-'; } ?>
|
|
</th>
|
|
<th class="date">Evolution</th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r5']['commentaires'])?>">CHIFFRE D'AFFAIRES</a></td>
|
|
<td class="right"><?php dRatio(2,'r5'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r5'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r6'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r5'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r6'); ?></td>
|
|
<td><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r5))?>" name="CHIFFRE D'AFFAIRES"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r7']['commentaires'])?>">RESULTAT COURANT AVANT IMPOTS</a></td>
|
|
<td class="right"><?php dRatio(2,'r7'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r7'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r8'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r7'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r8'); ?></td>
|
|
<td><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r7))?>" name="RESULTAT COURANT AVANT IMPOTS"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r10']['commentaires'])?>">RESULTAT NET</a></td>
|
|
<td class="right"><?php dRatio(2,'r10'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r10'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r11'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r10'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r11'); ?></td>
|
|
<td><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r10))?>" name="RESULTAT NET"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r18']['commentaires'])?>">FONDS PROPRES</a></td>
|
|
<td class="right"><?php dRatio(2,'r18'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r18'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r19'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r18'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r19'); ?></td>
|
|
<td class="right"><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r18))?>" name="FONDS PROPRES"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r22']['commentaires'])?>">TOTAL BILAN</a></td>
|
|
<td class="right"><?php dRatio(2,'r22'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r22'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r23'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r22'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r23'); ?></td>
|
|
<td><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r22))?>" name="TOTAL BILAN"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r231']['commentaires'])?>">FONDS DE ROULEMENT</a></td>
|
|
<td class="right"><?php dRatio(2,'r231'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r231'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r235'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r231'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r235'); ?></td>
|
|
<td><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r231))?>" name="FONDS DE ROULEMENT"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r232']['commentaires'])?>">BESOIN EN FONDS DE ROULEMENT</a></td>
|
|
<td class="right"><?php dRatio(2,'r232'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r232'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r236'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r232'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r236'); ?></td>
|
|
<td><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r232))?>" name="BESOIN EN FONDS DE ROULEMENT"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r63']['commentaires'])?>">TRESORERIE</a></td>
|
|
<td class="right"><?php dRatio(2,'r63'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r63'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r64'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r63'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r64'); ?></td>
|
|
<td><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r63))?>" name="TRESORERIE"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="head"><a tooltip="<?=wrapComment($ratiosInfos['r24']['commentaires'])?>">EFFECTIF</a></td>
|
|
<td class="right"><?php dRatio(2,'r24'); ?></td>
|
|
<td class="right"><?php dRatio(1,'r24'); ?></td>
|
|
<td class="right"><?php dEvol(1,'r24'); ?></td>
|
|
<td class="right"><?php dRatio(0,'r24'); ?></td>
|
|
<td class="right"><?php dEvol(0,'r24'); ?></td>
|
|
<td><a class="jTip" href="./pages/synthese_dgraph.php?width=375&data=<?=urlencode(serialize($evol_r24))?>&unite=<?=$ratiosInfos['r24']['unite']?>" name="EFFECTIF"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<br/><br/>
|
|
<?php
|
|
if(count($dataGraph)<=1){
|
|
print "<div id=\"graphInfo\">Les informations sont insuffisantes pour générer le graphique de synthèse</div>";
|
|
}else{
|
|
?>
|
|
<img src="./graphs/synthese_graph_linecompare.php?d=<?=$fileName.'-graph-linecompare.tmp'?>" />
|
|
<?php
|
|
}
|
|
?>
|
|
<br/><br/>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
<?php
|
|
}//Fin du cache
|
|
$cache->stopCapture();
|
|
?>
|