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-08-27 07:28:00 +00:00
require_once 'cache/cache.php' ;
require_once 'ratios/ratios.php' ;
2009-10-08 13:20:51 +00:00
require_once 'scoresws/scoresws.php' ;
2009-04-02 09:54:01 +00:00
2009-03-25 18:32:45 +00:00
$siret = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'siret' ]));
if ( strlen ( $siret ) <> 0 && strlen ( $siret ) <> 9 && strlen ( $siret ) <> 14 ) die ( 'Param<61> tres incorrects !' );
$idEntreprise = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'idEntreprise' ])) * 1 ; // Si id=0 alors non communiqu<71>
if (( $siret * 1 ) == 0 && $idEntreprise == 0 ) die ( 'Param<61> tres incorrects !' );
$siren = substr ( $siret , 0 , 9 );
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-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-06-18 13:22:31 +00:00
2009-10-02 17:26:29 +00:00
//Tableau des diff<66> rents type de bilans
2009-10-02 14:39:29 +00:00
$typBil = array ( 'C' => 'Consolid<69> ' , 'N' => '' , 'S' => 'R<> el Simplifi<66> ' , 'B' => 'Banque' , 'A' => 'Assurance' );
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' ];;
list ( $bilansInfos , $ratiosEntrep , $ratiosEntrepEvol , $dataActif , $dataPassif , $dataSIG ) = filtreTypeBilans ( $bilansInfos , $ratiosEntrep , $ratiosEntrepEvol , array (), array (), array (), $typeBilan );
2009-06-23 15:16:21 +00:00
2009-10-02 17:26:29 +00:00
//On d<> termine le bilan s<> lectionn<6E>
if ( $mil == '' )
{
$bilan = 0 ;
$mil = $bilansInfos [ $bilan ][ 'typeBilan' ] . substr ( $bilansInfos [ $bilan ][ 'dateCloture' ], 6 , 2 ) . substr ( $bilansInfos [ $bilan ][ 'dateCloture' ], 4 , 2 ) . substr ( $bilansInfos [ $bilan ][ 'dateCloture' ], 0 , 4 );
}
else
{
if ( count ( $bilansInfos ) > 0 )
{
$countBilans = 0 ;
foreach ( $bilansInfos as $bilanItem )
{
$millesime = $bilanItem [ 'typeBilan' ] . substr ( $bilanItem [ 'dateCloture' ], 6 , 2 ) . substr ( $bilanItem [ 'dateCloture' ], 4 , 2 ) . substr ( $bilanItem [ 'dateCloture' ], 0 , 4 );
if ( $mil == $millesime )
{
$bilan = $countBilans ;
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 >
< td width = " 340 " class = " StyleInfoData " >< ? = $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'raisonSociale' ]; ?> </td>
2009-10-02 14:39:29 +00:00
</ 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-09-24 16:05:13 +00:00
$firephp -> log ( $_SESSION , 'SESSION' );
2009-10-09 14:27:01 +00:00
if ( count ( $bilansInfos ) == 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
}
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 >
< td width = " 200 " class = " StyleInfoLib " > Secteur d ' activit<EFBFBD> :</ td >
< td width = " 340 " class = " StyleInfoData " >
< ? php print $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'nafEn' ]; ?> - <?php print $_SESSION['tabInfo']['entrep']['nafEnLib']; ?>
</ td >
2009-10-02 17:26:29 +00:00
</ tr >
2009-10-13 16:36:27 +00:00
< ? php
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 " >
2009-10-09 16:04:17 +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<66> </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> </label><?php }?>
< ? php if ( $numBilanN > 0 && $numBilanC == 0 ){ ?> R<EFBFBD> el normal ou Simplifi<66> <?php }?>
< ? php if ( $numBilanN == 0 && $numBilanC > 0 ){ ?> Consolid<EFBFBD> <?php }?>
2009-10-02 17:26:29 +00:00
</ td >
</ tr >
2009-10-13 16:36:27 +00:00
< ? php
}
?>
2009-10-02 17:26:29 +00:00
< tr >
2009-08-27 07:28:00 +00:00
< td width = " 30 " >& nbsp ; </ td >
2009-09-24 16:05:13 +00:00
< td width = " 200 " class = " StyleInfoLib " > Mill<EFBFBD> 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 = '' ;
if ( isset ( $bilanItem [ 'dateCloture' ]))
{
$annee = substr ( $bilanItem [ 'dateCloture' ], 6 , 2 ) . substr ( $bilanItem [ 'dateCloture' ], 4 , 2 ) . substr ( $bilanItem [ 'dateCloture' ], 0 , 4 );
$millesime = $bilanItem [ 'typeBilan' ] . $annee ;
?>
< option value = " index.php?page=<?= $page ?>&siret=<?= $siret ?>&idEntreprise=<?= $idEntreprise ?>&mil=<?= $millesime ?> " < ? php if ( $mil == $millesime ){ print 'selected="selected"' ;} ?> >
< ? = substr ( $bilanItem [ 'dateCloture' ], 6 , 2 ) . '/' . substr ( $bilanItem [ 'dateCloture' ], 4 , 2 ) . '/' . substr ( $bilanItem [ 'dateCloture' ], 0 , 4 ); ?>
< ? php
if ( isset ( $typBil [ $bilanItem [ 'typeBilan' ]]) &&
2009-10-09 14:27:01 +00:00
( isset ( $typBil [ $bilanItem [ 'typeBilan' ]]) != 'N' ||
isset ( $typBil [ $bilanItem [ 'typeBilan' ]]) != '' ) )
2009-10-02 17:26:29 +00:00
{
?>
< ? = $typBil [ $bilanItem [ 'typeBilan' ]] ?>
< ? php
}
?>
</ 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 >
< td width = " 200 " class = " StyleInfoLib " > Dur<EFBFBD> e du bilan </ td >
< td width = " 340 " class = " StyleInfoData " >
2009-06-18 13:22:31 +00:00
< ? php
2009-10-02 17:26:29 +00:00
if ( isset ( $bilansInfos [ $bilan ][ 'dateCloture' ]))
{
print $bilansInfos [ $bilan ][ 'duree' ]; ?> mois
< ? php
} else { print '-' ; }
?>
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 >
< td width = " 200 " class = " StyleInfoLib " > Retour <EFBFBD> la page compl<EFBFBD> te </ td >
< td width = " 340 " class = " StyleInfoData " >< a href = " /?page=ratios&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 ></ td >
</ 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 >
</ table > <EFBFBD>
< ? php
}
?>
< br />
< ? php
//Affichage du graphique associ<63> au ratio s<> lectionn<6E>
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 ){
print " Les informations sont insuffisantes pour g<> n<EFBFBD> rer la courbe d'<27> volution " ;
} 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
?>
2009-08-27 07:28:00 +00:00
</ div >