212 lines
7.0 KiB
PHP
212 lines
7.0 KiB
PHP
<?php
|
|
if (!$_SESSION['connected']) die();
|
|
|
|
require_once 'cache/cache.php';
|
|
require_once 'ratios/ratios.php';
|
|
|
|
$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);
|
|
|
|
isset($_REQUEST['ratio'])? $ratio=$_REQUEST['ratio'] : $ratio='';
|
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
|
|
}else{ $fileName = $page2.'-'.$siret; }
|
|
if($ratio!=''){$fileName.='-'.$ratio;}
|
|
cache_filename($fileName);
|
|
|
|
$ratiosEntrep = array();
|
|
$ratiosInfos = array();
|
|
$bilansInfos = array();
|
|
$rationsEntrepEvol = array();
|
|
|
|
if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) ){
|
|
$ratiosEntrep = cache_get('ratiosEntrep');
|
|
$ratiosInfos = cache_get('ratiosInfos');
|
|
$bilansInfos = cache_get('bilansInfos');
|
|
$rationsEntrepEvol = cache_get('rationsEntrepEvol');
|
|
$firephp->log($rationsEntrepEvol,'ratiosEntrepEvol');
|
|
}else{
|
|
try {
|
|
$O = $client->getRatios($siren, 'synthese');
|
|
$bilansInfos = $O['result']['BilansInfos'];
|
|
$ratiosInfos = $O['result']['RatiosInfos'];
|
|
$ratiosEntrep = $O['result']['RatiosEntrep'];
|
|
$ratiosEntrepEvol = $O['result']['RatiosEntrepEvol'];
|
|
cache_delete();
|
|
cache_add('ratiosEntrep',$ratiosEntrep);
|
|
cache_add('bilansInfos',$bilansInfos);
|
|
cache_add('ratiosInfos',$ratiosInfos);
|
|
cache_add('ratiosEntrepEvol',$ratiosEntrepEvol);
|
|
}catch (SoapFault $fault) {
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
die();
|
|
}
|
|
}
|
|
|
|
//Liste des ratios pour le graphique général
|
|
$tabRatioGraph = array( 0 => array('ratio'=>'r236', 'op' => 1000),
|
|
1 => array('ratio'=>'r235', 'op' => 1000),
|
|
2 => array('ratio'=>'r6', 'op' => 1000),
|
|
3 => array('ratio'=>'r146', 'op' => 1000));
|
|
|
|
//Liste des ratios à afficher
|
|
$tabRatio = array(
|
|
'r5' => array('evol'=>'r6', 'op' => 1000, 'titre'=>'CHIFFRE D\'AFFAIRES'),
|
|
'r7' => array('evol'=>'r8', 'op' => 1000, 'titre'=>'RESULTAT COURANT AVANT IMPOTS'),
|
|
'r10' => array('evol'=>'r11', 'op' => 1000, 'titre'=>'RESULTAT NET'),
|
|
'r18' => array('evol'=>'r19', 'op' => 1000, 'titre'=>'FONDS PROPRES'),
|
|
'r22' => array('evol'=>'r23', 'op' => 1000, 'titre'=>'TOTAL BILAN'),
|
|
'r231' => array('evol'=>'r235', 'op' => 1000, 'titre'=>'FONDS DE ROULEMENT'),
|
|
'r232' => array('evol'=>'r236', 'op' => 1000, 'titre'=>'BESOIN EN FONDS DE ROULEMENT'),
|
|
'r62' => array('evol'=>'r64', 'op' => 1000, 'titre'=>'TRESORERIE'),
|
|
'r24' => array('evol'=>'r24', 'op' => 1, 'titre'=>'EFFECTIF', 'unite' => 1),
|
|
);
|
|
|
|
//On souhaite n'afficher qu'un seul ratio, on réduit donc le tableau
|
|
if($ratio!=''){
|
|
$tabRatio = array( $ratio => $tabRatio[$ratio]);
|
|
}
|
|
$data = synthese_datagraph($bilansInfos, $ratiosEntrep, $tabRatioGraph, $tabRatio);
|
|
$dataGraph = $data['graph'];
|
|
$dataEvol = $data['evol'];
|
|
|
|
$firephp->log($dataEvol, 'evol');
|
|
|
|
?>
|
|
<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('rel'),
|
|
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>
|
|
<style>
|
|
#synthese { clear:both; font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size: 12px; margin: 10px 0 0 0; width:100%; 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;}
|
|
#titreEvol {margin:0 130px;}
|
|
#imgEvol {margin:0 100px;}
|
|
</style>
|
|
|
|
<div id="center">
|
|
<h1>SYNTHÈSE</h1>
|
|
|
|
<table width="570" border="0" align="left" bgcolor="#FFFFFF">
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Numéro identifiant Siren</td>
|
|
<td width="340" 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="340" class="StyleInfoData"><?=$_SESSION['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 align="center"><?php if($ratio!=''){?><a href="/?page=synthese&siret=<?=$_REQUEST['siret']?>&idEntreprise=<?=$_REQUEST['idEntreprise']?>" title="Retour à la page complète"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a><?php } ?></th>
|
|
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, 2); ?></th>
|
|
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, 1); ?></th>
|
|
<th class="date">Evolution</th>
|
|
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, 0); ?></th>
|
|
<th class="date">Evolution</th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
print synthese_tablerow($ratiosInfos, $dataEvol, $tabRatio)
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<br/>
|
|
<?php
|
|
//Affichage du graphique associé au ratio sélectionné
|
|
if(count($tabRatio)==1){ ?>
|
|
<div id="titreEvol"><b>Evolution</b></div>
|
|
<?php
|
|
if(count($dataEvol[$ratio])<=1){
|
|
print "Les informations sont insuffisantes pour générer la courbe d'évolution";
|
|
}else{?>
|
|
<img id="imgEvol" src="./imgcache/<?=$fileName.'.png'?>" />
|
|
<?php
|
|
}
|
|
//Affichage du graphique général
|
|
}else{
|
|
if(count($dataGraph)<=1){
|
|
print '<div id="graphInfo">Les informations sont insuffisantes pour générer le graphique de synthèse</div>';
|
|
}else{
|
|
print synthese_graph_linecompare($dataGraph, $fileName);
|
|
}
|
|
}
|
|
?>
|
|
<br/><br/>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|