How to simple calculate tariff

$new =new rate(1,1,’014415645465′);

class rate
public $parent_id;
public $service_id;
public $prefix_field_value;

public function __construct($parent_id,$service_id,$prefix_field_value)
$this->parent_id = $parent_id;
$this->service_id = $service_id;
$this->prefix_field_value = $prefix_field_value;


public function getMyRate()
$rows=R::getAll(“SELECT *FROM uu_rate WHERE servicemodule_id=:service_id and parent_id=:parent_id”

foreach($rows as $row)
$prefixes = explode(‘,’,$row[‘prefix’]);
foreach($prefixes as $prefix)
if(strncmp($prefix, $this->prefix_field_value, strlen( $prefix)) == 0){
$return = array($row[‘rate’],$row[‘comission’],$row[‘charge’]);
return $return;




tariff table


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s