Ajout export de la liste des surveillances sous forme pdf
This commit is contained in:
parent
1d854d1e43
commit
d8d20a41a3
95
www/html2pdf.php
Normal file
95
www/html2pdf.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'common/dates.php';
|
||||
require_once 'common/curl.php';
|
||||
|
||||
isset($_REQUEST['q'])? $nomFic = $_REQUEST['q'] : $nomFic = '';
|
||||
|
||||
if($nomFic == ''){
|
||||
print 'Impossible de générer le document.';
|
||||
}else{
|
||||
|
||||
require_once 'surveillance/survliste.php';
|
||||
$client = new SoapClient(null, array( 'trace' => 1,
|
||||
'soap_version' => SOAP_1_1,
|
||||
'location' => WEBSERVICE_URL,
|
||||
'uri' => WEBSERVICE_URI,
|
||||
'login' => $_SESSION['tabInfo']['login'],
|
||||
'password' => $_SESSION['tabInfo']['password'],
|
||||
));
|
||||
|
||||
try {
|
||||
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
|
||||
$file = PATH_DATA.'/pdf/'.$nomFic;
|
||||
$file2 = $file.'.bz2';
|
||||
if (!file_exists($file)) {
|
||||
$page = getUrl(WEBSERVICE_URI.'csv/'.$nomFic.'.bz2', '', '', '', false);
|
||||
$body = $page['body'];
|
||||
$fp=@fopen($file2, 'w');
|
||||
@fwrite($fp, $body);
|
||||
@fclose($fp);
|
||||
$bz = bzopen($file2, "r") or die("Impossible d'ouvrir le fichier $file");
|
||||
$fp=@fopen($file, 'w');
|
||||
while (!feof($bz)) {
|
||||
@fwrite($fp, bzread($bz, 4096));
|
||||
}
|
||||
bzclose($bz);
|
||||
}
|
||||
} catch (SoapFault $fault) {
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$tabInfo);
|
||||
exit;
|
||||
}
|
||||
$annonces = readann($file, '');
|
||||
|
||||
$output = '';
|
||||
$output.= '<page backtop="10mm" backbottom="10mm">';
|
||||
$output.= '<page_header>';
|
||||
$output.= '<table style="width: 100%; border: solid 1px black;">';
|
||||
$output.= '<tr>';
|
||||
$output.= '<td style="text-align: center; width: 67%">'.$nomFic.'</td>';
|
||||
$output.= '<td style="text-align: right; width: 33%">'.date('d/m/Y').'</td>';
|
||||
$output.= '</tr>';
|
||||
$output.= '</table>';
|
||||
$output.= '</page_header>';
|
||||
$output.= '<page_footer>';
|
||||
$output.= '<table style="width: 100%; border: solid 1px black;">';
|
||||
$output.= '<tr>';
|
||||
$output.= '<td style="text-align: left; width: 50%"> </td>';
|
||||
$output.= '<td style="text-align: right; width: 50%">page [[page_cu]]/[[page_nb]]</td>';
|
||||
$output.= '</tr>';
|
||||
$output.= '</table>';
|
||||
$output.= '</page_footer>';
|
||||
$count = 0;
|
||||
foreach($annonces as $annonce){
|
||||
if ($count>0) $output.= '<page>';
|
||||
$output.= '<table width="580">'."\n";
|
||||
$output.= '<tr><td width="30"> </td>'."\n";
|
||||
$output.= ' <td width="550" colspan="2" class="StyleInfoLib">Entreprise : '.$annonce['RaisonSociale'].' ('.$annonce['Siren'].')</td>'."\n";
|
||||
$output.= '</tr>'."\n";
|
||||
$output.= '<tr><td width="30"> </td>'."\n";
|
||||
$output.= ' <td width="200" class="StyleInfoData">Site : '.$annonce['SiteCnasea'].'</td>'."\n";
|
||||
$output.= ' <td width="350" colspan="2" class="StyleInfoData">Référence : '.$annonce['Ref'].'</td>'."\n";
|
||||
$output.= '</tr>'."\n";
|
||||
$output.= '<tr><td width="30"> </td>'."\n";
|
||||
$output.= ' <td width="550" colspan="2" class="StyleInfoData">BODACC n°'.$annonce['Parution'].' '.$annonce['Bodacc'].' du '.$annonce['DatePar'].' '.$annonce['Tribunal'].'.</td>'."\n";
|
||||
$output.= '</tr>'."\n";
|
||||
$output.= '<tr><td width="30"> </td>'."\n";
|
||||
$output.= ' <td width="550" colspan="2" class="StyleInfoLib"><b>'.$annonce['Even'].'</b></td>'."\n";
|
||||
$output.= '</tr>'."\n";
|
||||
$output.= '<tr><td colspan="4"> </td></tr>'."\n";
|
||||
$output.= '<tr><td width="30"> </td>'."\n";
|
||||
$output.= ' <td width="550" colspan="2">'.$annonce['TexteAnn'].'</td>'."\n";
|
||||
$output.= '</tr>'."\n";
|
||||
$output.= '</table>'."\n";
|
||||
$output.= '</page>'."\n";
|
||||
$count++;
|
||||
}
|
||||
// conversion HTML => PDF
|
||||
require_once 'html2pdf/html2pdf.class.php';
|
||||
$html2pdf = new HTML2PDF('P','A4','fr');
|
||||
$html2pdf->WriteHTML($output);
|
||||
$html2pdf->Output(str_replace('.csv', '.pdf', $nomFic), 'D');
|
||||
}
|
||||
|
||||
?>
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
include_once(FWK_PATH.'/common/dates.php');
|
||||
require_once 'common/dates.php';
|
||||
|
||||
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
|
||||
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; // Si id=0 alors non communiqué
|
||||
@ -8,34 +8,27 @@ $siren=substr($siret,0,9);
|
||||
if (!$_SESSION['connected'])
|
||||
echo ('Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité');
|
||||
else {
|
||||
if (isset($_REQUEST['nomFic'])) $nomFic = $_REQUEST['nomFic'];
|
||||
else $nomFic = '';
|
||||
|
||||
isset($_REQUEST['nomFic'])? $nomFic = $_REQUEST['nomFic'] : $nomFic='' ;
|
||||
|
||||
//Génération liste surveillance
|
||||
$ref = $_SESSION['tabInfo']['prenom'];
|
||||
if ( strtolower($_SESSION['tabInfo']['login'])=='cnasea95' ||
|
||||
strtolower($_SESSION['tabInfo']['login'])=='cnasea96' ||
|
||||
$_SESSION['tabInfo']['idClient']==32)
|
||||
$ref='*';
|
||||
/*
|
||||
if ($_SERVER['REMOTE_ADDR']=='83.206.102.217')
|
||||
$ref='*';*/
|
||||
$_SESSION['tabInfo']['idClient']==32
|
||||
) $ref='*';
|
||||
|
||||
try {
|
||||
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $ref, $nomFic);
|
||||
//if ($O['result']==1) $message='Informations mises à jour !';
|
||||
//print_r($O);
|
||||
$tabFichier=$O['results'];
|
||||
} catch (SoapFault $fault) {
|
||||
include_once(realpath(dirname(__FILE__).'/../../').'/includes/soaperror.php');
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$tabInfo);
|
||||
}
|
||||
echo '<!--';print_r($tabInfos);echo '-->';
|
||||
}
|
||||
|
||||
?>
|
||||
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="3"><img src="./img/rub_identite.png" width="577" height="36"></td>
|
||||
</tr>
|
||||
<tr><td colspan="3"><img src="./img/rub_identite.png" width="577" height="36"></td></tr>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Mon identifiant</td>
|
||||
@ -52,10 +45,10 @@ else {
|
||||
<tr>
|
||||
<td colspan="3"><img src="./img/srub_surveillance.png" width="576" height="27"></td>
|
||||
</tr>
|
||||
<?foreach ($tabFichier as $nomFic) {?>
|
||||
<?php foreach ($tabFichier as $nomFic) {?>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<?
|
||||
<?php
|
||||
$tabTmp=explode('_', $nomFic);// surveillanceBodacc_SURBODTSTFTSCNASEA_20081223.csv html
|
||||
$dateFic=Wdate::dateT('Ymd','d/m/Y', substr($tabTmp[2],0,8));
|
||||
|
||||
@ -68,7 +61,13 @@ else {
|
||||
$dejaLu2='';
|
||||
}
|
||||
?>
|
||||
<td width="200" colspan="2" class="lienNormal"><?=$dejaLu1?>Liste des annonces du <?=$dateFic?> au format <a href="./?page=fichier&nomFic=<?=$nomFic?>" title="<?=$nomFic?>">CSV</a><?/*if ($_SERVER['REMOTE_ADDR']=='83.206.102.217') { */?> ou au format <a href="./?page=survlisteann&nomFic=<?=$nomFic?>">HTML</a><?/*}*/?><?=$dejaLu2?>
|
||||
<td width="200" colspan="2" class="lienNormal">
|
||||
<?=$dejaLu1?>
|
||||
Liste des annonces du <?=$dateFic?>
|
||||
au format <a href="./?page=fichier&nomFic=<?=$nomFic?>" title="<?=$nomFic?>">CSV</a>
|
||||
ou au format <a href="./?page=survlisteann&nomFic=<?=$nomFic?>">HTML</a>
|
||||
ou au format <a href="./html2pdf.php?q=<?=$nomFic?>" target="_blank">PDF</a>
|
||||
<?=$dejaLu2?>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
@ -76,6 +75,3 @@ else {
|
||||
<td colspan="3"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
//}
|
||||
?>
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
include_once(FWK_PATH.'/common/dates.php');
|
||||
include_once(FWK_PATH.'/common/curl.php');
|
||||
require_once 'common/dates.php';
|
||||
require_once 'common/curl.php';
|
||||
|
||||
if (!$_SESSION['connected'])
|
||||
echo ('Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité');
|
||||
else
|
||||
{
|
||||
else{
|
||||
|
||||
if (isset($_REQUEST['nomFic'])) $nomFic = $_REQUEST['nomFic'];
|
||||
else $nomFic = '';
|
||||
require_once 'surveillance/survliste.php';
|
||||
|
||||
isset($_REQUEST['vue'])? $vue = $_REQUEST['vue'] : $vue='' ;
|
||||
isset($_REQUEST['nomFic'])? $nomFic = $_REQUEST['nomFic'] : $nomFic='' ;
|
||||
|
||||
$filtre = '';
|
||||
if (isset($_REQUEST['filtre'])) {
|
||||
@ -33,7 +34,6 @@ else
|
||||
$fp=@fopen($file2, 'w');
|
||||
@fwrite($fp, $body);
|
||||
@fclose($fp);
|
||||
|
||||
$bz = bzopen($file2, "r") or die("Impossible d'ouvrir le fichier $file");
|
||||
$fp=@fopen($file, 'w');
|
||||
while (!feof($bz)) {
|
||||
@ -42,9 +42,13 @@ else
|
||||
bzclose($bz);
|
||||
}
|
||||
} catch (SoapFault $fault) {
|
||||
include_once(realpath(dirname(__FILE__).'/../../').'/includes/soaperror.php');
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$tabInfo);
|
||||
exit;
|
||||
}
|
||||
|
||||
$annonces = readann($file, $filtre);
|
||||
|
||||
?>
|
||||
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
@ -84,67 +88,30 @@ else
|
||||
<td colspan="3"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
$row = 0;
|
||||
$handle = fopen($file, "r");
|
||||
while (($ann = fgetcsv($handle, 3000, ';')) !== FALSE) {
|
||||
$row++;
|
||||
if ($row==1) {
|
||||
// Ligne d'entête, on repère les colonnes
|
||||
$num = count($ann);
|
||||
for ($i=0; $i<$num; $i++) {
|
||||
if ($ann[$i]=='SITE_CNASEA') $colSiteCnasea=$i;
|
||||
elseif($ann[$i]=='Siren') $colSiren=$i;
|
||||
elseif($ann[$i]=='Nic') $colNic=$i;
|
||||
elseif($ann[$i]=='Référence') $colRef=$i;
|
||||
elseif($ann[$i]=='Parution') $colParution=$i;
|
||||
elseif($ann[$i]=='Bodacc') $colBodacc=$i;
|
||||
elseif($ann[$i]=='Date parution') $colDatePar=$i;
|
||||
elseif($ann[$i]=='Numéro Annonce') $colNumAnn=$i;
|
||||
elseif($ann[$i]=='Type Annonce') $colTypeAnn=$i;
|
||||
elseif($ann[$i]=='Tribunal') $colTribunal=$i;
|
||||
elseif($ann[$i]=='Numéro RCS') $colNumRCS=$i;
|
||||
elseif($ann[$i]=='Raison sociale') $colRaisonSociale=$i;
|
||||
elseif($ann[$i]=='Chapitre') $colChapitre=$i;
|
||||
elseif($ann[$i]=='Evènement(s)') $colEven=$i;
|
||||
elseif($ann[$i]=='Texte Annonce') $colTexteAnn=$i;
|
||||
elseif($ann[$i]=='Date évènement') $colDateEven=$i;
|
||||
}
|
||||
// On n'affiche pas d'annonce car il s'agit de la ligne d'entête
|
||||
continue;
|
||||
} elseif ($filtre<>'' && $ann[$colChapitre]<>$filtre)
|
||||
continue;
|
||||
|
||||
//
|
||||
// echo "<p> $num champs à la ligne $row: <br /></p>\n";
|
||||
foreach($annonces as $annonce){
|
||||
?>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="550" colspan="2" class="StyleInfoLib">Entreprise : <?=$ann[$colRaisonSociale].' ('.$ann[$colSiren]?>)</td>
|
||||
<td width="550" colspan="2" class="StyleInfoLib">Entreprise : <?=$annonce['RaisonSociale'].' ('.$annonce['Siren']?>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoData">Site : <?=$ann[$colSiteCnasea]?></td>
|
||||
<td width="350" colspan="2" class="StyleInfoData">Référence : <?=$ann[$colRef]?></td>
|
||||
<td width="200" class="StyleInfoData">Site : <?=$annonce['SiteCnasea']?></td>
|
||||
<td width="350" colspan="2" class="StyleInfoData">Référence : <?=$annonce['Ref']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="550" colspan="2" class="StyleInfoData">BODACC n°<?=$ann[$colParution].' '.$ann[$colBodacc].' du '.WDate::dateT('Ymd','d/m/Y',$ann[$colDatePar]);?>. <?=$ann[$colTribunal]?>.</td>
|
||||
<td width="550" colspan="2" class="StyleInfoData">BODACC n°<?=$annonce['Parution'].' '.$annonce['Bodacc'].' du '.$annonce['DatePar'];?>. <?=$annonce['Tribunal']?>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="550" colspan="2" class="StyleInfoLib"><b><?=str_replace(', ','<br/>',$ann[$colEven])?></b></td>
|
||||
<td width="550" colspan="2" class="StyleInfoLib"><b><?=$annonce['Even']?></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30"> </td><?
|
||||
/**
|
||||
** Affichage du texte de l'annonce
|
||||
**/
|
||||
//$texte=preg_replace_callback("/((?:[0-9]{9,9})|(?:[0-9]{3,3} [0-9]{3,3} [0-9]{3,3})|(?:[0-9]{3,3}\.[0-9]{3,3}\.[0-9]{3,3})|(?:[0-9]{3,3}-[0-9]{3,3}-[0-9]{3,3}))/", replace_siren, $ann[14]);
|
||||
$texte=$ann[$colTexteAnn];
|
||||
?><td width="550" colspan="2"><code><?=$texte?></code></td>
|
||||
<td width="30"> </td><td width="550" colspan="2"><code><?=$annonce['TexteAnn']?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
@ -152,11 +119,6 @@ else
|
||||
<tr>
|
||||
<td colspan="3"><hr width="80%"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php }?>
|
||||
</table>
|
||||
<?php
|
||||
fclose($handle);
|
||||
}
|
||||
?>
|
||||
<?php }?>
|
Loading…
x
Reference in New Issue
Block a user