affichage et export liasse a partir d'un meme tableau

This commit is contained in:
Sebastien BEAUGRAND 2010-08-23 09:07:31 +00:00
parent ecbfce94bd
commit 2c3aad9ed4
3 changed files with 742 additions and 1286 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,105 @@
<?php
// --------------------------------------------------------------------------- //
// liasse2xml
// --------------------------------------------------------------------------- //
function liasse2xml(&$val, &$liasse, &$tableTexteBilan)
{
global $tabBilan;
global $unite;
if (is_array($val)) {
$label = 'Elem';
foreach ($val as $n => $vniv2) {
$lniv2 = '';
if (liasse2xml($vniv2, $lniv2, $tableTexteBilan) == true) {
if (is_array($lniv2) == false) {
$lniv2 = strip_tags(str_replace('-<br/>', '', $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('&nbsp;', '', $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;
@ -164,29 +265,34 @@ if(isset($_REQUEST['mil']) == true) {
include 'liasse/bilan_banque.php';
} else {
include 'liasse/bilan_normal.php';
// Export
require_once 'export.php';
if (isset($siret) == true) {
$fileName = $page.'-'.$siret;
} else {
$fileName = $page.'-'.$idEntreprise;
}
$liasse['Liasse']['raisonSociale'] = $raisonSociale;
$liasse['Liasse']['type'] = $mil[0];
$liasse['Liasse']['date'] = $annee;
liasse2xml($tabLiasseN, $liasse, $tableTexteBilan);
$parseTab = new tabExport;
$parseTab->tab = array($liasse['Liasse']);
$parseTab->type = array();
$array2csv = new ExportCSV;
$array2csv->records = $parseTab->convertTable();
$array2csv->writeCSV($fileName);
$array2xml = new ExportXML;
$array2xml->rootName = $page;
$array2xml->defaultTagName = 'elem';
$array2xml->records = $liasse['Liasse'];
$array2xml->writeXML($fileName);
} // Fin test bilan banque ou assurance et autres
// Export
require_once 'export.php';
if (isset($siret) == true) {
$fileName = $page.'-'.$siret;
} else {
$fileName = $page.'-'.$idEntreprise;
}
$parseTab = new tabExport;
$parseTab->tab = array($tabBilans);
$parseTab->type = array();
$array2csv = new ExportCSV;
$array2csv->records = $parseTab->convertTable();
$array2csv->writeCSV($fileName);
$array2xml = new ExportXML;
$array2xml->rootName = $page.'s';
$array2xml->defaultTagName = $page;
$array2xml->records = $tabBilans;
$array2xml->writeXML($fileName);
} // Fin if "pas de bilan choisit"
?>
</div>

View File

@ -46,6 +46,7 @@ if ($page == 'identite' ||
$page == 'synthese' ||
$page == 'bilans' ||
$page == 'ratios' ||
$page == 'liasse' ||
$page == 'indiscore' ||
$page == 'bourse' ||
$page == 'banque' ||