Prise en compte des bons ratios dans rsynthesemin

This commit is contained in:
Michael RICOIS 2009-10-15 14:50:00 +00:00
parent d6abf21c03
commit 3d7c2f51ec
2 changed files with 28 additions and 30 deletions

View File

@ -196,6 +196,19 @@ function dEvol($nAnnee,$nRatio){
}
}
function dTotal($nAnnee, $nRatio, $nTotal)
{
global $ratiosEntrep, $firephp;
$ratio = isset($ratiosEntrep[$nAnnee][$nRatio]) ? $ratiosEntrep[$nAnnee][$nRatio] : 0;
$total = isset($ratiosEntrep[$nAnnee][$nTotal]) ? $ratiosEntrep[$nAnnee][$nTotal] : 0;
$firephp->log($total, 'total');
if($total!=0){
return number_format($ratio*100/$total, 2);
}else{
return '-';
}
}
/**
* Retourne le pourcentage d'un ratio par rapport au total pour les graphiques .
* @param sting $nRatio
@ -390,13 +403,13 @@ function syntheseRatio($ratio)
function syntheseRatioMin()
{
$tabRatio = array(
'r5' => array('evol'=>'r6', 'op' => 1000, 'titre'=>'CHIFFRE D\'AFFAIRES'),
'r16' => array('evol'=>'r17', 'op' => 1000, 'titre'=>'RESULTAT D\'EXPLOITATION'),
'r7' => array('evol'=>'r8', 'op' => 1000, 'titre'=>'RESULTAT COURANT'),
'r10' => array('evol'=>'r11', 'op' => 1000, 'titre'=>'RESULTAT NET'),
'r63' => array('evol'=>'r64', 'op' => 1000, 'titre'=>'TRESORERIE NETTE'),
'r18' => array('evol'=>'r19', 'op' => 1000, 'titre'=>'FONDS PROPRES'),
'r20' => array('evol'=>'r21', 'op' => 1000, 'titre'=>'FRAIS FINANCIER'),
'r5' => array('total'=>'r5', 'total_info'=>'% ca', 'op' => 1000, 'titre'=>'CHIFFRE D\'AFFAIRES'),
'r16' => array('total'=>'r5', 'total_info'=>'% ca', 'op' => 1000, 'titre'=>'RESULTAT D\'EXPLOITATION'),
'r7' => array('total'=>'r5', 'total_info'=>'% ca', 'op' => 1000, 'titre'=>'RESULTAT COURANT'),
'r10' => array('total'=>'r5', 'total_info'=>'% ca', 'op' => 1000, 'titre'=>'RESULTAT NET'),
'r70' => array('total'=>'r22', 'total_info'=>'% bilan', 'op' => 1000, 'titre'=>'FONDS PROPRES'),
'r63' => array('total'=>'', 'total_info'=>'', 'op' => 1000, 'titre'=>'TRESORERIE NETTE'),
'r20' => array('total'=>'r5', 'total_info'=>'% ca', 'op' => 1000, 'titre'=>'FRAIS FINANCIER'),
);
return $tabRatio;
}

View File

@ -364,29 +364,14 @@ function synthese_tablerowmin($ratiosInfos, $dataEvol)
$row = '';
foreach($tabRatio as $ratio => $info)
{
$row.= '<tr>'."\n".
' <td class="head"><a tooltip="'.wrapComment($ratiosInfos[$ratio]['commentaires']).'">'.$info['titre'].'</a></td>'."\n".
' <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";
if(count($tabRatio)!=1){
$class = 'class="sTip"';
$href = '/?page=synthese&siret='.$_REQUEST['siret'].'&idEntreprise='.$_REQUEST['idEntreprise'].'&ratio='.$ratio;
$unite = '';
if(isset($info['unite']) && $info['unite']==1){
$unite = $ratiosInfos[$info['evol']]['unite'];
}
$rel='./pages/synthese_dgraph.php?widht=375&f='.synthese_graphEvol($dataEvol[$ratio], $unite, $ratio, $fileName);
}else{
$class = '';
$href='#';
$ref='';
}
$row.= ' <td><a '.$class.' href="'.$href.'" rel="'.$rel;
$row.= '" name="'.$info['titre'].'"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>'."\n";
$row.= '<tr>'."\n";
$row.= ' <td class="head"><a tooltip="'.wrapComment($ratiosInfos[$ratio]['commentaires']).'">'.$info['titre'].'</a></td>'."\n";
$row.= ' <td class="right">'.dRatio(2,$ratio).'</td>'."\n";
$row.= ' <td class="right">'.dTotal(2,$ratio, $info['total']).' '.$info['total_info'].'</td>'."\n";
$row.= ' <td class="right">'.dRatio(1,$ratio).'</td>'."\n";
$row.= ' <td class="right">'.dTotal(1,$ratio, $info['total']).' '.$info['total_info'].'</td>'."\n";
$row.= ' <td class="right">'.dRatio(0,$ratio).'</td>'."\n";
$row.= ' <td class="right">'.dTotal(0,$ratio, $info['total']).' '.$info['total_info'].'</td>'."\n";
$row.= '</tr>'."\n";
}
return $row;