138 lines
4.7 KiB
PHP
138 lines
4.7 KiB
PHP
<?php
|
|
if (!$_SESSION['connected']) die();
|
|
|
|
$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['ratio'])? $ratio=$_REQUEST['ratio'] : $ratio='';
|
|
isset($_REQUEST['type']) ? $typeBilan=$_REQUEST['type'] : $typeBilan='' ;
|
|
|
|
require_once 'cache/cache.php';
|
|
require_once 'ratios/ratios.php';
|
|
require_once 'scoresws/scoresws.php';
|
|
|
|
$result = scoresws_synthese($siret, $siren, $idEntreprise);
|
|
$bilansInfos = $result['bilansInfos'];
|
|
$ratiosInfos = $result['ratiosInfos'];
|
|
$ratiosEntrep = $result['ratiosEntrep'];
|
|
$ratiosEntrepEvol = $result['ratiosEntrepEvol'];
|
|
|
|
$firephp->log($bilansInfos, 'bilansInfos');
|
|
list($typeBilan, $numBilan) = countBilans($bilansInfos, $typeBilan);
|
|
$numBilanN = $numBilan['N'];
|
|
$numBilanC = $numBilan['C'];
|
|
$numBilanB = $numBilan['B'];
|
|
$numBilanA = $numBilan['A'];
|
|
list($bilansInfos, $ratiosEntrep, $ratiosEntrepEvol, $dataActif, $dataPassif, $dataSIG) = filtreTypeBilans($bilansInfos, $ratiosEntrep, $ratiosEntrepEvol, array(), array(), array(), $typeBilan);
|
|
$nbrAnnees = count($bilansInfos)-1;
|
|
$data = synthese_datagraph($bilansInfos, $ratiosEntrep, $ratio);
|
|
$dataGraph = $data['graph'];
|
|
$dataEvol = $data['evol'];
|
|
|
|
?>
|
|
<div id="center">
|
|
<h1>SYNTHÈSE</h1>
|
|
|
|
<table width="570" border="0" align="left" bgcolor="#FFFFFF">
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Numé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"> </td>
|
|
<td width="200" class="StyleInfoLib">Raison Sociale</td>
|
|
<td width="340" class="StyleInfoData"><?=$_SESSION['tabInfo']['entrep']['raisonSociale'];?></td>
|
|
</tr>
|
|
<?php
|
|
if ( $numBilanN>0 || $numBilanC>0 )
|
|
{
|
|
?>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Type de bilans</td>
|
|
<td width="340" class="StyleInfoData">
|
|
<?php if($numBilanN>0 && $numBilanC>0){ ?><input type="radio" name="typeBilan" value="index.php?page=<?=$page?>&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&type=N" <?=($typeBilan=='N')? 'checked' : '';?>/><label>Réel normal ou Simplifié</label><?php }?>
|
|
<?php if($numBilanN>0 && $numBilanC>0){ ?><input type="radio" name="typeBilan" value="index.php?page=<?=$page?>&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&type=C" <?=($typeBilan=='C')? 'checked' : '';?>/><label>Consolidé</label><?php }?>
|
|
<?php if($numBilanN>0 && $numBilanC==0){ ?>Réel normal ou Simplifié<?php }?>
|
|
<?php if($numBilanN==0 && $numBilanC>0){ ?>Consolidé<?php }?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
<?php
|
|
if ($numBilanN==0 && $numBilanC==0 && $numBilanB==0 && $numBilanA==0)
|
|
{
|
|
?>
|
|
<table>
|
|
<tr><td width="30"> </td><td><b>Aucun bilan disponible pour cette entreprise !</b></td></tr>
|
|
</table>
|
|
<?php
|
|
}
|
|
elseif($numBilanN==0 && $numBilanC==0 && ($numBilanB>0 || $numBilanA>0) )
|
|
{
|
|
?>
|
|
<table>
|
|
<tr><td width="30"> </td><td><b>Bilan de banque/assurance non gérés</b></td></tr>
|
|
</table>
|
|
<?php
|
|
}
|
|
else
|
|
{
|
|
?>
|
|
<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"><?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> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
//TODO : Afficher ligne par ligne les éléments
|
|
print synthese_tablerow($ratiosInfos, $dataEvol, $ratio);
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<br/>
|
|
<?php
|
|
//Affichage du graphique associé au ratio sélectionné
|
|
if(count($tabRatio)==1){ ?>
|
|
<div id="titreEvol"><b>Evolution</b></div>
|
|
<?php
|
|
|
|
if( ($siret*1)==0 || ($siren*1)<100 ){ $fileName = 'synthese-'.$idEntreprise;}
|
|
else{ $fileName = 'synthese-'.$siret; }
|
|
if($ratio!=''){ $fileName.='-'.$ratio; }
|
|
if(count($dataEvol[$ratio])<=1){
|
|
print "Les informations sont insuffisantes pour générer la courbe d'évolution";
|
|
}else{?>
|
|
<img id="imgEvol" src="./imgcache/<?=$fileName.'.png'?>" />
|
|
<?php
|
|
}
|
|
//Affichage du graphique général
|
|
}else{
|
|
if(count($dataGraph)<=1){
|
|
print '<div id="graphInfo">Les informations sont insuffisantes pour générer le graphique de synthèse</div>';
|
|
}else{
|
|
print synthese_graph_linecompare($dataGraph);
|
|
}
|
|
}
|
|
?>
|
|
<br/><br/>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|