Problem with FPDF

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? How do I output the database info into the generated pdf? Thanks in advance.

What does your pdf.php look like, can you at least post the line in question? and any variables you may have defined at the top of the pdf.php script?

I don’t see the point of doing it, but if you want to have all vars in the global scope with all those lines like

$id = $results['jobcards']->id;

you can also just use


extract(get_object_vars($results['jobcards']));

to replace all the lines you have there. I.e., it just becomes


//Print out the Job Card
elseif(isset($_POST['action']) && $_POST['action'] == 'Print JC')
{
    $results['jobcards'] = JobCardManager::getJobCardById( (int)$_POST['id'] );
    
    $action = 'printJobCard';
    extract(get_object_vars($results['jobcards']));
    include 'pdf.php';
    exit();
}  

Thanks Cpradio, Here is my pdf.php.

<?php
require('../fpdf/fpdf.php');

class PDF extends FPDF
{

function PDF($orientation='L', $unit='mm', $size='A4')
{
    // Call parent constructor
    $this->FPDF($orientation,$unit,$size);

}

// Page header
function Header()
{
    // Logo
    $this->Image('logo.png',10,6,30);
    // Arial bold 10
    $this->SetFont('Arial','',10);
    // Move to the right
    $this->Cell(70);
    // Owner
    $this->Cell(130,6,'OWNER:',1,0,'L');
	// Repair Order No
    $this->Cell(80,6,'REPAIR ORDER NO:',1,1,'L');
	// Move to the right
    $this->Cell(70);
	// Address
    $this->Cell(130,6,'ADDRESS:',1,0,'L');
	// Open Date
    $this->Cell(80,6, $openDate,1,1,'L');
	// Move to the right
    $this->Cell(70);
	// Customer Code
    $this->Cell(80,6,'CUSTOMER CODE:',1,0,'L');
	// Res
    $this->Cell(60,6,'RES:',1,0,'L');
	// Open Time
    $this->Cell(70,6,'OPEN TIME:',1,1,'L');
	// Move to the right
    $this->Cell(70);
	// Mobile Number
    $this->Cell(60,6,'MOBILE NO:',1,0,'L');
	// Email
    $this->Cell(80,6,'EMAIL:',1,0,'L');
	// R .O Type
    $this->Cell(70,6,'R. O TYPE:',1,1,'L');
	// Move to the right
    $this->Cell(70);
	// Office Telelphone
    $this->Cell(80,6,'TELEPHONE:',1,0,'L');
	// Date
    $this->Cell(60,6,'DATE:',1,0,'L');
	// Section
    $this->Cell(70,6,'SECTION:',1,1,'L');
	// Move to the right
    $this->Cell(70);
	// Repair Time
    $this->Cell(60,6,'REPAIR TIME:',1,0,'L');
	// Prepared By
    $this->Cell(60,6,'PREP BY(CODE):',1,0,'L');
	// Promised Delivery Date
    $this->Cell(45,6,'PRO DL DATE:',1,0,'L');
	// Revised Delivery Date
    $this->Cell(45,6,'REV DL DATE:',1,1,'L');
	    $this->Cell(70);
	// Primary Repair Order Number
    $this->Cell(60,6,'PRY R.O NO:',1,0,'L');
	// Prepared By
    $this->Cell(60,6,'PREP BY:',1,0,'L');
	// Promised Delivery Time
    $this->Cell(45,6,'PRO DL TIME:',1,0,'L');
	// Revised Delivery Time
    $this->Cell(45,6,'REV DL TIME:',1,1,'L');
	// Move to the right
    $this->Cell(70);
	// VIN
    $this->Cell(60,6,'VIN:',1,0,'L');
	// Reg No
    $this->Cell(60,6,'REG. NO:',1,0,'L');
	// Kms In
    $this->Cell(45,6,'KMS IN:',1,0,'L');
	// Kms Out
    $this->Cell(45,6,'KMS OUT:',1,1,'L');
    // Move to the right
    $this->Cell(70);
	// Model
    $this->Cell(55,6,'MODEL:',1,0,'L');
	// Engine No
    $this->Cell(55,6,'ENG. NO:',1,0,'L');
	// MT
    $this->Cell(20,6,'MT:',1,0,'L');
	// Kms Out
    $this->Cell(20,6,'AT:',1,0,'L');
	// Parking Location
    $this->Cell(60,6,'PARK. LOC:',1,0,'L');
    // Line break
    $this->Ln(6);
}

// Page footer
function Footer()
{
    // Position at 0.5 cm from bottom
    $this->SetY(-8);
    // Arial italic 8
    $this->SetFont('Arial','I',8);
    // Page number
    $this->Cell(0,10,'Created by Papadammy',0,0,'C');
}

function BodyPart()
{
	$this->SetFont('Arial','B',6);
    // Checklist
    $this->Cell(50,6,'CHECK LIST',0,1,'C');
		
	// Repair Order No
    $this->Cell(25,4,'SERVICE BOOK',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );
	
	// RC Book
    $this->Cell(25,4,'RC BOOK',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );
	
	// Spare Wheel
    $this->Cell(25,4,'SPARE WHEEL',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

// Jack & HAndle
    $this->Cell(25,5,'JACK & HANDLE',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

// Tool Kit
    $this->Cell(25,5,'TOOL KIT',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Fire Extinguisher
    $this->Cell(25,5,'FIRE EXTINGUISHER',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    //  C- Caution
    $this->Cell(25,5,'C-CAUTION',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Wheel Caps
    $this->Cell(25,5,'WHEEL CAPS',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

   // Mud Flap
    $this->Cell(25,5,'MUD FLAP',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Floor Mat
    $this->Cell(25,5,'FLOOR MAT',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Antenna
    $this->Cell(25,5,'ANTENNA',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // O/S RV Mirror
    $this->Cell(25,5,'O/S RV MIRROE',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Monograms
    $this->Cell(25,5,'MONOGRAMS',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Head rest
    $this->Cell(25,5,'HEAD REST',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Cigarette Lighter
    $this->Cell(25,5,'CIG LIGHTER',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // CD/Stereo Player
    $this->Cell(25,5,'CD/STEREO PLAYER',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

   // No of Speakers
    $this->Cell(25,5,'NO OF SPEAKERS',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

   // Digital Clock
    $this->Cell(25,5,'DIGITAL CLOCK',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Head Lamps LH/RH
    $this->Cell(25,5,'HEAD LAMP LH/RH',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Tail Lamp LH/RH
    $this->Cell(25,5,'TAIL LAMP LH/RH',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );
	
	// Side Lamps
    $this->Cell(25,5,'SIDE LAMPS',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Air Conditioner
    $this->Cell(25,5,'AIR CONDITIONER',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );

    // Power Window
    $this->Cell(25,5,'POWER WINDOW',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );
	
	// Wipers
    $this->Cell(25,5,'WIPERS',0,0,'L');
	//Move cell to the right
	$this->Cell(10);
	$this->Cell(4, 4, '', 1, 1, 'C' );
	$this->Ln(13);

}

//Estimate Ref and co
function EstimateRef()
{
	//Set the font
	$this->SetFont('Arial', '', 7);
	//Move the cell to the right
	$this->SetXY(54, 65);
	// Estimate Ref
    $this->Cell(50,6,'ESTIMATE REF',1,0,'L');
	// Date
    $this->Cell(50,6,'DATE',1,1,'L');
	//Move the cell to the right
	$this->SetXY(54, 71);
	// Contractor Customer
    $this->Cell(37,6,'CONTRACTOR CUSTOMER',1,0,'L');
	$this->Cell(10,6,'',1,0,'L');
	// Spl Package
    $this->Cell(20,6,'SPL PACKAGE',1,0,'L');
	$this->Cell(10,6,'',1,0,'L');
	// Others
    $this->Cell(13,6,'OTHERS',1,0,'L');
	$this->Cell(10,6,'',1,0,'L');
}

function LubService()
{
	//Set the font for Lub Services
	$this->SetFont('Arial', '', 4);
	//Set the coordinate for Lub Service
	$this->SetXY(160, 65);
	// Lubrication Services
    $this->Cell(12,4,'LUB SERVICE',1,0,'C');
	// Body Wash
    $this->Cell(10,4,'BODY WASH',1,0,'C');
	// Full Wash
    $this->Cell(10,4,'FULL WASH',1,0,'C');
	// Lubrication
    $this->Cell(10,4,'LUBRICATION',1,0,'C');
	// E. Oil Cahnge
    $this->Cell(10,4,'E. OIL CHG',1,0,'C');
	// E Oil Top Up
    $this->Cell(11,4,'E. OIL TOP UP',1,0,'C');
	// Filter Change
    $this->Cell(10,4,'FILTER CHG',1,0,'C');
	// Dif Oil Change
    $this->Cell(10,4,'DIF. OIL CHG',1,0,'C');
	// Dif Oil Change
    $this->Cell(12,4,'DIF. OIL TOP UP',1,0,'C');
	// Gif Oil Change
    $this->Cell(11,4,'GIF OIL CHG',1,0,'C');
	// Gif Oil Top Up
    $this->Cell(12,4,'GIF. OIL TOP UP',1,0,'C');
	// Sig Oil
    $this->Cell(10,4,'SIG OIL',1,1,'C');
	
	//Second Line for requested
	//Set the font for Lub Services
	$this->SetFont('Arial', '', 4);
	//Set the coordinate for Lub Service
	$this->SetXY(160, 69);
	
	// Lubrication Services
    $this->Cell(12,4,'REQUESTED',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(11,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(12,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(11,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(12,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,1,'C');
	
	//Second Line for requested
	//Set the font for Lub Services
	$this->SetFont('Arial', '', 4);
	//Set the coordinate for Lub Service
	$this->SetXY(160, 73);
	
	// Lubrication Services
    $this->Cell(12,4,'CARRIED OUT',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(11,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(12,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(11,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(12,4,'',1,0,'C');
	// Lubrication Services
    $this->Cell(10,4,'',1,1,'C');
}
//This handles the agrrement to be signed
function Authorise($authorise)
{
	$this->SetFont('Arial','',6);
	$this->MultiCell(150, 2, $authorise);
	$this->Ln(4);
}

//This handles the agrrement to be signed
function NojAndRco()
{
	$this->SetFont('Arial','',8);
	$this->SetXY(90, 80);
	//Nature of Jobs
	$this->Cell(100, 7, 'NATURE OF JOBS/REPAIR REQUESTED', 1, 0, 'C');
	//Nature of Jobs
	$this->Cell(100, 7, 'REPAIRS CARRIED OUT', 1, 1, 'C');
	$this->SetXY(90, 87);
	//Nature of Jobs
	$this->Cell(70, 5, 'DESCRIPTION', 1, 0, 'C');
	//Nature of Jobs
	$this->Cell(30, 5, 'OP CODE', 1, 0, 'C');
	//Nature of Jobs
	$this->Cell(70, 5, 'DESCRIPTION', 1, 0, 'C');
	//Nature of Jobs
	$this->Cell(30, 5, 'LAB. COST', 1, 1, 'C');
	$this->SetXY(90, 92);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
	//Set the coordinate
	$this->SetXY(90, 97);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
	//Set the coordinate
	$this->SetXY(90, 102);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
    //Set the coordinate
	$this->SetXY(90, 107);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
    //Set the coordinate
	$this->SetXY(90, 112);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
    //Set the coordinate
	$this->SetXY(90, 117);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
    //Set the coordinate
	$this->SetXY(90, 122);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
    //Set the coordinate
	$this->SetXY(90, 127);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
    //Set the coordinate
	$this->SetXY(90, 132);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
    //Set the coordinate
	$this->SetXY(90, 137);
	//Nature of Jobs
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 0, 'L');
	$this->Cell(70, 5, '', 1, 0, 'L');
	$this->Cell(30, 5, '', 1, 1, 'L');
	
}

function JobCompletion()
{
	$this->SetXY(90, 143);
	$this->SetFont('Arial', '', 8);
	$this->Cell(100, 6, 'JOB COMPLETION DETAILS', 1, 1, 'C');
	$this->SetXY(90, 149);
	$this->Cell(33, 6, 'FLOOR IN CHARGE', 1, 0, 'C');
	$this->Cell(33, 6, 'TESTER', 1, 0, 'C');
	$this->Cell(34, 6, 'LUB IN CHARGE', 1, 1, 'C');
	$this->SetXY(90, 155);
	$this->Cell(33, 6, '', 1, 0, 'C');
	$this->Cell(33, 6, '', 1, 0, 'C');
	$this->Cell(34, 6, '', 1, 1, 'C');
	
}

function JobCompletion2()
{
	$this->SetXY(90, 160);
	$this->SetFont('Arial', '', 8);
	$this->Cell(60, 6, 'R.O CLOSED BY CODE:', 1, 0, 'L');
	$this->Cell(40, 6, 'DATE', 1, 1, 'L');
	$this->SetXY(90, 166);
	$this->Cell(40, 6, 'G. P NO:', 1, 0, 'L');
	$this->Cell(30, 6, 'DATE:', 1, 0, 'L');
	$this->Cell(30, 6, 'RECPN:', 1, 1, 'L');
	$this->SetXY(90, 172);
	$this->Cell(40, 6, 'G. P NO:', 1, 0, 'L');
	$this->Cell(30, 6, 'DATE:', 1, 0, 'L');
	$this->Cell(30, 6, 'RECPN:', 1, 1, 'L');
	
}

function SpecialInstruction()
{
	$this->SetXY(165, 180);
	$this->SetFont('Arial', '', 8);
	$this->Cell(50, 6, 'SPECIAL INSTRUCTION/EDP DATA', 1, 1, 'C');
	$this->SetXY(165, 186);
	$this->Cell(20, 15, '', 1, 0, 'C');
	$this->Cell(10, 15, '', 1, 0, 'C');
	$this->Cell(20, 15, '', 1, 1, 'C');
	
}

//This handles the summary
function Summary()
{
	$this->SetXY(220, 145);
	$this->SetFont('Arial', 'B', 8);
	$this->Cell(40, 4, 'DESCRIPTION', 1, 0, 'C');
	$this->Cell(30, 4, 'COST', 1, 1, 'C');
	
	$this->SetXY(220, 149);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'LABOUR:', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 153);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'PARTS', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 157);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'TBA', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 161);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'GAS & OIL', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 165);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'SUBLET', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 169);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'OTHERS', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 173);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'TOTAL', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 177);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'DISCOUNT(Labour/Parts)', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 181);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'VAT', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 185);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'NET AMOUNT PAYABLE', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 189);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'WARRANTY(Labour/Parts)', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
	$this->SetXY(220, 193);
	$this->SetFont('Arial', '', 8);
	$this->Cell(40, 4, 'I/II SERVICE', 1, 0, 'L');
	$this->Cell(30, 4, '', 1, 1, 'C');
	
}

//This handles the places to place name and signature
function Signature()
{
	$this->SetFont('Arial','',6);
	$this->SetAutoPageBreak( 1, 5);
	$this->Cell(100, 4, 'Name:', 1, 0, 'L');
	$this->Cell(50, 4, 'Signature:', 1, 1, 'L');
	$this->SetFont('Arial','B',5);
	$this->Cell(150, 2, 'Received', 0, 0, 'C');
}


} //closing tag for class declaration

$authorise = 'Me';

$pdf = new PDF();
// First page
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial','',10);
$pdf->BodyPart();
$pdf->SetFont('Arial','',10);
$pdf->Authorise($authorise);
$pdf->Signature();
$pdf->LubService();
$pdf->EstimateRef();
$pdf->NojAndRco();
$pdf->JobCompletion();
$pdf->JobCompletion2();
$pdf->SpecialInstruction();
$pdf->Summary();
$pdf->Output();

?>

This is where I will agree with @ScallioXTX ; and say you shouldn’t be creating individual variables. Instead pass your JobManager object to your PDF class so it has access to the variable and its properties.

To recap,
Add private variable and Update the constructor

private $jobManager;
function __constructor($jobManager, $orientation='L', $unit='mm', $size='A4') 
{ 
    // Call parent constructor 
    $this->jobManager = $jobManager;
    $this->FPDF($orientation,$unit,$size); 

} 

Pass it in

$pdf = new PDF($results['jobcards']); 

Now you can reference your JobManager data using inside your PDF functions

$this->jobManager->openDate;

My mentors, I really appreciate you guys, I have it working now and I’ve learnt a lot from you guys. Please one more challenge, how do I display date in a correct format in the pdf document? Thanks so much, men.

By probably using the [fphp]date[/fphp] command.
Example:

date("F j, Y", $this->jobManager->openDate)