Updates to invoice display
This commit is contained in:
@@ -21,7 +21,9 @@ class Model_Payment extends ORMOSB {
|
||||
'checkout'=>array('foreign_key'=>'checkout_plugin_id'),
|
||||
);
|
||||
|
||||
protected $_sorting = array('date_payment'=>'DESC');
|
||||
protected $_sorting = array(
|
||||
'date_payment'=>'DESC'
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'date_payment'=>array(
|
||||
@@ -42,4 +44,32 @@ class Model_Payment extends ORMOSB {
|
||||
->where('date_payment','>=',time()-$start*86400)
|
||||
->find_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the remaining balance available for this payment
|
||||
*/
|
||||
public function balance($format=FALSE) {
|
||||
$t = 0;
|
||||
|
||||
foreach ($this->payment_item->find_all() as $pio)
|
||||
$t += $pio->alloc_amt;
|
||||
|
||||
return $format ? Currency::display($this->total_amt-$t) : $this->total_amt-$t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of invoices that this payment is applied to
|
||||
*/
|
||||
public function invoices() {
|
||||
$invoices = array();
|
||||
|
||||
foreach ($this->payment_item->find_all() as $pio)
|
||||
array_push($invoices,$pio->invoice);
|
||||
|
||||
return $invoices;
|
||||
}
|
||||
|
||||
public function invoicelist() {
|
||||
return join(',',$this->invoices());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user