SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Location
    Port Harcourt
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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:



    PHP Code:
    //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:


    PHP Code:
    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"$idPDO::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.

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,131
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    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?

  3. #3
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,070
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    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

    PHP Code:
    $id $results['jobcards']->id
    you can also just use

    PHP Code:
    extract(get_object_vars($results['jobcards'])); 
    to replace all the lines you have there. I.e., it just becomes

    PHP Code:
    //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();

    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Location
    Port Harcourt
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My pdf.php script

    Thanks Cpradio, Here is my pdf.php.

    PHP Code:
    <?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(44''11'C' );
        
        
    // RC Book
        
    $this->Cell(25,4,'RC BOOK',0,0,'L');
        
    //Move cell to the right
        
    $this->Cell(10);
        
    $this->Cell(44''11'C' );
        
        
    // Spare Wheel
        
    $this->Cell(25,4,'SPARE WHEEL',0,0,'L');
        
    //Move cell to the right
        
    $this->Cell(10);
        
    $this->Cell(44''11'C' );

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

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

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

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

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

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

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

        
    // Antenna
        
    $this->Cell(25,5,'ANTENNA',0,0,'L');
        
    //Move cell to the right
        
    $this->Cell(10);
        
    $this->Cell(44''11'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(44''11'C' );

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

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

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

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

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

       
    // Digital Clock
        
    $this->Cell(25,5,'DIGITAL CLOCK',0,0,'L');
        
    //Move cell to the right
        
    $this->Cell(10);
        
    $this->Cell(44''11'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(44''11'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(44''11'C' );
        
        
    // Side Lamps
        
    $this->Cell(25,5,'SIDE LAMPS',0,0,'L');
        
    //Move cell to the right
        
    $this->Cell(10);
        
    $this->Cell(44''11'C' );

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

        
    // Power Window
        
    $this->Cell(25,5,'POWER WINDOW',0,0,'L');
        
    //Move cell to the right
        
    $this->Cell(10);
        
    $this->Cell(44''11'C' );
        
        
    // Wipers
        
    $this->Cell(25,5,'WIPERS',0,0,'L');
        
    //Move cell to the right
        
    $this->Cell(10);
        
    $this->Cell(44''11'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(5465);
        
    // 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(5471);
        
    // 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(16065);
        
    // 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(16069);
        
        
    // 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(16073);
        
        
    // 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(1502$authorise);
        
    $this->Ln(4);
    }

    //This handles the agrrement to be signed
    function NojAndRco()
    {
        
    $this->SetFont('Arial','',8);
        
    $this->SetXY(9080);
        
    //Nature of Jobs
        
    $this->Cell(1007'NATURE OF JOBS/REPAIR REQUESTED'10'C');
        
    //Nature of Jobs
        
    $this->Cell(1007'REPAIRS CARRIED OUT'11'C');
        
    $this->SetXY(9087);
        
    //Nature of Jobs
        
    $this->Cell(705'DESCRIPTION'10'C');
        
    //Nature of Jobs
        
    $this->Cell(305'OP CODE'10'C');
        
    //Nature of Jobs
        
    $this->Cell(705'DESCRIPTION'10'C');
        
    //Nature of Jobs
        
    $this->Cell(305'LAB. COST'11'C');
        
    $this->SetXY(9092);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(9097);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(90102);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(90107);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(90112);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(90117);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(90122);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(90127);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(90132);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    //Set the coordinate
        
    $this->SetXY(90137);
        
    //Nature of Jobs
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''10'L');
        
    $this->Cell(705''10'L');
        
    $this->Cell(305''11'L');
        
    }

    function 
    JobCompletion()
    {
        
    $this->SetXY(90143);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(1006'JOB COMPLETION DETAILS'11'C');
        
    $this->SetXY(90149);
        
    $this->Cell(336'FLOOR IN CHARGE'10'C');
        
    $this->Cell(336'TESTER'10'C');
        
    $this->Cell(346'LUB IN CHARGE'11'C');
        
    $this->SetXY(90155);
        
    $this->Cell(336''10'C');
        
    $this->Cell(336''10'C');
        
    $this->Cell(346''11'C');
        
    }

    function 
    JobCompletion2()
    {
        
    $this->SetXY(90160);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(606'R.O CLOSED BY CODE:'10'L');
        
    $this->Cell(406'DATE'11'L');
        
    $this->SetXY(90166);
        
    $this->Cell(406'G. P NO:'10'L');
        
    $this->Cell(306'DATE:'10'L');
        
    $this->Cell(306'RECPN:'11'L');
        
    $this->SetXY(90172);
        
    $this->Cell(406'G. P NO:'10'L');
        
    $this->Cell(306'DATE:'10'L');
        
    $this->Cell(306'RECPN:'11'L');
        
    }

    function 
    SpecialInstruction()
    {
        
    $this->SetXY(165180);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(506'SPECIAL INSTRUCTION/EDP DATA'11'C');
        
    $this->SetXY(165186);
        
    $this->Cell(2015''10'C');
        
    $this->Cell(1015''10'C');
        
    $this->Cell(2015''11'C');
        
    }

    //This handles the summary
    function Summary()
    {
        
    $this->SetXY(220145);
        
    $this->SetFont('Arial''B'8);
        
    $this->Cell(404'DESCRIPTION'10'C');
        
    $this->Cell(304'COST'11'C');
        
        
    $this->SetXY(220149);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'LABOUR:'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220153);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'PARTS'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220157);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'TBA'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220161);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'GAS & OIL'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220165);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'SUBLET'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220169);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'OTHERS'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220173);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'TOTAL'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220177);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'DISCOUNT(Labour/Parts)'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220181);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'VAT'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220185);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'NET AMOUNT PAYABLE'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220189);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'WARRANTY(Labour/Parts)'10'L');
        
    $this->Cell(304''11'C');
        
        
    $this->SetXY(220193);
        
    $this->SetFont('Arial'''8);
        
    $this->Cell(404'I/II SERVICE'10'L');
        
    $this->Cell(304''11'C');
        
    }

    //This handles the places to place name and signature
    function Signature()
    {
        
    $this->SetFont('Arial','',6);
        
    $this->SetAutoPageBreak15);
        
    $this->Cell(1004'Name:'10'L');
        
    $this->Cell(504'Signature:'11'L');
        
    $this->SetFont('Arial','B',5);
        
    $this->Cell(1502'Received'00'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();

    ?>

  5. #5
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,131
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    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
    PHP Code:
    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
    PHP Code:
    $pdf = new PDF($results['jobcards']); 
    Now you can reference your JobManager data using inside your PDF functions
    PHP Code:
    $this->jobManager->openDate

  6. #6
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Location
    Port Harcourt
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Its Working Fine Now

    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.

  7. #7
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,131
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    By probably using the date command.
    Example:
    PHP Code:
    date("F j, Y"$this->jobManager->openDate


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •