2009-03-25 09:37:17 +00:00
< ? php
2009-03-25 18:32:45 +00:00
if ( ! $_SESSION [ 'connected' ]) die ();
2009-08-27 07:39:27 +00:00
2009-03-25 18:32:45 +00:00
$siret = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'siret' ]));
2010-02-10 17:27:03 +00:00
if ( strlen ( $siret ) <> 0 && strlen ( $siret ) <> 9 && strlen ( $siret ) <> 14 ) die ( 'Paramètres incorrects !' );
2009-03-25 18:32:45 +00:00
2010-02-10 17:27:03 +00:00
$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 !' );
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 14:39:29 +00:00
isset ( $_REQUEST [ 'type' ]) ? $typeBilan = $_REQUEST [ 'type' ] : $typeBilan = '' ;
2009-06-18 13:22:31 +00:00
2009-10-15 15:09:54 +00:00
require_once 'cache/cache.php' ;
require_once 'ratios/ratios.php' ;
require_once 'scoresws/scoresws.php' ;
2009-10-23 13:34:42 +00:00
$result = scoresws_ratios ( $siret , $siren , $idEntreprise );
2009-10-08 13:20:51 +00:00
$bilansInfos = $result [ 'bilansInfos' ];
$ratiosInfos = $result [ 'ratiosInfos' ];
$ratiosEntrep = $result [ 'ratiosEntrep' ];
$ratiosEntrepEvol = $result [ 'ratiosEntrepEvol' ];
2009-10-23 13:34:42 +00:00
$ratiosSecteur = $result [ 'ratiosSecteur' ];
2009-10-02 09:18:34 +00:00
2009-11-04 09:52:03 +00:00
$firephp -> log ( $bilansInfos , 'bilansInfos' );
2009-10-12 13:31:05 +00:00
list ( $typeBilan , $numBilan ) = countBilans ( $bilansInfos , $typeBilan );
$numBilanN = $numBilan [ 'N' ];
$numBilanC = $numBilan [ 'C' ];
2009-10-13 16:36:27 +00:00
$numBilanB = $numBilan [ 'B' ];
$numBilanA = $numBilan [ 'A' ];
2009-10-23 13:34:42 +00:00
list ( $bilansInfos , $ratiosEntrep , $ratiosEntrepEvol , $ratiosSecteur , $dataActif , $dataPassif , $dataSIG ) = filtreTypeBilans ( $bilansInfos , $ratiosEntrep , $ratiosEntrepEvol , $ratiosSecteur , array (), array (), array (), $typeBilan );
2009-10-02 09:18:34 +00:00
$nbrAnnees = count ( $bilansInfos ) - 1 ;
2009-10-13 16:36:27 +00:00
$data = synthese_datagraph ( $bilansInfos , $ratiosEntrep , $ratio );
2009-08-27 07:39:27 +00:00
$dataGraph = $data [ 'graph' ];
$dataEvol = $data [ 'evol' ];
2009-06-16 14:27:19 +00:00
2009-11-04 09:52:03 +00:00
$firephp -> log ( $bilansInfos , 'bilansInfos' );
2009-08-27 07:39:27 +00:00
?>
< div id = " center " >
< h1 > SYNTH & Egrave ; SE </ h1 >
2009-12-04 17:17:09 +00:00
< table border = " 0 " align = " left " >
2009-08-27 07:39:27 +00:00
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Num & eacute ; ro identifiant Siren </ td >
2009-12-04 17:17:09 +00:00
< td width = " 330 " class = " StyleInfoData " >< ? = substr ( $siren , 0 , 3 ) . ' ' . substr ( $siren , 3 , 3 ) . ' ' . substr ( $siren , 6 , 3 ) ?> </td>
2009-08-27 07:39:27 +00:00
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Raison Sociale </ td >
2009-12-04 17:17:09 +00:00
< td width = " 330 " class = " StyleInfoData " >< ? = $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'raisonSociale' ]; ?> </td>
2009-08-27 07:39:27 +00:00
</ tr >
2009-10-09 14:27:01 +00:00
< ? php
2009-10-13 16:36:27 +00:00
if ( $numBilanN > 0 || $numBilanC > 0 )
{
2009-10-09 14:27:01 +00:00
?>
2009-10-02 14:39:29 +00:00
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Type de bilans </ td >
2009-12-04 17:17:09 +00:00
< td width = " 330 " class = " StyleInfoData " >
2010-02-10 17:27:03 +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>Réel normal ou Simplifié</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é</label><?php }?>
< ? php if ( $numBilanN > 0 && $numBilanC == 0 ){ ?> Réel normal ou Simplifié<?php }?>
< ? php if ( $numBilanN == 0 && $numBilanC > 0 ){ ?> Consolidé<?php }?>
2009-10-02 14:39:29 +00:00
</ td >
</ tr >
2009-10-09 14:27:01 +00:00
< ? php
}
?>
2009-08-27 07:39:27 +00:00
</ table >
< ? php
2009-10-13 16:36:27 +00:00
if ( $numBilanN == 0 && $numBilanC == 0 && $numBilanB == 0 && $numBilanA == 0 )
2009-08-27 07:39:27 +00:00
{
?>
< table >
< tr >< td width = " 30 " >& nbsp ; </ td >< td >< b > Aucun bilan disponible pour cette entreprise !</ b ></ td ></ tr >
</ table >
< ? php
}
2009-10-13 16:36:27 +00:00
elseif ( $numBilanN == 0 && $numBilanC == 0 && ( $numBilanB > 0 || $numBilanA > 0 ) )
{
?>
< table >
2010-02-10 17:27:03 +00:00
< tr >< td width = " 30 " >& nbsp ; </ td >< td >< b > Bilan de banque / assurance non gérés </ b ></ td ></ tr >
2009-10-13 16:36:27 +00:00
</ table >
< ? php
}
2009-08-27 07:39:27 +00:00
else
{
?>
< table id = " synthese " >
< thead >
< tr >
2010-02-10 17:27:03 +00:00
< 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>
2009-08-27 07:39:27 +00:00
< 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:39:29 +00:00
< th class = " date " >< ? php print synthese_formatdateCloture ( $bilansInfos , 0 ); ?> </th>
2009-08-27 07:39:27 +00:00
< th class = " date " > Evolution </ th >
< th >& nbsp ; </ th >
</ tr >
</ thead >
< tbody >
< ? php
2010-02-10 17:27:03 +00:00
//TODO : Afficher ligne par ligne les éléments
2009-10-13 16:36:27 +00:00
print synthese_tablerow ( $ratiosInfos , $dataEvol , $ratio );
2009-08-27 07:39:27 +00:00
?>
</ tbody >
</ table >
< br />
< ? php
2010-02-10 17:27:03 +00:00
//Affichage du graphique associé au ratio sélectionné
2009-12-04 17:17:09 +00:00
if ( ! empty ( $ratio ))
{
?>
2009-08-27 07:39:27 +00:00
< div id = " titreEvol " >< b > Evolution </ b ></ div >
2009-06-17 14:41:41 +00:00
< ? php
2009-10-08 13:20:51 +00:00
if ( ( $siret * 1 ) == 0 || ( $siren * 1 ) < 100 ){ $fileName = 'synthese-' . $idEntreprise ;}
else { $fileName = 'synthese-' . $siret ; }
2009-12-04 17:17:09 +00:00
$fileName .= '-' . $typeBilan . '-' . $ratio ;
if ( count ( $dataEvol [ $ratio ]) <= 1 )
{
2010-02-10 17:27:03 +00:00
print " Les informations sont insuffisantes pour générer la courbe d'évolution " ;
2009-08-27 07:39:27 +00:00
} else { ?>
< img id = " imgEvol " src = " ./imgcache/<?= $fileName .'.png'?> " />
2009-06-18 13:22:31 +00:00
< ? php
}
2010-02-10 17:27:03 +00:00
//Affichage du graphique général
2009-08-27 07:39:27 +00:00
} else {
if ( count ( $dataGraph ) <= 1 ){
2010-02-10 17:27:03 +00:00
print '<div id="graphInfo">Les informations sont insuffisantes pour générer le graphique de synthèse</div>' ;
2009-08-27 07:39:27 +00:00
} else {
2009-10-08 13:20:51 +00:00
print synthese_graph_linecompare ( $dataGraph );
2009-04-01 15:42:12 +00:00
}
2009-08-27 07:39:27 +00:00
}
?>
< br />< br />
2009-06-17 14:41:41 +00:00
< ? php
2009-08-27 07:39:27 +00:00
}
2009-04-01 15:42:12 +00:00
?>
2009-08-27 07:39:27 +00:00
</ div >