Improved service display

This commit is contained in:
Deon George
2011-07-14 19:09:03 +10:00
parent 46c3b9a075
commit 27cdab1fe4
37 changed files with 1319 additions and 1042 deletions

View File

@@ -9,6 +9,7 @@
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
* @todo Replace View::factory files to use $this->viewpath()
*/
class Controller_Admin_Service extends Controller_TemplateDefault {
protected $control = array('Services'=>'services');
@@ -17,6 +18,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault {
'listbycheckout'=>TRUE,
'listadslservices'=>TRUE,
'listhspaservices'=>TRUE,
'update'=>TRUE,
);
/**
@@ -355,7 +357,7 @@ GROUP BY DATE_FORMAT(DATE,"%%Y-%%m"),SID
Block::add(array(
'title'=>_('ADSL Services'),
'body'=>$output,
));
));
if ($summary)
Block::add(array(
@@ -411,5 +413,28 @@ GROUP BY DATE_FORMAT(DATE,"%%Y-%%m"),SID
return $return;
}
public function action_update($id) {
$so = ORM::factory('service',$id);
if (! $so->loaded())
Request::current()->redirect('welcome/index');
if ($_POST) {
if (isset($_POST['plugin']) AND $_POST['plugin'])
if (! $so->plugin()->values($_POST['plugin'])->update()->saved())
throw new Kohana_Exception('Failed to save updates to plugin data for record :record',array(':record'=>$so->id()));
if (! $so->values($_POST)->update()->saved())
throw new Kohana_Exception('Failed to save updates to plugin data for record :record',array(':record'=>$so->id()));
}
Block::add(array(
'title'=>sprintf('%s %s:%s',_('Update Service'),$so->id(),$so->name()),
'body'=>View::factory($so->viewpath())
->set('so',$so)
->set('plugin_form',$so->admin_update()),
));
}
}
?>

View File

@@ -40,66 +40,15 @@ class Controller_User_Service extends Controller_TemplateDefault {
public function action_view($id) {
$so = ORM::factory('service',$id);
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id)) {
$this->template->content = 'Unauthorised or doesnt exist?';
return FALSE;
}
$graph = $graph_data = $product_info = $product_detail = '';
// @todo Work this out dynamically
if ($so->product->prod_plugin AND in_array($so->product->prod_plugin_file,array('ADSL'))) {
$google = GoogleChart::factory('vertical_bar');
// If we came in via a post to show a particular month, then show that, otherwise show the yearly result
if ($_POST AND isset($_POST['month'])) {
$google->title = sprintf('DSL traffic usage for %s',$_POST['month']);
$traffic_data = $so->service_adsl->get_traffic_data_daily(strtotime($_POST['month'].'-01'));
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)),
'axis'=>'x',
'data'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)=>$traffic_data[$k])));
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),
'axis'=>'r',
'data'=>array((isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)=>$so->service_adsl->cumulative($traffic_data[$k]))));
$graph_data = View::factory('service/view_detail_adsl_traffic')
->set('traffic',$so->service_adsl->traffic_month(strtotime($_POST['month'].'-01'),FALSE));
} else {
// @todo Change the date to the last record date
$google->title = sprintf('Monthly DSL traffic usage as at %s',Config::date(strtotime('yesterday')));
$traffic_data = $so->service_adsl->get_traffic_data_monthly();
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)),
'axis'=>'x',
'data'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)=>$traffic_data[$k])));
}
$graph = (string)$google;
$product_info = ADSL::instance()->product_view($so->service_adsl->adsl_plan_id,$so->price,$so->product->price_setup);
$product_detail = View::factory('service/view_detail_adsl')
->set('graph',$graph)
->set('graph_data',$graph_data)
->set('service',$so);
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id)) {
$this->template->content = 'Unauthorised or doesnt exist?';
return FALSE;
}
// @todo need to get the monthly price
Block::add(array(
'title'=>sprintf('%06s: %s',$so->id,$so->product->product_translate->find()->name),
'title'=>sprintf('%s: %s',$so->id(),$so->product->name()),
'body'=>View::factory('service/view')
->set('service',$so)
->set('product_info',$product_info)
->set('product_detail',$product_detail),
->set('so',$so),
));
}
}

View File

@@ -14,10 +14,10 @@ class Model_Service extends ORMOSB {
// Relationships
protected $_has_many = array(
'invoice'=>array('through'=>'invoice_item'),
'adsl_plan'=>array('through'=>'service__adsl'),
);
protected $_has_one = array(
'service_adsl'=>array('far_key'=>'id'),
'service_domain'=>array('far_key'=>'id'),
);
protected $_belongs_to = array(
'product'=>array(),
@@ -31,6 +31,9 @@ class Model_Service extends ORMOSB {
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'date_last_invoice'=>array(
array('Config::date',array(':value')),
),
'date_next_invoice'=>array(
array('Config::date',array(':value')),
),
@@ -43,23 +46,107 @@ class Model_Service extends ORMOSB {
),
);
/**
* The service_name should be implemented in child objects.
* It renders the name of the service, typically used on invoice
*/
protected function _service_name() {
throw new Kohana_Exception(':method not defined in child class :class',array(':method'=>__METHOD__,':class'=>get_class($this)));
}
/**
* The service_view should be implemented in child objects.
* It renders the details of the ordered service
*/
protected function _service_view() {
throw new Kohana_Exception(':method not defined in child class :class',array(':method'=>__METHOD__,':class'=>get_class($this)));
}
/**
* The _details should be implemented in child objects.
*/
protected function _details($type) {
throw new Kohana_Exception(':method not defined in child class :class',array(':method'=>__METHOD__,':class'=>get_class($this)));
}
protected function _admin_update() {
throw new Kohana_Exception(':method not defined in child class :class',array(':method'=>__METHOD__,':class'=>get_class($this)));
}
/**
* Return the object of the product plugin
*/
public function plugin() {
if (! $this->product->prod_plugin_file)
return NULL;
if (! is_numeric($this->product->prod_plugin_data))
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->product->id,':type'=>$this->product->prod_plugin_file));
$spn = sprintf('%s_%s',get_class($this),$this->product->prod_plugin_file);
return new $spn(array('service_id'=>$this->id));
}
/**
* Display the service number
*/
public function svcnum() {
public function id() {
return sprintf('%05s',$this->id);
}
// Nothing to directly display on invoices for this module.
public function invoice_display() {
if ($this->sku)
return sprintf('%s: %s',_('Service'),$this->sku);
else
return '';
/**
* Display the service product name
*/
public function name() {
return $this->product->name();
}
public function name() {
return $this->product->product_translate->find()->name;
/**
* Display the product feature summary
*/
public function product_feature_summary() {
return $this->product->feature_summary();
}
/**
* Display the service details
*/
public function service_view() {
if (is_null($plugin = $this->plugin()))
return HTML::nbsp('');
else
return $plugin->_service_view();
}
public function service_name() {
if (is_null($plugin = $this->plugin()))
return $this->name();
else
return $plugin->_service_name();
}
/**
* Render some details for specific calls, eg: invoice
*/
public function details($type) {
switch ($type) {
case 'invoice':
if (is_null($plugin = $this->plugin()))
return array();
else
return $plugin->_details($type);
break;
default:
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
}
}
public function admin_update() {
if (is_null($plugin = $this->plugin()))
return NULL;
else
return $plugin->_admin_update();
}
// @todo To implement

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Service_ADSL extends ORMOSB {
class Model_Service_ADSL extends Model_Service {
protected $_table_name = 'service__adsl';
protected $_updated_column = FALSE;
@@ -20,6 +20,13 @@ class Model_Service_ADSL extends ORMOSB {
'service'=>array(),
);
protected $_display_filters = array(
'service_connect_date'=>array(
array('Config::date',array(':value')),
),
);
/**
* Return the IP Address for the service
*/
@@ -27,14 +34,8 @@ class Model_Service_ADSL extends ORMOSB {
return $this->ipaddress ? $this->ipaddress : _('Dynamic');
}
public function contract_date_start() {
//@todo Use the system configured date format
return date('Y-m-d',$this->service_connect_date);
}
public function contract_date_end() {
//@todo Use the system configured date format
return date('Y-m-d',strtotime(sprintf('+%s months',$this->adsl_plan->contract_term),$this->service_connect_date));
return Config::date(strtotime(sprintf('+%s months',$this->contract_term),$this->service_connect_date));
}
/**
@@ -324,5 +325,79 @@ class Model_Service_ADSL extends ORMOSB {
// If we get here, then we dont need to report usage.
return FALSE;
}
protected function _service_name() {
return sprintf('%s - %s',$this->service->product->name(),$this->service_number);
}
protected function _service_view() {
return View::factory('service/adsl/view')
->set('so',$this);
}
/**
* Get specific service details for use in other modules
* For Example: Invoice
*
* @todo Make the rendered items configurable
*/
protected function _details($type) {
switch ($type) {
case 'invoice':
return array(
_('Service Address')=>$this->display('service_address'),
_('Contact Until')=>$this->contract_date_end(),
);
break;
default:
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
}
}
protected function _admin_update() {
return View::factory($this->viewpath(strtolower($this->service->prod_plugin_name)))
->set('so',$this);
}
/**
* Render a google chart of traffic
*/
public function graph_traffic($month=null) {
$google = GoogleChart::factory('vertical_bar');
// If we came in via a post to show a particular month, then show that, otherwise show the yearly result
if (! is_null($month) AND trim($month)) {
$google->title = sprintf('DSL traffic usage for %s',$_POST['month']);
$traffic_data = $this->get_traffic_data_daily(strtotime($_POST['month'].'-01'));
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)),
'axis'=>'x',
'data'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)=>$traffic_data[$k])));
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),
'axis'=>'r',
'data'=>array((isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)=>$this->cumulative($traffic_data[$k]))));
$graph_data = View::factory('service/view_detail_adsl_traffic')
->set('traffic',$this->traffic_month(strtotime($_POST['month'].'-01'),FALSE));
} else {
// @todo Change the date to the last record date
$google->title = sprintf('Monthly DSL traffic usage as at %s',Config::date(strtotime('yesterday')));
$traffic_data = $this->get_traffic_data_monthly();
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)),
'axis'=>'x',
'data'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)=>$traffic_data[$k])));
}
return (string)$google;
}
}
?>

