Improvements to invoice display and other misc items

This commit is contained in:
Deon George
2013-12-20 10:00:32 +11:00
parent 778eada7f0
commit e19518c505
43 changed files with 1122 additions and 887 deletions

View File

@@ -46,7 +46,9 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
$y += 2;
$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;
if ($this->co->fax()) {
$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;
}
@@ -332,7 +334,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
foreach ($items as $name => $line) {
if ($i < $this->itemsSummaryMax) {
$this->SetX($x);
$this->Cell(0,0,sprintf('%3.2f',$line['quantity']));
$this->Cell(0,0,sprintf('%3.0f',$line['quantity']));
$this->SetX($x+8);
$this->Cell(0,0,$name);
$this->SetX($x+135);
@@ -439,8 +441,19 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
*/
public function drawDetailLineItems() {
$this->i = 0;
foreach ($this->io->subitems() as $io)
$this->drawLineItem($io);
foreach ($this->io->items_periods() as $rs) {
$sids=array();
foreach ($this->io->items_periods($rs) as $iio) {
if (in_array($iio->service_id,$sids))
continue;
array_push($sids,$iio->service_id);
$this->drawLineItem($iio);
}
}
}
/**
@@ -478,35 +491,60 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
$this->SetFont('helvetica','',8);
$this->SetX($x);
$this->Cell(0,0,sprintf('%s - %s',$ito->product->title(),$ito->service->name()));
$this->Cell(0,0,$ito->title());
$this->SetFont('helvetica','',7);
if ($ito->price_base) {
$this->SetX($x+160);
$this->Cell(10,0,Currency::display($ito->price_base),0,0,'R');
if ($z=$this->io->service_items($ito)) {
foreach ($z as $eiio) {
$this->y += 3;
$this->SetY($this->y);
$this->SetX($x+10);
$this->Cell(10,0,$eiio->invoice_line());
if ($eiio->price_base) {
$this->SetX($x+160);
$this->Cell(10,0,Currency::display($eiio->price_base),0,0,'R');
}
if ($eiio->quantity) {
$this->SetX($x+130);
$this->Cell(10,0,$eiio->quantity,0,0,'R');
}
$this->SetX($x+130);
$this->Cell(0,0,$eiio->total(TRUE),0,0,'R');
}
}
if ($ito->quantity) {
$this->SetX($x+130);
$this->Cell(10,0,$ito->quantity,0,0,'R');
}
$this->SetX($x+130);
$this->Cell(0,0,Currency::display($ito->total()),0,0,'R');
if ($this->show_service_range && $ito->period()) {
$this->SetFont('helvetica','I',7);
$this->y += 3;
$this->SetXY($x+10,$this->y); $this->Cell(0,0,'Service Period');
$this->SetFont('helvetica','',7);
$this->SetXY($x+40,$this->y); $this->Cell(0,0,$ito->period());
if ($z=$this->io->service_items_extra($ito)) {
foreach ($z as $eiio) {
$this->y += 3;
$this->SetY($this->y);
$this->SetX($x+10);
$this->Cell(10,0,$eiio->invoice_line());
if ($eiio->price_base) {
$this->SetX($x+160);
$this->Cell(10,0,Currency::display($eiio->price_base),0,0,'R');
}
if ($eiio->quantity) {
$this->SetX($x+130);
$this->Cell(10,0,$eiio->quantity,0,0,'R');
}
$this->SetX($x+130);
$this->Cell(0,0,$eiio->total(TRUE),0,0,'R');
}
}
$this->y += 2;
if ($ito->invoice_detail_items())
foreach ($ito->invoice_detail_items() as $k=>$v) {
$this->SetFont('helvetica','I',7);
$this->SetFont('helvetica','I',6);
$this->y += 3;
$this->SetXY($x+10,$this->y); $this->Cell(0,0,$k);
$this->SetFont('helvetica','',7);
$this->SetFont('helvetica','',6);
$this->SetXY($x+40,$this->y); $this->Cell(0,0,$v);
}