extranet/www/pages/liasse.php

177 lines
4.2 KiB
PHP

<?php
if (!page_checkParams()) die('Paramètres incorrects !');
require_once 'partenaires/classMTva.php';
require_once 'partenaires/classMMap.php';
require_once 'common/dates.php';
require_once 'liasse/liasse.php';
FB::log($tabBilan, 'Bilan');
?>
<style type="text/css">
.tabLiasse { font-size:1em;}
</style>
<div id="center">
<h1 class="titre">&Eacute;L&Eacute;MENTS FINANCIERS - BILANS</h1>
<form action="./" method="get">
<table>
<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>
<td width="350" class="StyleInfoData"><?=$raisonSociale?></td>
</tr>
<?php
if (count($tabBilans)>0)
{
$tabUnit = array(
0 => array('lib'=>'€', 'val'=>''),
1 => array('lib'=>'K€', 'val'=>'K'),
2 => array('lib'=>'M€', 'val'=>'M'),
);
?>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Valeurs exprimées en</td>
<td width="350" class="StyleInfoData">
<select name="unit">
<?php
foreach($tabUnit as $unit)
{
$select = '';
if($unite == $unit['val']) $select = ' selected';
?><option value="<?=$unit['val']?>"<?=$select?>><?=$unit['lib']?></option><?php
}
?>
</select>
</td>
</tr>
<?php
}
?>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Millesime</td>
<td width="350" class="StyleInfoData">
<?
if (count($tabBilans)>0)
{
?>
<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)
{
$numBil=0;
foreach ($tabBilans as $millesime => $bilan)
{
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"/>
<?php
} else {
?>
<b>Aucun bilan disponible pour cette entreprise !</b>
<?php
}
?>
</td>
</tr>
<?php
//Exportation excel
if(isset($_REQUEST['mil']) && $_SESSION['tabInfo']['idClient']==1)
{
?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2">
<a href="./?<?=$_SERVER['QUERY_STRING']?>&q=export" id="xls">Exporter en fichier Excel.</a>
</td>
</tr>
<?php
}
?>
</table>
</form>
<div class="blockh2">
<?php
/** Si un bilan est sélectionné dans la liste, on affiche le bilan **/
if(isset($_REQUEST['mil']) == true) {
$mil = $_REQUEST['mil'];
if ($mil[0] == 'A') {
include 'liasse/bilan_assurance.php';
} else if ($mil[0] == 'B') {
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
} // Fin if "pas de bilan choisit"
?>
</div>
<table>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?php
require_once 'surveillance/surveillance.php';
echo getSurveillance('bilans', $siret);
?>
</td>
</tr>
</table>
<p class="confidentiel blockh2">
<?php
require_once 'cgu/cgu.php';
echo afficheCgu();
?>
</p>
</div>