View File

@@ -19,7 +19,7 @@
<index>
<date>site_id,date_orig</date>
<parent>site_id,parent_id</parent>
<invoice>site_id,invoice_id</invoice>
<invoice>site_id</invoice>
<invoice_item>site_id,invoice_item_id</invoice_item>
<account>site_id,account_id</account>
<billing>site_id,account_billing_id</billing>
@@ -132,9 +132,6 @@
<recur_weekday>
<type>I4</type>
</recur_weekday>
<recur_week>
<type>I4</type>
</recur_week>
<recur_schedule_change>
<display>User Change Schedule</display>
<type>L</type>
@@ -143,26 +140,9 @@
<display>User May Cancel</display>
<type>C(16)</type>
</recur_cancel>
<group_grant>
<type>X2</type>
<convert>array</convert>
</group_grant>
<group_type>
<type>I4</type>
</group_type>
<group_days>
<type>I4</type>
</group_days>
<host_server_id>
<type>I4</type>
</host_server_id>
<host_provision_plugin_data>
<type>X2</type>
<convert>array</convert>
</host_provision_plugin_data>
<host_ip>
<type>C(16)</type>
</host_ip>
<host_username>
<display>Hosting User Name</display>
<type>C(128)</type>
@@ -200,9 +180,6 @@
<convert>array</convert>
<type>X2</type>
</prod_attr>
<prod_attr_cart>
<type>X2</type>
</prod_attr_cart>
<prod_plugin_name>
<type>C(128)</type>
</prod_plugin_name>
@@ -214,23 +191,15 @@
<display>User May Modify</display>
<type>L</type>
</recur_modify>
<invoice_advance_notified>
<type>L</type>
</invoice_advance_notified>
</field>
<!-- Methods for this class, and the fields they have access to, if applicable -->
<method>
<add>id,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify</add>
<update>id,date_last,account_id,account_billing_id,product_id,sku,active,type,price,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify,prod_attr</update>
<add>id,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_schedule_change,recur_cancel,host_server_id,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify</add>
<update>id,date_last,account_id,account_billing_id,product_id,sku,active,type,price,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_schedule_change,recur_cancel,host_server_id,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify,prod_attr</update>
<delete>id</delete>
<view>id,date_orig,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify,prod_attr</view>
<search>id,date_orig,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_week,recur_schedule_change,recur_cancel,group_grant,group_type,group_days,host_server_id,host_provision_plugin_data,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify,prod_attr</search>
<search_export>id,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing</search_export>
<export_excel>id,date_orig,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing</export_excel>
<export_csv>id,date_orig,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing</export_csv>
<export_tab>id,date_orig,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing</export_tab>
<export_xml>id,date_orig,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,host_server_id,host_ip,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing</export_xml>
<view>id,date_orig,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_schedule_change,recur_cancel,host_server_id,host_username,host_password,domain_name,domain_tld,domain_term,domain_type,domain_date_expire,domain_host_tld_id,domain_host_registrar_id,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify,prod_attr</view>
<search>id,date_orig,date_last,account_id,account_billing_id,product_id,sku,active,type,price,price_type,taxable,queue,date_last_invoice,date_next_invoice,recur_type,recur_schedule,recur_weekday,recur_schedule_change,recur_cancel,suspend_billing,prod_plugin_name,prod_plugin_data,recur_modify,prod_attr</search>
</method>
<!-- Method triggers -->

