Added Revenue information

This commit is contained in:
Deon George
2013-10-29 10:36:57 +11:00
parent 1407da5e01
commit 28ea1ac613
14 changed files with 150 additions and 9 deletions

View File

@@ -203,6 +203,15 @@ class Model_Service extends ORM_OSB {
return $type ? $o->$type : $o;
}
public function revenue($annual=FALSE) {
$multiple = $annual ? Period::multiple($this->recur_schedule) : 1;
if ($this->suspend_billing)
$multiple = 0;
return $this->price(TRUE)*$multiple;
}
public function service_change() {
return $this->service_change->where_active()->where_open()->and_where('complete','!=',1)->or_where('complete','IS',null)->where_close()->find();
}
@@ -258,7 +267,7 @@ class Model_Service extends ORM_OSB {
}
public function transactions() {
return $this->invoice_item->order_by('date_start,date_stop');
return $this->invoice_item->order_by('date_start')->order_by('date_stop');
}
/** LIST FUNCTIONS **/