Décomposition des PDFs survliste
This commit is contained in:
parent
abedde5fd8
commit
61d4923ed1
@ -4,43 +4,32 @@ require_once 'common/dates.php';
|
||||
require_once 'common/curl.php';
|
||||
|
||||
isset($_REQUEST['q'])? $nomFic = $_REQUEST['q'] : $nomFic = '';
|
||||
isset($_REQUEST['page'])? $page = $_REQUEST['page'] : $page = '';
|
||||
|
||||
$nbAnnoncesMin = ($page-1)*100;
|
||||
$nbAnnoncesMax = $nbAnnoncesMin+100;
|
||||
|
||||
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);
|
||||
$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));
|
||||
}
|
||||
/*} catch (SoapFault $fault) {
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$tabInfo);
|
||||
exit;
|
||||
}*/
|
||||
bzclose($bz);
|
||||
}
|
||||
|
||||
$annonces = readann($file, '');
|
||||
|
||||
$output = '';
|
||||
@ -66,28 +55,31 @@ if($nomFic == ''){
|
||||
$count = 0;
|
||||
if(count($annonces)>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>';
|
||||
if ($count>$nbAnnoncesMax) break;
|
||||
if($count>$nbAnnoncesMin){
|
||||
$output.= '<page>';
|
||||
$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++;
|
||||
}
|
||||
}
|
||||
|
@ -10,14 +10,14 @@ if (!$_SESSION['connected'])
|
||||
else {
|
||||
|
||||
isset($_REQUEST['nomFic'])? $nomFic = $_REQUEST['nomFic'] : $nomFic='' ;
|
||||
|
||||
|
||||
//Génération liste surveillance
|
||||
$ref = $_SESSION['tabInfo']['prenom'];
|
||||
if ( strtolower($_SESSION['tabInfo']['login'])=='cnasea95' ||
|
||||
if ( strtolower($_SESSION['tabInfo']['login'])=='cnasea95' ||
|
||||
strtolower($_SESSION['tabInfo']['login'])=='cnasea96' ||
|
||||
$_SESSION['tabInfo']['idClient']==32
|
||||
$_SESSION['tabInfo']['idClient']==32
|
||||
) $ref='*';
|
||||
|
||||
|
||||
try {
|
||||
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $ref, $nomFic);
|
||||
$tabFichier=$O['results'];
|
||||
@ -51,7 +51,7 @@ else {
|
||||
<?php
|
||||
$tabTmp=explode('_', $nomFic);// surveillanceBodacc_SURBODTSTFTSCNASEA_20081223.csv html
|
||||
$dateFic=Wdate::dateT('Ymd','d/m/Y', substr($tabTmp[2],0,8));
|
||||
|
||||
|
||||
$localfile = PATH_DATA.'/pdf/'.$nomFic;
|
||||
if (!file_exists($localfile)) {
|
||||
$dejaLu1='<b>';
|
||||
@ -63,10 +63,10 @@ else {
|
||||
?>
|
||||
<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>
|
||||
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>
|
||||
ou au format <a href="./?page=survlisteann&nomFic=<?=$nomFic?>" title="<?=$nomFic?>">PDF</a>
|
||||
<?=$dejaLu2?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -24,31 +24,25 @@ else{
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
$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));
|
||||
}
|
||||
} catch (SoapFault $fault) {
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$tabInfo);
|
||||
exit;
|
||||
bzclose($bz);
|
||||
}
|
||||
|
||||
$annonces = readann($file, $filtre);
|
||||
|
||||
$nbAnnonces = count($annonces);
|
||||
$firephp->log($nbAnnonces, 'count');
|
||||
?>
|
||||
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
@ -78,6 +72,19 @@ else{
|
||||
<option value="mmd" <?if ($filtre=='mmd') echo 'selected';?>>Modifications diverses</option>
|
||||
</select></form></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Télécharger la liste en pdf</td>
|
||||
<td width="350" class="StyleInfoData">
|
||||
<?php
|
||||
//On souhaite afficher 100 annonces par PDF
|
||||
$nbPDF = ceil($nbAnnonces/100);
|
||||
for($i=0;$i<$nbPDF;$i++){ ?>
|
||||
<a href="./html2pdf.php?q=<?=$nomFic?>&page=<?=$i+1?>"><?=$i+1?></a>
|
||||
<?php if($i!=$nbPDF-1) print "-"; ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
</tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user