Improvements to taxing
This commit is contained in:
parent
8ba487a4a6
commit
778eada7f0
@ -168,4 +168,8 @@ if (file_exists(APPPATH.'cache/CLEAR_APC_CACHE') AND function_exists('apc_clear_
|
|||||||
if (! apc_clear_cache() OR ! unlink(APPPATH.'cache/CLEAR_APC_CACHE'))
|
if (! apc_clear_cache() OR ! unlink(APPPATH.'cache/CLEAR_APC_CACHE'))
|
||||||
throw new Kohana_Exception('Unable to clear the APC cache.');
|
throw new Kohana_Exception('Unable to clear the APC cache.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we are a CLI, set our session dir
|
||||||
|
if (PHP_SAPI === 'cli')
|
||||||
|
session_save_path('tmp/');
|
||||||
?>
|
?>
|
||||||
|
@ -17,8 +17,8 @@ class Currency {
|
|||||||
return Num::format($amount,Company::instance()->decimals(),TRUE);
|
return Num::format($amount,Company::instance()->decimals(),TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function round($amount) {
|
public static function round($amount,$decimals=0) {
|
||||||
return Num::round($amount,Company::instance()->decimals());
|
return Num::round($amount,Company::instance()->decimals()+$decimals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -12,13 +12,13 @@
|
|||||||
class Model_Account extends Model_Auth_UserDefault {
|
class Model_Account extends Model_Auth_UserDefault {
|
||||||
// Relationships
|
// Relationships
|
||||||
protected $_has_many = array(
|
protected $_has_many = array(
|
||||||
'user_tokens' => array('model' => 'user_token'),
|
'user_tokens'=>array('model'=>'user_token'),
|
||||||
'service_billing' => array('far_key'=>'id'),
|
'service_billing'=>array('far_key'=>'id'),
|
||||||
'email_log' => array('far_key'=>'id'),
|
'email_log'=>array('far_key'=>'id'),
|
||||||
'group' => array('through' => 'account_group'),
|
'group'=>array('through'=>'account_group'),
|
||||||
'invoice' => array('far_key'=>'id'),
|
'invoice'=>array('far_key'=>'id'),
|
||||||
'payment'=>array('far_key'=>'id'),
|
'payment'=>array('far_key'=>'id'),
|
||||||
'service' => array('far_key'=>'id'),
|
'service'=>array('far_key'=>'id'),
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $_has_one = array(
|
protected $_has_one = array(
|
||||||
|
@ -14,6 +14,10 @@ class Model_Country extends ORM_OSB {
|
|||||||
'currency'=>array('far_key'=>'id'),
|
'currency'=>array('far_key'=>'id'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
protected $_has_many = array(
|
||||||
|
'tax'=>array('far_key'=>'id'),
|
||||||
|
);
|
||||||
|
|
||||||
protected $_sorting = array(
|
protected $_sorting = array(
|
||||||
'name'=>'ASC',
|
'name'=>'ASC',
|
||||||
);
|
);
|
||||||
|
@ -163,6 +163,17 @@ abstract class ORM_OSB extends ORM {
|
|||||||
return empty($mc[$key]) ? '' : $mc[$key];
|
return empty($mc[$key]) ? '' : $mc[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dump() {
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
$result['this'] = $this->object();
|
||||||
|
|
||||||
|
foreach ($this->_sub_items as $o)
|
||||||
|
$result['sub'][] = $o->dump();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Next record id
|
* Get Next record id
|
||||||
*
|
*
|
||||||
@ -240,6 +251,10 @@ abstract class ORM_OSB extends ORM {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function subitems() {
|
||||||
|
return $this->_sub_items;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override the Kohana processing so we can null values if required.
|
* Override the Kohana processing so we can null values if required.
|
||||||
*/
|
*/
|
||||||
|
@ -104,20 +104,22 @@ abstract class Checkout_Plugin_Paypal extends Checkout_Plugin {
|
|||||||
// We assume fees are added to $po->items() which are invoices.
|
// We assume fees are added to $po->items() which are invoices.
|
||||||
if (preg_match('/^0:/',$cno->data['item_number'.$c])) {
|
if (preg_match('/^0:/',$cno->data['item_number'.$c])) {
|
||||||
$i = $j = 0;
|
$i = $j = 0;
|
||||||
foreach ($po->items() as $pio) {
|
foreach ($po->subitems() as $pio) {
|
||||||
$io = ORM::factory('Invoice',$pio->invoice_id);
|
$io = ORM::factory('Invoice',$pio->invoice_id);
|
||||||
// @todo Need to do tax.
|
|
||||||
$iio = $io->add_item();
|
$iio = ORM::factory('Invoice_Item');
|
||||||
$iio->quantity = 1;
|
$iio->quantity = 1;
|
||||||
$iio->module_id = $cno->mid()->id;
|
$iio->module_id = $cno->mid()->id;
|
||||||
$iio->item_type = 125; // Payment Fee
|
$iio->item_type = 125; // Payment Fee
|
||||||
$iio->price_base = (++$j==count($amts)) ? $cno->data['mc_gross_'.$c]-$i : Currency::round($pio->alloc_amt/array_sum($amts)*$cno->data['mc_gross_'.$c]);
|
$iio->price_base = (++$j==count($amts)) ? $cno->data['mc_gross_'.$c]-$i : Currency::round($pio->alloc_amt/array_sum($amts)*$cno->data['mc_gross_'.$c]);
|
||||||
$iio->date_start = $iio->date_stop = time();
|
$iio->date_start = $iio->date_stop = time();
|
||||||
|
|
||||||
|
$io->subitem_add($iio,$io->account->country,TRUE);
|
||||||
|
|
||||||
// @todo Validate Save
|
// @todo Validate Save
|
||||||
$io->save();
|
$io->save();
|
||||||
|
|
||||||
$pio->alloc_amt = ($pio->alloc_amt+$iio->price_base > $pio->invoice->total()) ? $pio->alloc_amt : $pio->alloc_amt+$iio->price_base;
|
$pio->alloc_amt = ($pio->alloc_amt+$iio->total() > $pio->invoice->total()) ? $pio->alloc_amt : $pio->alloc_amt+$iio->total();
|
||||||
$i += $iio->price_base;
|
$i += $iio->price_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class Export_Plugin_Quicken extends Export_Plugin {
|
|||||||
$c = 0;
|
$c = 0;
|
||||||
|
|
||||||
// Add the items to the invoice
|
// Add the items to the invoice
|
||||||
foreach ($io->items('CHARGE') as $iio) {
|
foreach ($io->subitems('CHARGE') as $iio) {
|
||||||
// Skip any zero amount items not relating to a service
|
// Skip any zero amount items not relating to a service
|
||||||
if ($iio->total() == 0 and ! $iio->service_id)
|
if ($iio->total() == 0 and ! $iio->service_id)
|
||||||
continue;
|
continue;
|
||||||
@ -141,7 +141,7 @@ class Export_Plugin_Quicken extends Export_Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add credits as a other item
|
// Add credits as a other item
|
||||||
foreach ($io->items('CREDIT') as $iio) {
|
foreach ($io->subitems('CREDIT') as $iio) {
|
||||||
$items[$c]['ACCNT'] = 'Other Income';
|
$items[$c]['ACCNT'] = 'Other Income';
|
||||||
$items[$c]['INVITEM'] = 'Product:Unknown';
|
$items[$c]['INVITEM'] = 'Product:Unknown';
|
||||||
$items[$c]['CLEAR'] = 'N';
|
$items[$c]['CLEAR'] = 'N';
|
||||||
|
@ -11,28 +11,30 @@
|
|||||||
*/
|
*/
|
||||||
class Invoice {
|
class Invoice {
|
||||||
// This invoice Object
|
// This invoice Object
|
||||||
private $io;
|
private $_io;
|
||||||
|
|
||||||
private $_methods = array(
|
private $_methods = array(
|
||||||
|
'dump',
|
||||||
'min_due',
|
'min_due',
|
||||||
'save',
|
'save',
|
||||||
'saved',
|
'saved',
|
||||||
|
'total',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Enable passing calls to ORM::Invoice()
|
// Enable passing calls to ORM::Invoice()
|
||||||
public function __call($method,array $args) {
|
public function __call($method,array $args) {
|
||||||
if (in_array($method,$this->_methods))
|
if (in_array($method,$this->_methods))
|
||||||
return call_user_func_array(array($this->io,$method),$args);
|
return call_user_func_array(array($this->_io,$method),$args);
|
||||||
else
|
else
|
||||||
throw HTTP_Exception::factory(501,'Unknown/unauthorised method :method',array(':method'=>$method));
|
throw HTTP_Exception::factory(501,'Unknown/unauthorised method :method',array(':method'=>$method));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct(Model_Invoice $io=NULL) {
|
public function __construct(Model_Invoice $io=NULL) {
|
||||||
$this->io = is_null($io) ? ORM::factory('Invoice') : $io;
|
$this->_io = is_null($io) ? ORM::factory('Invoice') : $io;
|
||||||
|
|
||||||
// Set our invoice as valid
|
// Set our invoice as valid
|
||||||
if (is_null($io))
|
if (is_null($io))
|
||||||
$this->io->status = 1;
|
$this->_io->status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function instance(Model_Invoice $io=NULL) {
|
public static function instance(Model_Invoice $io=NULL) {
|
||||||
@ -45,18 +47,18 @@ class Invoice {
|
|||||||
* @param $so Model_Servie
|
* @param $so Model_Servie
|
||||||
*/
|
*/
|
||||||
public function add_service(Model_Service $so) {
|
public function add_service(Model_Service $so) {
|
||||||
if ($this->io->loaded())
|
if ($this->_io->loaded())
|
||||||
throw HTTP_Exception::factory(501,'Cannot use add service :service to an existing invoice :invoice ',array(':service'=>$so->id,':invoice'=>$this->io->id));
|
throw HTTP_Exception::factory(501,'Cannot use add service :service to an existing invoice :invoice ',array(':service'=>$so->id,':invoice'=>$this->_io->id));
|
||||||
|
|
||||||
if (! $this->io->account_id)
|
if (! $this->_io->account_id)
|
||||||
$this->io->account_id = $so->account_id;
|
$this->_io->account_id = $so->account_id;
|
||||||
|
|
||||||
else if ($this->io->account_id != $so->account_id)
|
else if ($this->_io->account_id != $so->account_id)
|
||||||
throw HTTP_Exception::factory(501,'Cannot add service :service to invoice - it is for a different account',array(':service'=>$so->id));
|
throw HTTP_Exception::factory(501,'Cannot add service :service to invoice - it is for a different account',array(':service'=>$so->id));
|
||||||
|
|
||||||
// Set the invoice due date
|
// Set the invoice due date
|
||||||
if (! $this->io->due_date OR $this->io->due_date > $this->io->min_due($so->date_next_invoice))
|
if (! $this->_io->due_date OR $this->_io->due_date > $this->_io->min_due($so->date_next_invoice))
|
||||||
$this->io->due_date = $this->io->min_due($so->date_next_invoice);
|
$this->_io->due_date = $this->_io->min_due($so->date_next_invoice);
|
||||||
|
|
||||||
$pdata = Period::details($so->recur_schedule,$so->product->price_recurr_day,$so->invoiced_to()+86400,FALSE,$so->product->price_recurr_strict);
|
$pdata = Period::details($so->recur_schedule,$so->product->price_recurr_day,$so->invoiced_to()+86400,FALSE,$so->product->price_recurr_strict);
|
||||||
|
|
||||||
@ -72,7 +74,7 @@ class Invoice {
|
|||||||
// Service Billing
|
// Service Billing
|
||||||
$iio->item_type = 0;
|
$iio->item_type = 0;
|
||||||
|
|
||||||
$this->io->add_item($iio);
|
$this->_io->subitem_add($iio,$this->_io->account->country);
|
||||||
|
|
||||||
// Check if there are any charges
|
// Check if there are any charges
|
||||||
$c = ORM::factory('Charge')
|
$c = ORM::factory('Charge')
|
||||||
@ -91,7 +93,7 @@ class Invoice {
|
|||||||
$iio->date_stop = $co->date_orig;
|
$iio->date_stop = $co->date_orig;
|
||||||
$iio->item_type = $co->type;
|
$iio->item_type = $co->type;
|
||||||
|
|
||||||
$this->io->add_item($iio);
|
$this->_io->subitem_add($iio,$this->_io->account->country);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -104,7 +106,7 @@ class Invoice {
|
|||||||
case 'body':
|
case 'body':
|
||||||
return View::factory('invoice/user/view/body')
|
return View::factory('invoice/user/view/body')
|
||||||
->set('show_id',(isset($args['noid']) AND $args['noid']) ? FALSE : TRUE)
|
->set('show_id',(isset($args['noid']) AND $args['noid']) ? FALSE : TRUE)
|
||||||
->set('o',$this->io);
|
->set('o',$this->_io);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -124,7 +126,7 @@ class Invoice {
|
|||||||
public function pdf() {
|
public function pdf() {
|
||||||
$invoice_class = Kohana::classname('Invoice_TCPDF_'.Kohana::$config->load('invoice')->driver);
|
$invoice_class = Kohana::classname('Invoice_TCPDF_'.Kohana::$config->load('invoice')->driver);
|
||||||
|
|
||||||
$pdf = new $invoice_class($this->io);
|
$pdf = new $invoice_class($this->_io);
|
||||||
|
|
||||||
if ($pdf->getTemplate()) {
|
if ($pdf->getTemplate()) {
|
||||||
$pagecount = $pdf->setSourceFile($pdf->getTemplate());
|
$pagecount = $pdf->setSourceFile($pdf->getTemplate());
|
||||||
@ -153,12 +155,12 @@ class Invoice {
|
|||||||
$pdf->drawRemittenceStub();
|
$pdf->drawRemittenceStub();
|
||||||
$pdf->drawPaymentMethods();
|
$pdf->drawPaymentMethods();
|
||||||
|
|
||||||
if ($this->io->billing_status !=1 && $this->io->due_date <= time())
|
if ($this->_io->billing_status !=1 && $this->_io->due_date <= time())
|
||||||
$pdf->drawInvoiceDueNotice();
|
$pdf->drawInvoiceDueNotice();
|
||||||
elseif($this->io->billing_status == 1)
|
elseif($this->_io->billing_status == 1)
|
||||||
$pdf->drawInvoicePaidNotice();
|
$pdf->drawInvoicePaidNotice();
|
||||||
|
|
||||||
if ($this->io->account->invoices_due_total())
|
if ($this->_io->account->invoices_due_total())
|
||||||
$pdf->drawSummaryInvoicesDue();
|
$pdf->drawSummaryInvoicesDue();
|
||||||
|
|
||||||
$pdf->drawSummaryLineItems();
|
$pdf->drawSummaryLineItems();
|
||||||
|
@ -439,7 +439,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
|||||||
*/
|
*/
|
||||||
public function drawDetailLineItems() {
|
public function drawDetailLineItems() {
|
||||||
$this->i = 0;
|
$this->i = 0;
|
||||||
foreach ($this->io->items() as $io)
|
foreach ($this->io->subitems() as $io)
|
||||||
$this->drawLineItem($io);
|
$this->drawLineItem($io);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,23 +55,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
return count(Cart::instance()->get($this->mid(),$this->id));
|
return count(Cart::instance()->get($this->mid(),$this->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an item to an invoice
|
|
||||||
*/
|
|
||||||
public function add_item(Model_Invoice_Item $iio=NULL) {
|
|
||||||
// @todo This is the old calling of this function, which should be removed
|
|
||||||
if (is_null($iio)) {
|
|
||||||
$c = count($this->_sub_items);
|
|
||||||
|
|
||||||
$this->_sub_items[$c] = ORM::factory('Invoice_Item');
|
|
||||||
|
|
||||||
return $this->_sub_items[$c];
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($this->_sub_items,$iio);
|
|
||||||
$this->_sub_items_sorted = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the recurring schedules that are on an invoice
|
* Return the recurring schedules that are on an invoice
|
||||||
*
|
*
|
||||||
@ -80,7 +63,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function items_periods($period=FALSE) {
|
public function items_periods($period=FALSE) {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
foreach ($this->items() as $ito) {
|
foreach ($this->subitems() as $ito) {
|
||||||
// We are only interested in item_type=0
|
// We are only interested in item_type=0
|
||||||
if ($ito->item_type != 0)
|
if ($ito->item_type != 0)
|
||||||
continue;
|
continue;
|
||||||
@ -106,7 +89,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function items_titles($title=NULL,$period=NULL) {
|
public function items_titles($title=NULL,$period=NULL) {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
foreach ($this->items() as $ito) {
|
foreach ($this->subitems() as $ito) {
|
||||||
if ($ito->service_id) {
|
if ($ito->service_id) {
|
||||||
if (is_null($title) AND ! in_array($ito->title(),$result) AND (is_null($period) OR ($period == $ito->recurring_schedule)))
|
if (is_null($title) AND ! in_array($ito->title(),$result) AND (is_null($period) OR ($period == $ito->recurring_schedule)))
|
||||||
array_push($result,$ito->title());
|
array_push($result,$ito->title());
|
||||||
@ -156,7 +139,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
if (! $o->service_id)
|
if (! $o->service_id)
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
foreach ($this->items() as $iio)
|
foreach ($this->subitems() as $iio)
|
||||||
if ($iio->item_type == 0 AND $iio->service_id == $o->service_id)
|
if ($iio->item_type == 0 AND $iio->service_id == $o->service_id)
|
||||||
array_push($result,$iio);
|
array_push($result,$iio);
|
||||||
|
|
||||||
@ -174,7 +157,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
if (! $o->service_id)
|
if (! $o->service_id)
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
foreach ($this->items() as $iio)
|
foreach ($this->subitems() as $iio)
|
||||||
if ($iio->item_type != 0 AND $iio->service_id == $o->service_id)
|
if ($iio->item_type != 0 AND $iio->service_id == $o->service_id)
|
||||||
array_push($result,$iio);
|
array_push($result,$iio);
|
||||||
|
|
||||||
@ -191,7 +174,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
if (! $o->service_id)
|
if (! $o->service_id)
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
foreach ($this->items() as $iio)
|
foreach ($this->subitems() as $iio)
|
||||||
if ($iio->service_id == $o->service_id)
|
if ($iio->service_id == $o->service_id)
|
||||||
$result += $iio->tax();
|
$result += $iio->tax();
|
||||||
|
|
||||||
@ -208,13 +191,63 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
if (! $o->service_id)
|
if (! $o->service_id)
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
foreach ($this->items() as $iio)
|
foreach ($this->subitems() as $iio)
|
||||||
if ($iio->service_id == $o->service_id)
|
if ($iio->service_id == $o->service_id)
|
||||||
$result += $iio->total();
|
$result += $iio->total();
|
||||||
|
|
||||||
return $format ? Currency::display($result) : $result;
|
return $format ? Currency::display($result) : $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an item to an invoice
|
||||||
|
*/
|
||||||
|
public function subitem_add(Model_Invoice_Item $iio,Model_Country $co,$taxed=FALSE) {
|
||||||
|
$iio->subitem_add($co,$taxed);
|
||||||
|
|
||||||
|
array_push($this->_sub_items,$iio);
|
||||||
|
|
||||||
|
$this->_sub_items_sorted = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a list of invoice items for this invoice.
|
||||||
|
* @param type [CHARGE|CREDIT|ALL]
|
||||||
|
* @see invoice_items
|
||||||
|
*/
|
||||||
|
public function subitems($type='ALL') {
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
foreach ($this->_sub_items as $ito) {
|
||||||
|
// Ignore voided items
|
||||||
|
if ($ito->void)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$return = FALSE;
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'CHARGE':
|
||||||
|
if ($ito->product_id OR $ito->quantity > 0)
|
||||||
|
$return = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'CREDIT':
|
||||||
|
if (! $ito->product_id AND $ito->quantity < 0)
|
||||||
|
$return = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ALL':
|
||||||
|
default:
|
||||||
|
$return = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($return)
|
||||||
|
array_push($result,$ito);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of valid checkout options for this invoice
|
* Return a list of valid checkout options for this invoice
|
||||||
*/
|
*/
|
||||||
@ -247,45 +280,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
return sprintf('%06s',$this->id);
|
return sprintf('%06s',$this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of invoice items for this invoice.
|
|
||||||
* @param type [CHARGE|CREDIT|ALL]
|
|
||||||
* @see invoice_items
|
|
||||||
*/
|
|
||||||
public function items($type='ALL') {
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
foreach ($this->_sub_items as $ito) {
|
|
||||||
// Ignore voided items
|
|
||||||
if ($ito->void)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
$return = FALSE;
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case 'CHARGE':
|
|
||||||
if ($ito->product_id OR $ito->quantity > 0)
|
|
||||||
$return = TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'CREDIT':
|
|
||||||
if (! $ito->product_id AND $ito->quantity < 0)
|
|
||||||
$return = TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ALL':
|
|
||||||
default:
|
|
||||||
$return = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($return)
|
|
||||||
array_push($result,$ito);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide a sorted list of items by an index
|
* Provide a sorted list of items by an index
|
||||||
*/
|
*/
|
||||||
@ -296,7 +290,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
if (! $this->_changed AND array_key_exists($index,$result))
|
if (! $this->_changed AND array_key_exists($index,$result))
|
||||||
return $result[$index];
|
return $result[$index];
|
||||||
|
|
||||||
foreach ($this->items() as $ito) {
|
foreach ($this->subitems() as $ito) {
|
||||||
switch ($index) {
|
switch ($index) {
|
||||||
case 'account':
|
case 'account':
|
||||||
if (! $ito->service_id)
|
if (! $ito->service_id)
|
||||||
@ -332,7 +326,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function items_services(array $items=array()) {
|
public function items_services(array $items=array()) {
|
||||||
$result = array();
|
$result = array();
|
||||||
if (! $items)
|
if (! $items)
|
||||||
$items = $this->items();
|
$items = $this->subitems();
|
||||||
|
|
||||||
foreach ($items as $ito)
|
foreach ($items as $ito)
|
||||||
if ($ito->service_id AND empty($result[$ito->service_id]))
|
if ($ito->service_id AND empty($result[$ito->service_id]))
|
||||||
@ -344,7 +338,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
// @todo to retire
|
// @todo to retire
|
||||||
public function items_invoice() {
|
public function items_invoice() {
|
||||||
$result = array();
|
$result = array();
|
||||||
$items = $this->items();
|
$items = $this->subitems();
|
||||||
|
|
||||||
foreach ($items as $ito)
|
foreach ($items as $ito)
|
||||||
if (! $ito->service_id AND empty($result[$ito->id]))
|
if (! $ito->service_id AND empty($result[$ito->id]))
|
||||||
@ -377,7 +371,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
$c = array();
|
$c = array();
|
||||||
foreach ($this->items() as $ito)
|
foreach ($this->subitems() as $ito)
|
||||||
if ($ito->service_id) {
|
if ($ito->service_id) {
|
||||||
// If we have already covered a service with no recurring_schedule
|
// If we have already covered a service with no recurring_schedule
|
||||||
if (! $ito->recurring_schedule AND in_array($ito->service_id,$c))
|
if (! $ito->recurring_schedule AND in_array($ito->service_id,$c))
|
||||||
@ -400,7 +394,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function items_summary() {
|
public function items_summary() {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
foreach ($this->items() as $ito) {
|
foreach ($this->subitems() as $ito) {
|
||||||
// We only summarise item_type=0
|
// We only summarise item_type=0
|
||||||
if (! $ito->item_type == 0)
|
if (! $ito->item_type == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -491,7 +485,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
|
|
||||||
public function save(Validation $validation = NULL) {
|
public function save(Validation $validation = NULL) {
|
||||||
// Our items will be clobbered once we save the object, so we need to save it here.
|
// Our items will be clobbered once we save the object, so we need to save it here.
|
||||||
$items = $this->items();
|
$subitems = $this->subitems();
|
||||||
|
|
||||||
// If this is a new invoice, we'll need to do more work
|
// If this is a new invoice, we'll need to do more work
|
||||||
$new = ! $this->loaded();
|
$new = ! $this->loaded();
|
||||||
@ -501,7 +495,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
|
|
||||||
// Need to save the associated items and their taxes
|
// Need to save the associated items and their taxes
|
||||||
if ($this->loaded()) {
|
if ($this->loaded()) {
|
||||||
foreach ($items as $iio) {
|
foreach ($subitems as $iio) {
|
||||||
$iio->invoice_id = $this->id;
|
$iio->invoice_id = $this->id;
|
||||||
|
|
||||||
if (! $iio->changed())
|
if (! $iio->changed())
|
||||||
@ -510,8 +504,10 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
$iio->save();
|
$iio->save();
|
||||||
|
|
||||||
if (! $iio->saved()) {
|
if (! $iio->saved()) {
|
||||||
// @todo Mark invoice as cancelled and write a memo, then...
|
$this->void = 1;
|
||||||
throw new Kohana_Exception('Problem saving invoice_item for invoice :invoice - Failed save()',array(':invoice'=>$this->id));
|
$this->save();
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is a new invoice, we'll need to update some other items
|
// If this is a new invoice, we'll need to update some other items
|
||||||
@ -573,7 +569,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function subtotal($format=FALSE) {
|
public function subtotal($format=FALSE) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
foreach ($this->items() as $ito)
|
foreach ($this->subitems() as $ito)
|
||||||
$result += $ito->subtotal();
|
$result += $ito->subtotal();
|
||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
@ -582,7 +578,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function tax($format=FALSE) {
|
public function tax($format=FALSE) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
foreach ($this->items() as $ito)
|
foreach ($this->subitems() as $ito)
|
||||||
$result += $ito->tax();
|
$result += $ito->tax();
|
||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
@ -595,7 +591,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function tax_summary() {
|
public function tax_summary() {
|
||||||
$summary = array();
|
$summary = array();
|
||||||
|
|
||||||
foreach ($this->items() as $ito) {
|
foreach ($this->subitems() as $ito) {
|
||||||
foreach ($ito->invoice_item_tax->find_all() as $item_tax) {
|
foreach ($ito->invoice_item_tax->find_all() as $item_tax) {
|
||||||
if (! isset($summary[$item_tax->tax_id]))
|
if (! isset($summary[$item_tax->tax_id]))
|
||||||
$summary[$item_tax->tax_id] = $item_tax->amount;
|
$summary[$item_tax->tax_id] = $item_tax->amount;
|
||||||
@ -618,7 +614,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
// This will include charges and credits
|
// This will include charges and credits
|
||||||
foreach ($this->items() as $ito)
|
foreach ($this->subitems() as $ito)
|
||||||
$result += $ito->total();
|
$result += $ito->total();
|
||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
@ -627,7 +623,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function total_charges($format=FALSE) {
|
public function total_charges($format=FALSE) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
foreach ($this->items('CHARGE') as $ito)
|
foreach ($this->subitems('CHARGE') as $ito)
|
||||||
$result += $ito->subtotal()+$ito->tax();
|
$result += $ito->subtotal()+$ito->tax();
|
||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
@ -636,7 +632,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function total_credits($format=FALSE) {
|
public function total_credits($format=FALSE) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
foreach ($this->items('CREDIT') as $ito)
|
foreach ($this->subitems('CREDIT') as $ito)
|
||||||
$result += ($ito->subtotal()+$ito->tax())*-1;
|
$result += ($ito->subtotal()+$ito->tax())*-1;
|
||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
@ -645,7 +641,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
public function total_discounts($format=FALSE) {
|
public function total_discounts($format=FALSE) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
foreach ($this->items() as $ito)
|
foreach ($this->subitems() as $ito)
|
||||||
$result += $ito->discount();
|
$result += $ito->discount();
|
||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
|
@ -43,6 +43,108 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
'invoice_item_tax'=>FALSE,
|
'invoice_item_tax'=>FALSE,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// The total of all discounts
|
||||||
|
public function discount() {
|
||||||
|
return Currency::round($this->discount_amt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display the period that a transaction applies
|
||||||
|
public function period() {
|
||||||
|
return ($this->date_start == $this->date_stop) ? Config::date($this->date_start) : sprintf('%s -> %s',Config::date($this->date_start),Config::date($this->date_stop));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save(Validation $validation = NULL) {
|
||||||
|
// Our items will be clobbered once we save the object, so we need to save it here.
|
||||||
|
$subitems = $this->subitems();
|
||||||
|
|
||||||
|
// Save the invoice item
|
||||||
|
parent::save($validation);
|
||||||
|
|
||||||
|
// Need to save the associated items and their taxes
|
||||||
|
if ($this->loaded()) {
|
||||||
|
foreach ($subitems as $iito) {
|
||||||
|
$iito->invoice_item_id = $this->id;
|
||||||
|
|
||||||
|
if (! $iito->changed())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$iito->save();
|
||||||
|
|
||||||
|
if (! $iito->saved()) {
|
||||||
|
$this->void = 1;
|
||||||
|
$this->save();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
throw new Kohana_Exception('Couldnt save invoice_item for some reason?');
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add tax to our item
|
||||||
|
*
|
||||||
|
* @param Model_Country the country to get the tax rates
|
||||||
|
* @param Boolean Is this price inc/ex tax
|
||||||
|
*/
|
||||||
|
public function subitem_add(Model_Country $co,$taxed=FALSE) {
|
||||||
|
$orig = $this->subtotal();
|
||||||
|
$tax = 0;
|
||||||
|
|
||||||
|
foreach ($co->tax->find_all() as $to) {
|
||||||
|
$iito = ORM::factory('Invoice_Item_Tax');
|
||||||
|
|
||||||
|
$iito->tax_id = $to->id;
|
||||||
|
$iito->amount = Currency::round($taxed ? ($orig-$orig/(1+$to->rate)) : $orig*$to->rate);
|
||||||
|
|
||||||
|
$tax += $iito->amount;
|
||||||
|
array_push($this->_sub_items,$iito);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If taxed, we need to reduce our base_rate to a pre-tax amount
|
||||||
|
if ($taxed) {
|
||||||
|
$this->price_base -= Currency::round($tax/$this->quantity,1);
|
||||||
|
|
||||||
|
// If there is any rounding, we'll take it off the last IITO
|
||||||
|
$iito->amount += $orig-$this->total();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_sub_items_sorted = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This total of this item before discounts and taxes
|
||||||
|
public function subtotal($format=FALSE) {
|
||||||
|
$result = $this->price_base*$this->quantity;
|
||||||
|
|
||||||
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sum up the tax that applies to this invoice item
|
||||||
|
public function tax($format=FALSE) {
|
||||||
|
$result = 0;
|
||||||
|
|
||||||
|
foreach ($this->subitems() as $iito)
|
||||||
|
$result += $iito->amount;
|
||||||
|
|
||||||
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tax_items() {
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
foreach ($this->subitems() as $iito) {
|
||||||
|
if (! isset($result[$iit->tax_id]))
|
||||||
|
$result[$iit->tax_id] = 0;
|
||||||
|
|
||||||
|
$result[$iito->tax_id] += $iito->amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The title for invoice items
|
* The title for invoice items
|
||||||
*/
|
*/
|
||||||
@ -53,6 +155,17 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
return 'Unknown Item';
|
return 'Unknown Item';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function total($format=FALSE) {
|
||||||
|
$result = $this->void ? 0 : $this->subtotal()+$this->tax()-$this->discount();
|
||||||
|
|
||||||
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display a transaction number
|
||||||
|
public function trannum() {
|
||||||
|
return sprintf('%03s-%06s',$this->item_type,$this->id);
|
||||||
|
}
|
||||||
|
|
||||||
public function invoice_line() {
|
public function invoice_line() {
|
||||||
if ($this->charge_id)
|
if ($this->charge_id)
|
||||||
return $this->charge->description.' '.$this->period();
|
return $this->charge->description.' '.$this->period();
|
||||||
@ -62,69 +175,9 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
throw HTTP_Exception::factory(501,'Unable to render invoice item :id',array(':id'=>$this->id));
|
throw HTTP_Exception::factory(501,'Unable to render invoice item :id',array(':id'=>$this->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display a transaction number
|
|
||||||
public function trannum() {
|
|
||||||
return sprintf('%03s-%06s',$this->item_type,$this->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display the period that a transaction applies
|
|
||||||
public function period() {
|
|
||||||
if ($this->date_start == $this->date_stop)
|
|
||||||
return Config::date($this->date_start);
|
|
||||||
|
|
||||||
else
|
|
||||||
return sprintf('%s -> %s',Config::date($this->date_start),Config::date($this->date_stop));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sum up the tax that applies to this invoice item
|
|
||||||
public function tax($format=FALSE) {
|
|
||||||
$result = 0;
|
|
||||||
|
|
||||||
foreach ($this->invoice_item_tax->find_all() as $iit)
|
|
||||||
$result += $iit->amount;
|
|
||||||
|
|
||||||
// @todo This shouldnt be required.
|
|
||||||
if (! $result)
|
|
||||||
$result += round($this->price_base*$this->quantity*.1,2);
|
|
||||||
|
|
||||||
$result = Currency::round($result);
|
|
||||||
|
|
||||||
return $format ? Currency::display($result) : $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function tax_items() {
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
foreach ($this->invoice_item_tax->find_all() as $iit) {
|
|
||||||
if (! isset($result[$iit->tax_id]))
|
|
||||||
$result[$iit->tax_id] = 0;
|
|
||||||
|
|
||||||
$result[$iit->tax_id] += $iit->amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This total of this item before discounts and taxes
|
|
||||||
public function subtotal($format=FALSE) {
|
|
||||||
$result = Currency::round($this->price_base*$this->quantity);
|
|
||||||
|
|
||||||
return $format ? Currency::display($result) : $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The total of all discounts
|
|
||||||
public function discount() {
|
|
||||||
return Currency::round($this->discount_amt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function total($format=FALSE) {
|
|
||||||
$result = $this->void ? 0 : Currency::round($this->subtotal()+$this->tax()-$this->discount());
|
|
||||||
|
|
||||||
return $format ? Currency::display($result) : $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name for an invoice item
|
* Name for an invoice item
|
||||||
|
* @deprecated, use StaticList_ItemType()
|
||||||
*/
|
*/
|
||||||
public function name() {
|
public function name() {
|
||||||
switch ($this->item_type) {
|
switch ($this->item_type) {
|
||||||
@ -186,40 +239,5 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
return array('Item'=>$this->item_type);
|
return array('Item'=>$this->item_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save(Validation $validation = NULL) {
|
|
||||||
// Save the invoice item
|
|
||||||
parent::save($validation);
|
|
||||||
|
|
||||||
// Need to save the discounts associated with the invoice_item
|
|
||||||
if ($this->saved()) {
|
|
||||||
$iito = ORM::factory('Invoice_Item_Tax');
|
|
||||||
|
|
||||||
if ($this->_sub_items) {
|
|
||||||
foreach (array('tax') as $i)
|
|
||||||
foreach ($this->_sub_items[$i] as $io)
|
|
||||||
if ($io->changed())
|
|
||||||
$io->save();
|
|
||||||
|
|
||||||
// Add TAX details
|
|
||||||
} else
|
|
||||||
// @todo tax parameters should come from user session
|
|
||||||
foreach (Tax::detail(61,NULL,$this->subtotal()) as $tax) {
|
|
||||||
$iito->clear();
|
|
||||||
$iito->invoice_item_id = $this->id;
|
|
||||||
$iito->tax_id = $tax['id'];
|
|
||||||
// @todo Rounding here should come from a global config
|
|
||||||
$iito->amount = round($tax['amount'],2);
|
|
||||||
|
|
||||||
$iito->save();
|
|
||||||
|
|
||||||
if (! $iito->saved())
|
|
||||||
throw new Kohana_Exception('Couldnt save tax for some reason - failed save()?');
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
throw new Kohana_Exception('Couldnt save invoice_item for some reason?');
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -66,7 +66,7 @@ class Model_Payment extends ORM_OSB {
|
|||||||
public function balance($format=FALSE) {
|
public function balance($format=FALSE) {
|
||||||
$result = $this->total();
|
$result = $this->total();
|
||||||
|
|
||||||
foreach ($this->items('ALLOC') as $pio)
|
foreach ($this->subitems('ALLOC') as $pio)
|
||||||
$result -= $pio->alloc_amt;
|
$result -= $pio->alloc_amt;
|
||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
@ -78,7 +78,7 @@ class Model_Payment extends ORM_OSB {
|
|||||||
public function credit($format=FALSE) {
|
public function credit($format=FALSE) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
foreach ($this->items('CREDIT') as $pio)
|
foreach ($this->subitems('CREDIT') as $pio)
|
||||||
$result += $pio->alloc_amt*-1;
|
$result += $pio->alloc_amt*-1;
|
||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
@ -105,7 +105,7 @@ class Model_Payment extends ORM_OSB {
|
|||||||
* @param type [ALLOC|CREDIT|ALL]
|
* @param type [ALLOC|CREDIT|ALL]
|
||||||
* @see payment_items
|
* @see payment_items
|
||||||
*/
|
*/
|
||||||
public function items($type='ALL') {
|
public function subitems($type='ALL') {
|
||||||
if (! $this->_sub_items_sorted) {
|
if (! $this->_sub_items_sorted) {
|
||||||
Sort::MAsort($this->_sub_items,'invoice_id');
|
Sort::MAsort($this->_sub_items,'invoice_id');
|
||||||
$this->_sub_items_sorted = TRUE;
|
$this->_sub_items_sorted = TRUE;
|
||||||
@ -145,7 +145,7 @@ class Model_Payment extends ORM_OSB {
|
|||||||
*/
|
*/
|
||||||
public function save(Validation $validation = NULL) {
|
public function save(Validation $validation = NULL) {
|
||||||
// Our items will be clobbered once we save the object, so we need to save it here.
|
// Our items will be clobbered once we save the object, so we need to save it here.
|
||||||
$items = $this->items();
|
$items = $this->subitems();
|
||||||
|
|
||||||
// If a user modified this payment, we'll update the source to their ID.
|
// If a user modified this payment, we'll update the source to their ID.
|
||||||
if ($ao = Auth::instance()->get_user())
|
if ($ao = Auth::instance()->get_user())
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $c=0;foreach ($o->items('ALLOC') as $pio) : ?>
|
<?php $c=0;foreach ($o->subitems('ALLOC') as $pio) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$pio->invoice_id),$pio->invoice->id()); ?></td>
|
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$pio->invoice_id),$pio->invoice->id()); ?></td>
|
||||||
<td><?php echo $pio->invoice->display('date_orig'); ?></td>
|
<td><?php echo $pio->invoice->display('date_orig'); ?></td>
|
||||||
|
Reference in New Issue
Block a user