extranet/www/pages/synthese.php

204 lines
6.6 KiB
PHP
Raw Normal View History

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);
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
}else{ $fileName = $page2.'-'.$siret; }
2009-03-30 16:27:40 +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
}
if ( $cache->startCapture($fileName.'.html') == FALSE){
print $cache->displayCache();
}else{
2009-03-30 16:27:40 +00:00
$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,$tabInfo);
die();
2009-03-31 14:16:03 +00:00
}
//require_once 'ratios/functions.php';
require_once 'ratios/ratios.php';
//Liste des ratios pour le graphique g<>n<EFBFBD>ral
$tabRatioGraph = array( 0 => array('ratio'=>'r236', 'op' => 1000),
1 => array('ratio'=>'r235', 'op' => 1000),
2 => array('ratio'=>'r6', 'op' => 1000),
3 => array('ratio'=>'r146', 'op' => 1000));
//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),
);
$data = synthese_datagraph($bilansInfos, $ratiosEntrep, $tabRatioGraph, $tabRatio);
$dataGraph = $data['graph'];
$dataEvol = $data['evol'];
$firephp->log($dataEvol, 'evol');
//Cr<43>ation du fichier image
$path = '../cache/';
file_put_contents($path.$fileName.'-graph-linecompare.tmp', serialize($dataGraph));
2009-06-12 16:48:50 +00:00
?>
<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>
<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: 12px;}
ul{list-style: none;}
ul li{padding-top:3px;}
.qtip-title {font-size:11px;}
.qtip-content {font-size:12px;}
</style>
<div id="container">
<div><img id="entete" src="./img/rub_synthese.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>
<?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{
?>
<table id="synthese">
<thead>
<tr>
<th>&nbsp;</th>
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, 2); ?></th>
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, 1); ?></th>
<th class="date">Evolution</th>
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, 0); ?></th>
<th class="date">Evolution</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
print synthese_tablerow($ratiosInfos, $dataEvol, $tabRatio)
?>
</tbody>
</table>
<br/><br/>
<?php
if(count($tabRatio)==1){
}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
}
}
?>
<br/><br/>
<?php
}
?>
</div>
<?php
}//Fin du cache
$cache->stopCapture();
?>