</tr> <tr> <td align="right">Country:</td> <td align="left"><?php echo country_any_cell($row->customer_country, 'countryname');?></td> </tr> <tr> <td align="right">Phone:</td> <td align="left"><?php echo $row->customer_phone_prefix.'-'.$row->customer_phone;?></td> </tr> <tr> <td align="right">Timezone:</td> <td align="left"><?php echo timezone_any_cell($row->customer_timezone, 'timezone_location').' '.timezone_any_cell($row->customer_timezone, 'gmt');?></td> </tr> <tr> <td align="right">Group:</td> <td align="left"><?php echo group_any_cell($row->customer_rate_group, 'group_name');?></td> </tr> <tr> <td align="right">Billing Email:</td> <td align="left"><?php echo $row->customer_billing_email;?></td> </tr> <?php if($customer_access->num_rows() > 0){ $rowAccess = $customer_access->row(); ?> <tr> <td align="center" colspan="2" style="background:#dadada;padding:5px;">User Panel Access Info</td> </tr> <tr id="userpass"> <td align="center" colspan="2"><table cellspacing="3" cellpadding="2" border="0" width="100%" class="search_col"> <tbody>
<tr> <td align="right">Country:</td> <td align="left"> <?php echo country_any_cell($row->customer_country, 'countryname');?> </td> </tr> <tr> <td align="right">Phone:</td> <td align="left"> <?php echo $row->customer_phone_prefix.'-'.$row->customer_phone;?></td> </tr> <tr> <td align="right">Timezone:</td> <td align="left"> <?php echo timezone_any_cell($row->customer_timezone, 'timezone_location').' '.timezone_any_cell($row->customer_timezone, 'gmt');?></td> </tr> <tr> <td align="right">Group:</td> <td align="left"> <?php echo group_any_cell($row->customer_rate_group, 'group_name');?> </td> </tr> <tr> <td align="right">Billing Email:</td> <td align="left"><?php echo $row->customer_billing_email;?></td> </tr> <?php if($customer_access->num_rows() > 0){ $rowAccess = $customer_access->row(); ?> <tr> <td align="center" colspan="2" style="background:#dadada;padding:5px;">User Panel Access Info</td> </tr> <tr id="userpass">
function insert_new_rate($data, $group_rate_table_name) { /* There are 3 Possibilities 1) reseller 3 insert the rate assigned by admin 2) reseller 2 insert the rate assigned by reseller 3 3) reseller 2 insert the rate assigned by admin (becuase admin can directly create a reseller of level 2 so in this case no need for reseller 3) */ $admin_rate_table = ''; $admin_rate_id = 0; $reseller_rate_table = ''; $reseller_rate_id = 0; if(customer_any_cell($this->session->userdata('customer_id'), 'reseller_level') == '3') //master reseller { //here we only need admin rate table and rate id becuase reseller 3 does not have a parent reseller his parent //can only be admin $admin_rate_table = group_any_cell(customer_any_cell($this->session->userdata('customer_id'), 'customer_rate_group'), 'group_rate_table'); $admin_rate_id = $data['parent_rate_id']; } else if(customer_any_cell($this->session->userdata('customer_id'), 'reseller_level') == '2' && customer_any_cell($this->session->userdata('customer_id'), 'parent_id') != '0') //level 2 reseller created by reseller 3 { //we need both admin and parent reseller info because if parent id != 0 than it means this reseller is created by level 3 $reseller_rate_table = group_any_cell(customer_any_cell($this->session->userdata('customer_id'), 'customer_rate_group'), 'group_rate_table'); $reseller_rate_id = $data['parent_rate_id']; $fetch = $this->groups_model->get_single_rate($reseller_rate_id, $reseller_rate_table); $row = $fetch->row(); $admin_rate_table = $row->admin_rate_group; $admin_rate_id = $row->admin_rate_id; } else if(customer_any_cell($this->session->userdata('customer_id'), 'reseller_level') == '2' && customer_any_cell($this->session->userdata('customer_id'), 'parent_id') == '0') //level 2 reseller created by admin { //if parent id = 0 but the type is reseller level 2 which means this level 2 reseller was directly created by admin //there is no master reseller involved so we only need admin rate group and rate id $admin_rate_table = group_any_cell(customer_any_cell($this->session->userdata('customer_id'), 'customer_rate_group'), 'group_rate_table'); $admin_rate_id = $data['parent_rate_id']; } $sql = "INSERT INTO ".$group_rate_table_name."(digits, country_id, sell_rate, cost_rate, sellblock_min_duration, buyblock_min_duration, buy_initblock, sell_initblock, carrier_id, lead_strip, trail_strip, prefix, suffix, lcr_profile, date_start, date_end, quality, reliability, enabled, lrn, admin_rate_group, admin_rate_id, reseller_rate_group, reseller_rate_id) VALUES ('".$data['digits']."', '".$data['country']."', '".$data['sellrate']."', '".$data['costrate']."', '".$data['sellblock_min_duration']."', '".$data['buyblock_min_duration']."', '".$data['buyblock']."', '".$data['sellblock']."', '".$data['carrier']."', '".$data['leadstrip']."', '".$data['trailstrip']."', '".$data['prefix']."', '".$data['suffix']."', '".$data['profile']."', '".$data['startdate']."', '".$data['enddate']."', '".$data['quality']."', '".$data['reliability']."', '1', '".$data['lrn']."', '".$admin_rate_table."', '".$admin_rate_id."', '".$reseller_rate_table."', '".$reseller_rate_id."')"; $query = $this->db->query($sql); }
function update_rate($rate_id = '', $rate_group_id = '') { if(!is_numeric($rate_id) || $rate_id == '' || !is_numeric($rate_group_id) || $rate_group_id == '' || group_any_cell($rate_group_id, 'created_by') != $this->session->userdata('customer_id')) { redirect ('reseller/groups/'); } $data['rate_id'] = $rate_id; $data['rate_group_id'] = $rate_group_id; $group_rate_table_name = $this->groups_model->group_any_cell($rate_group_id, 'group_rate_table'); $data['rate'] = $this->groups_model->get_single_rate($rate_id, $group_rate_table_name); $data['page_name'] = 'edit_rate'; $data['selected'] = 'groups'; $data['sub_selected'] = ''; $data['page_title'] = 'UPDATE RATE'; $data['main_menu'] = 'default/main_menu/reseller_main_menu'; $data['sub_menu'] = 'default/sub_menu/reseller/groups_sub_menu'; $data['main_content'] = 'reseller/groups/edit_rate_view'; $this->load->view('default/template',$data); }