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

@@ -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;
}
}
?>

View File

@@ -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
*/

View File

@@ -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;

View File

@@ -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">&nbsp;</td><td><?php echo $o->total(TRUE); ?></td><td>&nbsp;</td></tr>
<tr class="info"><td colspan="5">&nbsp;</td><td><?php echo $o->totalcharge(TRUE); ?></td><td>&nbsp;</td><td><?php echo $o->totalexcess(TRUE); ?></tr>
</tbody>
</table>