314 lines
7.6 KiB
PHP
314 lines
7.6 KiB
PHP
|
<?php
|
||
|
if (!page_checkParams()) die('Paramètres incorrects !');
|
||
|
|
||
|
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; }
|
||
|
|
||
|
define('NB_BILANS', 5);
|
||
|
|
||
|
if (isset($_REQUEST['type']) == true) {
|
||
|
$typeBilan = $_REQUEST['type'];
|
||
|
} else {
|
||
|
$typeBilan = 'N';
|
||
|
}
|
||
|
|
||
|
$result = scoresws_ratios($siret, $siren, $idEntreprise);
|
||
|
$bilansInfos = $result['bilansInfos'];
|
||
|
$ratiosInfos = $result['ratiosInfos'];
|
||
|
$ratiosEntrep = $result['ratiosEntrep'];
|
||
|
$ratiosEntrepEvol = $result['ratiosEntrepEvol'];
|
||
|
$ratiosSecteur = $result['ratiosSecteur'];
|
||
|
|
||
|
FB::log($ratiosEntrep, 'ratiosEntrep');
|
||
|
|
||
|
//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);
|
||
|
|
||
|
$dataTable = array(
|
||
|
0 => array(
|
||
|
'titre' => "ACTIVITE",
|
||
|
'r' => '', 'op' => '',
|
||
|
),
|
||
|
1 => array(
|
||
|
'titre' => "Chiffre d'affaires HT & autres produits d'exploitation",
|
||
|
'r' => 561, 'op' => '',
|
||
|
),
|
||
|
2 => array(
|
||
|
'titre' => "Variation des creances clients & autres creances d'exploitation",
|
||
|
'r' => 562, 'op' => '-',
|
||
|
),
|
||
|
3 => array(
|
||
|
'titre' => "Recettes d'exploitation (a)",
|
||
|
'r' => 563, 'op' => '=', 'class' => 'subhead'
|
||
|
),
|
||
|
4 => array(
|
||
|
'titre' => "Achats & autres charges d'exploitation",
|
||
|
'r' => 564, 'op' => '',
|
||
|
),
|
||
|
5 => array(
|
||
|
'titre' => "Variation des dettes fournisseurs & autres dettes d'exploitation",
|
||
|
'r' => 565, 'op' => '-',
|
||
|
),
|
||
|
6 => array(
|
||
|
'titre' => "Depenses d'exploitation (b)",
|
||
|
'r' => 566, 'op' => '=', 'class' => 'subhead'
|
||
|
),
|
||
|
7 => array(
|
||
|
'titre' => "Excedent de Tresorerie d'Exploitation (ETE) (a-b)",
|
||
|
'r' => 567, 'op' => '=', 'class' => 'subhead'
|
||
|
),
|
||
|
8 => array(
|
||
|
'titre' => "Flux lies aux operations hors exploitation",
|
||
|
'r' => 568,
|
||
|
'op' => '+',
|
||
|
),
|
||
|
9 => array(
|
||
|
'titre' => "Interets bancaires",
|
||
|
'r' => 569,
|
||
|
'op' => '-',
|
||
|
),
|
||
|
10 => array(
|
||
|
'titre' => "Impots sur les benefices",
|
||
|
'r' => 570,
|
||
|
'op' => '-',
|
||
|
),
|
||
|
11 => array(
|
||
|
'titre' => "Flux affectes a la participation des salaries",
|
||
|
'r' => 571,
|
||
|
'op' => '-',
|
||
|
),
|
||
|
12 => array(
|
||
|
'titre' => "Dividendes verses",
|
||
|
'r' => 572,
|
||
|
'op' => '-',
|
||
|
),
|
||
|
13 => array(
|
||
|
'titre' => "Flux de tresorerie interne (A)",
|
||
|
'r' => 573, 'op' => '=', 'class' => 'subhead'
|
||
|
),
|
||
|
14 => array(
|
||
|
'titre' => "INVESTISSEMENT",
|
||
|
'r' => '',
|
||
|
'op' => '',
|
||
|
),
|
||
|
15 => array(
|
||
|
'titre' => "Investissements d'exploitation hors production immobilisee",
|
||
|
'r' => 574,
|
||
|
'op' => '',
|
||
|
),
|
||
|
16 => array(
|
||
|
'titre' => "Acquisition de participations & autres titres immobilises",
|
||
|
'r' => 575,
|
||
|
'op' => '+',
|
||
|
),
|
||
|
17 => array(
|
||
|
'titre' => "Variation des autres actifs immobilises hors charges a repartir",
|
||
|
'r' => 576,
|
||
|
'op' => '+',
|
||
|
),
|
||
|
18 => array(
|
||
|
'titre' => "Subventions d'investissement recues",
|
||
|
'r' => 577,
|
||
|
'op' => '-',
|
||
|
),
|
||
|
19 => array(
|
||
|
'titre' => "Variation des dettes sur immobilisations",
|
||
|
'r' => 578,
|
||
|
'op' => '-',
|
||
|
),
|
||
|
20 => array(
|
||
|
'titre' => "Encaissements sur cessions d'immobilisations",
|
||
|
'r' => 579,
|
||
|
'op' => '-',
|
||
|
),
|
||
|
21 => array(
|
||
|
'titre' => "Flux d'investissement (I)",
|
||
|
'r' => 580, 'op' => '=', 'class' => 'subhead'
|
||
|
),
|
||
|
22 => array(
|
||
|
'titre' => "FINANCEMENT",
|
||
|
'r' => '',
|
||
|
'op' => '',
|
||
|
),
|
||
|
23 => array(
|
||
|
'titre' => "Augmentation-Reduction de capital",
|
||
|
'r' => 581,
|
||
|
'op' => '',
|
||
|
),
|
||
|
24 => array(
|
||
|
'titre' => "Variation des creances sur capital appele non verse",
|
||
|
'r' => 582,
|
||
|
'op' => '-',
|
||
|
),
|
||
|
25 => array(
|
||
|
'titre' => "Flux du capital (C)",
|
||
|
'r' => 583,
|
||
|
'op' => '=',
|
||
|
),
|
||
|
26 => array(
|
||
|
'titre' => "Variation des emprunts (D)",
|
||
|
'r' => 586,
|
||
|
'op' => '=',
|
||
|
),
|
||
|
27 => array(
|
||
|
'titre' => "Variation de la tresorerie du passif (E)",
|
||
|
'r' => 589,
|
||
|
'op' => '=',
|
||
|
),
|
||
|
28 => array(
|
||
|
'titre' => "Flux du financement (F)=(C)+(D)+(E)",
|
||
|
'r' => 590,
|
||
|
'op' => '=',
|
||
|
),
|
||
|
29 => array(
|
||
|
'titre' => "VARIATION DE TRESORERIE D'ACTIF",
|
||
|
'r' => '',
|
||
|
'op' => '=',
|
||
|
),
|
||
|
30 => array(
|
||
|
'titre' => "Variation du disponible",
|
||
|
'r' => 591,
|
||
|
'op' => '',
|
||
|
),
|
||
|
31 => array(
|
||
|
'titre' => "Variation des valeurs mobilieres de placement",
|
||
|
'r' => 592,
|
||
|
'op' => '',
|
||
|
),
|
||
|
32 => array(
|
||
|
'titre' => "Variation de la tresorerie d'actif = (A)-(I)+(F)",
|
||
|
'r' => 593, 'op' => '=', 'class' => 'subhead'
|
||
|
),
|
||
|
);
|
||
|
|
||
|
?>
|
||
|
<div id="center">
|
||
|
<h1 class="titre">Flux de Trésorerie</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>
|
||
|
<?php
|
||
|
if ($numBilanN > 0 || $numBilanC > 0) {
|
||
|
print '<tr>';
|
||
|
print '<td width="30"> </td>';
|
||
|
print '<td width="200" class="StyleInfoLib">Type de bilans</td>';
|
||
|
print '<td width="340" class="StyleInfoData">';
|
||
|
if ($numBilanN > 0 && $numBilanC > 0) {
|
||
|
print '<input type="radio" name="typeBilan" value="/?page='.
|
||
|
$page.'&siret='.$siret.'&idEntreprise='.$idEntreprise.'&type=N"';
|
||
|
if ($typeBilan == 'N') {
|
||
|
print ' checked';
|
||
|
}
|
||
|
print '/><label>Réel normal ou Simplifié</label>';
|
||
|
print '<input type="radio" name="typeBilan" value="/?page='.
|
||
|
$page.'&siret='.$siret.'&idEntreprise='.$idEntreprise.'&type=C"';
|
||
|
if ($typeBilan == 'C') {
|
||
|
print ' checked';
|
||
|
}
|
||
|
print '/><label>Consolidé</label>';
|
||
|
} else if ($numBilanN > 0 && $numBilanC == 0) {
|
||
|
print 'Réel normal ou Simplifié';
|
||
|
} else if ($numBilanN == 0 && $numBilanC > 0) {
|
||
|
print 'Consolidé';
|
||
|
}
|
||
|
print '</td>';
|
||
|
print '</tr>';
|
||
|
}
|
||
|
?>
|
||
|
</table>
|
||
|
|
||
|
<h2>Tableau des flux</h2>
|
||
|
<div class="blockh2">
|
||
|
<table class="bilans">
|
||
|
<tr class="subhead">
|
||
|
<td colspan="2"> </td>
|
||
|
<?php
|
||
|
for($i=0; $i<NB_BILANS; $i++){
|
||
|
$annee = substr($bilansInfos[NB_BILANS-$i-1]['dateCloture'],6,2).'/'.
|
||
|
substr($bilansInfos[NB_BILANS-$i-1]['dateCloture'],4,2).'/'.
|
||
|
substr($bilansInfos[NB_BILANS-$i-1]['dateCloture'],0,4);
|
||
|
$duree = $bilansInfos[NB_BILANS-$i-1]['duree'];
|
||
|
?>
|
||
|
<td class="center" ><?=$annee?><br/><?=$duree?> mois</td>
|
||
|
<?php
|
||
|
}
|
||
|
?>
|
||
|
</tr>
|
||
|
<?php
|
||
|
foreach ($dataTable as $ratio){
|
||
|
$trClass = '';
|
||
|
if ( empty($ratio['r']) ){
|
||
|
$trClass = ' class="darkblue"';
|
||
|
}
|
||
|
|
||
|
if ( isset($ratio['class']) && $ratio['class']=='subhead' ){
|
||
|
$trClass = ' class="'.$ratio['class'].'"';
|
||
|
}
|
||
|
?>
|
||
|
<tr<?=$trClass?>>
|
||
|
<td><?=$ratio['op']?></td>
|
||
|
<td><?=$ratio['titre']?></td>
|
||
|
<?php
|
||
|
for($i=0; $i<NB_BILANS; $i++){
|
||
|
?>
|
||
|
<td class="right">
|
||
|
<?php
|
||
|
if ( !empty($ratio['r']) ){
|
||
|
echo dRatio(NB_BILANS-$i-1, 'r'.$ratio['r']);
|
||
|
}
|
||
|
?>
|
||
|
</td>
|
||
|
<?php
|
||
|
}
|
||
|
?>
|
||
|
</tr>
|
||
|
<?php
|
||
|
}
|
||
|
?>
|
||
|
</table>
|
||
|
|
||
|
<?php
|
||
|
$graphRatio = array(28, 21, 13);
|
||
|
$nbBilans = count($bilansInfos);
|
||
|
foreach ($graphRatio as $iRatio => $ratio){
|
||
|
$data[$iRatio]['titre'] = $dataTable[$ratio]['titre'];
|
||
|
$data[$iRatio]['values'] = array();
|
||
|
for($i=0; $i<$nbBilans; $i++){
|
||
|
$data[$iRatio]['values'][$i] = $ratiosEntrep[$nbBilans-$i-1]['r'.$dataTable[$ratio]['r']];
|
||
|
}
|
||
|
}
|
||
|
for($i=0; $i<$nbBilans; $i++){
|
||
|
$labels[$i] = substr($bilansInfos[$nbBilans-$i-1]['dateCloture'], 0, 4);
|
||
|
}
|
||
|
$image = flux_graph($labels, $data, $fileName.$typeBilan);
|
||
|
if ( $image != false ){
|
||
|
echo '<img src="imgcache/'.$image.'" />';
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|