1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| <?php
$full_path = 'C:\xampp\htdocs\wsinn'; // chemin système (local) vers le fichier
$navire_pdf = basename($full_path);
ini_set('zlib.output_compression', 0);
header('Pragma: public');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Content-Tranfer-Encoding: none');
header('Content-Length: '.filesize($full_path));
header('Content-MD5: '.base64_encode(md5_file($full_path)));
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename=navire.pdf');
readfile($full_path);
?>
<?php
session_start();
$serverName = "192.168.127.107";
$uid = "sa";
$pwd = "m0615315009";
$dbname = "wsinn";
$connectionInfo = array("UID" => $uid, "PWD" => $pwd, "Database"=>$dbname);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$mat_navire=$_SESSION['mat_navire'];
$date1=$_SESSION['date1'];
$date2=$_SESSION['date2'];
define('FPDF_FONTPATH','font/');
require('fpdf.php');
$dimension = array(60,60);
$pdf=new FPDF('P','cm',$dimension);
//Titres des colonnes
$header=array('id_mareyeur' , 'nom_mareyeur' , 'mat_Navire' , 'nom_navire' , 'Type_navire' , 'num_visa' , 'num_EAche' , 'poids_Vendu' );
$pdf->SetFont('Arial','B',17);
$pdf->AddPage();
$pdf->SetFillColor(96,96,96);
$pdf->SetTextColor(255,255,255);
set_time_limit(0);
$sql = "select distinct ea.num_EAchat,ea.Id_Mareyeur,ea.Nom_Mareyeur,dea.mat_Navire,dea.Nom_Navire,dea.Type_Navire,dea.Num_Visa,dnea.Code_DEAchat,dnea.PoidsVendu,ea.Session_Travail
from Etat_Achat ea inner join dbo.Detail_EAchat dea
on ea.Code_EAchat=dea.Code_EAchat inner join Detail_Navire_EAchat dnea on dea.Code_DEAchat=dnea.Code_DEAchat
where dea.mat_navire='".$mat_navire."' AND ea.Session_Travail BETWEEN '".$date1."' AND '".$date2."' ";
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$stmt = sqlsrv_query( $conn, $sql, $params, $options);
$num = sqlsrv_num_rows($stmt);
$pdf->SetXY(3,3);
for($i=0;$i<sizeof($header);$i++)
$pdf->cell(5,1,$header[$i],1,0,'C',1);
$pdf->SetFillColor(0xdd,0xdd,0xdd);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',10);
$pdf->SetXY(3,$pdf->GetY()+1);
$fond=0;
while ($row = sqlsrv_fetch_array($stmt,SQLSRV_FETCH_ASSOC)){
$pdf->cell(5,0.7,$row['Id_Mareyeur'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['Nom_Mareyeur'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['mat_Navire'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['Nom_Navire'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['Type_Navire'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['Num_Visa'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['num_EAchat'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['PoidsVendu'],1,0,'C',$fond);
$pdf->SetXY(3,$pdf->GetY()+0.7);
$fond=!$fond;
}
//header("Content-type: application/pdf");
//header("Content-disposition: attachment; filename=navire_pdf.pdf");
//print($pdf);
//$pdf->output();
exit;
?> |
Partager