Viewing File: /people/testlab/www/testlab.com.pl/generuj_pdf.php

<?php
require('inc/fpdf.php');
include ('inc/db.php');
$db = new DBConnect();
$db2 = new DBConnect();

$result = $db->query($_POST['sql2']);

$pdf = new FPDF();
$pdf->AddFont('qhvr','','qhvr.php');
$pdf->AddFont('qhvb','','qhvb.php');
$pdf->AddPage();
$pdf->SetFont('qhvb','',9);

if ($db->numrows()==0)  $pdf->Cell(40,10,"Nie znaleziono !!!",1);

$pdf->Cell(10,10,"LP",1,0,'C');
$pdf->Cell(25,10,"Numer",1,0,'C');
$pdf->Cell(40,10,"Ekspert",1,0,'C');
$pdf->Cell(35,10,"Klient",1,0,'C');
$pdf->Cell(25,10,"Rodzaj szkody",1,0,'C');
$pdf->Cell(25,10,"Prowizja",1,0,'C');
$pdf->Cell(30,10,iconv('utf-8','iso-8859-2','ProwadzÄ…cy'),1,1,'C');

$pdf->SetFont('qhvr','',8);
while ($row=$db->fetchrow())
{
$I++;
$pdf->Cell(10,10,$I,1,0,'L');
$pdf->Cell(25,10,$row['numer'],1,0,'L');
	$sql = "select * from users where id=".$row['id_agenta'];
	$db2->query($sql);
	$row2=$db2->fetchrow();

if ($row2['nazwa'])	
$pdf->Cell(40,10,iconv('utf-8','iso-8859-2',$row2['nazwa']),1,0,'L');
else
$pdf->Cell(40,10,iconv('utf-8','iso-8859-2',$row2['nazwisko']." ".$row2['imie']),1,0,'L');

$pdf->Cell(35,10,iconv('utf-8','iso-8859-2',$row['nazwisko']." ".$row['imie']),1,0,'L');
	$sql = "select * from rodzaj_szkody where id=".$row['rodzaj_szkody'];
	$db2->query($sql);
	$row2=$db2->fetchrow();

$pdf->Cell(25,10,$row2['nazwa'],1,0,'C');
	$sql = "select * from umowa_prowizje where id_umowy=".$row['id']." order by id desc";
	$db2->query($sql);
	$row2=$db2->fetchrow();
	$prow=$row2['kwota'];
	while ($row2=$db2->fetchrow()) 	$prow=$prow.", ".$row2['kwota'];

$pdf->Cell(25,10,$prow,1,0,'C');
	$sql = "select * from users where id=".$row['prowadzacy'];
	$db2->query($sql);
	$row2=$db2->fetchrow();

$pdf->Cell(30,10,iconv('utf-8','iso-8859-2',$row2['nazwisko']." ".$row2['imie']),1,1,'C');


	
	
	
}


$pdf->Output();
?>
Back to Directory File Manager