Hi
I have a db that has the following Data for example:
PolicyNumber, StoreId, ConsultantName,ClientName, ClientSurname
I would like to have a report that will give me a list of policies done for that day seperated by store printed to PDF.
So Basically
Store - 12CEL
24Hr001 Bob Joe Soap
24Hr002 Bill Gill Henry
Store - 1156
24Hr003 Luke Manfred Kiy
24Hr004 Peter Ursula Jent
I currently use R&OS for pdf Printing
http://www.ros.co.nz/pdf
The Code below Gives me all policies, I just need to now seperate them in the PDF
//include pdf class
include ('class.ezpdf.php');
//Include PHP Mailer Class
require("class.phpmailer.php");
//Connect to database
mysql_connect("localhost", "root", "");
@mysql_select_db("mobility") or die("Unable to select database");
$queryP= mysql_query("SELECT * FROM tblpolicies WHERE CaptureDate='2006-04-03' ORDER BY StoreId");
$pdf =& new Cezpdf();
//$pdf->addJpegFromFile('policy.jpg',60,$pdf->y-750,500,0);
$pdf->selectFont('./fonts/Helvetica.afm');
$p = 750;
While($x=mysql_fetch_array($queryP)){
$pdf->addText(50,$p,7,"{$x['PolicyNumber']}");
$pdf->addText(80,$p,7,"{$x['StoreId']}");
$pdf->addText(120,$p,7,"{$x['NickName']}");
$pdf->addText(220,$p,7,"{$x['ClientsName']}");
$pdf->addText(330,$p,7,"{$x['DateReceived']}");
$pdf->addText(410,$p,7,"{$x['Comments']}");
$p = $p - 10;
if($p == 10){
$pdf->ezNewPage();
$p = 750;
}
}
$pdf->ezText("\n\n\n\n\n\n\n" . $body,16,array('justification'=>'centre'));
$pdf->output();
$pdf->ezStream();
//write pdf stream to pdf file
$pdfcode = $pdf->ezOutput();
$fp=fopen('policy.pdf','wb');
fwrite($fp,$pdfcode);
fclose($fp);