View File

@@ -0,0 +1,36 @@
<!-- @todo NEEDS TO BE TRANSLATED -->
<table width="100%">
<tr>
<td class="head">Plugin Details</td>
</tr>
<tr>
<td style="width: 50%; vertical-align: top;">
<table>
<tr>
<td style="width: 40%;">Service Number</td>
<td style="width: 60%;" class="data"><?php echo Form::input('plugin[service_number]',$so->service_number); ?></td>
</tr>
<tr>
<td>Service Address</td>
<td class="data"><?php echo Form::input('plugin[service_address]',$so->service_address); ?></td>
</tr>
<tr>
<td>Service Connect Date</td>
<td class="data"><?php echo Form::input('plugin[service_connect_date]',$so->service_connect_date); ?></td>
</tr>
<tr>
<td>Service Username</td>
<td class="data"><?php echo Form::input('plugin[service_username]',$so->service_username); ?></td>
</tr>
<tr>
<td>Service Password</td>
<td class="data"><?php echo Form::input('plugin[service_password]',$so->service_password); ?></td>
</tr>
<tr>
<td>Service IP Address</td>
<td class="data"><?php echo Form::input('plugin[ipaddress]',$so->ipaddress); ?></td>
</tr>
</table>
</td>
</tr>
</table>

View File

