185 lines
6.0 KiB
PHP
185 lines
6.0 KiB
PHP
<?php
|
|
if (!page_checkParams()) die('Paramètres incorrects !');
|
|
|
|
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_ratios($siret, $siren, $idEntreprise);
|
|
$bilansInfos = $result['bilansInfos'];
|
|
$ratiosInfos = $result['ratiosInfos'];
|
|
$ratiosEntrep = $result['ratiosEntrep'];
|
|
$ratiosEntrepEvol = $result['ratiosEntrepEvol'];
|
|
$ratiosSecteur = $result['ratiosSecteur'];
|
|
|
|
list($typeBilan, $numBilan) = countBilans($bilansInfos, $typeBilan);
|
|
$numBilanN = $numBilan['N'];
|
|
$numBilanC = $numBilan['C'];
|
|
$numBilanB = $numBilan['B'];
|
|
$numBilanA = $numBilan['A'];
|
|
list($bilansInfos, $ratiosEntrep, $ratiosEntrepEvol, $ratiosSecteur, $dataActif, $dataPassif, $dataSIG) = filtreTypeBilans($bilansInfos, $ratiosEntrep, $ratiosEntrepEvol, $ratiosSecteur, 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 border="0">
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Numéro identifiant Siren</td>
|
|
<td width="330" 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="330" class="StyleInfoData"><?=$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="330" 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(!empty($ratio))
|
|
{
|
|
?>
|
|
<div id="titreEvol"><b>Evolution</b></div>
|
|
<?php
|
|
|
|
if( ($siret*1)==0 || ($siren*1)<100 ){ $fileName = 'synthese-'.$idEntreprise;}
|
|
else{ $fileName = 'synthese-'.$siret; }
|
|
$fileName.='-'.$typeBilan.'-'.$ratio;
|
|
|
|
$firephp->log(count($dataEvol), 'dataEvol');
|
|
|
|
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
|
|
}
|
|
// --------------------------------------------------------------------------- //
|
|
// Export
|
|
// --------------------------------------------------------------------------- //
|
|
require_once 'export.php';
|
|
if (isset($siret) == true) {
|
|
$fileName = $page.'-'.$siret;
|
|
} else {
|
|
$fileName = $page.'-'.$idEntreprise;
|
|
}
|
|
|
|
$export = array('siren' => $siren,
|
|
'raisonSociale' => $raisonSociale,
|
|
'type' => $typeBilan);
|
|
$tabRatio = syntheseRatio($ratio);
|
|
foreach ($tabRatio as $ratio => $info) {
|
|
$titre = str_replace(' ', '_', $info['titre']);
|
|
$titre = str_replace('\'', '_', $titre);
|
|
$export[$titre] =
|
|
array(array('date' => $bilansInfos[2]['dateCloture'],
|
|
'duree' => $bilansInfos[2]['duree'],
|
|
'valeur' => dRatio(2, $ratio)),
|
|
array('date' => $bilansInfos[1]['dateCloture'],
|
|
'duree' => $bilansInfos[1]['duree'],
|
|
'valeur' => dRatio(1, $ratio)),
|
|
array('date' => $bilansInfos[0]['dateCloture'],
|
|
'duree' => $bilansInfos[0]['duree'],
|
|
'valeur' => dRatio(0, $ratio)));
|
|
}
|
|
|
|
$parseTab = new tabExport;
|
|
$parseTab->tab = array($export);
|
|
$parseTab->type = array();
|
|
|
|
$array2csv = new ExportCSV;
|
|
$array2csv->records = $parseTab->convertTable();
|
|
$array2csv->writeCSV($fileName);
|
|
$array2xml = new ExportXML;
|
|
|
|
$array2xml->rootName = $page;
|
|
$array2xml->defaultTagName = 'elem';
|
|
$array2xml->records = $export;
|
|
$array2xml->writeXML($fileName);
|
|
|
|
require_once 'cgu/cgu.php';
|
|
print '<p class="confidentiel blockh2">'.afficheCgu();
|
|
?>
|
|
</p>
|
|
</div>
|