261 lines
7.8 KiB
PHP
261 lines
7.8 KiB
PHP
<?php
|
||
if (!page_checkParams()) die('Paramètres incorrects !');
|
||
|
||
isset($_REQUEST['type']) ? $typeBilan=$_REQUEST['type'] : $typeBilan='' ;
|
||
isset($_REQUEST['mil']) ? $mil=$_REQUEST['mil'] : $mil='' ;
|
||
isset($_REQUEST['ratio']) ? $ratio=$_REQUEST['ratio'] : $ratio='' ;
|
||
|
||
require_once 'cache/cache.php';
|
||
require_once 'ratios/ratios.php';
|
||
require_once 'scoresws/scoresws.php';
|
||
|
||
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page.'-'.$idEntreprise;
|
||
}else{ $fileName = $page.'-'.$siren; }
|
||
|
||
$result = scoresws_ratios($siret, $siren, $idEntreprise);
|
||
$bilansInfos = $result['bilansInfos'];
|
||
$ratiosInfos = $result['ratiosInfos'];
|
||
$ratiosEntrep = $result['ratiosEntrep'];
|
||
$ratiosEntrepEvol = $result['ratiosEntrepEvol'];
|
||
$ratiosSecteur = $result['ratiosSecteur'];
|
||
$firephp->log($bilansInfos, 'bilansInfos');
|
||
$firephp->log($ratiosSecteur, 'ratiosSecteur');
|
||
|
||
//Tableau des différents type de bilans
|
||
$typBil = array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié', 'B'=> 'Banque', 'A'=>'Assurance');
|
||
|
||
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);
|
||
$firephp->log($bilansInfos, 'bilansInfos');
|
||
$firephp->log($ratiosSecteur, 'ratiosSecteur');
|
||
//On détermine le bilan sélectionné
|
||
if($mil=='')
|
||
{
|
||
$bilan = 0;
|
||
$mil = $bilansInfos[$bilan]['typeBilan'].substr($bilansInfos[$bilan]['dateCloture'],6,2).substr($bilansInfos[$bilan]['dateCloture'],4,2).substr($bilansInfos[$bilan]['dateCloture'],0,4);
|
||
}
|
||
else
|
||
{
|
||
if(count($bilansInfos)>0)
|
||
{
|
||
$countBilans = 0;
|
||
foreach($bilansInfos as $bilanItem)
|
||
{
|
||
$millesime = $bilanItem['typeBilan'].substr($bilanItem['dateCloture'],6,2).substr($bilanItem['dateCloture'],4,2).substr($bilanItem['dateCloture'],0,4);
|
||
if($mil==$millesime)
|
||
{
|
||
$bilan = $countBilans;
|
||
break;
|
||
}
|
||
$countBilans++;
|
||
}
|
||
}
|
||
}
|
||
|
||
?>
|
||
<div id="center">
|
||
<h1 class="titre">RATIOS</h1>
|
||
|
||
<table>
|
||
<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"><?=$raisonSociale?></td>
|
||
</tr>
|
||
</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>
|
||
<tr>
|
||
<td width="30"> </td>
|
||
<td width="200" class="StyleInfoLib">Secteur d'activité :</td>
|
||
<td width="340" class="StyleInfoData">
|
||
<?php
|
||
print $_SESSION['tabInfo']['entrep']['nafEn'];
|
||
if (isset($_SESSION['tabInfo']['entrep']['nafEnLib']) == true) {
|
||
print ' - '.$_SESSION['tabInfo']['entrep']['nafEnLib'];
|
||
}
|
||
?>
|
||
</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
|
||
}
|
||
?>
|
||
<tr>
|
||
<td width="30"> </td>
|
||
<td width="200" class="StyleInfoLib">Millésime</td>
|
||
<td width="340" class="StyleInfoData">
|
||
<form name="selectBilan" method="post" action="index.php?<?=$_SERVER['QUERY_STRING'];?>">
|
||
<select name="mil">
|
||
<?php
|
||
if(count($bilansInfos)>0)
|
||
{
|
||
$countBilans = 0;
|
||
foreach($bilansInfos as $bilanItem)
|
||
{
|
||
if($countBilans>=5){ break; }
|
||
$millesime = '';
|
||
if(isset($bilanItem['dateCloture']))
|
||
{
|
||
$annee = substr($bilanItem['dateCloture'],6,2).substr($bilanItem['dateCloture'],4,2).substr($bilanItem['dateCloture'],0,4);
|
||
$millesime = $bilanItem['typeBilan'].$annee;
|
||
?>
|
||
<option value="index.php?page=<?=$page?>&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&mil=<?=$millesime?>&type=<?=substr($millesime,0,1);?>"<?php if($mil==$millesime){ print 'selected="selected"';} ?>>
|
||
<?=substr($bilanItem['dateCloture'],6,2).'/'.substr($bilanItem['dateCloture'],4,2).'/'.substr($bilanItem['dateCloture'],0,4);?>
|
||
<?php
|
||
if( isset($typBil[$bilanItem['typeBilan']]) &&
|
||
( isset($typBil[$bilanItem['typeBilan']])!='N' ||
|
||
isset($typBil[$bilanItem['typeBilan']])!='') )
|
||
{
|
||
?>
|
||
<?=$typBil[$bilanItem['typeBilan']]?>
|
||
<?php
|
||
}
|
||
?>
|
||
</option>
|
||
<?php
|
||
$countBilans++;
|
||
}
|
||
}
|
||
}else{ print '-'; }
|
||
?>
|
||
</select>
|
||
</form>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="30"> </td>
|
||
<td width="200" class="StyleInfoLib">Durée du bilan</td>
|
||
<td width="340" class="StyleInfoData">
|
||
<?php
|
||
if(isset($bilansInfos[$bilan]['dateCloture']))
|
||
{
|
||
|
||
print $bilansInfos[$bilan]['duree']; ?> mois
|
||
<?php
|
||
}else{ print '-'; }
|
||
?>
|
||
</td>
|
||
</tr>
|
||
<?php
|
||
if($ratio!=''){
|
||
?>
|
||
<tr>
|
||
<td colspan="3"> </td>
|
||
</tr>
|
||
<tr>
|
||
<td width="30"> </td>
|
||
<td width="200" class="StyleInfoLib">Retour à la page complète</td>
|
||
<td width="340" class="StyleInfoData"><a href="/?page=ratios&siret=<?=$_REQUEST['siret']?>&idEntreprise=<?=$_REQUEST['idEntreprise']?>" title="Retour à la page complète"><img src="./img/synthese/chart_bar.png" alt="Visionner le graphique"></a></td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
?>
|
||
</table>
|
||
<div class="blockh2">
|
||
<table id="ratios">
|
||
<tbody>
|
||
<?php print ratios_tablerow($ratiosInfos, $bilan, $ratio);?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<?php
|
||
}
|
||
?>
|
||
<br/>
|
||
<?php
|
||
//Affichage du graphique associé au ratio sélectionné
|
||
if($ratio!=''){
|
||
$data = dGraph($ratio, $bilan);
|
||
?>
|
||
<div id="titreEvol"><b>Evolution</b></div>
|
||
<?php
|
||
if(count($data['data'])<=1){
|
||
print "Les informations sont insuffisantes pour générer la courbe d'évolution";
|
||
}else{
|
||
$image = ratios_graph($ratio, $data, $fileName);
|
||
?>
|
||
<img id="imgEvol" src="./imgcache/<?=$image;?>" />
|
||
<?php
|
||
}
|
||
}
|
||
|
||
// --------------------------------------------------------------------------- //
|
||
// Export
|
||
// --------------------------------------------------------------------------- //
|
||
require_once 'export.php';
|
||
if (isset($siret) == true) {
|
||
$fileName = $page.'-'.$siret;
|
||
} else {
|
||
$fileName = $page.'-'.$idEntreprise;
|
||
}
|
||
|
||
$export = ratiosExport($siren, $raisonSociale,
|
||
$_SESSION['tabInfo']['entrep']['nafEn'],
|
||
$typeBilan,
|
||
$bilansInfos[$bilan]['dateCloture'],
|
||
$bilansInfos[$bilan]['duree'],
|
||
$ratiosInfos, $bilan, $result['nbEntNaf'], $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>
|