From 97d894d47268a8c428a5f6a10a8d2dbcb706401a Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 9 Feb 2013 23:40:18 +1100 Subject: [PATCH] More work on invoice --- application/config/config.php | 4 --- .../invoice/classes/Invoice/TCPDF/Default.php | 30 ++++++++----------- modules/invoice/classes/Model/Invoice.php | 9 ------ .../invoice/classes/Model/Invoice/Item.php | 4 +-- 4 files changed, 14 insertions(+), 33 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index 8aca5644..432ce3e6 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -34,10 +34,6 @@ return array( 'www.graytech.net.au'=>1, ), 'site_debug' => FALSE, - 'site_mode' => array( - '172.31.10.200'=>Kohana::DEVELOPMENT, - 'www.graytech.net.au'=>Kohana::PRODUCTION, - ), 'bsb' => '633-000', // @todo This should come from the DB 'accnum' => '120 440 821', // @todo This should come from the DB 'site_name' => 'Graytech Hosting Pty Ltd', // @todo This should come from the DB diff --git a/modules/invoice/classes/Invoice/TCPDF/Default.php b/modules/invoice/classes/Invoice/TCPDF/Default.php index ea50d57d..65557e0e 100644 --- a/modules/invoice/classes/Invoice/TCPDF/Default.php +++ b/modules/invoice/classes/Invoice/TCPDF/Default.php @@ -135,7 +135,7 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF { // Draw a box. $this->SetFillColor(245); - $this->SetXY($x-1,$y-1); $this->Cell(0,35+($this->io->billed_amt ? 5 : 0)+($this->io->credit_amt ? 5 : 0),'',1,0,'',1); + $this->SetXY($x-1,$y-1); $this->Cell(0,35+5+($this->io->credit_amt ? 5 : 0),'',1,0,'',1); // Draw a box around the invoice due date and amount due. $this->SetFont('helvetica','B',11); @@ -166,13 +166,11 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF { $this->SetFont('helvetica','B',11); $this->SetXY($x+55,$y); $this->Cell(0,0,$this->io->total(TRUE),0,0,'R'); - if ($this->io->billed_amt) { - $y += 5; - $this->SetFont('helvetica','',10); - $this->SetXY($x,$y); $this->Cell(0,0,'Payments Received'); - $this->SetFont('helvetica','B',11); - $this->SetXY($x+55,$y); $this->Cell(0,0,$this->io->display('billed_amt'),0,0,'R'); - } + $y += 5; + $this->SetFont('helvetica','',10); + $this->SetXY($x,$y); $this->Cell(0,0,'Payments Received'); + $this->SetFont('helvetica','B',11); + $this->SetXY($x+55,$y); $this->Cell(0,0,$this->io->payments_total('TRUE'),0,0,'R'); if ($this->io->credit_amt) { $y += 5; @@ -321,7 +319,7 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF { $this->SetFillColor(245); $this->SetXY($x-1,$y-1); $this->Cell(0,5*( - 1+1+1+3+($this->io->discount_amt ? 1 : 0)+($this->io->billed_amt ? 1 : 0)+($this->io->credit_amt ? 1 : 0)+$box + 1+1+1+3+($this->io->discount_amt ? 1 : 0)+1+($this->io->credit_amt ? 1 : 0)+$box )+1+4,'',1,0,'',1); $this->SetFont('helvetica','B',11); @@ -409,15 +407,13 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF { $this->Cell(0,0,Currency::display($this->io->total()),0,0,'R'); // Show payments already received for this invoice - if ($this->io->billed_amt) { - $y += 5; - $this->SetY($y); + $y += 5; + $this->SetY($y); - $this->SetX($x+8); - $this->Cell(0,0,'Payments Received'); - $this->SetX($x+135); - $this->Cell(0,0,$this->io->payments_total(TRUE),0,0,'R'); - } + $this->SetX($x+8); + $this->Cell(0,0,'Payments Received'); + $this->SetX($x+135); + $this->Cell(0,0,$this->io->payments_total(TRUE),0,0,'R'); if ($this->io->credit_amt) { $y += 5; diff --git a/modules/invoice/classes/Model/Invoice.php b/modules/invoice/classes/Model/Invoice.php index 7f64b462..b08df1e0 100644 --- a/modules/invoice/classes/Model/Invoice.php +++ b/modules/invoice/classes/Model/Invoice.php @@ -33,18 +33,9 @@ class Model_Invoice extends ORM_OSB implements Cartable { 'due_date'=>array( array('Config::date',array(':value')), ), - 'billed_amt'=>array( - array('Currency::display',array(':value')), - ), - 'credit_amt'=>array( - array('Currency::display',array(':value')), - ), 'status'=>array( array('StaticList_YesNo::display',array(':value')), ), - 'total_amt'=>array( - array('Currency::display',array(':value')), - ), ); // Items belonging to an invoice diff --git a/modules/invoice/classes/Model/Invoice/Item.php b/modules/invoice/classes/Model/Invoice/Item.php index 4c6bfe82..7ebba19a 100644 --- a/modules/invoice/classes/Model/Invoice/Item.php +++ b/modules/invoice/classes/Model/Invoice/Item.php @@ -11,8 +11,6 @@ * @license http://dev.osbill.net/license.html */ class Model_Invoice_Item extends ORM_OSB { - protected $_updated_column = FALSE; // @todo No update columns - // Relationships protected $_belongs_to = array( 'product'=>array(), @@ -82,7 +80,7 @@ class Model_Invoice_Item extends ORM_OSB { // @todo This shouldnt be required. if (! $result) - $result += round($this->subtotal() *.1,2); + $result += round($this->price_base*$this->quantity*.1,2); return Currency::round($result); }