Added Tasks to KH

This commit is contained in:
Deon George
2011-08-16 12:27:19 +10:00
parent f272bc254d
commit 4c9b214ff7
53 changed files with 773 additions and 170 deletions

View File

@@ -324,5 +324,37 @@ class Model_Invoice extends ORMOSB {
$this->_changed[$field] = $field;
}
/** LIST FUNCTIONS **/
/**
* Identify all the invoices that are due
*/
private function _list_due($time=NULL,$op='<=') {
if (is_null($time))
$time = time();
// @todo This rounding should be a system configuration
return $this
->where('round(total_amt-ifnull(credit_amt,0),2)','>','=billed_amt')
->and_where('due_date',$op,$time)
->and_where('status','=',1)
->order_by('due_date,account_id,id')
->find_all();
}
/**
* Return a list of invoices that are over their due date.
*/
public function list_overdue($time=NULL) {
return $this->_list_due($time,'<=');
}
/**
* Return a list of invoices that are due, excluding overdue.
*/
public function list_due($time=NULL) {
return $this->_list_due($time,'>');
}
}
?>