Prise en compte des types de bilan + correction impression des bilans en pdf

This commit is contained in:
Michael RICOIS 2009-10-02 16:41:16 +00:00
parent 455b8ed90f
commit e9105328a6
3 changed files with 104 additions and 39 deletions

View File

@ -432,9 +432,13 @@ function synthese_graph_linecompare($data, $filename){
* Retourne une chaîne.
*/
function ratios_tablerow($ratiosInfos, $tabRatio, $bilan, $ratio = ''){
global $fileName;
global $siren, $idEntreprise, $typeBilan;
foreach($tabRatio as $item){
if (($siret*1)==0 || ($siren*1)<100){ $fileName = 'ratios-'.$idEntreprise;
}else{ $fileName = 'ratios-'.$siret; }
$fileName.= '-'.$typeBilan;
foreach($tabRatio as $item)
{
if($ratio==''){
if(isset($item['ratio'])){
$row.= '<tr>'."\n";

View File

@ -33,4 +33,9 @@ $(document).ready(function()
}
})
});
$('[name=mil]').change(function(){
document.location.href=$(this).val();;
});
});

View File

@ -11,16 +11,16 @@ $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['bilan']) ? $bilan=$_REQUEST['bilan'] : $bilan=0 ;
$firephp->log($_REQUEST, 'REQUEST');
isset($_REQUEST['type']) ? $typeBilan=$_REQUEST['type'] : $typeBilan='' ;
isset($_REQUEST['mil']) ? $mil=$_REQUEST['mil'] : $mil='' ;
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; }
$fileName.= '-'.$bilan;
if($ratio!=''){$fileName.='-'.$ratio;}
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');
@ -94,6 +94,8 @@ $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'=>'>' ),
);
//Tableau des différents type de bilans
$typBil = array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié', 'B'=> 'Banque', 'A'=>'Assurance');
$firephp->log($bilansInfos, 'bilansInfos');
@ -109,7 +111,11 @@ if(count($bilansInfos)>0)
}
}
//On supprime les bilans consolidés
if($typeBilan=='')
{
if($numBilanN>0){ $typeBilan = 'N'; }
if($numBilanN==0 && $numBilanC>0){ $typeBilan = 'C'; }
}
$typeBilan = 'N';
if(count($bilansInfos)>0)
{
@ -130,6 +136,30 @@ if(count($bilansInfos)>0)
}
}
//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>
@ -161,59 +191,85 @@ else
{
?>
<table>
<tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Secteur d'activité :</td>
<td width="340" class="StyleInfoData">
<?php print $_SESSION['tabInfo']['entrep']['nafEn']; ?> - <?php print $_SESSION['tabInfo']['entrep']['nafEnLib']; ?>
</td>
</tr>
<tr>
</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>
<tr>
<td width="30">&nbsp;</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="bilan">
<select name="mil">
<?php
$countBilans = 0;
if(count($bilansInfos)>0){
foreach($bilansInfos as $bilanItem){
if(isset($bilanItem['dateCloture'])) {
?>
<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']])!='') )
if(count($bilansInfos)>0)
{
foreach($bilansInfos as $bilanItem)
{
?>
<?=$typBil[$bilanItem['typeBilan']]?>
<?php
}
?>
</option>
<?php
$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?>"<?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>
&nbsp;<a href="javascript:document.selectBilan.submit();">Ok</a>
</form>
</td>
</tr>
<tr>
</tr>
<tr>
<td width="30">&nbsp;</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 '-'; } ?>
if(isset($bilansInfos[$bilan]['dateCloture']))
{
print $bilansInfos[$bilan]['duree']; ?> mois
<?php
}else{ print '-'; }
?>
</td>
</tr>
</tr>
<?php
if($ratio!=''){
?>