Work on Service Reports

This commit is contained in:
Deon George
2013-10-11 00:08:02 +11:00
parent 91980b891e
commit 6f855fb32d
18 changed files with 198 additions and 225 deletions

View File

@@ -13,7 +13,8 @@ class Controller_Reseller_Service extends Controller_Service {
protected $secure_actions = array(
'list'=>TRUE,
'listbycheckout'=>TRUE,
'listhostservices'=>TRUE,
'listexpiring'=>TRUE,
'listinvoicesoon'=>TRUE,
);
/**
@@ -49,7 +50,7 @@ class Controller_Reseller_Service extends Controller_Service {
// @todo This needs to be configurable
$go = ORM::factory('Group',array('name'=>'Personal'));
foreach (ORM::factory('Account')->where_active()->where_authoised($this->ao,'id')->find_all() as $ao)
foreach (ORM::factory('Account')->where_active()->where_authorised($this->ao,'id')->find_all() as $ao)
if ($ao->has_any('group',array($go)))
foreach ($ao->service->list_active() as $so)
if (! $so->service_billing->checkout_id)
@@ -108,5 +109,57 @@ class Controller_Reseller_Service extends Controller_Service {
);
}
}
/**
* Show a list of expring services
*/
public function action_listexpiring() {
Block::factory()
->title('Customer Services Expiring')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('services')
->data(ORM::factory('Service')->where_authorised($this->ao)->list_expiring())
->columns(array(
'id'=>'ID',
'expire(TRUE)'=>'Expiry',
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
}
/**
* Show a list of expring services
*/
public function action_listinvoicesoon() {
Block::factory()
->title('Customer Services soon to be Invoiced')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('services')
->data(ORM::factory('Service')->where_authorised($this->ao)->list_invoicesoon(ORM::factory('Invoice')->config('GEN_SOON_DAYS')+30))
->columns(array(
'id'=>'ID',
'expire(TRUE)'=>'Expiry',
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'charges(TRUE,TRUE)'=>'Charges',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
}
}
?>