Optimised Company() Setup() Config() and changed method_directory into URL
This commit is contained in:
@@ -22,6 +22,8 @@ require_once('includes/tcpdf/tcpdf.php');
|
||||
abstract class Invoice_TCPDF extends TCPDF {
|
||||
// Our invoice object
|
||||
protected $io;
|
||||
// Our company object
|
||||
protected $co;
|
||||
|
||||
protected $billToCompany = true;
|
||||
protected $itemsSummaryMax = 16;
|
||||
@@ -48,11 +50,12 @@ abstract class Invoice_TCPDF extends TCPDF {
|
||||
parent::__construct();
|
||||
|
||||
$this->io = $io;
|
||||
$this->co = Company::instance();
|
||||
|
||||
// Set up the invoice
|
||||
$this->SetCreator('Open Source Billing');
|
||||
$this->SetAuthor(Company::name());
|
||||
$this->SetTitle(sprintf('%s Invoice',Company::name()));
|
||||
$this->SetAuthor($this->co->name());
|
||||
$this->SetTitle(sprintf('%s Invoice',$this->co->name()));
|
||||
$this->SetSubject(sprintf('Invoice #%06s',$this->io->id()));
|
||||
$this->SetKeywords($this->io->id());
|
||||
$this->SetAutoPageBreak(TRUE,25);
|
||||
|
@@ -23,7 +23,7 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
|
||||
public function drawCompanyLogo() {
|
||||
$x = 9; $y = 7;
|
||||
$size = 25;
|
||||
$logo = Config::logo_file();
|
||||
$logo = $this->co->logo_file();
|
||||
|
||||
if (is_file($logo))
|
||||
$this->Image($logo,$x,$y,$size);
|
||||
@@ -37,17 +37,17 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
|
||||
$x = 40; $y = 7;
|
||||
|
||||
$this->SetFont('helvetica','B',10);
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,Company::name()); $y += 4;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,$this->co->name()); $y += 4;
|
||||
|
||||
$this->SetFont('helvetica','',10);
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,Company::taxid()); $y += 6;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,$this->co->taxid()); $y += 6;
|
||||
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,Company::street(', ')); $y += 4;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',Company::city(),Company::state(),Company::pcode())); $y += 4;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,$this->co->street(', ')); $y += 4;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',$this->co->city(),$this->co->state(),$this->co->pcode())); $y += 4;
|
||||
|
||||
$y += 2;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,'Phone:'); $this->SetXY($x+16,$y); $this->Cell(0,0,Company::phone()); $y += 4;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,'Fax:'); $this->SetXY($x+16,$y); $this->Cell(0,0,Company::fax()); $y += 4;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,'Phone:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$this->co->phone()); $y += 4;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,'Fax:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$this->co->fax()); $y += 4;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,'Web:'); $this->SetXY($x+16,$y); $this->addHtmlLink(URL::base(TRUE,TRUE),URL::base(TRUE,TRUE)); $y += 4;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
|
||||
|
||||
$this->SetFont('helvetica','',8);
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,_('Please return this portion with your cheque or money order')); $y +=3;
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,_('made payable to').' '.Company::name());
|
||||
$this->SetXY($x,$y); $this->Cell(0,0,_('made payable to').' '.$this->co->name());
|
||||
|
||||
// Due Date
|
||||
$x = 110; $y = 200;
|
||||
@@ -91,9 +91,9 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
|
||||
// Company Address
|
||||
$y = 216;
|
||||
$this->SetFont('helvetica','',10);
|
||||
$this->SetXY(18,$y); $this->Cell(0,0,Company::name()); $y += 4;
|
||||
$this->SetXY(18,$y); $this->Cell(0,0,Company::street(', ')); $y += 4;
|
||||
$this->SetXY(18,$y); $this->Cell(0,0,sprintf('%s, %s %s',Company::city(),Company::state(),Company::pcode())); $y += 4;
|
||||
$this->SetXY(18,$y); $this->Cell(0,0,$this->co->name()); $y += 4;
|
||||
$this->SetXY(18,$y); $this->Cell(0,0,$this->co->street(', ')); $y += 4;
|
||||
$this->SetXY(18,$y); $this->Cell(0,0,sprintf('%s, %s %s',$this->co->city(),$this->co->state(),$this->co->pcode())); $y += 4;
|
||||
|
||||
// Previous Due
|
||||
$y = 215;
|
||||
|
Reference in New Issue
Block a user