$vniv2) {
$lniv2 = '';
if (liasse2xml($vniv2, $lniv2, $tableTexteBilan) == true) {
if (is_array($lniv2) == false) {
$lniv2 = strip_tags(str_replace('-
', '', $lniv2));
if ($label == 'Elem') {
$label = $lniv2;
} else {
$label .= ' '.$lniv2;
}
$label = strtr(utf8_decode($label),
utf8_decode(' .àéèêôÔç(),:\''),
'__aeeeoOc_____');
$count = 1;
while ($count) {
$label = str_replace('__', '_', $label, $count);
}
$label = preg_replace('/_$/', '', $label);
$label = preg_replace('/^_/', '', $label);
}
if ( isset($val[$n + 1]) == true &&
is_array($val[$n + 1]) == true) {
break;
}
}
}
if (is_numeric(substr($label, 0, 1)) == true) {
$label = '_'.$label;
}
if ($n == count($val) - 1) {
$n = 0;
} else {
++$n;
}
for ($i = $n; $i < count($val); ++$i) {
$lniv2 = '';
if (liasse2xml($val[$i], $lniv2, $tableTexteBilan) == true) {
if (isset($liasse[$label]) == true) {
if (is_array($liasse[$label]) == true) {
$liasse[$label] = array_merge($liasse[$label], $lniv2);
} else if (is_numeric($lniv2) == true) {
$liasse[$label] = $lniv2;
}
} else if (is_array($lniv2) ||
is_numeric($lniv2) == true) {
$liasse[$label] = $lniv2;
}
}
}
return empty($liasse) == false;
} else {
if ( empty($val) == false &&
is_int($val) == false && $val != '#') {
if (substr($val, 0, 4) == 'text') {
$val = $tableTexteBilan[intval(substr($val, 4, 4))];
}
$val = str_replace(' ', '', $val);
if (substr($val, 0, 1) != '(') {
$val = preg_replace('/\(.*\)/', '', $val);
}
if (empty($val) == false) {
if (strlen($val) == 3 && substr($val, 0, 1) != '(') {
$m = dMontant($tabBilan, $val, $unite);
if (empty($m) == false) {
if (is_numeric(substr($val, 0, 1)) == true) {
$val = '_'.$val;
}
$liasse[$val] = $m;
} else {
return false;
}
} else if (strlen($val) == 2) {
$m = dMontant($tabBilan, $val, $unite);
if (empty($m) == false) {
if (is_numeric(substr($val, 0, 1)) == true) {
$val = '_'.$val;
}
$liasse[$val] = $m;
} else {
return false;
}
} else {
$liasse = $val;
}
return true;
}
}
return false;
}
}
if (!page_checkParams()) die('Paramètres incorrects !');
$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 = $page.'-'.$idEntreprise;
}else{ $fileName = $page.'-'.$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;
}
isset($_REQUEST['unit']) ? $unite = $_REQUEST['unit'] : $unite = '';
$typBil = array(
'C'=>'Consolidé',
'N'=>'',
'S'=>'Réel Simplifié',
'B'=> 'Banque',
'A'=>'Assurance'
);
cache_filename($fileName);
if( cache_exist() && !hasModeEdition() )
{
$tabBilans = cache_get('tabBilans');
$tabBilan = cache_get('tabBilan');
}else{
try {
$O = $client->getListeBilans($siren);
$tabBilans = $O['result'];
//Tri du tableau
if(count($tabBilans)>0)
{
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();
cache_add('tabBilans', $tabBilans);
if (isset($_REQUEST['mil']))
{
$O = $client->getBilan($siren, substr($mil[0],-10), substr($mil[0],0,1), $mil[1]);
$tabBilan = $O['result'];
cache_add('tabBilan',$tabBilan);
}
} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client,$fault,$_SESSION['tabInfo']);
die();
}
}
?>