Prise en compte des types de bilans mais désactivation de tous les types sauf les bilans normaux

This commit is contained in:
Michael RICOIS 2009-10-02 14:39:29 +00:00
parent efc0acfdc7
commit 90bf14e282
8 changed files with 223 additions and 115 deletions

View File

@ -1,3 +1,5 @@
<h2>Bilan d'assurance - <?=substr($_REQUEST['siret'],0,3).' '.substr($_REQUEST['siret'],3,3).' '.substr($_REQUEST['siret'],6,3)?></h2>
<p>Exercice au :<?=$tabBilan['DATE_CLOTURE'];?></p>
<p>Montants exprimés en : milliers d'Euros (KE)</p>
<style>

View File

@ -1,3 +1,5 @@
<h2>Bilan de banque - <?=substr($_REQUEST['siret'],0,3).' '.substr($_REQUEST['siret'],3,3).' '.substr($_REQUEST['siret'],6,3)?></h2>
<p>Exercice au :<?=$tabBilan['DATE_CLOTURE'];?></p>
<p>Montants exprimés en : milliers d'Euros (KE)</p>
<style>

View File

@ -75,7 +75,8 @@ function synthese_formatdateCloture($bilansInfos, $nAnnee){
function synthese_tablerow($ratiosInfos, $dataEvol, $tabRatio){
global $fileName;
$row = '';
foreach($tabRatio as $ratio => $info){
foreach($tabRatio as $ratio => $info)
{
$row.= '<tr>'."\n".
' <td class="head"><a tooltip="'.wrapComment($ratiosInfos[$ratio]['commentaires']).'">'.$info['titre'].'</a></td>'."\n".
' <td class="right">'.dRatio(2,$ratio).'</td>'."\n".
@ -118,7 +119,8 @@ function synthese_graphEvol($data, $unite, $ratio, $filename){
if(count($data)<=1){
$return = 0;
}else{
foreach($data as $value){
foreach($data as $value)
{
$dataX[] = $value['value'];
$labelsX[] = substr($value['date'],0,4);
}

View File

@ -8,15 +8,17 @@ $idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; /
if (($siret*1)==0 && $idEntreprise==0) die('Paramètres incorrects !');
$siren=substr($siret,0,9);
isset($_REQUEST['type']) ? $typeBilan=$_REQUEST['type'] : $typeBilan='' ;
require_once 'cache/cache.php';
require_once 'ratios/ratios.php';
$raisonSociale = $_SESSION['tabInfo']['entrep']['raisonSociale'];
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
}else{ $fileName = $page2.'-'.$siret; }
cache_filename($fileName);
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page.'-'.$idEntreprise;
}else{ $fileName = $page.'-'.$siret; }
cache_filename($fileName);
if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
{
$bilansInfos = cache_get('bilansInfos');
@ -35,60 +37,11 @@ else
$ratiosInfos = $O['result']['RatiosInfos'];
$ratiosEntrep = $O['result']['RatiosEntrep'];
$ratiosEntrepEvol = $O['result']['RatiosEntrepEvol'];
//Affichage des dates dans l'ordre décroissant
//Tri des tableaux
foreach ($bilansInfos as $key => $row) {
$bilansInfos[$key]['cle'] = $key;
$date[$key] = $row['dateCloture'];
$duree[$key] = $row['duree'];
$devise[$key] = $row['devise'];
$unite[$key] = $row['unite'];
$cle[$key] = $row['cle'];
$format = ratiosBilans($bilansInfos, $ratiosEntrep, $ratiosEntrepEvol, $ratiosInfos);
while ( list($key, $val) = each( $format ) )
{
${$key} = $val;
}
array_multisort($date, SORT_DESC, $duree, SORT_DESC, $devise, SORT_DESC, $unite, SORT_DESC, $cle, SORT_DESC, $bilansInfos);
//Tri des autres tableaux
$tempRatiosEntrep = $ratiosEntrep;
$tempRatiosEntrepEvol = $ratiosEntrepEvol;
$tempRatiosSecteur = $ratiosSecteur;
$i = 0;
foreach ($bilansInfos as $row){
$ratiosEntrep[$i] = $tempRatiosEntrep[$row['cle']];
$ratiosEntrepEvol[$i] = $tempRatiosEntrepEvol[$row['cle']];
$ratiosSecteur[$i] = $tempRatiosSecteur[$row['cle']];
$i++;
}
//Fin de tri des tableaux
$dataActif = array( graphPercent('r51','r22'),
graphPercent('r52','r22'),
graphPercent('r53','r22'),
graphPercent('r60','r22'),
graphPercent('r61','r22'),
graphPercent('r62','r22'),
graphPercent('r63','r22'),
);
$dataPassif = array( graphPercent('r70','r22'),
graphPercent('r71','r22'),
graphPercent('r72','r22'),
graphPercent('r83','r22'),
graphPercent('r84','r22'),
graphPercent('r85','r22'),
graphPercent('r86','r22'),
graphPercent('r87','r22'),
);
$dataSIG = array( graphPercent('r101','r101')-graphPercent('r122','r101'),
graphPercent('r122','r101')-graphPercent('r130','r101'),
graphPercent('r130','r101')-graphPercent('r140','r101'),
graphPercent('r140','r101')-graphPercent('r150','r101'),
graphPercent('r150','r101')-graphPercent('r170','r101'),
graphPercent('r170','r101')-graphPercent('r199','r101'),
graphPercent('r199','r101'),
);
cache_delete();
cache_add('bilansInfos', $bilansInfos);
cache_add('ratiosInfos', $ratiosInfos);
@ -104,7 +57,60 @@ else
die();
}
}
$firephp->log($bilansInfos, 'bilansInfos');
$numBilanC = 0;
$numBilanN = 0;
if(count($bilansInfos)>0)
{
foreach($bilansInfos as $key => $item)
{
if($item['typeBilan']!='C') { $numBilanC++; }
if($item['typeBilan']!='N') { $numBilanN++; }
}
}
if($typeBilan=='')
{
if($numBilanN>0){ $typeBilan = 'N'; }
if($numBilanN==0 && $numBilanC>0){ $typeBilan = 'C'; }
}
if(count($bilansInfos)>0)
{
//En fonction du type de bilan sélectionné
//on filtre les bilans avant de les envoyer sur l'affichage
$index = 0;
foreach($bilansInfos as $key => $item)
{
if($item['typeBilan']!=$typeBilan)
{
array_splice($bilansInfos, $index, 1);
array_splice($ratiosInfos, $index, 1);
array_splice($ratiosEntrep, $index, 1);
array_splice($ratiosEntrepEvol, $index, 1);
array_splice($dataActif, $index, 1);
array_splice($dataPassif, $index, 1);
array_splice($dataSIG, $index, 1);
$index--;
}
$index++;
}
}
$firephp->log($bilansInfos, 'bilansInfos');
?>
<script type="text/javascript">
$(document).ready(function()
{
$('input[type=radio][name=typeBilan]').change(function(){
url = document.location.href;
url = url.replace('&type=C', '');
url = url.replace('&type=N', '');
document.location.href=url+'&type='+$(this).val();
});
});
</script>
<div id="center">
<h1>&Eacute;L&Eacute;MENTS FINANCIERS - BILANS</h1>
<table>
@ -118,6 +124,25 @@ else
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="340" class="StyleInfoData"><?=$_SESSION['tabInfo']['entrep']['raisonSociale']?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Type de bilans</td>
<td width="340" class="StyleInfoData">
<?php
if( $numBilanN>0 || $numBilanC>0 )
{
$firephp->log($typeBilan, 'typeBilan');
?>
<?php if($numBilanN>0 && $numBilanC>0){ ?><input type="radio" name="typeBilan" value="N" <?=($typeBilan=='N')? 'checked' : '';?>/><label>Normaux</label><?php }?>
<?php if($numBilanN>0 && $numBilanC>0){ ?><input type="radio" name="typeBilan" value="C" <?=($typeBilan=='C')? 'checked' : '';?>/><label>Consolidés</label><?php }?>
<?php if($numBilanN>0 && $numBilanC==0){ ?>Normaux<?php }?>
<?php if($numBilanN==0 && $numBilanC>0){ ?>Consolidés<?php }?>
<?php
}
?>
</td>
</tr>
</table>
<?php
@ -285,7 +310,7 @@ if (count($ratiosEntrep)==0 || !isset($ratiosEntrep)){
<td class="right"><?php print dPercent(0,'r22','r22')?></td>
</tr>
<tr><td colspan="7" class="graph">
<?php print bilans_graph_actif($dataActif, $fileName); ?>
<?php print bilans_graph_actif($dataActif[0], $fileName.$typeBilan); ?>
</td></tr>
</tbody>
@ -447,7 +472,7 @@ if (count($ratiosEntrep)==0 || !isset($ratiosEntrep)){
<td class="right"><?php print dPercent(0,'r22','r22')?></td>
</tr>
<tr><td colspan="7" class="graph">
<?php print bilans_graph_passif($dataPassif, $fileName);?>
<?php print bilans_graph_passif($dataPassif[0], $fileName.$typeBilan);?>
</td></tr>
</tbody>
@ -827,7 +852,7 @@ if (count($ratiosEntrep)==0 || !isset($ratiosEntrep)){
<td class="right"><?php print dPercent(0,'r199','r101'); ?></td>
</tr>
<tr><td colspan="8" class="graph">
<?php print bilans_graph_sig($dataSIG, $fileName);?>
<?php print bilans_graph_sig($dataSIG[0], $fileName.$typeBilan);?>
</td></tr>
</tbody>
</table> 

View File

@ -130,7 +130,7 @@ if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits'])
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="2" class="StyleInfoData">L'&eacute;valuation indiScore&copy; c'est en partie basée sur les points notables suivantes :<br/>
<td width="550" colspan="2" class="StyleInfoData">L'&eacute;valuation indiScore&copy; est en partie basée sur les points notables suivants :<br/>
<h3><u>Conformit&eacute; l&eacute;gale :</u></h3>
<div class="stats gradiant_pic">
<ul>

View File

@ -25,6 +25,10 @@ if(isset($_REQUEST['mil'])){
$indice = str_replace('/', '', substr($mil[0], 0, 11));
$fileName.= '-'.$indice;
}
$raisonSociale = $_SESSION['tabInfo']['entrep']['raisonSociale'];
$typBil = array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié', 'B'=> 'Banque', 'A'=>'Assurance');
cache_filename($fileName);
if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
{
@ -49,9 +53,6 @@ if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits'])
die();
}
}
$raisonSociale = $_SESSION['tabInfo']['entrep']['raisonSociale'];
$typBil = array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié', 'B'=> 'Banque', 'A'=>'Assurance');
?>
<div id="center" style="width:660px">
<h1 class="titre">&Eacute;L&Eacute;MENTS FINANCIERS - BILANS</h1>
@ -81,7 +82,12 @@ $typBil = array('C'=>'Consolid
<select name="mil">
<?php
$numBil=0;
//Tri de l'affichage des bilans en fonction de leurs types
foreach($typBil as $keyType => $type)
{
foreach ($tabBilans as $millesime => $bilan)
{
if( $millesime[0] == $keyType )
{
echo '<option value="'.$millesime.','.$bil['ref'].'"';
if ($mil==$millesime) echo ' selected';
@ -89,6 +95,8 @@ $typBil = array('C'=>'Consolid
echo '>'. substr($millesime,-10) . $str .'</option>';
$numBil++;
}
}
}
?>
</select>&nbsp;<input type="submit" value="Ok"></form>
<?php

View File

@ -13,6 +13,7 @@ $siren=substr($siret,0,9);
isset($_REQUEST['bilan']) ? $bilan=$_REQUEST['bilan'] : $bilan=0 ;
isset($_REQUEST['ratio']) ? $ratio=$_REQUEST['ratio'] : $ratio='' ;
isset($_REQUEST['type']) ? $typeBilan=$_REQUEST['type'] : $typeBilan='' ;
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
}else{ $fileName = $page2.'-'.$siret; }
@ -27,48 +28,26 @@ if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits'])
$ratiosEntrepEvol = cache_get('ratiosEntrepEvol');
$ratiosInfos = cache_get('ratiosInfos');
$ratiosSecteur = cache_get('ratiosSecteur');
}else{
cache_delete();
try {
try
{
$O = $client->getRatios($siren, 'bilan');
$bilansInfos = $O['result']['BilansInfos'];
$ratiosInfos = $O['result']['RatiosInfos'];
$ratiosEntrep = $O['result']['RatiosEntrep'];
$ratiosEntrepEvol = $O['result']['RatiosEntrepEvol'];
$ratiosSecteur = $O['result']['RatiosSecteur'];
//Affichage des dates dans l'ordre décroissant
//Tri des tableaux
foreach ($bilansInfos as $key => $row) {
$bilansInfos[$key]['cle'] = $key;
$date[$key] = $row['dateCloture'];
$duree[$key] = $row['duree'];
$devise[$key] = $row['devise'];
$unite[$key] = $row['unite'];
$cle[$key] = $row['cle'];
$format = ratiosRatios($bilansInfos, $ratiosEntrep, $ratiosEntrepEvol, $ratiosInfos, $ratiosSecteur);
while ( list($key, $val) = each( $format ) )
{
${$key} = $val;
}
array_multisort($date, SORT_DESC, $duree, SORT_DESC, $devise, SORT_DESC, $unite, SORT_DESC, $cle, SORT_DESC, $bilansInfos);
//Tri des autres tableaux
$tempRatiosEntrep = $ratiosEntrep;
$tempRatiosEntrepEvol = $ratiosEntrepEvol;
$tempRatiosSecteur = $ratiosSecteur;
$i = 0;
foreach ($bilansInfos as $row){
$ratiosEntrep[$i] = $tempRatiosEntrep[$row['cle']];
$ratiosEntrepEvol[$i] = $tempRatiosEntrepEvol[$row['cle']];
$ratiosSecteur[$i] = $tempRatiosSecteur[$row['cle']];
$i++;
}
//Fin de tri des tableaux
cache_delete();
cache_add('bilansInfos', $bilansInfos);
cache_add('ratiosEntrep', $ratiosEntrep);
cache_add('ratiosEntrepEvol', $ratiosEntrepEvol);
cache_add('ratiosInfos', $ratiosInfos);
cache_add('ratiosSecteur', $ratiosSecteur);
}catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client,$fault,$_SESSION['tabInfo']);
@ -115,33 +94,71 @@ $tabRatio = array(
26 => array('titre'=>'RENDEMENT', 'stitre'=>'(Production sur 12mois / Effectif)', 'ratio'=>'r261', 'parent'=>21, 'position'=>'>' ),
27 => array('titre'=>'PRODUCTIVITE', 'stitre'=>'(CA / Effectif)', 'ratio'=>'r267', 'parent'=>21, 'position'=>'>' ),
);
$typBil = array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié', 'B'=> 'Banque', 'A'=>'Assurance');
$firephp->log($bilansInfos, 'bilansInfos');
$numBilanC = 0;
$numBilanN = 0;
if(count($bilansInfos)>0)
{
foreach($bilansInfos as $key => $item)
{
if($item['typeBilan']!='C') { $numBilanC++; }
if($item['typeBilan']!='N') { $numBilanN++; }
}
}
//On supprime les bilans consolidés
$typeBilan = 'N';
if(count($bilansInfos)>0)
{
//En fonction du type de bilan sélectionné
//on filtre les bilans avant de les envoyer sur l'affichage
$index = 0;
foreach($bilansInfos as $key => $item)
{
if($item['typeBilan']!=$typeBilan)
{
array_splice($bilansInfos, $index, 1);
array_splice($ratiosInfos, $index, 1);
array_splice($ratiosEntrep, $index, 1);
array_splice($ratiosEntrepEvol, $index, 1);
$index--;
}
$index++;
}
}
?>
<div id="center">
<h1 class="titre">RATIOS</h1>
<table>
<tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Num&eacute;ro identifiant Siren</td>
<td width="340" class="StyleInfoData"><?=substr($siren,0,3).' '.substr($siren,3,3).' '.substr($siren,6,3)?></td>
</tr>
<tr>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="340" class="StyleInfoData"><?=$_SESSION['tabInfo']['entrep']['raisonSociale'];?></td>
</tr>
</tr>
</table>
<?php
$firephp->log($_SESSION, 'SESSION');
if (count($ratiosEntrep)==0 || !isset($ratiosEntrep)){
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{
}
else
{
?>
<table>
<tr>
@ -163,7 +180,19 @@ if (count($ratiosEntrep)==0 || !isset($ratiosEntrep)){
foreach($bilansInfos as $bilanItem){
if(isset($bilanItem['dateCloture'])) {
?>
<option value="<?php print $countBilans;?>"<?php if($bilan==$countBilans){ print 'selected="selected"';} ?>><?php print substr($bilanItem['dateCloture'],6,2).'/'.substr($bilanItem['dateCloture'],4,2).'/'.substr($bilanItem['dateCloture'],0,4);?></option>
<option value="<?php print $countBilans;?>"<?php if($bilan==$countBilans){ 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++;

View File

@ -12,10 +12,11 @@ if (($siret*1)==0 && $idEntreprise==0) die('Param
$siren=substr($siret,0,9);
isset($_REQUEST['ratio'])? $ratio=$_REQUEST['ratio'] : $ratio='';
isset($_REQUEST['type']) ? $typeBilan=$_REQUEST['type'] : $typeBilan='' ;
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
}else{ $fileName = $page2.'-'.$siret; }
if($ratio!=''){$fileName.='-'.$ratio;}
if($ratio!=''){ $fileName.='-'.$ratio; }
cache_filename($fileName);
$ratiosEntrep = array();
@ -53,6 +54,23 @@ if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits'])
}
$firephp->log($bilansInfos, 'bilansInfos');
$numBilanC = 0;
$numBilanN = 0;
if(count($bilansInfos)>0)
{
foreach($bilansInfos as $key => $item)
{
if($item['typeBilan']!='C') { $numBilanC++; }
if($item['typeBilan']!='N') { $numBilanN++; }
}
}
if($typeBilan=='')
{
if($numBilanN>0){ $typeBilan = 'N'; }
if($numBilanN==0 && $numBilanC>0){ $typeBilan = 'C'; }
}
$typeBilan = 'N';
if(count($bilansInfos)>0)
{
//En fonction du type de bilan sélectionné
@ -62,17 +80,18 @@ if(count($bilansInfos)>0)
{
if($item['typeBilan']!=$typeBilan)
{
array_slice($bilansInfos, $index, 1);
array_slice($ratiosInfos, $index, 1);
array_slice($ratiosEntrep, $index, 1);
array_slice($ratiosEntrepEvol, $index, 1);
array_splice($bilansInfos, $index, 1);
array_splice($ratiosInfos, $index, 1);
array_splice($ratiosEntrep, $index, 1);
array_splice($ratiosEntrepEvol, $index, 1);
$index--;
}
$index++;
}
}
$nbrAnnees = count($bilansInfos)-1;
$firephp->log($bilansInfos);
$firephp->log($bilansInfos, 'bilansInfos');
//Liste des ratios pour le graphique général
$tabRatioGraph = array( 0 => array('ratio'=>'r236', 'op' => 1000),
@ -116,6 +135,26 @@ $dataEvol = $data['evol'];
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="340" class="StyleInfoData"><?=$_SESSION['tabInfo']['entrep']['raisonSociale'];?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Type de bilans</td>
<td width="340" class="StyleInfoData">
Normaux
<?php
/*
if( $numBilanN>0 || $numBilanC>0 )
{
?>
<?php if($numBilanN>0 && $numBilanC>0){ ?><input type="radio" name="typeBilan" value="N" <?=($typeBilan=='N')? 'checked' : '';?>/><label>Normaux</label><?php }?>
<?php if($numBilanN>0 && $numBilanC>0){ ?><input type="radio" name="typeBilan" value="C" <?=($typeBilan=='C')? 'checked' : '';?>/><label>Consolidés</label><?php }?>
<?php if($numBilanN>0 && $numBilanC==0){ ?>Normaux<?php }?>
<?php if($numBilanN==0 && $numBilanC>0){ ?>Consolidés<?php }?>
<?php
}
*/
?>
</td>
</tr>
</table>
<?php
@ -138,13 +177,14 @@ else
<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, $nbrAnnees-$nbrAnnees); ?></th>
<th class="date"><?php print synthese_formatdateCloture($bilansInfos, 0); ?></th>
<th class="date">Evolution</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
//TODO : Afficher ligne par ligne les éléments
print synthese_tablerow($ratiosInfos, $dataEvol, $tabRatio)
?>
</tbody>