140 lines
3.9 KiB
PHP
140 lines
3.9 KiB
PHP
<?php
|
|
if (!$_SESSION['connected']) die();
|
|
|
|
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
|
|
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Paramètres incorrects !');
|
|
|
|
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; // Si id=0 alors non communiqué
|
|
if (($siret*1)==0 && $idEntreprise==0) die('Paramètres incorrects !');
|
|
$siren=substr($siret,0,9);
|
|
$mil = false;
|
|
|
|
require_once 'partenaires/classMTva.php';
|
|
require_once 'partenaires/classMMap.php';
|
|
require_once 'common/dates.php';
|
|
require_once 'cache/cache.php';
|
|
require_once 'liasse/liasse.php';
|
|
|
|
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page2.'-'.$idEntreprise;
|
|
}else{ $fileName = $page2.'-'.$siret; }
|
|
|
|
if(isset($_REQUEST['mil'])){
|
|
$mil = explode(',',$_REQUEST['mil']);
|
|
$annee = substr($mil[0],-10);
|
|
$annee = str_replace('/', '', $annee);
|
|
$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 ) )
|
|
{
|
|
$tabBilans = cache_get('tabBilans');
|
|
$tabBilan = cache_get('tabBilan');
|
|
}else{
|
|
cache_delete();
|
|
try {
|
|
$O = $client->getListeBilans($siren);
|
|
$tabBilans = $O['result'];
|
|
cache_add('tabBilans', $tabBilans);
|
|
if (isset($_REQUEST['mil'])) {
|
|
$tabTmp = explode(',',$_REQUEST['mil']);
|
|
$mil = $tabTmp[0];
|
|
$O = $client->getBilan($siren, substr($mil,-10), substr($mil,0,1), $tabTmp[1]);
|
|
$tabBilan = $O['result'];
|
|
cache_add('tabBilan',$tabBilan);
|
|
}
|
|
} catch (SoapFault $fault) {
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
die();
|
|
}
|
|
}
|
|
?>
|
|
<div id="center" style="width:660px">
|
|
<h1 class="titre">ÉLÉMENTS FINANCIERS - BILANS</h1>
|
|
|
|
<table>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Numé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"> </td>
|
|
<td width="200" class="StyleInfoLib">Raison Sociale</td>
|
|
<td width="350" class="StyleInfoData"><?=$raisonSociale?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Millesime</td>
|
|
<td width="350" class="StyleInfoData">
|
|
<?
|
|
if (count($tabBilans)>0)
|
|
{
|
|
?>
|
|
<form action="./?page=liasse&siret=<?=$siren?>" method="GET">
|
|
<input type="hidden" name="page" value="liasse"/>
|
|
<input type="hidden" name="siret" value="<?=$siren?>"/>
|
|
<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';
|
|
$str=' '. $typBil[substr($millesime,0,1)];
|
|
echo '>'. substr($millesime,-10) . $str .'</option>';
|
|
$numBil++;
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
</select> <input type="submit" value="Ok"></form>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<b>Aucun bilan disponible pour cette entreprise !</b>
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<?php
|
|
/** Si un bilan est sélectionné dans la liste, on affiche le bilan **/
|
|
if ($mil)
|
|
{
|
|
$firephp->log($tabBilan,'bilan');
|
|
if($mil[0]=='A'){
|
|
include 'liasse/bilan_assurance.php';
|
|
}elseif($mil[0]=='B'){
|
|
include 'liasse/bilan_banque.php';
|
|
}else{
|
|
$firephp->log($tabBilan, 'tabBilan');
|
|
include 'liasse/bilan_normal.php';
|
|
} // Fin test bilan banque ou assurance et autres
|
|
} // Fin if "pas de bilan choisit"
|
|
?>
|
|
<table>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td colspan="2" width="550" class="StyleInfoData">
|
|
<?php
|
|
require_once 'surveillance/surveillance.php';
|
|
print getSurveillance($page, $siret);
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|