@@ -0,0 +1,62 @@
<!-- @todo NEEDS TO BE TRANSLATED -->
<?php echo Form::open(); ?>
<table width="100%">
<tr>
<td style="width: 50%; vertical-align: top;">
<table>
<tr>
<td style="width: 40%;">Service Active</td>
<td style="width: 60%;" class="data"><?php echo StaticList_YesNo::form('active',$so->active); ?></td>
</tr>
<tr>
<td>Queue</td>
<td class="data"><?php echo $so->display('queue'); ?></td>
</tr>
<tr>
<td>Billing Period</td>
<td class="data"><?php echo StaticList_RecurSchedule::form('recure_schedule',$so->product,$so->recur_schedule);?></td>
</tr>
<tr>
<td>Date Last Invoice</td>
<td class="data"><?php echo $so->display('date_last_invoice'); ?></td>
</tr>
<tr>
<td>Date Next Invoice</td>
<td class="data"><?php echo $so->display('date_next_invoice'); ?></td>
</tr>
<tr>
<td>Taxable</td>
<td class="data"><?php echo StaticList_YesNo::form('taxable',$so->taxable); ?></td>
</tr>
<tr>
<td>Type</td>
<td class="data"><?php echo StaticList_RecurType::display($so->recur_type); ?></td>
</tr>
<tr>
<td>Recur on Weekday</td>
<td class="data"><?php echo Form::input('recur_weekday',$so->recur_weekday,array('size'=>4)); ?></td>
</tr>
<tr>
<td>User Can Change Schedule</td>
<td class="data"><?php echo StaticList_YesNo::form('recur_schedule_change',$so->recur_schedule_change); ?></td>
</tr>
<tr>
<td>User Can Cancel</td>
<td class="data"><?php echo StaticList_YesNo::form('recur_cancel',$so->recur_cancel); ?></td>
</tr>
<tr>
<td>User Can Modify</td>
<td class="data"><?php echo StaticList_YesNo::form('recur_modify',$so->recur_modify); ?></td>
</tr>
<tr>
<td>Suspend Billing</td>
<td class="data"><?php echo StaticList_YesNo::form('suspend_billing',$so->suspend_billing); ?></td>
</tr>
</table>
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
<!-- END Service Information -->
</td>
</tr>
</table>
<?php echo Form::submit('submit',_('Update')); ?>
<?php echo Form::close(); ?>

