Local fixes to invoice display and retrieve traffic data

This commit is contained in:
Deon George
2011-08-02 16:48:41 +10:00
parent 41eec89afa
commit 5953e28f22
9 changed files with 1039 additions and 15 deletions

View File

@@ -21,6 +21,7 @@ class Model_Invoice extends ORMOSB {
'invoice_item_tax'=>array(),
'service'=>array('through'=>'invoice_item'),
'payment'=>array('through'=>'payment_item'),
'payment_item'=>array('far_key'=>'id'),
);
protected $_sorting = array(
@@ -132,14 +133,14 @@ class Model_Invoice extends ORMOSB {
}
public function payments() {
return ($this->loaded() AND ! $this->_changed) ? $this->payments->find_all() : NULL;
return ($this->loaded() AND ! $this->_changed) ? $this->payment_item->find_all() : NULL;
}
public function payments_total($format=FALSE) {
$result = 0;
foreach ($this->payments() as $po)
$result += $po->total_amt;
$result += $po->alloc_amt;
return $format ? Currency::display($result) : $result;
}