96 lines
3.3 KiB
PHP
96 lines
3.3 KiB
PHP
<?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 pageset="old">';
|
|
$output.= '<table style="width:100%;">';
|
|
$output.= '<tr>';
|
|
$output.= '<td style="width:50%;">Entreprise : '.$annonce['RaisonSociale'].' ('.$annonce['Siren'].')</td>';
|
|
$output.= '<td style="width:50%;"> </td>';
|
|
$output.= '</tr>';
|
|
$output.= '<tr>';
|
|
$output.= '<td style="width:50%;">Site : '.$annonce['SiteCnasea'].'</td>';
|
|
$output.= '<td style="width:50%;">Référence : '.$annonce['Ref'].'</td>';
|
|
$output.= '</tr>';
|
|
$output.= '<tr>';
|
|
$output.= '<td style="width:100%;" colspan="2">BODACC n°'.$annonce['Parution'].' '.$annonce['Bodacc'].' du '.$annonce['DatePar'].' '.$annonce['Tribunal'].'.</td>';
|
|
$output.= '</tr>';
|
|
$output.= '<tr><td style="width:100%;" colspan="2"> </td></tr>';
|
|
$output.= '<tr>';
|
|
$output.= '<td style="width:100%;" colspan="2"><b>'.$annonce['Even'].'</b></td>';
|
|
$output.= '</tr>';
|
|
$output.= '<tr>';
|
|
$output.= '<td style="width:100%;" colspan="2">'.$annonce['TexteAnn'].'</td>';
|
|
$output.= '</tr>';
|
|
$output.= '</table>';
|
|
$output.= '</page>';
|
|
$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');
|
|
}
|
|
|
|
?>
|