extranet/www/pages/ratios.php
2009-05-29 12:26:11 +00:00

484 lines
18 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
if (!$_SESSION['connected']) die();
$tabInfo = $_SESSION['tabInfo'];
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Paramètres incorrects !');
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; // Si id=0 alors non communiqué
if (($siret*1)==0 && $idEntreprise==0) die('Paramètres incorrects !');
$siren=substr($siret,0,9);
isset($_REQUEST['bilan']) ? $bilan=$_REQUEST['bilan'] : $bilan=0 ;
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
}else{ $fileName = $page2.'-'.$siret; }
$fileName.= '-'.$bilan;
require_once 'cache.php';
$cache = new Cache();
//Forcer la cré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;
}
if ( $cache->startCapture($fileName.'.html') == FALSE){
print $cache->displayCache();
}else{
$ratiosEntrep = array();
$ratiosInfos = array();
$bilansInfos = array();
$rationsEntrepEvol = array();
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'];
print '<!--';
//print_r($ratiosInfos);
print '-->';
}catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
die();
}
require_once 'ratios/functions.php';
?>
<script type="text/javascript" src="./js/jquery.qtip.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#ratios 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('href'),
title: { text: $(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>
<link rel="stylesheet" type="text/css" href="./css/jtip.css" />
<style>
#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; }
#ratios a { color:#000000; cursor:help; }
#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; }
#ratios tr.subhead td { padding: 8px; background: #b9c9fe; border: 1px solid #000; font-weight: bold; color: #000; }
#entete { margin:1px; }
#secteur{ margin-top:10px; }
.qtip-title {font-size:11px;}
.qtip-content {font-size:12px;}
</style>
<div id="container">
<div><img id="entete" src="./img/rub_ratios.png" width="577" height="36"></div>
<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/>
<?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{
$firephp->log($tabInfo,'tabInfo');
?>
<br/><br/>
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Secteur d'activité :</td>
<td width="350" class="StyleInfoData">
<?php print $tabInfo['entrep']['nafEn']; ?> - <?php print $tabInfo['entrep']['nafEnLib']; ?>
</td>
</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">
<?php
$countBilans = 0;
if(count($bilansInfos)>0){
foreach($bilansInfos as $bilanItem){
if(isset($bilanItem['dateCloture'])) {
?>
<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>
<?php
}
$countBilans++;
}
}else{ print '-'; }
?>
</select>
&nbsp;<a href="javascript:document.selectBilan.submit();">Ok</a>
</form>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Durée du bilan</td>
<td width="350" class="StyleInfoData">
<?php
$firephp->log($bilan, 'bilan');
if(isset($bilansInfos[$bilan]['dateCloture'])) {
print $bilansInfos[$bilan]['duree']; ?> mois
<?php }else{ print '-'; } ?>
</td>
</tr>
</table>
<br/><br/>
<table id="ratios">
<tbody>
<tr class="subhead">
<td class="center italique">EQUILIBRE FINANCIER</td>
<td>Entreprise</td>
<td>Secteur</td>
<td>Position</td>
</tr>
<!--
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r231']['commentaires'])?>">FR (FONDS DE ROULEMENT)</a></td>
<td class="right"><?php dRatio($bilan,'r235'); ?></td>
<td class="right"><?php dSecteur($bilan,'r235'); ?></td>
<td class="position"><?php dPosition($bilan,'r235','>'); ?></td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r232']['commentaires'])?>">BFR (Besoin en fonds de roulement)</a></td>
<td class="right"><?php dRatio($bilan,'r236'); ?></td>
<td class="right"><?php dSecteur($bilan,'r236'); ?></td>
<td class="position"><?php dPosition($bilan,'r236','<'); ?></td>
</tr>
-->
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r233']['commentaires'])?>">MARGE BRUTE D'AUTOFINANCEMENT (MBA) ou CAF</a></td>
<td class="right"><?php dRatio($bilan,'r233'); ?></td>
<td class="right"><?php dSecteur($bilan,'r233'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r233')));?>" name="MARGE BRUTE D'AUTOFINANCEMENT (MBA) ou CAF">
<?php dPosition($bilan,'r233','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r234']['commentaires'])?>">COUVERTURE du BFR (FR/BFR)</a></td>
<td class="right"><?php dRatio($bilan,'r234'); ?></td>
<td class="right"><?php dSecteur($bilan,'r234'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r234')));?>" name="COUVERTURE du BFR (FR/BFR)">
<?php dPosition($bilan,'r234','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r237']['commentaires'])?>">COUVERTURE des IMMOS NETTES <br/>capitaux permanents/immobilisations nettes</a></td>
<td class="right"><?php dRatio($bilan,'r237'); ?></td>
<td class="right"><?php dSecteur($bilan,'r237'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r237')));?>" name="COUVERTURE des IMMOS NETTES">
<?php dPosition($bilan,'r237','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r238']['commentaires'])?>">COUVERTURE du CA <br/>fond de roulement net global sur 12m x 360 / chiffre d'affaire</a></td>
<td class="right"><?php dRatio($bilan,'r238'); ?></td>
<td class="right"><?php dSecteur($bilan,'r238'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r238')));?>" name="COUVERTURE du CA">
<?php dPosition($bilan,'r238','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r239']['commentaires'])?>">SOLVABILITE capitaux propres / ensemble des dettes</a></td>
<td class="right"><?php dRatio($bilan,'r239'); ?></td>
<td class="right"><?php dSecteur($bilan,'r239'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r239')));?>" name="SOLVABILITE">
<?php dPosition($bilan,'r239','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r240']['commentaires'])?>">INDEPENDANCE FINANCIERE (Cap.propres/Capitaux permanents)</a></td>
<td class="right"><?php dRatio($bilan,'r240'); ?></td>
<td class="right"><?php dSecteur($bilan,'r240'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r240')));?>" name="INDEPENDANCE FINANCIERE">
<?php dPosition($bilan,'r240','>'); ?>
</a>
</td>
</tr>
<tr class="subhead">
<td class="center italique">PROFITABILITE</td>
<td>Entreprise</td>
<td>Secteur</td>
<td>Position</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r262']['commentaires'])?>">RENTABILITE ECONOMIQUE (EBE/TOTAL bilan)</a></td>
<td class="right"><?php dRatio($bilan,'r262'); ?></td>
<td class="right"><?php dSecteur($bilan,'r262'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r262')));?>" name="RENTABILITE ECONOMIQUE">
<?php dPosition($bilan,'r262','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r263']['commentaires'])?>">RENTABILITE FINANCIERE (Résult.Net/Cap.propres)</a></td>
<td class="right"><?php dRatio($bilan,'r263'); ?></td>
<td class="right"><?php dSecteur($bilan,'r263'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r263')));?>" name="RENTABILITE FINANCIERE">
<?php dPosition($bilan,'r263','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r264']['commentaires'])?>">RENTABILITE COMMERCIALE (résultat net/CA)</a></td>
<td class="right"><?php dRatio($bilan,'r264'); ?></td>
<td class="right"><?php dSecteur($bilan,'r264'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r264')));?>" name="RENTABILITE COMMERCIALE">
<?php dPosition($bilan,'r264','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r265']['commentaires'])?>">CONTRIBUTION DU CAPITAL<br/>Capacité d'autofinancement sur 12 mois / capitaux permanents</a></td>
<td class="right"><?php dRatio($bilan,'r265'); ?></td>
<td class="right"><?php dSecteur($bilan,'r265'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r265')));?>" name="CONTRIBUTION DU CAPITAL">
<?php dPosition($bilan,'r265','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r266']['commentaires'])?>">CONTRIBUTION DE LA VA<br/>capacité d'autofinancement / valeur ajoutée</a></td>
<td class="right"><?php dRatio($bilan,'r266'); ?></td>
<td class="right"><?php dSecteur($bilan,'r266'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r266')));?>" name="CONTRIBUTION DE LA VA">
<?php dPosition($bilan,'r266','>'); ?>
</a>
</td>
</tr>
<tr class="subhead">
<td class="center italique">LIQUIDITE</td>
<td>Entreprise</td>
<td>Secteur</td>
<td>Position</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r250']['commentaires'])?>">LIQUIDITE IMMEDIATE : (Disponibilité/Dettes CT)</a></td>
<td class="right"><?php dRatio($bilan,'r250'); ?></td>
<td class="right"><?php dSecteur($bilan,'r250'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r250')));?>" name="LIQUIDITE IMMEDIATE">
<?php dPosition($bilan,'r250','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r251']['commentaires'])?>">LIQUIDITE GENERALE : (Act.circulant net/Dettes CT)</a></td>
<td class="right"><?php dRatio($bilan,'r251'); ?></td>
<td class="right"><?php dSecteur($bilan,'r251'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r251')));?>" name="LIQUIDITE GENERALE">
<?php dPosition($bilan,'r251','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r252']['commentaires'])?>">LIQUIDITE REDUITE: Disponibilité et créances réelles /Dettes CT)</a></td>
<td class="right"><?php dRatio($bilan,'r252'); ?></td>
<td class="right"><?php dSecteur($bilan,'r252'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r252')));?>" name="LIQUIDITE REDUITE">
<?php dPosition($bilan,'r252','>'); ?>
</a>
</td>
</tr>
<tr class="subhead">
<td class="center italique">ENDETTEMENT</td>
<td>Entreprise</td>
<td>Secteur</td>
<td class="position">Position</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r244']['commentaires'])?>">ENDETTEMENT (dettes a + 1 an / capitaux propres)</a></td>
<td class="right"><?php dRatio($bilan,'r244'); ?></td>
<td class="right"><?php dSecteur($bilan,'r244'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r244')));?>" name="ENDETTEMENT">
<?php dPosition($bilan,'r244','<'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r247']['commentaires'])?>">CAPACITE DE REMBOURSEMENT (Dettes.bancaires.(+MT+LT+C.bail)/CAF)</a></td>
<td class="right"><?php dRatio($bilan,'r247'); ?></td>
<td class="right"><?php dSecteur($bilan,'r247'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r247')));?>" name="CAPACITE DE REMBOURSEMENT">
<?php dPosition($bilan,'r247','<'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r248']['commentaires'])?>">FINANCEMENT DES STOCKS (dettes aux fournisseurs / stock)</a></td>
<td class="right"><?php dRatio($bilan,'r248'); ?></td>
<td class="right"><?php dSecteur($bilan,'r248'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r248')));?>" name="FINANCEMENT DES STOCKS">
<?php dPosition($bilan,'r248','<'); ?>
</a>
</td>
</tr>
<tr class="subhead">
<td class="center italique">PRODUCTIVITE</td>
<td>Entreprise</td>
<td>Secteur</td>
<td>Position</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r271']['commentaires'])?>">PRODUCTIVITE DE L'ACTIF<br/>chiffre d'affaire/actif comptable</a></td>
<td class="right"><?php dRatio($bilan,'r271'); ?></td>
<td class="right"><?php dSecteur($bilan,'r271'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r271')));?>" name="PRODUCTIVITE DE L'ACTIF">
<?php dPosition($bilan,'r271','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r278']['commentaires'])?>">DUREE CLIENT (Rotation clients en VJ TTC)</a></td>
<td class="right"><?php dRatio($bilan,'r278'); ?></td>
<td class="right"><?php dSecteur($bilan,'r278'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r278')));?>" name="DUREE CLIENT">
<?php dPosition($bilan,'r278','<'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r279']['commentaires'])?>">DUREE FOURNISSEUR (Rotation fournisseurs en JA TTC)</a></td>
<td class="right"><?php dRatio($bilan,'r279'); ?></td>
<td class="right"><?php dSecteur($bilan,'r279'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r279')));?>" name="DUREE FOURNISSEUR">
<?php dPosition($bilan,'r279','<'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r281']['commentaires'])?>">POIDS MASSE SALARIALE (Ch personnel/VA)</a></td>
<td class="right"><?php dRatio($bilan,'r281'); ?></td>
<td class="right"><?php dSecteur($bilan,'r281'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r281')));?>" name="POIDS MASSE SALARIALE">
<?php dPosition($bilan,'r281','<'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r261']['commentaires'])?>">RENDEMENT (Production sur 12mois / effectif)</a></td>
<td class="right"><?php dRatio($bilan,'r261'); ?></td>
<td class="right"><?php dSecteur($bilan,'r261'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r261')));?>" name="RENDEMENT">
<?php dPosition($bilan,'r261','>'); ?>
</a>
</td>
</tr>
<tr>
<td><a tooltip="<?=wrapComment($ratiosInfos['r267']['commentaires'])?>">PRODUCTIVITE <br/>(CA/effectif)</a></td>
<td class="right"><?php dRatio($bilan,'r267'); ?></td>
<td class="right"><?php dSecteur($bilan,'r267'); ?></td>
<td class="position">
<a class="jTip" href="./pages/ratios_dgraph.php?width=375&data=<?=urlencode(serialize(dGraph('r267')));?>" name="PRODUCTIVITE">
<?php dPosition($bilan,'r267','>'); ?>
</a>
</td>
</tr>
</tbody>
</table> 
<?php
}
?>
<br/>
<br/>
</div>
<?php
}//Fin du cache
$cache->stopCapture();
?>