View File

@@ -0,0 +1,72 @@
<!-- //@todo To translate -->
<table class="box-full">
<tr>
<td class="head" colspan="2">Service Details</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td style="width: 50%">
<table>
<tr>
<td style="width: 40%;">Service Number</td>
<td style="width: 60%;" class="data"><?php echo $so->display('service_number'); ?></td>
</tr>
<tr>
<td>Service Address</td>
<td class="data"><?php echo $so->display('service_address'); ?></td>
</tr>
<tr>
<td>Contract Term</td>
<td class="data"><?php echo $so->display('contract_term'); ?></td>
</tr>
<tr>
<td>Connect Date</td>
<td class="data"><?php echo $so->display('service_connect_date'); ?></td>
</tr>
<tr>
<td>Contract End Date</td>
<td class="data"><?php echo $so->contract_date_end(); ?></td>
</tr>
<tr>
<td>Service Username</td>
<td class="data"><?php echo $so->display('service_username'); ?></td>
</tr>
<tr>
<td>Service Password</td>
<td class="data"><?php echo $so->display('service_password'); ?></td>
</tr>
<tr>
<td>Service IP</td>
<td class="data"><?php echo $so->ipaddress(); ?></td>
</tr>
</table>
</td>
<td style="width: 50%; vertical-align: top;">
<table width="100%">
<tr>
<td style="width: 40%;">Traffic Used This Month</td>
<td style="width: 60%;" class="data"><?php echo $so->traffic_month(null); ?></td>
</tr>
<tr>
<td style="width: 40%;">Traffic Used Last Month</td>
<td style="width: 60%;" class="data"><?php echo $so->traffic_lastmonth(); ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>View Daily Traffic for Month</td>
<td><?php echo Form::open(); echo Form::select('month',array_merge(array(''),$so->get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : '')); echo Form::submit('submit',_('Show')); echo Form::close(); ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><?php echo $so->graph_traffic(isset($_POST['month']) ? $_POST['month'] : ''); ?><td>
</tr>
</table>

