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
$tabInfo = $_SESSION [ 'tabInfo' ];
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-06-18 13:22:31 +00:00
isset ( $_REQUEST [ 'bilan' ]) ? $bilan = $_REQUEST [ 'bilan' ] : $bilan = 0 ;
isset ( $_REQUEST [ 'ratio' ]) ? $ratio = $_REQUEST [ 'ratio' ] : $ratio = '' ;
2009-04-09 16:48:56 +00:00
2009-05-28 15:52:29 +00:00
if (( $siret * 1 ) == 0 || ( $siren * 1 ) < 100 ){ $fileName = $page2 . '-' . $idEntreprise ;
2009-06-18 13:22:31 +00:00
} else { $fileName = $page2 . '-' . $siret ; }
2009-05-28 17:10:09 +00:00
$fileName .= '-' . $bilan ;
2009-06-18 13:22:31 +00:00
if ( $ratio != '' ){ $fileName .= '-' . $ratio ;}
2009-05-28 17:10:09 +00:00
2009-05-28 15:52:29 +00:00
require_once 'cache.php' ;
$cache = new Cache ();
2009-06-18 13:22:31 +00:00
$cache -> forceStart = TRUE ;
2009-05-28 15:52:29 +00:00
//Forcer la cr<63> ation de la page dans le cache lorsque l'utilisateur a le mode saisie
$firephp -> log ( $_SESSION , 'SESSION' );
if ( preg_match ( '/saisie/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]) || $_SESSION [ 'tabInfo' ][ 'mode_edition' ] == 1 ){
$cache -> disable = TRUE ;
2009-03-25 18:32:45 +00:00
}
2009-05-28 15:52:29 +00:00
if ( $cache -> startCapture ( $fileName . '.html' ) == FALSE ){
print $cache -> displayCache ();
2009-04-03 09:30:51 +00:00
} else {
2009-05-28 15:52:29 +00:00
$ratiosEntrep = array ();
$ratiosInfos = array ();
$bilansInfos = array ();
$rationsEntrepEvol = array ();
2009-06-18 13:22:31 +00:00
2009-05-28 15:52:29 +00:00
try {
$O = $client -> getRatios ( $siren , 'ratios' );
$bilansInfos = $O [ 'result' ][ 'BilansInfos' ];
$ratiosInfos = $O [ 'result' ][ 'RatiosInfos' ];
$ratiosEntrep = $O [ 'result' ][ 'RatiosEntrep' ];
$ratiosEntrepEvol = $O [ 'result' ][ 'RatiosEntrepEvol' ];
$ratiosSecteur = $O [ 'result' ][ 'RatiosSecteur' ];
2009-06-18 13:22:31 +00:00
//print '<!--';
2009-05-28 17:10:09 +00:00
//print_r($ratiosInfos);
2009-06-18 13:22:31 +00:00
//print '-->';
2009-05-28 15:52:29 +00:00
} catch ( SoapFault $fault ) {
require_once 'soaperror.php' ;
processSoapFault ( $client , $fault , $tabInfo );
die ();
}
2009-06-18 13:22:31 +00:00
2009-06-16 07:47:53 +00:00
require_once 'ratios/ratios.php' ;
2009-06-18 13:22:31 +00:00
2009-06-23 15:16:21 +00:00
$tabRatio = array (
0 => array ( 'titre' => 'EQUILIBRE FINANCIER' ),
1 => array ( 'titre' => 'MARGE BRUTE D\'AUTOFINANCEMENT' , 'stitre' => '(MBA ou CAF)' , 'ratio' => 'r233' , 'parent' => 0 ),
2 => array ( 'titre' => 'COUVERTURE du BFR ' , 'stitre' => '(FR/BFR)' , 'ratio' => 'r234' , 'parent' => 0 ),
3 => array ( 'titre' => 'COUVERTURE des IMMOS NETTES ' , 'stitre' => '(Capitaux permanents / Immobilisations nettes)' , 'ratio' => 'r237' , 'parent' => 0 ),
4 => array ( 'titre' => 'COUVERTURE du CA ' , 'stitre' => '(Fond de roulement net global sur 12m x 360 / Chiffre d\'affaire)' , 'ratio' => 'r238' , 'parent' => 0 ),
5 => array ( 'titre' => 'SOLVABILITE ' , 'stitre' => '(Capitaux propres / Ensemble des dettes)' , 'ratio' => 'r239' , 'parent' => 0 ),
6 => array ( 'titre' => 'INDEPENDANCE FINANCIERE ' , 'stitre' => '(Cap.propres/Capitaux permanents)' , 'ratio' => 'r240' , 'parent' => 0 ),
7 => array ( 'titre' => 'PROFITABILITE' ),
8 => array ( 'titre' => 'RENTABILITE ECONOMIQUE ' , 'stitre' => '(EBE/TOTAL bilan)' , 'ratio' => 'r262' , 'parent' => 7 ),
9 => array ( 'titre' => 'RENTABILITE FINANCIERE ' , 'stitre' => '(R<> sult.Net/Cap.propres)' , 'ratio' => 'r263' , 'parent' => 7 ),
10 => array ( 'titre' => 'RENTABILITE COMMERCIALE ' , 'stitre' => '(R<> sultat net/CA)' , 'ratio' => 'r264' , 'parent' => 7 ),
11 => array ( 'titre' => 'CONTRIBUTION DU CAPITAL' , 'stitre' => '(Capacit<69> d\'autofinancement sur 12 mois / Capitaux permanents)' , 'ratio' => 'r265' , 'parent' => 7 ),
12 => array ( 'titre' => 'CONTRIBUTION DE LA VA' , 'stitre' => '(Capacit<69> d\'autofinancement / Valeur ajout<75> e)' , 'ratio' => 'r266' , 'parent' => 7 ),
13 => array ( 'titre' => 'LIQUIDITE' ),
14 => array ( 'titre' => 'LIQUIDITE IMMEDIATE' , 'stitre' => '(Disponibilit<69> / Dettes CT)' , 'ratio' => 'r250' , 'parent' => 13 ),
15 => array ( 'titre' => 'LIQUIDITE GENERALE' , 'stitre' => '(Act.circulant net/Dettes CT)' , 'ratio' => 'r251' , 'parent' => 13 ),
16 => array ( 'titre' => 'LIQUIDITE REDUITE' , 'stitre' => '(Disponibilit<69> et cr<63> ances r<> elles /Dettes CT)' , 'ratio' => 'r252' , 'parent' => 13 ),
17 => array ( 'titre' => 'ENDETTEMENT' ),
18 => array ( 'titre' => 'ENDETTEMENT ' , 'stitre' => '(Dettes a + 1 an / Capitaux propres)' , 'ratio' => 'r244' , 'parent' => 17 ),
19 => array ( 'titre' => 'CAPACITE DE REMBOURSEMENT' , 'stitre' => '(Dettes.bancaires.(+MT+LT+C.bail)/CAF)' , 'ratio' => 'r247' , 'parent' => 17 ),
20 => array ( 'titre' => 'FINANCEMENT DES STOCKS' , 'stitre' => '(Dettes aux fournisseurs / Stock)' , 'ratio' => 'r248' , 'parent' => 17 ),
21 => array ( 'titre' => 'PRODUCTIVITE' ),
22 => array ( 'titre' => 'PRODUCTIVITE DE L\'ACTIF' , 'stitre' => '(Chiffre d\'affaire / Actif comptable)' , 'ratio' => 'r271' , 'parent' => 21 ),
23 => array ( 'titre' => 'DUREE CLIENT' , 'stitre' => '(Rotation clients en VJ TTC)' , 'ratio' => 'r278' , 'parent' => 21 ),
24 => array ( 'titre' => 'DUREE FOURNISSEUR' , 'stitre' => '(Rotation fournisseurs en JA TTC)' , 'ratio' => 'r279' , 'parent' => 21 ),
25 => array ( 'titre' => 'POIDS MASSE SALARIALE' , 'stitre' => '(Ch personnel / VA)' , 'ratio' => 'r281' , 'parent' => 21 ),
26 => array ( 'titre' => 'RENDEMENT' , 'stitre' => '(Production sur 12mois / Effectif)' , 'ratio' => 'r261' , 'parent' => 21 ),
27 => array ( 'titre' => 'PRODUCTIVITE' , 'stitre' => '(CA / Effectif)' , 'ratio' => 'r267' , 'parent' => 21 ),
);
2009-05-28 15:52:29 +00:00
?>
2009-06-18 13:22:31 +00:00
< script type = " text/javascript " src = " ./js/jquery.qtip.js " ></ script >
2009-05-28 15:52:29 +00:00
< script type = " text/javascript " >
2009-06-18 13:22:31 +00:00
$ ( document ) . ready ( function ()
2009-05-28 15:52:29 +00:00
{
$ ( '#ratios a[tooltip]' ) . each ( function ()
{
2009-06-18 13:22:31 +00:00
$ ( this ) . qtip ( {
content : $ ( this ) . attr ( 'tooltip' ),
style : { width : 500 , name : 'dark' },
2009-05-28 15:52:29 +00:00
position : { corner : { target : 'bottomMiddle' , tooltip : 'topMiddle' } }
});
});
2009-05-29 12:26:11 +00:00
2009-05-28 15:52:29 +00:00
$ ( '.jTip' ) . each ( function ()
{
$ ( this ) . qtip (
{
content : {
text : 'Chargement...' ,
2009-06-03 10:11:29 +00:00
url : $ ( this ) . attr ( 'rel' ),
2009-05-29 12:26:11 +00:00
title : { text : $ ( this ) . attr ( 'name' )}
2009-05-28 15:52:29 +00:00
},
position : {
corner : {
target : 'leftMiddle' ,
tooltip : 'rightMiddle'
2009-05-29 12:26:11 +00:00
}
2009-05-28 15:52:29 +00:00
},
show : { solo : true },
style : {
tip : true ,
2009-05-29 12:26:11 +00:00
border : { width : 1 , radius : 0 },
2009-05-28 15:52:29 +00:00
name : 'light' ,
width : 400
}
})
});
});
</ script >
< link rel = " stylesheet " type = " text/css " href = " ./css/jtip.css " />
< style >
2009-06-03 10:16:25 +00:00
#container { width:580px; background-color:#FFFFFF; }
#ratios { clear:both; font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size:12px; margin:10px 0 0 0; width:580px; text-align:left; border-collapse:collapse; }
2009-05-28 15:52:29 +00:00
#ratios a { color:#000000; cursor:help; }
2009-06-03 10:16:25 +00:00
#ratios th { padding:8px; font-weight:normal; font-size:13px; color:#039; background:#b9c9fe; }
#ratios td { padding:8px; border:1px solid #000; color:#000; }
#ratios td.center { text-align:center; }
#ratios td.italique { font-style:italic ; }
#ratios td.right { text-align:right; }
#ratios td.position { text-align:center; }
2009-06-03 11:38:07 +00:00
#ratios td.position a { cursor:default; }
2009-06-03 10:16:25 +00:00
#ratios tr.subhead td { padding:8px; background:#b9c9fe; border:1px solid #000; font-weight:bold; color:#000; }
2009-05-28 15:52:29 +00:00
#entete { margin:1px; }
#secteur{ margin-top:10px; }
. qtip - title { font - size : 11 px ;}
. qtip - content { font - size : 12 px ;}
2009-06-29 09:15:48 +00:00
#titreEvol {margin:0 130px;}
#imgEvol {margin:0 100px;}
2009-05-28 15:52:29 +00:00
</ style >
2009-06-18 13:22:31 +00:00
2009-05-28 15:52:29 +00:00
< div id = " container " >
< div >< img id = " entete " src = " ./img/rub_ratios.png " width = " 577 " height = " 36 " ></ div >
2009-06-18 13:22:31 +00:00
2009-05-28 15:52:29 +00:00
< table width = " 580 " border = " 0 " align = " left " bgcolor = " #FFFFFF " >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Num & eacute ; ro identifiant Siren </ td >
< td width = " 350 " class = " StyleInfoData " >< ? = substr ( $siren , 0 , 3 ) . ' ' . substr ( $siren , 3 , 3 ) . ' ' . substr ( $siren , 6 , 3 ) ?> </td>
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Raison Sociale </ td >
< td width = " 350 " class = " StyleInfoData " >< ? = $tabInfo [ 'entrep' ][ 'raisonSociale' ]; ?> </td>
</ tr >
</ table >
< br />< br />
2009-06-18 13:22:31 +00:00
< ? php
2009-05-28 15:52:29 +00:00
if ( count ( $ratiosEntrep ) == 0 || ! isset ( $ratiosEntrep )){
?>
< table >
< tr >< td width = " 30 " >& nbsp ; </ td >< td >< b > Aucun bilan disponible pour cette entreprise !</ b ></ td ></ tr >
</ table >
2009-06-18 13:22:31 +00:00
< ? php
2009-05-28 15:52:29 +00:00
} else {
?>
< br />< br />
2009-06-18 13:22:31 +00:00
2009-05-28 15:52:29 +00:00
< table width = " 580 " border = " 0 " align = " left " bgcolor = " #FFFFFF " >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Secteur d ' activit<EFBFBD> :</ td >
< td width = " 350 " class = " StyleInfoData " >
< ? php print $tabInfo [ 'entrep' ][ 'nafEn' ]; ?> - <?php print $tabInfo['entrep']['nafEnLib']; ?>
2009-04-10 16:20:27 +00:00
</ td >
2009-05-28 15:52:29 +00:00
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Millesime </ td >
< td width = " 350 " class = " StyleInfoData " >
< form name = " selectBilan " method = " post " action = " index.php?<?= $_SERVER['QUERY_STRING'] ;?> " >
< select name = " bilan " >
2009-06-18 13:22:31 +00:00
< ? php
2009-05-28 15:52:29 +00:00
$countBilans = 0 ;
if ( count ( $bilansInfos ) > 0 ){
foreach ( $bilansInfos as $bilanItem ){
2009-06-18 13:22:31 +00:00
if ( isset ( $bilanItem [ 'dateCloture' ])) {
?>
2009-05-28 15:52:29 +00:00
< option value = " <?php print $countBilans ;?> " < ? php if ( $bilan == $countBilans ){ print 'selected="selected"' ;} ?> ><?php print substr($bilanItem['dateCloture'],6,2).'/'.substr($bilanItem['dateCloture'],4,2).'/'.substr($bilanItem['dateCloture'],0,4);?></option>
2009-06-18 13:22:31 +00:00
< ? php
2009-05-28 15:52:29 +00:00
}
$countBilans ++ ;
}
2009-06-18 13:22:31 +00:00
} else { print '-' ; }
?>
</ select >
2009-05-28 15:52:29 +00:00
& nbsp ; < a href = " javascript:document.selectBilan.submit(); " > Ok </ a >
</ form >
2009-04-10 16:20:27 +00:00
</ td >
2009-05-28 15:52:29 +00:00
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Dur<EFBFBD> e du bilan </ td >
< td width = " 350 " class = " StyleInfoData " >
2009-06-18 13:22:31 +00:00
< ? php
if ( isset ( $bilansInfos [ $bilan ][ 'dateCloture' ])) {
print $bilansInfos [ $bilan ][ 'duree' ]; ?> mois
2009-05-28 15:52:29 +00:00
< ? php } else { print '-' ; } ?>
2009-04-28 08:25:57 +00:00
</ td >
2009-05-28 15:52:29 +00:00
</ tr >
2009-06-18 13:22:31 +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 = " 350 " 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
}
?>
2009-05-28 15:52:29 +00:00
</ table >
< br />< br />
2009-06-18 13:22:31 +00:00
< table id = " ratios " >
2009-05-28 15:52:29 +00:00
< tbody >
2009-06-18 13:22:31 +00:00
< ? php print ratios_tablerow ( $ratiosInfos , $tabRatio , $bilan , $ratio ); ?>
2009-05-28 15:52:29 +00:00
</ tbody >
</ table > <EFBFBD>
2009-06-18 13:22:31 +00:00
< ? php
2009-05-28 15:52:29 +00:00
}
?>
< br />
2009-06-18 13:22:31 +00:00
< ? php
//Affichage du graphique associ<63> au ratio s<> lectionn<6E>
if ( $ratio != '' ){
2009-06-29 13:13:30 +00:00
$data = dGraph ( $ratio , $bilan );
2009-06-18 13:22:31 +00:00
?>
< div id = " titreEvol " >< b > Evolution </ b ></ div >
< ? php
if ( count ( $data [ 'data' ]) <= 1 ){
print " Les informations sont insuffisantes pour g<> n<EFBFBD> rer la courbe d'<27> volution " ;
} else {
2009-06-29 13:13:30 +00:00
$image = ratios_graph ( '' , $data , $fileName );
2009-06-23 15:16:21 +00:00
?>
2009-06-29 13:13:30 +00:00
< img id = " imgEvol " src = " ./imgcache/<?= $image ;?> " />
2009-06-23 15:16:21 +00:00
< ? php
2009-06-18 13:22:31 +00:00
}
}
?>
2009-05-28 15:52:29 +00:00
</ div >
2009-06-18 13:22:31 +00:00
< ? php
2009-05-28 15:52:29 +00:00
} //Fin du cache
$cache -> stopCapture ();
2009-04-03 09:30:51 +00:00
?>
2009-03-25 09:37:17 +00:00
2009-05-28 15:52:29 +00:00