2009-03-25 09:37:17 +00:00
< ? php
2009-03-25 18:32:45 +00:00
if ( ! $_SESSION [ 'connected' ]) die ();
2009-04-02 09:54:01 +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 );
2010-03-18 15:35:57 +00:00
$raisonSociale = etabSession ( $siren , $idEntreprise );
2009-03-25 18:32:45 +00:00
2009-10-02 17:26:29 +00:00
isset ( $_REQUEST [ 'type' ]) ? $typeBilan = $_REQUEST [ 'type' ] : $typeBilan = '' ;
isset ( $_REQUEST [ 'mil' ]) ? $mil = $_REQUEST [ 'mil' ] : $mil = '' ;
2009-06-18 13:22:31 +00:00
isset ( $_REQUEST [ 'ratio' ]) ? $ratio = $_REQUEST [ 'ratio' ] : $ratio = '' ;
2009-04-09 16:48:56 +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-02 17:26:29 +00:00
if (( $siret * 1 ) == 0 || ( $siren * 1 ) < 100 ){ $fileName = $page . '-' . $idEntreprise ;
2009-10-08 13:20:51 +00:00
} else { $fileName = $page . '-' . $siren ; }
$result = scoresws_ratios ( $siret , $siren , $idEntreprise );
$bilansInfos = $result [ 'bilansInfos' ];
$ratiosInfos = $result [ 'ratiosInfos' ];
$ratiosEntrep = $result [ 'ratiosEntrep' ];
$ratiosEntrepEvol = $result [ 'ratiosEntrepEvol' ];
$ratiosSecteur = $result [ 'ratiosSecteur' ];
2009-10-23 13:34:42 +00:00
$firephp -> log ( $bilansInfos , 'bilansInfos' );
$firephp -> log ( $ratiosSecteur , 'ratiosSecteur' );
2009-06-18 13:22:31 +00:00
2010-02-10 17:27:03 +00:00
//Tableau des différents type de bilans
$typBil = array ( 'C' => 'Consolidé' , 'N' => '' , 'S' => 'Réel Simplifié' , 'B' => 'Banque' , 'A' => 'Assurance' );
2009-10-02 14:39:29 +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 );
$firephp -> log ( $bilansInfos , 'bilansInfos' );
$firephp -> log ( $ratiosSecteur , 'ratiosSecteur' );
2010-02-10 17:27:03 +00:00
//On détermine le bilan sélectionné
2009-10-02 17:26:29 +00:00
if ( $mil == '' )
2010-03-18 14:57:23 +00:00
{
2009-10-02 17:26:29 +00:00
$bilan = 0 ;
2010-03-18 14:57:23 +00:00
$mil = $bilansInfos [ $bilan ][ 'typeBilan' ] . substr ( $bilansInfos [ $bilan ][ 'dateCloture' ], 6 , 2 ) . substr ( $bilansInfos [ $bilan ][ 'dateCloture' ], 4 , 2 ) . substr ( $bilansInfos [ $bilan ][ 'dateCloture' ], 0 , 4 );
2009-10-02 17:26:29 +00:00
}
else
{
if ( count ( $bilansInfos ) > 0 )
{
$countBilans = 0 ;
foreach ( $bilansInfos as $bilanItem )
{
2010-03-18 14:57:23 +00:00
$millesime = $bilanItem [ 'typeBilan' ] . substr ( $bilanItem [ 'dateCloture' ], 6 , 2 ) . substr ( $bilanItem [ 'dateCloture' ], 4 , 2 ) . substr ( $bilanItem [ 'dateCloture' ], 0 , 4 );
2009-10-02 17:26:29 +00:00
if ( $mil == $millesime )
2010-03-18 14:57:23 +00:00
{
$bilan = $countBilans ;
2009-10-02 17:26:29 +00:00
break ;
}
$countBilans ++ ;
}
}
}
2009-08-27 07:28:00 +00:00
?>
< div id = " center " >
< h1 class = " titre " > RATIOS </ h1 >
2009-06-18 13:22:31 +00:00
2009-09-24 16:05:13 +00:00
< table >
2009-10-02 14:39:29 +00:00
< tr >
2009-08-27 07:28:00 +00:00
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Num & eacute ; ro identifiant Siren </ td >
< td width = " 340 " class = " StyleInfoData " >< ? = substr ( $siren , 0 , 3 ) . ' ' . substr ( $siren , 3 , 3 ) . ' ' . substr ( $siren , 6 , 3 ) ?> </td>
2009-10-02 14:39:29 +00:00
</ tr >
< tr >
2009-08-27 07:28:00 +00:00
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Raison Sociale </ td >
2010-03-18 14:57:23 +00:00
< td width = " 340 " class = " StyleInfoData " >< ? = $raisonSociale ?> </td>
</ tr >
2009-08-27 07:28:00 +00:00
</ table >
2009-06-18 13:22:31 +00:00
2009-08-27 07:28:00 +00:00
< ? php
2009-10-16 15:21:58 +00:00
if ( $numBilanN == 0 && $numBilanC == 0 && $numBilanB == 0 && $numBilanA == 0 )
2009-10-02 14:39:29 +00:00
{
2009-08-27 07:28:00 +00:00
?>
< table >
< tr >< td width = " 30 " >& nbsp ; </ td >< td >< b > Aucun bilan disponible pour cette entreprise !</ b ></ td ></ tr >
</ table >
< ? php
2009-10-02 14:39:29 +00:00
}
2009-10-16 15:21:58 +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-16 15:21:58 +00:00
</ table >
2010-03-18 14:57:23 +00:00
< ? php
2009-10-16 15:21:58 +00:00
}
2009-10-02 14:39:29 +00:00
else
{
2009-08-27 07:28:00 +00:00
?>
2009-09-24 16:05:13 +00:00
< table >
2009-10-02 17:26:29 +00:00
< tr >
2009-08-27 07:28:00 +00:00
< td width = " 30 " >& nbsp ; </ td >
2010-04-09 14:55:22 +00:00
< td width = " 200 " class = " StyleInfoLib " > Secteur d ' activité :</ td >
2009-08-27 07:28:00 +00:00
< td width = " 340 " class = " StyleInfoData " >
2010-04-09 14:55:22 +00:00
< ? php
print $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'nafEn' ];
if ( isset ( $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'nafEnLib' ]) == true ) {
print ' - ' . $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'nafEnLib' ];
}
?>
2009-08-27 07:28:00 +00:00
</ td >
2009-10-02 17:26:29 +00:00
</ tr >
2010-03-18 14:57:23 +00:00
< ? php
2009-10-13 16:36:27 +00:00
if ( $numBilanN > 0 || $numBilanC > 0 )
{
?>
2009-10-02 17:26:29 +00:00
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Type de bilans </ td >
< td width = " 340 " 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 17:26:29 +00:00
</ td >
</ tr >
2010-03-18 14:57:23 +00:00
< ? php
2009-10-13 16:36:27 +00:00
}
?>
2009-10-02 17:26:29 +00:00
< tr >
2009-08-27 07:28:00 +00:00
< td width = " 30 " >& nbsp ; </ td >
2010-02-10 17:27:03 +00:00
< td width = " 200 " class = " StyleInfoLib " > Millésime </ td >
2009-08-27 07:28:00 +00:00
< td width = " 340 " class = " StyleInfoData " >
< form name = " selectBilan " method = " post " action = " index.php?<?= $_SERVER['QUERY_STRING'] ;?> " >
2009-10-02 17:26:29 +00:00
< select name = " mil " >
2009-08-27 07:28:00 +00:00
< ? php
2009-10-02 17:26:29 +00:00
if ( count ( $bilansInfos ) > 0 )
{
2009-10-09 14:27:01 +00:00
$countBilans = 0 ;
2009-10-02 17:26:29 +00:00
foreach ( $bilansInfos as $bilanItem )
2009-10-02 14:39:29 +00:00
{
2009-10-09 14:27:01 +00:00
if ( $countBilans >= 5 ){ break ; }
2009-10-02 17:26:29 +00:00
$millesime = '' ;
2010-03-18 14:57:23 +00:00
if ( isset ( $bilanItem [ 'dateCloture' ]))
2009-10-02 17:26:29 +00:00
{
$annee = substr ( $bilanItem [ 'dateCloture' ], 6 , 2 ) . substr ( $bilanItem [ 'dateCloture' ], 4 , 2 ) . substr ( $bilanItem [ 'dateCloture' ], 0 , 4 );
$millesime = $bilanItem [ 'typeBilan' ] . $annee ;
?>
2009-10-16 15:21:58 +00:00
< option value = " index.php?page=<?= $page ?>&siret=<?= $siret ?>&idEntreprise=<?= $idEntreprise ?>&mil=<?= $millesime ?>&type=<?=substr( $millesime ,0,1);?> " < ? php if ( $mil == $millesime ){ print 'selected="selected"' ;} ?> >
2009-10-02 17:26:29 +00:00
< ? = substr ( $bilanItem [ 'dateCloture' ], 6 , 2 ) . '/' . substr ( $bilanItem [ 'dateCloture' ], 4 , 2 ) . '/' . substr ( $bilanItem [ 'dateCloture' ], 0 , 4 ); ?>
< ? php
2010-03-18 14:57:23 +00:00
if ( isset ( $typBil [ $bilanItem [ 'typeBilan' ]]) &&
( isset ( $typBil [ $bilanItem [ 'typeBilan' ]]) != 'N' ||
2009-10-09 14:27:01 +00:00
isset ( $typBil [ $bilanItem [ 'typeBilan' ]]) != '' ) )
2009-10-02 17:26:29 +00:00
{
?>
< ? = $typBil [ $bilanItem [ 'typeBilan' ]] ?>
2010-03-18 14:57:23 +00:00
< ? php
}
2009-10-02 17:26:29 +00:00
?>
</ option >
< ? php
2009-10-09 14:27:01 +00:00
$countBilans ++ ;
2009-08-27 07:28:00 +00:00
}
}
} else { print '-' ; }
?>
</ select >
</ form >
</ td >
2009-10-02 17:26:29 +00:00
</ tr >
< tr >
2009-08-27 07:28:00 +00:00
< td width = " 30 " >& nbsp ; </ td >
2010-02-10 17:27:03 +00:00
< td width = " 200 " class = " StyleInfoLib " > Durée du bilan </ td >
2009-08-27 07:28:00 +00:00
< td width = " 340 " class = " StyleInfoData " >
2009-06-18 13:22:31 +00:00
< ? php
2010-03-18 14:57:23 +00:00
if ( isset ( $bilansInfos [ $bilan ][ 'dateCloture' ]))
2009-10-02 17:26:29 +00:00
{
2010-03-18 14:57:23 +00:00
2009-10-02 17:26:29 +00:00
print $bilansInfos [ $bilan ][ 'duree' ]; ?> mois
2010-03-18 14:57:23 +00:00
< ? php
} else { print '-' ; }
2009-10-02 17:26:29 +00:00
?>
2009-08-27 07:28:00 +00:00
</ td >
2009-10-02 17:26:29 +00:00
</ tr >
2009-08-27 07:28:00 +00:00
< ? php
if ( $ratio != '' ){
?>
< tr >
< td colspan = " 3 " >& nbsp ; </ td >
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
2010-02-10 17:27:03 +00:00
< td width = " 200 " class = " StyleInfoLib " > Retour à la page complète </ td >
< td width = " 340 " class = " StyleInfoData " >< a href = " /?page=ratios&siret=<?= $_REQUEST['siret'] ?>&idEntreprise=<?= $_REQUEST['idEntreprise'] ?> " title = " Retour à la page complète " >< img src = " ./img/synthese/chart_bar.png " alt = " Visionner le graphique " ></ a ></ td >
2009-08-27 07:28:00 +00:00
</ tr >
< ? php
}
?>
</ table >
< table id = " ratios " >
< tbody >
2009-10-13 16:36:27 +00:00
< ? php print ratios_tablerow ( $ratiosInfos , $bilan , $ratio ); ?>
2009-08-27 07:28:00 +00:00
</ tbody >
2010-02-10 17:27:03 +00:00
</ table >
2009-08-27 07:28:00 +00:00
< ? php
}
?>
< br />
< ? php
2010-02-10 17:27:03 +00:00
//Affichage du graphique associé au ratio sélectionné
2009-08-27 07:28:00 +00:00
if ( $ratio != '' ){
$data = dGraph ( $ratio , $bilan );
2009-05-28 15:52:29 +00:00
?>
2009-08-27 07:28:00 +00:00
< div id = " titreEvol " >< b > Evolution </ b ></ div >
2009-06-18 13:22:31 +00:00
< ? php
2009-08-27 07:28:00 +00:00
if ( count ( $data [ 'data' ]) <= 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:28:00 +00:00
} else {
$image = ratios_graph ( '' , $data , $fileName );
2009-06-18 13:22:31 +00:00
?>
2009-08-27 07:28:00 +00:00
< img id = " imgEvol " src = " ./imgcache/<?= $image ;?> " />
2009-06-18 13:22:31 +00:00
< ? php
}
2009-08-27 07:28:00 +00:00
}
2009-04-03 09:30:51 +00:00
?>
2010-04-12 14:49:55 +00:00
< p class = " confidentiel blockh2 " >
< ? php
require_once 'cgu/cgu.php' ;
echo afficheCgu ();
?>
</ p >
2009-08-27 07:28:00 +00:00
</ div >