extranet/www/pages/liasse.php

152 lines
4.4 KiB
PHP
Raw Normal View History

<?php
2009-06-01 08:41:05 +00:00
if (!$_SESSION['connected']) die();
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Param<61>tres incorrects !');
2009-03-11 07:51:18 +00:00
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; // Si id=0 alors non communiqu<71>
if (($siret*1)==0 && $idEntreprise==0) die('Param<61>tres incorrects !');
$siren=substr($siret,0,9);
$mil = false;
2009-05-20 15:49:08 +00:00
require_once 'partenaires/classMTva.php';
require_once 'partenaires/classMMap.php';
require_once 'common/dates.php';
2009-08-17 14:37:12 +00:00
require_once 'cache/cache.php';
require_once 'liasse/liasse.php';
2009-05-28 16:31:14 +00:00
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page.'-'.$idEntreprise;
}else{ $fileName = $page.'-'.$siret; }
2009-05-28 16:31:14 +00:00
if(isset($_REQUEST['mil'])){
$mil = explode(',',$_REQUEST['mil']);
$annee = substr($mil[0],-10);
$annee = str_replace('/', '', $annee);
2009-09-30 12:49:21 +00:00
$indice = str_replace('/', '', substr($mil[0], 0, 11));
$fileName.= '-'.$indice;
}
$typBil = array('C'=>'Consolid<69>', 'N'=>'', 'S'=>'R<>el Simplifi<66>', 'B'=> 'Banque', 'A'=>'Assurance');
2009-08-17 14:37:12 +00:00
cache_filename($fileName);
2009-09-30 12:49:21 +00:00
if( cache_exist() && !( preg_match('/saisie/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInfo']['mode_edition']==1 ) )
2009-08-17 14:37:12 +00:00
{
2009-09-30 12:49:21 +00:00
$tabBilans = cache_get('tabBilans');
$tabBilan = cache_get('tabBilan');
2009-05-28 16:31:14 +00:00
}else{
try {
$O = $client->getListeBilans($siren);
2009-08-17 14:37:12 +00:00
$tabBilans = $O['result'];
2009-10-13 08:48:19 +00:00
//Tri du tableau
foreach($tabBilans as $key => $bilan)
{
$cle[$key] = $key[0].substr($key, -4);
$dateProvPartenaire[$key] = $bilan['dateProvPartenaire'];
$dateInsert[$key] = $bilan['dateInsert'];
$dureeExercice[$key] = $bilan['dureeExercice'];
$dateExercicePre[$key] = $bilan['dateExercicePre'];
$monnaie[$key] = $bilan['monnaie'];
$source[$key] = $bilan['source'];
}
array_multisort($cle, SORT_DESC, $tabBilans);
cache_delete();
2009-08-17 14:37:12 +00:00
cache_add('tabBilans', $tabBilans);
if (isset($_REQUEST['mil']))
{
2009-10-13 16:53:25 +00:00
$O = $client->getBilan($siren, substr($mil[0],-10), substr($mil[0],0,1), $mil[1]);
2009-08-17 14:37:12 +00:00
$tabBilan = $O['result'];
cache_add('tabBilan',$tabBilan);
2009-05-28 16:31:14 +00:00
}
} catch (SoapFault $fault) {
require_once 'soaperror.php';
2009-08-17 14:37:12 +00:00
processSoapFault($client,$fault,$_SESSION['tabInfo']);
2009-05-28 16:31:14 +00:00
die();
}
2009-08-17 14:37:12 +00:00
}
$firephp->log($tabBilans, 'tabBilans');
$firephp->log($tabBilan, 'tabBilan');
2009-08-17 14:37:12 +00:00
?>
<div id="center" style="width:660px">
<h1 class="titre">&Eacute;L&Eacute;MENTS FINANCIERS - BILANS</h1>
2009-06-01 08:27:39 +00:00
2009-08-17 14:37:12 +00:00
<table>
2009-06-01 08:27:39 +00:00
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Num&eacute;ro identifiant Siren</td>
<td width="350" class="StyleInfoData"><?=substr($siren,0,3).' '.substr($siren,3,3).' '.substr($siren,6,3)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
2009-10-05 14:27:10 +00:00
<td width="350" class="StyleInfoData"><?=$_SESSION['tabInfo']['entrep']['raisonSociale']?></td>
2009-06-01 08:27:39 +00:00
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Millesime</td>
<td width="350" class="StyleInfoData">
<?
if (count($tabBilans)>0)
{
?>
<form action="./" method="get">
<input type="hidden" name="page" value="liasse"/>
<input type="hidden" name="siret" value="<?=$siren?>"/>
<select name="mil">
<?php
//Tri de l'affichage des bilans en fonction de leurs types
foreach($typBil as $keyType => $type)
{
2009-10-09 14:24:17 +00:00
$numBil=0;
foreach ($tabBilans as $millesime => $bilan)
{
2009-10-09 14:24:17 +00:00
if($numBil>=5){ break; }
if( $millesime[0] == $keyType )
{
echo '<option value="'.$millesime.','.$bilan['ref'].'"';
if ($mil[0]==$millesime) echo ' selected';
$str=' '. $typBil[substr($millesime,0,1)];
echo '>'. substr($millesime,-10) . $str .'</option>';
$numBil++;
}
}
}
?>
</select>&nbsp;<input type="submit" value="Ok"></form>
2009-06-01 08:27:39 +00:00
<?php
} else {
?>
2009-06-01 08:27:39 +00:00
<b>Aucun bilan disponible pour cette entreprise !</b>
<?php
}
?>
2009-06-01 08:27:39 +00:00
</td>
</tr>
</table>
2009-05-28 16:31:14 +00:00
<?php
/** Si un bilan est s<>lectionn<6E> dans la liste, on affiche le bilan **/
if(isset($_REQUEST['mil']))
{
$mil = $_REQUEST['mil'];
if($mil[0]=='A'){
include 'liasse/bilan_assurance.php';
}elseif($mil[0]=='B'){
include 'liasse/bilan_banque.php';
}else{
include 'liasse/bilan_normal.php';
} // Fin test bilan banque ou assurance et autres
} // Fin if "pas de bilan choisit"
2009-05-28 16:31:14 +00:00
?>
<table>
2009-05-20 15:49:08 +00:00
<tr>
<td width="30">&nbsp;</td>
2009-05-22 12:26:07 +00:00
<td colspan="2" width="550" class="StyleInfoData">
<?php
2009-05-20 15:49:08 +00:00
require_once 'surveillance/surveillance.php';
print getSurveillance($page, $siret);
?>
</td>
</tr>
2009-05-28 16:31:14 +00:00
</table>
2009-08-17 14:37:12 +00:00
</div>