2009-03-25 09:37:17 +00:00
< ? php
2009-03-25 18:32:45 +00:00
if ( ! $_SESSION [ 'connected' ]) die ();
2009-04-01 12:45:45 +00:00
$tabInfo = $_SESSION [ 'tabInfo' ];
2009-03-25 18:32:45 +00:00
$siret = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'siret' ]));
2009-03-30 16:27:40 +00:00
if ( strlen ( $siret ) <> 0 && strlen ( $siret ) <> 9 && strlen ( $siret ) <> 14 ) die ( 'Param<61> tres incorrects !' );
2009-03-25 18:32:45 +00:00
$idEntreprise = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'idEntreprise' ])) * 1 ; // Si id=0 alors non communiqu<71>
2009-03-30 16:27:40 +00:00
if (( $siret * 1 ) == 0 && $idEntreprise == 0 ) die ( 'Param<61> 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-05-28 14:40:58 +00:00
if (( $siret * 1 ) == 0 || ( $siren * 1 ) < 100 ){ $fileName = $page2 . '-' . $idEntreprise ;
2009-06-17 14:41:41 +00:00
} else { $fileName = $page2 . '-' . $siret ; }
2009-06-18 13:22:31 +00:00
if ( $ratio != '' ){ $fileName .= '-' . $ratio ;}
2009-03-30 16:27:40 +00:00
2009-05-28 14:40:58 +00:00
require_once 'cache.php' ;
$cache = new Cache ();
//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-30 16:27:40 +00:00
}
2009-05-28 14:40:58 +00:00
if ( $cache -> startCapture ( $fileName . '.html' ) == FALSE ){
print $cache -> displayCache ();
} else {
2009-03-30 16:27:40 +00:00
2009-05-28 14:40:58 +00:00
$ratiosEntrep = array ();
$ratiosInfos = array ();
$bilansInfos = array ();
$rationsEntrepEvol = array ();
2009-06-17 14:41:41 +00:00
2009-05-28 14:40:58 +00:00
try {
$O = $client -> getRatios ( $siren , 'synthese' );
$bilansInfos = $O [ 'result' ][ 'BilansInfos' ];
$ratiosInfos = $O [ 'result' ][ 'RatiosInfos' ];
$ratiosEntrep = $O [ 'result' ][ 'RatiosEntrep' ];
$ratiosEntrepEvol = $O [ 'result' ][ 'RatiosEntrepEvol' ];
2009-06-17 14:41:41 +00:00
2009-05-28 14:40:58 +00:00
} catch ( SoapFault $fault ) {
require_once 'soaperror.php' ;
processSoapFault ( $client , $fault , $tabInfo );
die ();
2009-03-31 14:16:03 +00:00
}
2009-06-17 14:41:41 +00:00
2009-06-15 14:52:56 +00:00
//require_once 'ratios/functions.php';
require_once 'ratios/ratios.php' ;
2009-06-16 14:27:19 +00:00
//Liste des ratios pour le graphique g<> n<EFBFBD> ral
2009-06-17 14:41:41 +00:00
$tabRatioGraph = array ( 0 => array ( 'ratio' => 'r236' , 'op' => 1000 ),
2009-06-15 14:52:56 +00:00
1 => array ( 'ratio' => 'r235' , 'op' => 1000 ),
2 => array ( 'ratio' => 'r6' , 'op' => 1000 ),
3 => array ( 'ratio' => 'r146' , 'op' => 1000 ));
2009-06-16 14:27:19 +00:00
2009-06-17 14:41:41 +00:00
//Liste des ratios <20> afficher
2009-06-16 14:27:19 +00:00
$tabRatio = array (
'r5' => array ( 'evol' => 'r6' , 'op' => 1000 , 'titre' => 'CHIFFRE D\'AFFAIRES' ),
'r7' => array ( 'evol' => 'r8' , 'op' => 1000 , 'titre' => 'RESULTAT COURANT AVANT IMPOTS' ),
'r10' => array ( 'evol' => 'r11' , 'op' => 1000 , 'titre' => 'RESULTAT NET' ),
'r18' => array ( 'evol' => 'r19' , 'op' => 1000 , 'titre' => 'FONDS PROPRES' ),
'r22' => array ( 'evol' => 'r23' , 'op' => 1000 , 'titre' => 'TOTAL BILAN' ),
'r231' => array ( 'evol' => 'r235' , 'op' => 1000 , 'titre' => 'FONDS DE ROULEMENT' ),
'r232' => array ( 'evol' => 'r236' , 'op' => 1000 , 'titre' => 'BESOIN EN FONDS DE ROULEMENT' ),
'r62' => array ( 'evol' => 'r64' , 'op' => 1000 , 'titre' => 'TRESORERIE' ),
2009-06-18 13:22:31 +00:00
'r24' => array ( 'evol' => 'r24' , 'op' => 1 , 'titre' => 'EFFECTIF' , 'unite' => 1 ),
2009-06-16 14:27:19 +00:00
);
2009-06-17 14:41:41 +00:00
2009-06-18 13:22:31 +00:00
//On souhaite n'afficher qu'un seul ratio, on r<> duit donc le tableau
if ( $ratio != '' ){
$tabRatio = array ( $ratio => $tabRatio [ $ratio ]);
}
2009-06-17 14:41:41 +00:00
$data = synthese_datagraph ( $bilansInfos , $ratiosEntrep , $tabRatioGraph , $tabRatio );
2009-06-15 14:52:56 +00:00
$dataGraph = $data [ 'graph' ];
2009-06-17 14:41:41 +00:00
$dataEvol = $data [ 'evol' ];
2009-06-16 14:27:19 +00:00
$firephp -> log ( $dataEvol , 'evol' );
2009-06-17 14:41:41 +00:00
2009-05-28 14:40:58 +00:00
//Cr<43> ation du fichier image
2009-06-18 13:22:31 +00:00
if ( $ratio == '' ){
$path = '../cache/' ;
file_put_contents ( $path . $fileName . '-graph-linecompare.tmp' , serialize ( $dataGraph ));
}
2009-05-28 14:40:58 +00:00
?>
2009-06-17 14:41:41 +00:00
< script type = " text/javascript " src = " ./js/jquery.qtip.js " ></ script >
2009-05-28 14:40:58 +00:00
< script type = " text/javascript " >
2009-06-17 14:41:41 +00:00
$ ( document ) . ready ( function ()
2009-05-27 17:00:50 +00:00
{
2009-05-28 14:40:58 +00:00
$ ( '#synthese a[tooltip]' ) . each ( function ()
{
$ ( this ) . qtip ({
content : $ ( this ) . attr ( 'tooltip' ),
2009-06-17 14:41:41 +00:00
style : { width : 500 , name : 'dark' },
position : { corner : { target : 'bottomMiddle' , tooltip : 'topMiddle' } }
2009-05-28 14:40:58 +00:00
});
});
2009-06-17 14:41:41 +00:00
2009-06-17 14:48:33 +00:00
$ ( '.jTip' ) . each ( function ()
{
2009-05-28 14:40:58 +00:00
$ ( this ) . qtip (
{
2009-06-17 14:41:41 +00:00
content : {
text : 'Chargement...' ,
url : $ ( this ) . attr ( 'rel' ),
2009-06-17 14:48:33 +00:00
title : { text : 'Evolution - ' + $ ( this ) . attr ( 'name' )}
2009-06-17 14:41:41 +00:00
},
position : {
corner : {
target : 'leftMiddle' ,
tooltip : 'rightMiddle'
2009-06-17 14:48:33 +00:00
}
2009-05-28 14:40:58 +00:00
},
show : { solo : true },
2009-06-17 14:41:41 +00:00
style : {
tip : true ,
2009-06-17 14:48:33 +00:00
border : { width : 1 , radius : 0 },
2009-05-28 14:40:58 +00:00
name : 'light' ,
width : 400
}
})
2009-06-17 14:48:33 +00:00
});
2009-05-28 14:40:58 +00:00
});
</ script >
< link rel = " stylesheet " type = " text/css " href = " ./css/jtip.css " />
< style >
#container { width: 580px; background-color: #FFFFFF; }
#synthese { 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; }
#synthese th { padding: 4px; font-weight: normal; font-size: 13px; color: #039; background: #b9c9fe; border: 1px solid #fff; }
#synthese th.date { font-size: 11px; }
#synthese td { padding: 4px; background: #e8edff; border: 1px solid #fff; color: #669; }
#synthese td.right { text-align: right; }
#synthese tbody tr:hover td { background: #d0dafd; }
#entete { margin:1px; }
#synthese .head { font-weight:bold; }
#graphInfo { font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; margin-left:10px; }
p , label { font - size : 12 px ;}
ul { list - style : none ;}
ul li { padding - top : 3 px ;}
. qtip - title { font - size : 11 px ;}
. qtip - content { font - size : 12 px ;}
2009-06-18 13:22:31 +00:00
#titreEvol {margin:0 30px;}
#imgEvol {margin:0 30px;}
2009-05-28 14:40:58 +00:00
</ style >
2009-06-17 14:41:41 +00:00
2009-05-28 14:40:58 +00:00
< div id = " container " >
< div >< img id = " entete " src = " ./img/rub_synthese.png " width = " 577 " height = " 36 " ></ div >
2009-06-17 14:41:41 +00:00
2009-05-28 14:40:58 +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 >
2009-06-17 14:41:41 +00:00
< ? php
2009-05-28 14:40:58 +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-17 14:41:41 +00:00
< ? php
2009-04-01 15:42:12 +00:00
} else {
2009-05-28 14:40:58 +00:00
?>
< table id = " synthese " >
< thead >
< tr >
2009-06-18 13:22:31 +00:00
< th align = " center " >< a href = " /?page=synthese&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 ></ th >
2009-06-15 14:52:56 +00:00
< th class = " date " >< ? php print synthese_formatdateCloture ( $bilansInfos , 2 ); ?> </th>
< th class = " date " >< ? php print synthese_formatdateCloture ( $bilansInfos , 1 ); ?> </th>
2009-05-28 14:40:58 +00:00
< th class = " date " > Evolution </ th >
2009-06-15 14:52:56 +00:00
< th class = " date " >< ? php print synthese_formatdateCloture ( $bilansInfos , 0 ); ?> </th>
2009-05-28 14:40:58 +00:00
< th class = " date " > Evolution </ th >
< th >& nbsp ; </ th >
</ tr >
2009-06-17 14:41:41 +00:00
</ thead >
2009-05-28 14:40:58 +00:00
< tbody >
2009-06-17 14:41:41 +00:00
< ? php
print synthese_tablerow ( $ratiosInfos , $dataEvol , $tabRatio )
2009-06-15 14:52:56 +00:00
?>
2009-05-28 14:40:58 +00:00
</ tbody >
</ table >
2009-06-18 13:22:31 +00:00
< br />
2009-06-17 14:41:41 +00:00
< ? php
2009-06-18 13:22:31 +00:00
//Affichage du graphique associ<63> au ratio s<> lectionn<6E>
if ( count ( $tabRatio ) == 1 ){ ?>
< div id = " titreEvol " >< b > Evolution </ b ></ div >
< ? php
if ( count ( $dataEvol [ $ratio ]) <= 1 ){
print " Les informations sont insuffisantes pour g<> n<EFBFBD> rer la courbe d'<27> volution " ;
2009-05-28 14:40:58 +00:00
} else {
2009-06-18 13:22:31 +00:00
if ( isset ( $tabRatio [ $ratio ][ 'unite' ])){ ?>
< img id = " imgEvol " src = " ./graphs/synthese_graph.php?data=<?=urlencode(serialize( $dataEvol[$ratio] ))?>&unite=<?= $ratiosInfos[$tabRatio[$ratio] ['evol']]['unite']?> " />
< ? php
} else { ?>
< img id = " imgEvol " src = " ./graphs/synthese_graph.php?data=<?=urlencode(serialize( $dataEvol[$ratio] ))?> " />
< ? php
2009-06-16 14:27:19 +00:00
}
2009-05-28 14:40:58 +00:00
}
2009-06-18 13:22:31 +00:00
//Affichage du graphique g<> n<EFBFBD> ral
} else {
if ( count ( $dataGraph ) <= 1 ){
print " <div id= \" graphInfo \" >Les informations sont insuffisantes pour g<> n<EFBFBD> rer le graphique de synth<74> se</div> " ;
} else {
?> <img src="./graphs/synthese_graph_linecompare.php?d=<?=$fileName.'-graph-linecompare.tmp'?>" />
< ? php
}
}
2009-05-28 14:40:58 +00:00
?>
< br />< br />
< ? php
2009-04-01 15:42:12 +00:00
}
2009-05-28 14:40:58 +00:00
?>
</ div >
2009-06-17 14:41:41 +00:00
< ? php
2009-05-28 14:40:58 +00:00
} //Fin du cache
$cache -> stopCapture ();
2009-04-01 15:42:12 +00:00
?>