Added Revenue information
This commit is contained in:
@@ -13,6 +13,7 @@ class ADSL_Billing_Exetelvisp {
|
||||
private $data = NULL;
|
||||
private $data_exception = NULL;
|
||||
private $exception = array();
|
||||
private $excess = 0;
|
||||
private $total = 0;
|
||||
|
||||
public function excess($service) {
|
||||
@@ -56,6 +57,7 @@ class ADSL_Billing_Exetelvisp {
|
||||
if ($cost != $this->charge($service))
|
||||
$this->exception[$service]['info'] = 'Charging difference: '.Currency::display($cost-$this->charge($service));
|
||||
|
||||
$this->excess += $this->excess($service);
|
||||
$this->total += $this->charge($service);
|
||||
}
|
||||
}
|
||||
@@ -151,8 +153,11 @@ class ADSL_Billing_Exetelvisp {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function total($format=FALSE) {
|
||||
public function totalcharge($format=FALSE) {
|
||||
return $format ? Currency::display($this->total) : $this->total;
|
||||
}
|
||||
public function totalexcess($format=FALSE) {
|
||||
return $format ? Currency::display($this->excess) : $this->excess;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -32,12 +32,22 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
|
||||
}
|
||||
|
||||
// Our required abstract methods
|
||||
public function cost($annual=FALSE) {
|
||||
$x = $this->adsl_supplier_plan->total();
|
||||
|
||||
return $annual ? $x*12 : $x;
|
||||
}
|
||||
|
||||
public function feature_summary() {
|
||||
// @todo This view should render based on the the results of this::allowance();
|
||||
return View::factory('product/plugin/adsl/feature_summary')
|
||||
->set('po',$this);
|
||||
}
|
||||
|
||||
public function supplier() {
|
||||
return $this->adsl_supplier_plan->supplier_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the ADSL allowance as a peak/offpeak metric
|
||||
*/
|
||||
|
@@ -119,6 +119,8 @@ abstract class Service_Traffic_Adsl {
|
||||
$co->sweep_type = 6;
|
||||
$co->account_id = $so->account_id;
|
||||
$co->service_id = $so->id;
|
||||
// @todo This needs to be calculated.
|
||||
$co->type = 5;
|
||||
$co->amount = $details['rate'];
|
||||
// @todo This needs to be calculated.
|
||||
$co->taxable = TRUE;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<table class="table table-striped table-condensed table-hover" id="list-table">
|
||||
<thead><tr>
|
||||
<th>Service</th>
|
||||
<th>ID</th>
|
||||
<th>Supplier Plan</th>
|
||||
<th>Contract Start</th>
|
||||
<th>Contract End</th>
|
||||
@@ -16,6 +17,7 @@
|
||||
<tr class="<?php echo $o->charge($service_number) == $po->adsl_supplier_plan->total() ? '' : 'error'; ?>">
|
||||
|
||||
<td><?php echo $service_number; ?></td>
|
||||
<td><?php echo HTML::anchor(URL::link('user','service/view/'.$so->id),$so->id); ?></td>
|
||||
<td><?php echo $po->adsl_supplier_plan->name().($p->provided_adsl_plan_id ? '*' : ''); ?></td>
|
||||
<td><?php echo $p->contract_date_start(TRUE); ?></td>
|
||||
<td><?php echo $p->contract_date_end(TRUE); ?></td>
|
||||
@@ -26,6 +28,6 @@
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
|
||||
<tr class="info"><td colspan="5"> </td><td><?php echo $o->total(TRUE); ?></td><td> </td></tr>
|
||||
<tr class="info"><td colspan="5"> </td><td><?php echo $o->totalcharge(TRUE); ?></td><td> </td><td><?php echo $o->totalexcess(TRUE); ?></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@@ -16,6 +16,13 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin {
|
||||
|
||||
// Our required abstract methods
|
||||
public function admin_update() {}
|
||||
|
||||
public function cost($annual=FALSE) {
|
||||
$x = 0;
|
||||
|
||||
return $annual ? $x*12 : $x;
|
||||
}
|
||||
|
||||
public function feature_summary() {}
|
||||
|
||||
// @todo This is not used, but should be.
|
||||
@@ -37,5 +44,9 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin {
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function supplier() {
|
||||
return 'internal';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -16,10 +16,20 @@ class Model_Product_Plugin_Host extends Model_Product_Plugin {
|
||||
|
||||
// Our required abstract methods
|
||||
public function admin_update() {}
|
||||
|
||||
public function cost($annual=FALSE) {
|
||||
$x = 0;
|
||||
|
||||
return $annual ? $x*12 : $x;
|
||||
}
|
||||
|
||||
public function feature_summary() {}
|
||||
|
||||
// @todo This is not used, but should be.
|
||||
public function order_features() {
|
||||
public function order_features() {}
|
||||
|
||||
public function supplier() {
|
||||
return 'internal';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -51,6 +51,10 @@ class Model_Product extends ORM_OSB {
|
||||
return $this->avail_category;
|
||||
}
|
||||
|
||||
public function cost($annual=FALSE) {
|
||||
return $this->plugin() ? $this->plugin()->cost($annual) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the translated description for a category.
|
||||
*/
|
||||
@@ -134,6 +138,10 @@ class Model_Product extends ORM_OSB {
|
||||
return $active ? $this->service->where_active() : $this->service;
|
||||
}
|
||||
|
||||
public function supplier() {
|
||||
return $this->plugin() ? $this->plugin()->supplier() : 'other';
|
||||
}
|
||||
|
||||
private function translate() {
|
||||
return $this->product_translate->where('language_id','=',Config::language())->find();
|
||||
}
|
||||
|
@@ -19,10 +19,17 @@ abstract class Model_Product_Plugin extends ORM_OSB {
|
||||
*/
|
||||
abstract public function admin_update();
|
||||
|
||||
/**
|
||||
* The cost of this service
|
||||
*/
|
||||
abstract public function cost($annual=FALSE);
|
||||
|
||||
/**
|
||||
* The feature summary should be implemented in plugins.
|
||||
* It is displayed on the product overview page, as a summary of the products features.
|
||||
*/
|
||||
abstract public function feature_summary();
|
||||
|
||||
abstract public function supplier();
|
||||
}
|
||||
?>
|
||||
|
@@ -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 **/
|
||||
|
@@ -15,10 +15,20 @@ class Model_Product_Plugin_Ssl extends Model_Product_Plugin {
|
||||
// Our required abstract methods
|
||||
public function admin_update() {}
|
||||
|
||||
public function cost($annual=FALSE) {
|
||||
$x = 0;
|
||||
|
||||
return $annual ? $x*12 : $x;
|
||||
}
|
||||
|
||||
public function feature_summary() {
|
||||
// @todo This view should render based on the the results of this::allowance();
|
||||
return View::factory('product/plugin/ssl/feature_summary')
|
||||
->set('po',$this);
|
||||
}
|
||||
|
||||
public function supplier() {
|
||||
return 'internal';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user