View File

@@ -3,37 +3,62 @@
<tr>
<td>
<!-- Service Information -->
<table>
<table class="box-full">
<tr>
<td>Service Name</td>
<td class="head"><?php echo $service->product->product_translate->find()->name; ?></td>
</tr>
<tr>
<td>Service Active</td>
<td class="head"><?php echo $service->display('active'); ?></td>
<td style="width: 40%;">Service Active</td>
<td style="width: 60%;" class="data"><?php echo $so->display('active'); ?></td>
</tr>
<tr>
<td>Billing Period</td>
<td class="head"><?php echo $service->display('recur_schedule');?></td>
<td class="data"><?php echo $so->display('recur_schedule');?></td>
</tr>
<tr>
<td>Cost</td>
<td class="head"><?php echo $service->display('price'); ?></td>
<td class="data"><?php echo $so->display('price'); ?></td>
</tr>
<tr>
<td>Date Next Invoice</td>
<td class="head"><?php echo Config::date($service->date_next_invoice); ?></td>
<td class="data"><?php echo $so->display('date_next_invoice'); ?></td>
</tr>
<tr>
<td>Current Invoices Due</td>
<td class="head"><?php echo Currency::display($service->account->invoices_due_total()); ?></td>
<td class="data"><?php echo Currency::display($so->account->invoices_due_total()); ?></td>
</tr>
</table>
<!-- END Service Information -->
</td>
<td style="vertical-align: top;">
<!-- Product Info -->
<?php echo $product_info; ?>
<!-- Product Summary Info -->
<?php echo $so->product_feature_summary(); ?>
<!-- END Product Summary Info -->
</td>
</tr>
</table>
<?php echo $product_detail; ?>
<br/>
<?php echo $so->service_view(); ?>
<br/>
<table class="box-left" width="50%">
<tr>
<td class="head" colspan="2">Invoices for this service</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2">Number</td>
<td>Invoice Date</td>
<td>Due Date</td>
<td>Total</td>
<td>Balance</td>
</tr>
<?php $i=0; foreach ($so->invoice->distinct('id')->order_by('id DESC')->find_all() as $io) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="icon" width="20px"><?php echo HTML::anchor('/user/invoice/download/'.$io->id,HTML::image('media/img/gnome-pdf.png',array('alt'=>_('Download'),'width'=>20))); ?></td>
<td class="data"><?php echo HTML::anchor('/user/invoice/view/'.$io->id,$io->id()); ?></td>
<td class="data"><?php echo $io->display('date_orig'); ?></td>
<td class="data"><?php echo $io->display('due_date'); ?></td>
<td class="data"><?php echo $io->total(TRUE); ?></td>
<td class="data"><?php echo $io->due(TRUE); ?></td>
</tr>
<?php } ?>
</table>

View File

@@ -1,32 +0,0 @@
<!-- @todo NEEDS TO BE TRANSLATED -->
<table>
<tr>
<td>View Daily Traffic for Month</td>
<td><?echo Form::open(); echo Form::select('month',$service->service_adsl->get_traffic_months(),(isset($_POST['month']) ? $_POST['month'] : '')); echo Form::submit('submit',_('Show')); echo Form::close(); ?></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><?php echo $graph; ?></td>
<td style="vertical-align: top" width="30%">
<table class="box-left">
<tr>
<td>ADSL Service</td>
<td class="head"><?php echo $service->service_adsl->service_number; ?></td>
</tr>
<tr>
<td>Contract Term</td>
<td class="head"><?php echo $service->service_adsl->contract_term; ?></td>
</tr>
<tr>
<td>Contract End</td>
<td class="head"><?php echo $service->service_adsl->contract_date_end(); ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><?php echo $graph_data; ?></td>
</tr>
</table>