2009-03-25 09:37:17 +00:00
< ? php
2010-04-27 08:09:23 +00:00
if ( ! page_checkParams ()) die ( 'Paramètres incorrects !' );
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-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-08-27 07:39:27 +00:00
?>
< div id = " center " >
< h1 > SYNTH & Egrave ; SE </ h1 >
2010-05-25 12:46:19 +00:00
< table border = " 0 " >
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 >
2010-03-18 14:57:23 +00:00
< td width = " 330 " class = " StyleInfoData " >< ? = $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 >
2010-03-18 14:57:23 +00:00
< ? php
2009-10-09 14:27:01 +00:00
}
?>
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 >
2010-05-25 12:46:19 +00:00
< tr >< td width = " 30 " >& nbsp ; </ td >
< td >< b > Aucun bilan disponible pour cette entreprise !</ b ></ td >
</ tr >
2009-08-27 07:39:27 +00:00
</ 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 >
2010-03-18 14:57:23 +00:00
< ? php
2009-10-13 16:36:27 +00:00
}
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
2010-03-18 14:57:23 +00:00
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 ;
2010-03-18 14:57:23 +00:00
2010-03-01 11:47:37 +00:00
$firephp -> log ( count ( $dataEvol ), 'dataEvol' );
2010-03-18 14:57:23 +00:00
2009-12-04 17:17:09 +00:00
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
}
2010-05-24 14:06:04 +00:00
// --------------------------------------------------------------------------- //
// Export
// --------------------------------------------------------------------------- //
require_once 'export.php' ;
if ( isset ( $siret ) == true ) {
$fileName = $page . '-' . $siret ;
} else {
$fileName = $page . '-' . $idEntreprise ;
}
$export = array ( 'siren' => $siren ,
'raisonSociale' => $raisonSociale ,
'type' => $typeBilan );
$tabRatio = syntheseRatio ( $ratio );
foreach ( $tabRatio as $ratio => $info ) {
$titre = str_replace ( ' ' , '_' , $info [ 'titre' ]);
$titre = str_replace ( '\'' , '_' , $titre );
$export [ $titre ] =
array ( array ( 'date' => $bilansInfos [ 2 ][ 'dateCloture' ],
'duree' => $bilansInfos [ 2 ][ 'duree' ],
'valeur' => dRatio ( 2 , $ratio )),
array ( 'date' => $bilansInfos [ 1 ][ 'dateCloture' ],
'duree' => $bilansInfos [ 1 ][ 'duree' ],
'valeur' => dRatio ( 1 , $ratio )),
array ( 'date' => $bilansInfos [ 0 ][ 'dateCloture' ],
'duree' => $bilansInfos [ 0 ][ 'duree' ],
'valeur' => dRatio ( 0 , $ratio )));
}
$parseTab = new tabExport ;
$parseTab -> tab = array ( $export );
$parseTab -> type = array ();
$array2csv = new ExportCSV ;
$array2csv -> records = $parseTab -> convertTable ();
$array2csv -> writeCSV ( $fileName );
$array2xml = new ExportXML ;
$array2xml -> rootName = $page ;
$array2xml -> defaultTagName = 'elem' ;
$array2xml -> records = $export ;
$array2xml -> writeXML ( $fileName );
2010-04-12 14:49:55 +00:00
require_once 'cgu/cgu.php' ;
2010-05-24 14:06:04 +00:00
print '<p class="confidentiel blockh2">' . afficheCgu ();
2010-04-12 14:49:55 +00:00
?>
</ p >
2009-08-27 07:39:27 +00:00
</ div >