2009-09-01 07:12:17 +00:00
< script type = " text/javascript " src = " ../js/synthese_perso_img.js " ></ script >
< script type = " text/javascript " >
2009-09-01 09:18:11 +00:00
function changeCouleur ( nouvelleCouleur , cnt ) {
2009-09-01 07:12:17 +00:00
elem = document . getElementById ( " idColor " + cnt );
elem . style . backgroundColor = nouvelleCouleur ;
}
2009-09-01 09:18:11 +00:00
function changeStyle ( nouveauStyle , cnt ) {
document . images [ " idStyle " + cnt ] . src = 'img/ratios/' + nouveauStyle + '.png' ;
2009-09-01 07:12:17 +00:00
document . images [ " idStyle " + cnt ] . alt = nouveauStyle ;
}
</ script >
< ? php
if ( ! $_SESSION [ 'connected' ]) die ();
/*
* Si on recharge la page
*/
if ( isset ( $_SESSION [ 'imgcache' ])) { // Si la session exite
2009-09-01 09:18:11 +00:00
if (( file_exists ( PATH_SITE . '/cache/imgcache/' . $_SESSION [ 'imgcache' ]))) { // Si le fichier existe
@ unlink ( PATH_SITE . '/cache/imgcache/' . $_SESSION [ 'imgcache' ]); // On supprime le fichier
2009-09-01 07:12:17 +00:00
}
unset ( $_SESSION [ 'imgcache' ]); // On d<> truit la session
$_SESSION [ 'graphperso' ] -> init (); // On vide le graphe
}
require_once 'cache/cache.php' ;
require_once 'ratios/ratios.php' ;
$siret = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'siret' ]));
2009-09-01 09:18:11 +00:00
if ( strlen ( $siret ) <> 0 && strlen ( $siret ) <> 9 && strlen ( $siret ) <> 14 ) die ( 'Param<61> tres incorrects !' );
2009-09-01 07:12:17 +00:00
$idEntreprise = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'idEntreprise' ])) * 1 ; // Si id=0 alors non communiqué
2009-09-01 09:18:11 +00:00
if (( $siret * 1 ) == 0 && $idEntreprise == 0 ) die ( 'Param<61> tres incorrects !' );
2009-09-01 07:12:17 +00:00
$siren = substr ( $siret , 0 , 9 );
isset ( $_REQUEST [ 'ratio' ]) ? $ratio = $_REQUEST [ 'ratio' ] : $ratio = '' ;
if (( $siret * 1 ) == 0 || ( $siren * 1 ) < 100 ){ $fileName = $page2 . '-' . $idEntreprise ;
} else { $fileName = $page2 . '-' . $siret ; }
$ratiosEntrep = array ();
$ratiosInfos = array ();
$bilansInfos = array ();
$rationsEntrepEvol = array ();
try {
$O = $client -> getRatios ( $siren , 'synthese' );
$bilansInfos = $O [ 'result' ][ 'BilansInfos' ];
$ratiosInfos = $O [ 'result' ][ 'RatiosInfos' ];
$ratiosEntrep = $O [ 'result' ][ 'RatiosEntrep' ];
$ratiosEntrepEvol = $O [ 'result' ][ 'RatiosEntrepEvol' ];
} catch ( SoapFault $fault ) {
require_once 'soaperror.php' ;
processSoapFault ( $client , $fault , $_SESSION [ 'tabInfo' ]);
die ();
}
//Liste des ratios <20> <> afficher
$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' ),
'r24' => array ( 'evol' => 'r24' , 'op' => 1 , 'titre' => 'EFFECTIF' , 'unite' => 1 ),
);
/******************************************
* Fonction *
*****************************************/
function Date_to_DateFr ( $Date ){
if ( ! empty ( $Date ))
{
$jour = substr ( $Date , 6 , 2 );
$mois = substr ( $Date , 4 , 2 );
$annee = substr ( $Date , 0 , 4 );
$Date_to_DateFr = $jour . " / " . $mois . " / " . $annee ;
}
return $Date_to_DateFr ;
}
function synthese_datagraph_perso ( $bilansInfos , $ratiosEntrep , $tabRatioGraph , $tabRatioGraphEvol ){
global $firephp ;
$dataGraph = array ();
$dataEvol = array ();
$nbrAnnees = count ( $bilansInfos ) - 1 ;
$i = 0 ;
foreach ( $bilansInfos as $dateCloture ){
//Donn<6E> es pour le graphique
if ( isset ( $dateCloture [ 'dateCloture' ])){
$dataGraph [ $i ][ 'date' ] = $dateCloture [ 'dateCloture' ];
$dataGraph [ $i ][ 'duree' ] = $dateCloture [ 'duree' ];
}
//Donn<6E> es pour les graphiques <20> volutions
if ( isset ( $bilansInfos [ $nbrAnnees - $i ][ 'dateCloture' ])){
foreach ( $tabRatioGraphEvol as $ratio => $info ){
$dataEvol [ $ratio ][] = array (
'date' => $bilansInfos [ $nbrAnnees - $i ][ 'dateCloture' ],
'value' => (( $ratiosEntrep [ $nbrAnnees - $i ][ $ratio ] != 'NS' ) ? $ratiosEntrep [ $nbrAnnees - $i ][ $ratio ] / $info [ 'op' ] : 0 )
);
}
}
$i ++ ;
}
return array ( " graph " => $dataGraph , " evol " => $dataEvol );
}
$data = synthese_datagraph_perso ( $bilansInfos , $ratiosEntrep , $tabRatioGraph , $tabRatio );
$dataGraph = $data [ 'graph' ];
$dataEvol = $data [ 'evol' ];
//$firephp->log($dataEvol, 'evol');
?>
< script type = " text/javascript " src = " ./js/jquery.qtip.js " ></ script >
< script type = " text/javascript " >
$ ( document ) . ready ( function ()
{
$ ( '#synthese a[tooltip]' ) . each ( function ()
{
$ ( this ) . qtip ({
content : $ ( this ) . attr ( 'tooltip' ),
style : { width : 500 , name : 'dark' },
position : { corner : { target : 'bottomMiddle' , tooltip : 'topMiddle' } }
});
});
$ ( '.jTip' ) . each ( function ()
{
$ ( this ) . qtip (
{
content : {
text : 'Chargement...' ,
url : $ ( this ) . attr ( 'rel' ),
title : { text : 'Evolution - ' + $ ( this ) . attr ( 'name' )}
},
position : {
corner : {
target : 'leftMiddle' ,
tooltip : 'rightMiddle'
}
},
show : { solo : true },
style : {
tip : true ,
border : { width : 1 , radius : 0 },
name : 'light' ,
width : 400
}
})
});
});
</ script >
< style >
#synthese { clear:both; font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size: 12px; margin: 10px 0 0 0; width:100%; 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 ;}
#titreEvol {margin:0 130px;}
#imgEvol {margin:0 100px;}
</ style >
< div id = " center " >
< h1 > SYNTH & Egrave ; SE </ h1 >
< table width = " 570 " 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 = " 340 " 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 = " 340 " class = " StyleInfoData " >< ? = $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'raisonSociale' ]; ?> </td>
</ tr >
</ table >
< ? php
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 >
< ? php
}
else
{
2009-09-01 09:18:11 +00:00
$tab_dateCloture = array ( Date_to_DateFr ( $bilansInfos [ 2 ][ 'dateCloture' ]), Date_to_DateFr ( $bilansInfos [ 1 ][ 'dateCloture' ]), Date_to_DateFr ( $bilansInfos [ 0 ][ 'dateCloture' ]));
2009-09-01 07:12:17 +00:00
?>
< p >< a href = " Javascript:; " onClick = " vider('vide'); " > Vider le graphe </ a ></ p >
< table id = " synthese " >
< thead >
< tr >
< 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>
< th class = " date " >< ? = $tab_dateCloture [ 0 ] . " <br /> " . $bilansInfos [ 2 ][ 'duree' ] . " mois " ; ?> </th>
< th class = " date " >< ? = $tab_dateCloture [ 1 ] . " <br /> " . $bilansInfos [ 1 ][ 'duree' ] . " mois " ; ?> </th>
< th class = " date " >< ? = $tab_dateCloture [ 2 ] . " <br /> " . $bilansInfos [ 0 ][ 'duree' ] . " mois " ; ?> </th>
< th class = " date " align = " center " > Actions </ th >
< th class = " date " align = " center " > Couleur </ th >
< th class = " date " align = " center " > Style </ th >
</ tr >
</ thead >
< tbody >
< ? php
//print synthese_tablerow($ratiosInfos, $dataEvol, $tabRatio)
$ligne_style = array ( 'Line' , 'DashLine' , 'DotLine' , 'DotDashLine' , 'AltDashLine' , 'Line' , 'DashLine' , 'DotLine' , 'DotDashLine' );
$color = array ( '#ff0000' , '#3333ff' , '#000000' , '#808080' , '#333366' , '#c3c3e6' , '#8080ff' , '#80ff80' , '#ff8080' );
$j = 0 ;
foreach ( $tabRatio as $ratio => $info ) {
2009-09-01 09:18:11 +00:00
2009-09-01 07:12:17 +00:00
$comment = empty ( $ratiosInfos [ $ratio ][ 'commentaires' ]) ? " " : " tooltip= \" " . wrapComment ( $ratiosInfos [ $ratio ][ 'commentaires' ]) . " \" " ;
2009-09-01 09:18:11 +00:00
$tab_chiffre = array ( dRatio ( 2 , $ratio ), dRatio ( 1 , $ratio ), dRatio ( 0 , $ratio ));
2009-09-01 07:12:17 +00:00
$chaine_date_cloture = $tab_dateCloture [ 0 ] . " @ " . $tab_dateCloture [ 1 ] . " @ " . $tab_dateCloture [ 2 ];
$chaine_date_dure = $bilansInfos [ 0 ][ 'duree' ] . " @ " . $bilansInfos [ 1 ][ 'duree' ] . " @ " . $bilansInfos [ 2 ][ 'duree' ];
$chaine_chiffre = $tab_chiffre [ 0 ] . " @ " . $tab_chiffre [ 1 ] . " @ " . $tab_chiffre [ 2 ];
2009-09-01 09:18:11 +00:00
2009-09-01 07:12:17 +00:00
// <span onClick=\"alert(document.getElementById('idColor$j').style.backgroundColor);\">Test</span>
// <span onClick=\"alert(document.images['idStyle$j'].alt);\">Test2</span>
2009-09-01 09:18:11 +00:00
2009-09-01 07:12:17 +00:00
echo " <tr> \n " ;
echo " <td class= \" head \" ><a $comment > " . $info [ 'titre' ] . " </a></td> \n " ;
echo " <td class= \" right \" > " . $tab_chiffre [ 0 ] . " </td> \n " ;
echo " <td class= \" right \" > " . $tab_chiffre [ 1 ] . " </td> \n " ;
echo " <td class= \" right \" > " . $tab_chiffre [ 2 ] . " </td> \n " ;
echo " <td align= \" center \" >
2009-09-01 09:18:11 +00:00
2009-09-01 07:12:17 +00:00
< a href = \ " Javascript:; \" onClick= \" ajouter('ajoute'
, '".$_REQUEST[' siret ']."'
, '".$chaine_date_cloture."'
, '".$chaine_date_dure."'
, '".$chaine_chiffre."'
, '".addslashes($info[' titre '])."'
, '".$info[' evol ']."'
, document . getElementById ( 'idColor$j' ) . style . backgroundColor
, document . images [ 'idStyle$j' ] . alt
2009-09-01 09:18:11 +00:00
); \ " >Ajouter</a>
2009-09-01 07:12:17 +00:00
< a href = \ " Javascript:; \" onClick= \" enlever('enleve', ' " . $info [ 'evol' ] . " '); \" >Enlever</a>
</ td > \n " ;
2009-09-01 09:18:11 +00:00
2009-09-01 07:12:17 +00:00
echo " <td class= \" right \" >
< div id = \ " idColor " . $j . " \" style= \" background-color: " . $color [ $j ] . " ; \" > </div>
< form >
< select name = \ " color \" onchange= \" changeCouleur(this.options[this.selectedIndex].value, ' " . $j . " '); \" >
< option value = \ " #000000 \" >Couleur</option>
< option value = \ " #ff0000 \" >Rouge</option>
< option value = \ " #3333ff \" >Bleu</option>
< option value = \ " #000000 \" >Noire</option>
< option value = \ " #808080 \" >Gris</option>
< option value = \ " #333366 \" >Violet</option>
< option value = \ " #c3c3e6 \" >---</option>
< option value = \ " #8080ff \" >Mauve</option>
< option value = \ " #80ff80 \" >Vert</option>
< option value = \ " #ff8080 \" >Orange</option>
</ select >
</ form >
</ td > \n " ;
echo " <td align= \" center \" >
< form >
< div >< img style = \ " margin-bottom:8px; \" name= \" idStyle " . $j . " \" src= \" img/ratios/ " . $ligne_style [ $j ] . " .png \" alt= \" " . $ligne_style [ $j ] . " \" width= \" 90 \" height= \" 1 \" /></div>
2009-09-01 09:18:11 +00:00
2009-09-01 07:12:17 +00:00
< select name = \ " style \" onchange= \" changeStyle(this.options[this.selectedIndex].value, ' " . $j . " '); \" >
< option value = \ " " . $ligne_style [ $j ] . " \" >Style</option>
< option value = \ " Line \" >Line</option>
< option value = \ " DashLine \" >DashLine</option>
< option value = \ " DotLine \" >DotLine</option>
< option value = \ " DotDashLine \" >DotDashLine</option>
< option value = \ " AltDashLine \" >AltDashLine</option>
</ select >
</ form >
2009-09-01 09:18:11 +00:00
</ td > \n " ;
2009-09-01 07:12:17 +00:00
echo " </tr> \n " ;
2009-09-01 09:18:11 +00:00
$j ++ ;
2009-09-01 07:12:17 +00:00
}
?>
</ tbody >
</ table >
< br />
< ? php
print " <div id= \" img \" >Bla bla bla bla bla bla bla bla bla bla bla bla.</div> " ;
//echo "<pre>";
//print_r($_SESSION['graphperso']);
unset ( $_SESSION [ 'graphperso' ]);
//print_r($bilansInfos);
}
?>
</ div >