Problem with FPDF

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

01-Nov-12 07:56
Good day Mr. Moderator,
Please I'm having problem displaying database data in my fpdf. I created the pdf document using fpdf and everything about that is working fine. The challenge now arise from here:
I have a class called JobCardManager which manages the jobcard. Anytime I want to create a pdf format of the job card from my database, i make this call shown below when Print JC button is clicked on a web form:



//Print out the Job Card
elseif(isset($_POST['action']) && $_POST['action'] == 'Print JC')
{
$results['jobcards'] = JobCardManager::getJobCardById( (int)$_POST['id'] );

$action = 'printJobCard';
$id = $results['jobcards']->id;
$repairId = $results['jobcards']->repairId;
$openDate = $results['jobcards']->openDate;
$openTime = $results['jobcards']->openTime;
$repairTime = $results['jobcards']->repairTime;
$repairOrderType = $results['jobcards']->repairOrderType;
$section = $results['jobcards']->section;
$pryRepairOrderNo = $results['jobcards']->pryRepairOrderNo;
$preparedBy = $results['jobcards']->preparedBy;
$promDelDate = $results['jobcards']->promDelDate;
$promDelTime = $results['jobcards']->promDelTime;
$revisedDelDate = $results['jobcards']->revisedDelDate;
$revisedDelTime = $results['jobcards']->revisedDelTime;
$kmIn = $results['jobcards']->kmIn;
$kmOut = $results['jobcards']->kmOut;
$mt = $results['jobcards']->mt;
$at = $results['jobcards']->at;
$estimateRef = $results['jobcards']->estimateRef;
$contractorCustomer = $results['jobcards']->contractorCustomer;
$splPackage = $results['jobcards']->splPackage;
$estimateDate = $results['jobcards']->estimateDate;
$others = $results['jobcards']->others;
$lubServices = $results['jobcards']->lubServices;
$noj1 = $results['jobcards']->noj1;
$noj2 = $results['jobcards']->noj2;
$noj3 = $results['jobcards']->noj3;
$noj4 = $results['jobcards']->noj4;
$noj5 = $results['jobcards']->noj5;
$noj6 = $results['jobcards']->noj6;
$noj7 = $results['jobcards']->noj7;
$noj8 = $results['jobcards']->noj8;
$noj9 = $results['jobcards']->noj9;
$noj10 = $results['jobcards']->noj10;
$opCode1 = $results['jobcards']->opCode1;
$opCode2 = $results['jobcards']->opCode2;
$opCode3 = $results['jobcards']->opCode3;
$opCode4 = $results['jobcards']->opCode4;
$opCode5 = $results['jobcards']->opCode5;
$opCode6 = $results['jobcards']->opCode6;
$opCode7 = $results['jobcards']->opCode7;
$opCode8 = $results['jobcards']->opCode8;
$opCode9 = $results['jobcards']->opCode9;
$opCode10 = $results['jobcards']->opCode10;
$rco1 = $results['jobcards']->rco1;
$rco2 = $results['jobcards']->rco2;
$rco3 = $results['jobcards']->rco3;
$rco4 = $results['jobcards']->rco4;
$rco5 = $results['jobcards']->rco5;
$rco6 = $results['jobcards']->rco6;
$rco7 = $results['jobcards']->rco7;
$rco8 = $results['jobcards']->rco8;
$rco9 = $results['jobcards']->rco9;
$rco10 = $results['jobcards']->rco10;
$labour = $results['jobcards']->labour;
$parts = $results['jobcards']->parts;
$tba = $results['jobcards']->tba;
$gasAndOil = $results['jobcards']->gasAndOil;
$sublet = $results['jobcards']->sublet;
$others2 = $results['jobcards']->others2;
$total = $results['jobcards']->total;
$discountLabour = $results['jobcards']->discountLabour;
$discountParts = $results['jobcards']->discountParts;
$services = $results['jobcards']->services;
$others = $results['jobcards']->others;
$lubServices = $results['jobcards']->lubServices;
$warrantyLabour = $results['jobcards']->warrantyLabour;
$warrantyParts = $results['jobcards']->warrantyParts;
$vat = $results['jobcards']->vat;
$netAmountPayable = $results['jobcards']->netAmountPayable;

include 'pdf.php';
exit();

}


The Print JC button actually calls this code from the JobCardManager class:



public static function getJobCardById( $id ) {
$conn = DatabaseManager::getConnection();
$sql = "SELECT *, UNIX_TIMESTAMP(openDate) AS openDate, UNIX_TIMESTAMP(promDelDate) AS promDelDate, UNIX_TIMESTAMP(revisedDelDate) AS revisedDelDate, UNIX_TIMESTAMP(estimateDate) AS estimateDate FROM jobcard WHERE id = :id";
$st = $conn->prepare( $sql );
$st->bindValue( ":id", $id, PDO::PARAM_INT );
$st->execute();
$row = $st->fetch();
$conn = null;
if ( $row ) return new JobCardManager( $row );
}


My generated pdf is working fine when I display normal data embedded in it directly but when I tried to output the value of $openDate inside it, it gave me this error:



Notice: Undefined variable: openDate in C:\wamp\www\me\customers\pdf.php on line 32



I tried to output the database data called when Print JC is pressed in another html/php page and it displayed my data rightly. What am I doing wrong with this fpdf doc? thanks in advance.
07-Nov-12 04:52
Thanks all, i have this problem sorted out.

 
New posts
Old posts

Follow Elated