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-10-07 07:46:28 +00:00
|
|
|
|
require_once 'scoresws/scoresws.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-10-02 13:05:32 +00:00
|
|
|
|
isset($_REQUEST['type']) ? $typeBilan=$_REQUEST['type'] : $typeBilan='' ;
|
2009-06-18 13:22:31 +00:00
|
|
|
|
|
2009-10-07 07:46:28 +00:00
|
|
|
|
$result = scoresws_synthese($siret, $siren, $idEntreprise);
|
|
|
|
|
$bilansInfos = $result['bilansInfos'];
|
|
|
|
|
$ratiosInfos = $result['ratiosInfos'];
|
|
|
|
|
$ratiosEntrep = $result['ratiosEntrep'];
|
|
|
|
|
$ratiosEntrepEvol = $result['ratiosEntrepEvol'];
|
2009-09-30 16:36:02 +00:00
|
|
|
|
|
2009-10-02 13:05:32 +00:00
|
|
|
|
$numBilanC = 0;
|
|
|
|
|
$numBilanN = 0;
|
|
|
|
|
if(count($bilansInfos)>0)
|
|
|
|
|
{
|
|
|
|
|
foreach($bilansInfos as $key => $item)
|
|
|
|
|
{
|
2009-10-09 14:04:55 +00:00
|
|
|
|
if($item['typeBilan']=='C') { $numBilanC++; }
|
|
|
|
|
if($item['typeBilan']=='N') { $numBilanN++; }
|
2009-10-02 13:05:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($typeBilan=='')
|
|
|
|
|
{
|
2009-10-09 14:04:55 +00:00
|
|
|
|
if($numBilanN>0){ $typeBilan='N'; }
|
|
|
|
|
if($numBilanN==0 && $numBilanC>0){ $typeBilan='C'; }
|
2009-10-02 13:05:32 +00:00
|
|
|
|
}
|
2009-10-09 14:04:55 +00:00
|
|
|
|
$firephp->log($typeBilan, 'typeBilan');
|
|
|
|
|
$firephp->log(count($bilansInfos),'nombre');
|
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)
|
|
|
|
|
{
|
2009-10-02 13:05:32 +00:00
|
|
|
|
array_splice($bilansInfos, $index, 1);
|
|
|
|
|
array_splice($ratiosEntrep, $index, 1);
|
|
|
|
|
array_splice($ratiosEntrepEvol, $index, 1);
|
|
|
|
|
$index--;
|
2009-09-30 16:36:02 +00:00
|
|
|
|
}
|
|
|
|
|
$index++;
|
2009-09-30 14:11:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$nbrAnnees = count($bilansInfos)-1;
|
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>
|
2009-10-09 14:04:55 +00:00
|
|
|
|
<?php
|
|
|
|
|
if (count($bilansInfos)>0){
|
|
|
|
|
?>
|
2009-10-02 13:05:32 +00:00
|
|
|
|
<tr>
|
|
|
|
|
<td width="30"> </td>
|
|
|
|
|
<td width="200" class="StyleInfoLib">Type de bilans</td>
|
|
|
|
|
<td width="340" class="StyleInfoData">
|
|
|
|
|
<?php
|
|
|
|
|
if( $numBilanN>0 || $numBilanC>0 )
|
|
|
|
|
{
|
|
|
|
|
?>
|
2009-10-07 07:46:28 +00:00
|
|
|
|
<?php if($numBilanN>0 && $numBilanC>0){ ?><input type="radio" name="typeBilan" value="index.php?page=<?=$page?>&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&type=N" <?=($typeBilan=='N')? 'checked' : '';?>/><label>Normaux</label><?php }?>
|
|
|
|
|
<?php if($numBilanN>0 && $numBilanC>0){ ?><input type="radio" name="typeBilan" value="index.php?page=<?=$page?>&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&type=C" <?=($typeBilan=='C')? 'checked' : '';?>/><label>Consolid<69>s</label><?php }?>
|
2009-10-02 13:05:32 +00:00
|
|
|
|
<?php if($numBilanN>0 && $numBilanC==0){ ?>Normaux<?php }?>
|
|
|
|
|
<?php if($numBilanN==0 && $numBilanC>0){ ?>Consolid<EFBFBD>s<?php }?>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2009-10-09 14:04:55 +00:00
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
2009-08-17 14:38:44 +00:00
|
|
|
|
</table>
|
2009-06-17 14:41:41 +00:00
|
|
|
|
|
2009-08-17 14:38:44 +00:00
|
|
|
|
<?php
|
2009-10-09 14:04:55 +00:00
|
|
|
|
if (count($bilansInfos)==0)
|
2009-08-17 14:38:44 +00:00
|
|
|
|
{
|
|
|
|
|
?>
|
|
|
|
|
<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-10-02 14:32:15 +00:00
|
|
|
|
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, 0); ?></th>
|
2009-08-17 14:38:44 +00:00
|
|
|
|
<th class="date">Evolution</th>
|
|
|
|
|
<th> </th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<?php
|
2009-10-02 13:05:32 +00:00
|
|
|
|
//TODO : Afficher ligne par ligne les <20>l<EFBFBD>ments
|
2009-08-17 14:38:44 +00:00
|
|
|
|
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-10-07 07:46:28 +00:00
|
|
|
|
|
|
|
|
|
if( ($siret*1)==0 || ($siren*1)<100 ){ $fileName = 'synthese-'.$idEntreprise;}
|
|
|
|
|
else{ $fileName = 'synthese-'.$siret; }
|
|
|
|
|
if($ratio!=''){ $fileName.='-'.$ratio; }
|
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{
|
2009-10-07 07:46:28 +00:00
|
|
|
|
print synthese_graph_linecompare($dataGraph);
|
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>
|