2009-03-25 09:37:17 +00:00
|
|
|
|
<?php
|
2009-03-25 18:32:45 +00:00
|
|
|
|
if (!$_SESSION['connected']) die();
|
2009-08-17 14:38:44 +00:00
|
|
|
|
|
|
|
|
|
require_once 'cache/cache.php';
|
|
|
|
|
require_once 'ratios/ratios.php';
|
2009-04-01 12:45:45 +00:00
|
|
|
|
|
2009-03-25 18:32:45 +00:00
|
|
|
|
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
|
2009-03-30 16:27:40 +00:00
|
|
|
|
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Param<61>tres incorrects !');
|
2009-03-25 18:32:45 +00:00
|
|
|
|
|
|
|
|
|
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; // Si id=0 alors non communiqu<71>
|
2009-03-30 16:27:40 +00:00
|
|
|
|
if (($siret*1)==0 && $idEntreprise==0) die('Param<61>tres incorrects !');
|
2009-03-25 18:32:45 +00:00
|
|
|
|
$siren=substr($siret,0,9);
|
|
|
|
|
|
2009-06-18 13:22:31 +00:00
|
|
|
|
isset($_REQUEST['ratio'])? $ratio=$_REQUEST['ratio'] : $ratio='';
|
|
|
|
|
|
2009-05-28 14:40:58 +00:00
|
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
|
2009-06-17 14:41:41 +00:00
|
|
|
|
}else{ $fileName = $page2.'-'.$siret; }
|
2009-06-18 13:22:31 +00:00
|
|
|
|
if($ratio!=''){$fileName.='-'.$ratio;}
|
2009-08-17 14:38:44 +00:00
|
|
|
|
cache_filename($fileName);
|
|
|
|
|
|
|
|
|
|
$ratiosEntrep = array();
|
|
|
|
|
$ratiosInfos = array();
|
|
|
|
|
$bilansInfos = array();
|
2009-09-08 14:21:15 +00:00
|
|
|
|
$ratiosEntrepEvol = array();
|
2009-08-17 14:38:44 +00:00
|
|
|
|
|
|
|
|
|
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');
|
2009-09-08 14:16:18 +00:00
|
|
|
|
$ratiosEntrepEvol = cache_get('ratiosEntrepEvol');
|
2009-05-28 14:40:58 +00:00
|
|
|
|
}else{
|
|
|
|
|
try {
|
|
|
|
|
$O = $client->getRatios($siren, 'synthese');
|
|
|
|
|
$bilansInfos = $O['result']['BilansInfos'];
|
|
|
|
|
$ratiosInfos = $O['result']['RatiosInfos'];
|
|
|
|
|
$ratiosEntrep = $O['result']['RatiosEntrep'];
|
|
|
|
|
$ratiosEntrepEvol = $O['result']['RatiosEntrepEvol'];
|
2009-09-30 16:36:02 +00:00
|
|
|
|
$format = ratiosRatios($bilansInfos, $ratiosEntrep, $ratiosEntrepEvol, $ratiosInfos, $ratiosSecteur);
|
|
|
|
|
while ( list($key, $val) = each( $format ) )
|
|
|
|
|
{
|
|
|
|
|
${$key} = $val;
|
|
|
|
|
}
|
2009-08-17 14:38:44 +00:00
|
|
|
|
cache_delete();
|
|
|
|
|
cache_add('ratiosEntrep',$ratiosEntrep);
|
|
|
|
|
cache_add('bilansInfos',$bilansInfos);
|
|
|
|
|
cache_add('ratiosInfos',$ratiosInfos);
|
|
|
|
|
cache_add('ratiosEntrepEvol',$ratiosEntrepEvol);
|
2009-05-28 14:40:58 +00:00
|
|
|
|
}catch (SoapFault $fault) {
|
|
|
|
|
require_once 'soaperror.php';
|
2009-08-17 14:38:44 +00:00
|
|
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
2009-05-28 14:40:58 +00:00
|
|
|
|
die();
|
2009-03-31 14:16:03 +00:00
|
|
|
|
}
|
2009-08-17 14:38:44 +00:00
|
|
|
|
}
|
2009-09-30 14:11:57 +00:00
|
|
|
|
$firephp->log($bilansInfos, 'bilansInfos');
|
2009-09-30 16:36:02 +00:00
|
|
|
|
|
|
|
|
|
if(count($bilansInfos)>0)
|
2009-09-30 14:11:57 +00:00
|
|
|
|
{
|
2009-09-30 16:36:02 +00:00
|
|
|
|
//En fonction du type de bilan s<>lectionn<6E>
|
|
|
|
|
//on filtre les bilans avant de les envoyer sur l'affichage
|
|
|
|
|
$index = 0;
|
|
|
|
|
foreach($bilansInfos as $key => $item)
|
2009-09-30 14:11:57 +00:00
|
|
|
|
{
|
2009-09-30 16:36:02 +00:00
|
|
|
|
if($item['typeBilan']!=$typeBilan)
|
|
|
|
|
{
|
|
|
|
|
array_slice($bilansInfos, $index, 1);
|
|
|
|
|
array_slice($ratiosInfos, $index, 1);
|
|
|
|
|
array_slice($ratiosEntrep, $index, 1);
|
|
|
|
|
array_slice($ratiosEntrepEvol, $index, 1);
|
|
|
|
|
}
|
|
|
|
|
$index++;
|
2009-09-30 14:11:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$nbrAnnees = count($bilansInfos)-1;
|
|
|
|
|
$firephp->log($bilansInfos);
|
2009-06-17 14:41:41 +00:00
|
|
|
|
|
2009-08-17 14:38:44 +00:00
|
|
|
|
//Liste des ratios pour le graphique g<>n<EFBFBD>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 <20> 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'),
|
2009-09-29 12:54:46 +00:00
|
|
|
|
'r63' => array('evol'=>'r64', 'op' => 1000, 'titre'=>'TRESORERIE'),
|
2009-08-17 14:38:44 +00:00
|
|
|
|
'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'];
|
2009-06-16 14:27:19 +00:00
|
|
|
|
|
2009-08-17 14:38:44 +00:00
|
|
|
|
?>
|
|
|
|
|
<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>
|
2009-06-17 14:41:41 +00:00
|
|
|
|
|
2009-08-17 14:38:44 +00:00
|
|
|
|
<?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 <20> la page compl<70>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>
|
2009-09-30 14:11:57 +00:00
|
|
|
|
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, $nbrAnnees-$nbrAnnees); ?></th>
|
2009-08-17 14:38:44 +00:00
|
|
|
|
<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<63> au ratio s<>lectionn<6E>
|
|
|
|
|
if(count($tabRatio)==1){ ?>
|
|
|
|
|
<div id="titreEvol"><b>Evolution</b></div>
|
2009-06-17 14:41:41 +00:00
|
|
|
|
<?php
|
2009-08-17 14:38:44 +00:00
|
|
|
|
if(count($dataEvol[$ratio])<=1){
|
|
|
|
|
print "Les informations sont insuffisantes pour g<>n<EFBFBD>rer la courbe d'<27>volution";
|
|
|
|
|
}else{?>
|
|
|
|
|
<img id="imgEvol" src="./imgcache/<?=$fileName.'.png'?>" />
|
2009-06-18 13:22:31 +00:00
|
|
|
|
<?php
|
|
|
|
|
}
|
2009-08-17 14:38:44 +00:00
|
|
|
|
//Affichage du graphique g<>n<EFBFBD>ral
|
|
|
|
|
}else{
|
|
|
|
|
if(count($dataGraph)<=1){
|
|
|
|
|
print '<div id="graphInfo">Les informations sont insuffisantes pour g<>n<EFBFBD>rer le graphique de synth<74>se</div>';
|
|
|
|
|
}else{
|
|
|
|
|
print synthese_graph_linecompare($dataGraph, $fileName);
|
2009-04-01 15:42:12 +00:00
|
|
|
|
}
|
2009-08-17 14:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<br/><br/>
|
2009-06-17 14:41:41 +00:00
|
|
|
|
<?php
|
2009-08-17 14:38:44 +00:00
|
|
|
|
}
|
2009-04-01 15:42:12 +00:00
|
|
|
|
?>
|
2009-08-17 14:38:44 +00:00
|
|
|
|
</div>
|