File: /home/mckernan/public_html/iJournal/includes/tracker/ItemReportClass.php
<?php
require(includePath() . 'fpdf.php');
class PDF extends FPDF
{
public $title;
public $client;
public $item;
public $target;
public $date;
public $year;
function PDF($theClient, $theItem, $theTarget, $theYear)
{
$this->title = 'Client Tracker Item Report';
$this->client = $theClient;
$this->target = $theTarget;
$this->date = date('M j Y @ g:ia');
$this->year = $theYear;
$this->item = $theItem;
parent::FPDF('P', 'mm', 'letter');
$this->SetAutoPageBreak(true, 20);
}
// Page header
function Header()
{
// report title
$this->SetXY(16, 12);
$this->SetTextColor(102, 102, 102);
$this->SetFont('Arial','BI',8);
$this->Cell(38, 3, "Anthony Marinaccio", 0, 1, 'C');
$this->SetFont('Arial','BI',7);
$this->SetX(16);
$this->Cell(38, 3, "Tax Consultants - Accountants", 0, 0, 'C');
$this->SetTextColor(0, 0, 0);
$this->SetXY(16, 11);
$this->SetFont('Arial','B',12);
$this->Cell(0, 10, $this->title, 0, 0, 'R');
$this->Line(16, 19, 206, 19);
// client info?
if ($this->PageNo() == 1)
{
// Line break
$this->Ln(12);
$this->SetX(20);
$this->SetFont('Arial', '', 7);
$this->Cell(10, 10, 'Client:', 0, 0, 'L');
$this->SetFont('Arial', 'B', 10);
$this->Cell(135, 10, $this->client, 0, 0, 'L');
$this->SetFont('Arial','',7);
$this->Cell(10, 10, 'Year:', 0, 0, 'L');
$this->SetFont('Arial', 'B', 10);
$this->Cell(0, 10, $this->year, 0, 1, 'L');
$this->Line(16, 32, 206, 32);
$this->Ln(5);
$this->SetX(30);
$this->SetFont('Arial','',7);
$this->Cell($this->GetStringWidth('Item: ') + 1, 5, 'Item:', 0, 0, "L");
$this->SetFont('Arial', 'B', 10);
$this->Cell($this->GetStringWidth($this->item) + 2, 5, $this->item, 0, 0, "L");
if ($this->target > 0)
{
$this->SetX(150);
$this->SetFont('Arial','',7);
$this->Cell($this->GetStringWidth('Target: ') + 1, 5, 'Target:', 0, 0, 'L');
$this->SetFont('Arial', 'B', 10);
$this->Cell(0, 5, $this->target, 0, 1, 'L');
}
// line break
$this->Ln(18);
}
else
{
// line break
$this->Ln(22);
}
// table header
$this->SetX(50);
$this->SetFillColor(225, 225, 225);
$this->SetTextColor(60, 60, 60);
$this->SetFont('Arial', 'B', 8);
$this->Cell(86, 4, 'Period', 1, 0, 'C', true);
$this->Cell(30, 4, 'Amount', 1, 1, 'C', true);
$this->SetTextColor(0, 0, 0);
}
// Page footer
function Footer()
{
// divider line
$this->Line(16, 261, 206, 261);
// confidential
$this->SetXY(16, -18);
$this->SetFont('Arial', 'B', 14);
$this->SetTextColor(155, 155, 155);
$this->Cell(60, 6, 'CONFIDENTIAL', 0, 0, 'L');
// page number
$this->SetFont('Arial','I',7);
$this->SetTextColor(0, 0, 0);
$this->MultiCell(60, 3, $this->date . "\n" . $this->PageNo() . ' of {nb}', 0, "C");
// title / client
$this->SetY(-17);
$this->SetFont('Arial','',8);
$this->Cell(0, 2, $this->title, 0, 1, 'R');
if ($this->PageNo() > 1)
{
$this->SetXY(16, -14);
$this->Cell(0, 2, $this->client, 0, 0, 'R');
}
}
}
?>