Added VOIP

This commit is contained in:
Deon George 2019-03-15 13:36:03 +11:00
parent 2e0eefe62f
commit fed590c325
5 changed files with 35 additions and 13 deletions

View File

@ -25,7 +25,7 @@ class Controller_User_Search extends Controller_Search {
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($this->request->query('term'),'url','id',array('SVC %s: %s'=>array('id','name()')),array(),array('urlprefix'=>URL::link('user','service/view/')))); $result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($this->request->query('term'),'url','id',array('SVC %s: %s'=>array('id','name()')),array(),array('urlprefix'=>URL::link('user','service/view/'))));
$result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($this->request->query('term'),'url','id',array('INV %s: %s'=>array('id','account->name()')),array(),array('urlprefix'=>URL::link('user','invoice/view/')))); $result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($this->request->query('term'),'url','id',array('INV %s: %s'=>array('id','account->name()')),array(),array('urlprefix'=>URL::link('user','invoice/view/'))));
foreach (array('Service_Plugin_Adsl','Service_Plugin_Domain','Service_Plugin_Host') as $o) foreach (array('Service_Plugin_Adsl','Service_Plugin_Domain','Service_Plugin_Host','Service_Plugin_Voip') as $o)
$result = Arr::merge($result,ORM::factory($o)->list_autocomplete($this->request->query('term'),'url','service_id',array('SVC %s: %s'=>array('service_id','service->name()')),array(),array('urlprefix'=>URL::link('user','service/view/')))); $result = Arr::merge($result,ORM::factory($o)->list_autocomplete($this->request->query('term'),'url','service_id',array('SVC %s: %s'=>array('service_id','service->name()')),array(),array('urlprefix'=>URL::link('user','service/view/'))));
} }

View File

@ -119,16 +119,23 @@ class ADSL_Billing_Exetelvisp {
$result[$service]['cost'] = str_replace('$','',$record[6]); $result[$service]['cost'] = str_replace('$','',$record[6]);
$result[$service]['info'] = 'Other Service'; $result[$service]['info'] = 'Other Service';
} elseif (preg_match('/VOIP Monthly Charges/',$record[3])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[3])));
$result[$service]['cost'] = str_replace('$','',$record[6]);
$result[$service]['info'] = 'VOIP Service';
} elseif (preg_match('/VISP Credit/',$record[4])) { } elseif (preg_match('/VISP Credit/',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4]))); list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['credit'] = str_replace('$','',$record[6]); $result[$service]['credit'] = str_replace('$','',$record[6]);
} elseif (preg_match('/Excess usage charges/',$record[4])) { } elseif (preg_match('/Peak Excess Usage /',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['excess'] = str_replace('$','',$record[7]);
} elseif (preg_match('/Residential VOIP Plan Monthly/',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['cost'] = str_replace('$','',$record[7]);
} elseif (preg_match('/Virtual FAX Number Monthly Rental/',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['cost'] = str_replace('$','',$record[7]);
} elseif (preg_match('/Residential VOIP Plan Excess Usage/',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4]))); list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['excess'] = str_replace('$','',$record[7]); $result[$service]['excess'] = str_replace('$','',$record[7]);
@ -148,8 +155,12 @@ class ADSL_Billing_Exetelvisp {
$this->data_exception = $this->data = $result; $this->data_exception = $this->data = $result;
// @todo This could be optimised better. // @todo This could be optimised better.
foreach ($aso->services(TRUE) as $so) foreach ($aso->services(TRUE) as $so) {
$this->haveService($so->plugin()->service_number,$so->plugin()->admin_plan()->supplier_plan->display('base_cost')); if ($so->plugin()->admin_plan() != 'VOIP')
$this->haveService($so->plugin()->service_number,$so->plugin()->admin_plan()->supplier_plan->display('base_cost'));
elseif ($so->plugin()->admin_plan() == 'VOIP')
$this->haveService($so->plugin()->service_number,10);
}
return $this; return $this;
} }

View File

@ -71,6 +71,17 @@ class Model_ADSL_Supplier extends ORM {
} }
} }
// VOIP
$pos = ORM::factory('Product')
->where('prod_plugin_file','=','VOIP')
->list_active();
foreach ($pos as $po) {
foreach ($po->service->list_active() as $so) {
array_push($result,$so);
}
}
return $result; return $result;
} }
} }

View File

@ -18,8 +18,8 @@
<?php $p = $so->plugin(); $po = $p->admin_plan(); $service_number = $p->service_number; ?> <?php $p = $so->plugin(); $po = $p->admin_plan(); $service_number = $p->service_number; ?>
<?php $cost = $o->charge($service_number); $excess = $o->excess($service_number); $charge = Period::multiple($so->recur_schedule)*$so->price(TRUE)/12; ?> <?php $cost = $o->charge($service_number); $excess = $o->excess($service_number); $charge = Period::multiple($so->recur_schedule)*$so->price(TRUE)/12; ?>
<?php if ($cost != $po->supplier_plan->display('base_cost')) : ?> <?php if ($po AND is_object($po) AND $cost != $po->supplier_plan->display('base_cost')) : ?>
<tr class="error"> <tr class="error" style="background-color: #ff8888;">
<?php elseif ($charge-$cost-$excess < 0) : ?> <?php elseif ($charge-$cost-$excess < 0) : ?>
<tr class="warning"> <tr class="warning">
<?php else : ?> <?php else : ?>
@ -28,10 +28,10 @@
<td><?php echo $service_number; ?></td> <td><?php echo $service_number; ?></td>
<td><?php echo HTML::anchor(URL::link('user','service/view/'.$so->id),$so->id); ?></td> <td><?php echo HTML::anchor(URL::link('user','service/view/'.$so->id),$so->id); ?></td>
<td><?php echo $po->supplier_plan->name().($p->provided_adsl_plan_id ? '*' : ''); ?></td> <td><?php echo ($po AND is_object($po)) ? ($po->supplier_plan->name().($p->provided_adsl_plan_id ? '*' : '')) : $so->name(); ?></td>
<td><?php echo $p->contract_date_start(TRUE); ?></td> <td><?php echo $p->contract_date_start(TRUE); ?></td>
<td><?php echo $p->contract_date_end(TRUE); ?></td> <td><?php echo $p->contract_date_end(TRUE); ?></td>
<td><?php echo $po->supplier_plan->display('base_cost'); ?></td> <td><?php echo ($po AND is_object($po)) ? ($po->supplier_plan->display('base_cost')) : ''; ?></td>
<td><?php echo Currency::display($cost); ?></td> <td><?php echo Currency::display($cost); ?></td>
<td><?php echo Currency::display($excess); ?></td> <td><?php echo Currency::display($excess); ?></td>
<td><?php echo Currency::display($cost+$excess); ?> <td><?php echo Currency::display($cost+$excess); ?>