2009-05-28 14:40:58 +00:00
|
|
|
|
<?php
|
2009-06-15 14:52:23 +00:00
|
|
|
|
|
|
|
|
|
require_once realpath(dirname(__FILE__)).'/functions.php';
|
|
|
|
|
|
2009-06-12 16:48:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* Retourne un tableau de donn<EFBFBD>es format<EFBFBD>s pour les graphiques.
|
|
|
|
|
* @param array $bilansInfo
|
|
|
|
|
* Le tableau des bilans
|
|
|
|
|
* @param array $ratiosEntrep
|
|
|
|
|
* Le tableau des ratios entreprise
|
|
|
|
|
* @param array $tabRatioGraph
|
|
|
|
|
* Un tableau des ratios <EFBFBD> utiliser pour le graphique g<EFBFBD>n<EFBFBD>ral
|
|
|
|
|
* @param array $tabRatioGraphEvol
|
|
|
|
|
* Un tableau des ratios <EFBFBD> utiliser pour les graphiques d'<EFBFBD>volution
|
|
|
|
|
* @return array
|
2009-06-15 14:52:23 +00:00
|
|
|
|
* Retourne un tableau structur<EFBFBD> compos<EFBFBD> de dataGraph, et de dataEvol.
|
2009-06-18 13:22:31 +00:00
|
|
|
|
*/
|
2009-06-15 14:52:23 +00:00
|
|
|
|
function synthese_datagraph($bilansInfos, $ratiosEntrep, $tabRatioGraph, $tabRatioGraphEvol){
|
2009-06-16 07:47:53 +00:00
|
|
|
|
global $firephp;
|
2009-06-15 14:52:23 +00:00
|
|
|
|
$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'];
|
|
|
|
|
foreach($tabRatioGraph as $item){
|
|
|
|
|
$dataGraph[$i][$item['ratio']] = $ratiosEntrep[$i][$item['ratio']]/$item['op'];
|
2009-06-18 13:22:31 +00:00
|
|
|
|
}
|
2009-06-15 14:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
//Donn<6E>es pour les graphiques <20>volutions
|
|
|
|
|
if(isset($bilansInfos[$nbrAnnees-$i]['dateCloture'])){
|
2009-06-16 07:47:53 +00:00
|
|
|
|
foreach($tabRatioGraphEvol as $ratio => $info){
|
|
|
|
|
$dataEvol[$ratio][] = array(
|
2009-06-15 14:52:23 +00:00
|
|
|
|
'date'=>$bilansInfos[$nbrAnnees-$i]['dateCloture'],
|
2009-06-16 07:47:53 +00:00
|
|
|
|
'value'=>(($ratiosEntrep[$nbrAnnees-$i][$ratio]!='NS') ? $ratiosEntrep[$nbrAnnees-$i][$ratio]/$info['op'] : 0 )
|
2009-06-15 14:52:23 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-06-18 13:22:31 +00:00
|
|
|
|
$i++;
|
|
|
|
|
}
|
2009-06-15 14:52:23 +00:00
|
|
|
|
return array("graph" => $dataGraph, "evol" => $dataEvol);
|
|
|
|
|
}
|
2009-05-28 14:40:58 +00:00
|
|
|
|
|
|
|
|
|
|
2009-06-15 14:52:23 +00:00
|
|
|
|
/**
|
|
|
|
|
* Formatte cha<EFBFBD>ne contenant la date format<EFBFBD>.
|
|
|
|
|
* @param array $bilansInfo
|
|
|
|
|
* Le tableau des bilans
|
|
|
|
|
* @param array $nAnnee
|
|
|
|
|
* Le num<EFBFBD>ro de l'ann<EFBFBD>e
|
|
|
|
|
* @return string
|
|
|
|
|
* Retourne la date format<EFBFBD>.
|
2009-06-18 13:22:31 +00:00
|
|
|
|
*/
|
2009-06-15 14:52:23 +00:00
|
|
|
|
function synthese_formatdateCloture($bilansInfos, $nAnnee){
|
|
|
|
|
if(isset($bilansInfos[$nAnnee]['dateCloture'])) {
|
|
|
|
|
print substr($bilansInfos[$nAnnee]['dateCloture'],6,2).'/'.substr($bilansInfos[$nAnnee]['dateCloture'],4,2).'/'.substr($bilansInfos[$nAnnee]['dateCloture'],0,4).'<br/>'.$bilansInfos[$nAnnee]['duree'].' mois';
|
|
|
|
|
}else{ print '-'; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2009-06-18 13:22:31 +00:00
|
|
|
|
* Retourne une cha<EFBFBD>ne contenant les ligne d'un tableau html.
|
2009-06-15 14:52:23 +00:00
|
|
|
|
* @param array $ratiosInfos
|
2009-06-18 13:22:31 +00:00
|
|
|
|
* Le tableau des informations ratios
|
2009-06-15 14:52:23 +00:00
|
|
|
|
* @param array $dataEvol
|
|
|
|
|
* Le tableau des donn<EFBFBD>es <EFBFBD>volution
|
|
|
|
|
* @param array $tabRatio
|
2009-06-18 13:22:31 +00:00
|
|
|
|
* Un tableau des ratios <EFBFBD> utiliser pour g<EFBFBD>n<EFBFBD>rer les lignes
|
2009-06-15 14:52:23 +00:00
|
|
|
|
* @return string
|
|
|
|
|
* Retourne une cha<EFBFBD>ne.
|
2009-06-18 13:22:31 +00:00
|
|
|
|
*/
|
|
|
|
|
function synthese_tablerow($ratiosInfos, $dataEvol, $tabRatio){
|
2009-06-16 07:47:53 +00:00
|
|
|
|
global $firephp;
|
2009-06-15 14:52:23 +00:00
|
|
|
|
$row = '';
|
|
|
|
|
foreach($tabRatio as $ratio => $info){
|
|
|
|
|
$row.= '<tr>'."\n".
|
2009-06-18 13:22:31 +00:00
|
|
|
|
' <td class="head"><a tooltip="'.wrapComment($ratiosInfos[$ratio]['commentaires']).'">'.$info['titre'].'</a></td>'."\n".
|
2009-06-15 14:52:23 +00:00
|
|
|
|
' <td class="right">'.dRatio(2,$ratio).'</td>'."\n".
|
|
|
|
|
' <td class="right">'.dRatio(1,$ratio).'</td>'."\n".
|
|
|
|
|
' <td class="right">'.dEvol(1,$info['evol']).'</td>'."\n".
|
|
|
|
|
' <td class="right">'.dRatio(0,$ratio).'</td>'."\n".
|
|
|
|
|
' <td class="right">'.dEvol(0,$info['evol']).'</td>'."\n";
|
2009-06-18 13:22:31 +00:00
|
|
|
|
|
|
|
|
|
if(count($tabRatio)!=1){
|
|
|
|
|
$class = 'class="jTip"';
|
|
|
|
|
$href='/?page=synthese&siret='.$_REQUEST['siret'].'&idEntreprise='.$_REQUEST['idEntreprise'].'&ratio='.$ratio;
|
|
|
|
|
$rel=synthese_graphEvol($dataEvol[$ratio]);
|
2009-06-15 14:52:23 +00:00
|
|
|
|
}else{
|
2009-06-18 13:22:31 +00:00
|
|
|
|
$class = '';
|
|
|
|
|
$href='#';
|
|
|
|
|
$ref='';
|
|
|
|
|
}
|
|
|
|
|
$row.= ' <td><a '.$class.' href="'.$href.'" rel="'.$rel;
|
|
|
|
|
if(isset($info['unite']) && $info['unite']==1){
|
|
|
|
|
$row.= '&unite='.$ratiosInfos[$info['evol']]['unite'];
|
2009-06-15 14:52:23 +00:00
|
|
|
|
}
|
2009-06-18 13:22:31 +00:00
|
|
|
|
$row.= '" name="'.$info['titre'].'"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>'."\n";
|
|
|
|
|
$row.= '</tr>'."\n";
|
2009-06-15 14:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
return $row;
|
|
|
|
|
}
|
2009-05-28 14:40:58 +00:00
|
|
|
|
|
2009-06-18 13:22:31 +00:00
|
|
|
|
/**
|
|
|
|
|
* Retourne l'url de la page d'appel du graphique avec tous ces param<EFBFBD>tres.
|
|
|
|
|
* @param array $data
|
|
|
|
|
* Les donn<EFBFBD>es du tableau
|
|
|
|
|
* @return string
|
|
|
|
|
* Retourne une cha<EFBFBD>ne.
|
|
|
|
|
*/
|
|
|
|
|
function synthese_graphEvol($data, $img = FALSE){
|
|
|
|
|
$url = './pages/synthese_dgraph.php';
|
|
|
|
|
$width = 375;
|
|
|
|
|
$data = urlencode(serialize($data));
|
|
|
|
|
return $url.'?width='.$width.'&data='.$data;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-16 07:47:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Retourne une cha<EFBFBD>ne contenant la ligne d'un tableau html.
|
|
|
|
|
* @param array $ratiosInfos
|
|
|
|
|
* Le tableau des information ratios
|
|
|
|
|
* @param array $dataEvol
|
|
|
|
|
* Le tableau des donn<EFBFBD>es <EFBFBD>volution
|
|
|
|
|
* @param array $tabRatio
|
|
|
|
|
* Un tableau des ratios <EFBFBD> utiliser pour le g<EFBFBD>n<EFBFBD>rer les lignes
|
|
|
|
|
* @return string
|
|
|
|
|
* Retourne une cha<EFBFBD>ne.
|
2009-06-18 13:22:31 +00:00
|
|
|
|
*/
|
|
|
|
|
function ratios_tablerow($ratiosInfos, $tabRatio, $bilan, $ratio = ''){
|
|
|
|
|
|
2009-06-16 07:47:53 +00:00
|
|
|
|
foreach($tabRatio as $item){
|
2009-06-18 13:22:31 +00:00
|
|
|
|
if($ratio==''){
|
2009-06-16 07:47:53 +00:00
|
|
|
|
if(isset($item['ratio'])){
|
2009-06-18 13:22:31 +00:00
|
|
|
|
$row.= '<tr>'."\n";
|
|
|
|
|
$row.= ' <td><a tooltip="'.wrapComment($ratiosInfos[$item['ratio']]['commentaires']).'">'.$item['titre'].'<br/>'.$item['stitre'].'</a></td>'."\n";
|
|
|
|
|
$row.= ' <td class="right">'.dRatio($bilan,$item['ratio']).'</td>'."\n";
|
|
|
|
|
$row.= ' <td class="right">'.dSecteur($bilan,$item['ratio']).'</td>'."\n";
|
|
|
|
|
$row.= ' <td class="position">';
|
|
|
|
|
$row.= '<a class="jTip" href="/?page=ratios&siret='.$_REQUEST['siret'].'&idEntreprise='.$_REQUEST['idEntreprise'].'&ratio='.$item['ratio'].'" rel="./pages/ratios_dgraph.php?width=375&data='.urlencode(serialize(dGraph($item['ratio']))).'" name="'.$item['titre'].'">'."\n";
|
|
|
|
|
$row.= dPosition($bilan,$item['ratio'],'>');
|
|
|
|
|
$row.= '</a>';
|
|
|
|
|
$row.= '</td>'."\n";
|
|
|
|
|
$row.= '</tr>'."\n";
|
2009-06-16 07:47:53 +00:00
|
|
|
|
}else{
|
2009-06-18 13:22:31 +00:00
|
|
|
|
$row.= '<tr class="subhead">'."\n";
|
|
|
|
|
$row.= ' <td class="center italique">'.$item['titre'].'</td>'."\n";
|
|
|
|
|
$row.= ' <td>Entreprise</td>'."\n";
|
|
|
|
|
$row.= ' <td>Secteur</td>'."\n";
|
|
|
|
|
$row.= ' <td>Position</td>'."\n";
|
|
|
|
|
$row.= '</tr>'."\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}elseif($ratio==$item['ratio']){
|
2009-06-16 07:47:53 +00:00
|
|
|
|
$row.= '<tr class="subhead">'."\n".
|
|
|
|
|
' <td class="center italique">'.$tabRatio[$item['parent']]['titre'].'</td>'."\n".
|
|
|
|
|
' <td>Entreprise</td>'."\n".
|
|
|
|
|
' <td>Secteur</td>'."\n".
|
|
|
|
|
' <td>Position</td>'."\n".
|
2009-06-18 13:22:31 +00:00
|
|
|
|
'</tr>'."\n";
|
2009-06-16 07:47:53 +00:00
|
|
|
|
$row.= '<tr>'."\n".
|
|
|
|
|
' <td><a tooltip="'.wrapComment($ratiosInfos[$item['ratio']]['commentaires']).'">'.$item['titre'].'<br/>'.$item['stitre'].'</a></td>'."\n".
|
|
|
|
|
' <td class="right">'.dRatio($bilan,$item['ratio']).'</td>'."\n".
|
|
|
|
|
' <td class="right">'.dSecteur($bilan,$item['ratio']).'</td>'."\n".
|
|
|
|
|
' <td class="position">'."\n".
|
2009-06-18 13:22:31 +00:00
|
|
|
|
' <a href="#" name="'.$item['titre'].'">'."\n".
|
2009-06-16 07:47:53 +00:00
|
|
|
|
dPosition($bilan,$item['ratio'],'>')."\n".
|
|
|
|
|
' </a>'."\n".
|
|
|
|
|
' </td>'."\n".
|
|
|
|
|
'</tr>'."\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $row;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-05-28 14:40:58 +00:00
|
|
|
|
?>
|