@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | parent::__construct(); |
29 | 29 | $this->load->model('common_model'); |
30 | - $this->load->library('common'); |
|
30 | + $this->load->library('common'); |
|
31 | 31 | $this->load->model('db_model'); |
32 | 32 | $this->load->model('Astpp_common'); |
33 | 33 | } |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | $opensips_flag=common_model::$global_config['system_config']['opensips']; |
36 | 36 | $accountid_arr=0; |
37 | 37 | if($opensips_flag == '1'){ |
38 | - $where=array('username'=>$sipnumber); |
|
39 | - $accountid_arr=$this->db_model->getSelect('accountid','sip_devices',$where); |
|
40 | - } |
|
38 | + $where=array('username'=>$sipnumber); |
|
39 | + $accountid_arr=$this->db_model->getSelect('accountid','sip_devices',$where); |
|
40 | + } |
|
41 | 41 | else{ |
42 | - $db_config = Common_model::$global_config['system_config']; |
|
43 | - $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
44 | - $this->opensips_db = $this->load->database($opensipdsn, true); |
|
45 | - $this->opensips_db->where(array("username"=>$sipnumber)); |
|
46 | - $accountnum_arr=$this->opensips_db->get("subscriber"); |
|
47 | - $accountnum_arr=$accountnum_arr->result_array(); |
|
48 | - foreach($accountnum_arr as $value_num){ |
|
49 | - $accountid_arr = $this->db_model->getSelect('id','accounts',array('number'=>$value_num['accountcode'])); |
|
50 | - } |
|
42 | + $db_config = Common_model::$global_config['system_config']; |
|
43 | + $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
44 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
45 | + $this->opensips_db->where(array("username"=>$sipnumber)); |
|
46 | + $accountnum_arr=$this->opensips_db->get("subscriber"); |
|
47 | + $accountnum_arr=$accountnum_arr->result_array(); |
|
48 | + foreach($accountnum_arr as $value_num){ |
|
49 | + $accountid_arr = $this->db_model->getSelect('id','accounts',array('number'=>$value_num['accountcode'])); |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | if($accountid_arr == ''){ |
53 | 53 | echo "Please enter proper username of SIP Account"; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | function __construct() |
27 | 27 | { |
28 | - $this->load->library('astpp/email_lib'); |
|
28 | + $this->load->library('astpp/email_lib'); |
|
29 | 29 | parent::__construct(); |
30 | 30 | } |
31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | function customer_mail_result($flag=FALSE){ |
39 | 39 | $account_info = $this->session->userdata['accountinfo']; |
40 | - $post_array = $this->input->post(); |
|
40 | + $post_array = $this->input->post(); |
|
41 | 41 | $post_array['accountid']=$account_info['id']; |
42 | 42 | $post_array['history_id']=0; |
43 | 43 | $post_array['email']=$post_array['to']; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->thanks(); |
47 | 47 | } |
48 | 48 | function thanks(){ |
49 | - $this->load->view('view_mail_response'); |
|
49 | + $this->load->view('view_mail_response'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | } |
@@ -24,249 +24,249 @@ |
||
24 | 24 | |
25 | 25 | class GenerateInvoice extends MX_Controller { |
26 | 26 | |
27 | - public static $global_config; |
|
27 | + public static $global_config; |
|
28 | 28 | |
29 | - function __construct() { |
|
30 | - parent::__construct(); |
|
31 | - $this->load->model("db_model"); |
|
32 | - $this->load->library("astpp/common"); |
|
33 | - $this->load->library('html2pdf'); |
|
34 | - ini_set("memory_limit", "2048M"); |
|
35 | - ini_set("max_execution_time", "259200"); |
|
36 | - $this->get_system_config(); |
|
37 | - } |
|
29 | + function __construct() { |
|
30 | + parent::__construct(); |
|
31 | + $this->load->model("db_model"); |
|
32 | + $this->load->library("astpp/common"); |
|
33 | + $this->load->library('html2pdf'); |
|
34 | + ini_set("memory_limit", "2048M"); |
|
35 | + ini_set("max_execution_time", "259200"); |
|
36 | + $this->get_system_config(); |
|
37 | + } |
|
38 | 38 | |
39 | - function get_system_config() { |
|
40 | - $query = $this->db->get("system"); |
|
41 | - $config = array(); |
|
42 | - $result = $query->result_array(); |
|
43 | - foreach ($result as $row) { |
|
44 | - $config[$row['name']] = $row['value']; |
|
45 | - } |
|
46 | - self::$global_config['system_config'] = $config; |
|
47 | - } |
|
39 | + function get_system_config() { |
|
40 | + $query = $this->db->get("system"); |
|
41 | + $config = array(); |
|
42 | + $result = $query->result_array(); |
|
43 | + foreach ($result as $row) { |
|
44 | + $config[$row['name']] = $row['value']; |
|
45 | + } |
|
46 | + self::$global_config['system_config'] = $config; |
|
47 | + } |
|
48 | 48 | |
49 | - function getInvoiceData() { |
|
50 | - $where = array("posttoexternal" => 1, "deleted" => "0", "status" => "0"); |
|
51 | - $query = $this->db_model->getSelect("*", "accounts", $where); |
|
52 | - if ($query->num_rows > 0) { |
|
53 | - $account_data = $query->result_array(); |
|
54 | - foreach ($account_data as $data_key => $account_value) { |
|
55 | - $end_date = gmdate("Y-m-d") . " 23:59:59"; |
|
56 | - $account_value['sweep_id'] = (int) $account_value['sweep_id']; |
|
57 | - switch ($account_value['sweep_id']) { |
|
58 | - case 0: |
|
59 | - $start_date = $this->validate_invoice_date($account_value); |
|
60 | - if (strtotime($start_date) >= strtotime(gmdate("Y-m-d H:i:s"))) { |
|
61 | - $start_date = gmdate("Y-m-d H:i:s"); |
|
62 | - } |
|
63 | - $end_date = gmdate("Y-m-d 23:59:59", strtotime($start_date . " + 1 days")); |
|
64 | - $this->Generate_Daily_invoice($account_value, $start_date, $end_date); |
|
65 | - break; |
|
66 | - case 2: |
|
67 | - if (date("d") == $account_value['invoice_day']) { |
|
68 | - $start_date = $this->validate_invoice_date($account_value); |
|
69 | - if (strtotime($start_date) >= strtotime(gmdate("Y-m-d H:i:s"))) { |
|
70 | - $start_date = gmdate("Y-m-d H:i:s"); |
|
71 | - } |
|
72 | - $end_date = gmdate("Y-m-d 23:59:59", strtotime($start_date . " + 1 month")); |
|
73 | - $this->Generate_Monthly_invoice($account_value, $start_date, $end_date); |
|
74 | - } |
|
75 | - break; |
|
76 | - } |
|
77 | - } |
|
78 | - $screen_path = getcwd() . "/cron"; |
|
79 | - $screen_filename = "Email_Broadcast_" . strtotime('now'); |
|
80 | - $command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
81 | - exec($command); |
|
82 | - } |
|
83 | - } |
|
49 | + function getInvoiceData() { |
|
50 | + $where = array("posttoexternal" => 1, "deleted" => "0", "status" => "0"); |
|
51 | + $query = $this->db_model->getSelect("*", "accounts", $where); |
|
52 | + if ($query->num_rows > 0) { |
|
53 | + $account_data = $query->result_array(); |
|
54 | + foreach ($account_data as $data_key => $account_value) { |
|
55 | + $end_date = gmdate("Y-m-d") . " 23:59:59"; |
|
56 | + $account_value['sweep_id'] = (int) $account_value['sweep_id']; |
|
57 | + switch ($account_value['sweep_id']) { |
|
58 | + case 0: |
|
59 | + $start_date = $this->validate_invoice_date($account_value); |
|
60 | + if (strtotime($start_date) >= strtotime(gmdate("Y-m-d H:i:s"))) { |
|
61 | + $start_date = gmdate("Y-m-d H:i:s"); |
|
62 | + } |
|
63 | + $end_date = gmdate("Y-m-d 23:59:59", strtotime($start_date . " + 1 days")); |
|
64 | + $this->Generate_Daily_invoice($account_value, $start_date, $end_date); |
|
65 | + break; |
|
66 | + case 2: |
|
67 | + if (date("d") == $account_value['invoice_day']) { |
|
68 | + $start_date = $this->validate_invoice_date($account_value); |
|
69 | + if (strtotime($start_date) >= strtotime(gmdate("Y-m-d H:i:s"))) { |
|
70 | + $start_date = gmdate("Y-m-d H:i:s"); |
|
71 | + } |
|
72 | + $end_date = gmdate("Y-m-d 23:59:59", strtotime($start_date . " + 1 month")); |
|
73 | + $this->Generate_Monthly_invoice($account_value, $start_date, $end_date); |
|
74 | + } |
|
75 | + break; |
|
76 | + } |
|
77 | + } |
|
78 | + $screen_path = getcwd() . "/cron"; |
|
79 | + $screen_filename = "Email_Broadcast_" . strtotime('now'); |
|
80 | + $command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
81 | + exec($command); |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | - function validate_invoice_date($account_value) { |
|
86 | - $last_invoice_date = $this->common->get_invoice_date("to_date", $account_value["id"],$account_value['reseller_id'],"to_date"); |
|
87 | - $last_invoice_date = ($last_invoice_date) ? $last_invoice_date : $account_value['creation']; |
|
88 | - $last_invoice_date = gmdate("Y-m-d H:i:s",strtotime("+1 Second",strtotime($last_invoice_date))); |
|
89 | - return $last_invoice_date; |
|
90 | - } |
|
85 | + function validate_invoice_date($account_value) { |
|
86 | + $last_invoice_date = $this->common->get_invoice_date("to_date", $account_value["id"],$account_value['reseller_id'],"to_date"); |
|
87 | + $last_invoice_date = ($last_invoice_date) ? $last_invoice_date : $account_value['creation']; |
|
88 | + $last_invoice_date = gmdate("Y-m-d H:i:s",strtotime("+1 Second",strtotime($last_invoice_date))); |
|
89 | + return $last_invoice_date; |
|
90 | + } |
|
91 | 91 | |
92 | - function Generate_Daily_invoice($account_value, $start_date, $end_date) { |
|
93 | - // echo "INVOICE SCRIPT-------start date :".$start_date."-------end date....".$end_date; |
|
92 | + function Generate_Daily_invoice($account_value, $start_date, $end_date) { |
|
93 | + // echo "INVOICE SCRIPT-------start date :".$start_date."-------end date....".$end_date; |
|
94 | 94 | |
95 | - require_once('updateBalance.php'); |
|
96 | - $updateBalance = new updateBalance(); |
|
97 | - $updateBalance->process_subscriptions($account_value, $start_date, $end_date, TRUE); |
|
98 | - $updateBalance->process_DID_charges($account_value, $start_date, $end_date, TRUE); |
|
99 | - $this->process_invoice($account_value, $start_date, $end_date); |
|
100 | - } |
|
95 | + require_once('updateBalance.php'); |
|
96 | + $updateBalance = new updateBalance(); |
|
97 | + $updateBalance->process_subscriptions($account_value, $start_date, $end_date, TRUE); |
|
98 | + $updateBalance->process_DID_charges($account_value, $start_date, $end_date, TRUE); |
|
99 | + $this->process_invoice($account_value, $start_date, $end_date); |
|
100 | + } |
|
101 | 101 | |
102 | - function Generate_Monthly_invoice($account_value, $start_date, $end_date) { |
|
103 | - require_once('updateBalance.php'); |
|
104 | - $updateBalance = new updateBalance(); |
|
105 | - $updateBalance->process_subscriptions($account_value, $start_date, $end_date, TRUE); |
|
106 | - $updateBalance->process_DID_charges($account_value, $start_date, $end_date, TRUE); |
|
107 | - $this->process_invoice($account_value, $start_date, $end_date); |
|
108 | - } |
|
102 | + function Generate_Monthly_invoice($account_value, $start_date, $end_date) { |
|
103 | + require_once('updateBalance.php'); |
|
104 | + $updateBalance = new updateBalance(); |
|
105 | + $updateBalance->process_subscriptions($account_value, $start_date, $end_date, TRUE); |
|
106 | + $updateBalance->process_DID_charges($account_value, $start_date, $end_date, TRUE); |
|
107 | + $this->process_invoice($account_value, $start_date, $end_date); |
|
108 | + } |
|
109 | 109 | |
110 | - function process_invoice($accountdata, $start_date, $end_date) { |
|
111 | - //Get Invoice configuration using single query instead of multiple queries. |
|
112 | - $invoice_conf = array(); |
|
113 | - $reseller_id = ($accountdata['reseller_id'] == 0) ? 1 : $accountdata['reseller_id']; |
|
114 | - $where = "accountid IN ('" . $reseller_id . "','1')"; |
|
115 | - $this->db->select('*'); |
|
116 | - $this->db->where($where); |
|
117 | - $this->db->order_by('accountid', 'desc'); |
|
118 | - $this->db->limit(1); |
|
119 | - $invoice_conf = $this->db->get('invoice_conf'); |
|
120 | - $invoice_conf = (array)$invoice_conf->first_row(); |
|
121 | - /*******************************************************/ |
|
122 | - $last_invoice_ID = $this->common->get_invoice_date("invoiceid","", $accountdata['reseller_id']); |
|
123 | - if ($last_invoice_ID && $last_invoice_ID > 0) { |
|
124 | - $last_invoice_ID = ($last_invoice_ID + 1); |
|
125 | - } else { |
|
126 | - $last_invoice_ID = $invoice_conf['invoice_start_from']; |
|
127 | - } |
|
128 | - $last_invoice_ID = str_pad($last_invoice_ID, (strlen($last_invoice_ID) + 4), '0', STR_PAD_LEFT); |
|
129 | - $invoice_sub_total = $this->count_invoice_data($accountdata, $start_date, $end_date); |
|
130 | - if ($invoice_sub_total > 0) { |
|
131 | - $invoiceid = $this->create_invoice($accountdata, $start_date, $end_date, $last_invoice_ID, $invoice_conf['invoice_prefix'], $invoice_conf); |
|
132 | - $this->update_cdrs_data($accountdata['id'], $invoiceid, $start_date, $end_date); |
|
133 | - $sort_order = $this->common_model->apply_invoice_taxes($invoiceid, $accountdata, $start_date); |
|
134 | - $invoice_total = $this->set_invoice_total($invoiceid, $accountdata['id']); |
|
135 | - $this->download_invoice($invoiceid, $accountdata, $invoice_conf); |
|
136 | - } else { |
|
137 | - $invoiceid = $this->create_invoice($accountdata, $start_date, $end_date, $last_invoice_ID, $invoice_conf['invoice_prefix'], $invoice_conf); |
|
138 | - $sort_order = $this->common_model->apply_invoice_taxes($invoiceid, $accountdata, $start_date); |
|
139 | - $invoice_total = $this->set_invoice_total($invoiceid, $accountdata['id']); |
|
140 | - } |
|
141 | - } |
|
110 | + function process_invoice($accountdata, $start_date, $end_date) { |
|
111 | + //Get Invoice configuration using single query instead of multiple queries. |
|
112 | + $invoice_conf = array(); |
|
113 | + $reseller_id = ($accountdata['reseller_id'] == 0) ? 1 : $accountdata['reseller_id']; |
|
114 | + $where = "accountid IN ('" . $reseller_id . "','1')"; |
|
115 | + $this->db->select('*'); |
|
116 | + $this->db->where($where); |
|
117 | + $this->db->order_by('accountid', 'desc'); |
|
118 | + $this->db->limit(1); |
|
119 | + $invoice_conf = $this->db->get('invoice_conf'); |
|
120 | + $invoice_conf = (array)$invoice_conf->first_row(); |
|
121 | + /*******************************************************/ |
|
122 | + $last_invoice_ID = $this->common->get_invoice_date("invoiceid","", $accountdata['reseller_id']); |
|
123 | + if ($last_invoice_ID && $last_invoice_ID > 0) { |
|
124 | + $last_invoice_ID = ($last_invoice_ID + 1); |
|
125 | + } else { |
|
126 | + $last_invoice_ID = $invoice_conf['invoice_start_from']; |
|
127 | + } |
|
128 | + $last_invoice_ID = str_pad($last_invoice_ID, (strlen($last_invoice_ID) + 4), '0', STR_PAD_LEFT); |
|
129 | + $invoice_sub_total = $this->count_invoice_data($accountdata, $start_date, $end_date); |
|
130 | + if ($invoice_sub_total > 0) { |
|
131 | + $invoiceid = $this->create_invoice($accountdata, $start_date, $end_date, $last_invoice_ID, $invoice_conf['invoice_prefix'], $invoice_conf); |
|
132 | + $this->update_cdrs_data($accountdata['id'], $invoiceid, $start_date, $end_date); |
|
133 | + $sort_order = $this->common_model->apply_invoice_taxes($invoiceid, $accountdata, $start_date); |
|
134 | + $invoice_total = $this->set_invoice_total($invoiceid, $accountdata['id']); |
|
135 | + $this->download_invoice($invoiceid, $accountdata, $invoice_conf); |
|
136 | + } else { |
|
137 | + $invoiceid = $this->create_invoice($accountdata, $start_date, $end_date, $last_invoice_ID, $invoice_conf['invoice_prefix'], $invoice_conf); |
|
138 | + $sort_order = $this->common_model->apply_invoice_taxes($invoiceid, $accountdata, $start_date); |
|
139 | + $invoice_total = $this->set_invoice_total($invoiceid, $accountdata['id']); |
|
140 | + } |
|
141 | + } |
|
142 | 142 | |
143 | - function count_invoice_data($account, $start_date = "", $end_date = "") { |
|
144 | - $cdr_query = ""; |
|
145 | - $inv_data_query = ""; |
|
146 | - $cdr_query = "select calltype,sum(debit) as debit from cdrs where accountid = " . $account['id']; |
|
147 | - $cdr_query .= " AND callstart >='" . $start_date . "' AND callstart <= '" . $end_date . "' AND invoiceid=0 group by calltype"; |
|
143 | + function count_invoice_data($account, $start_date = "", $end_date = "") { |
|
144 | + $cdr_query = ""; |
|
145 | + $inv_data_query = ""; |
|
146 | + $cdr_query = "select calltype,sum(debit) as debit from cdrs where accountid = " . $account['id']; |
|
147 | + $cdr_query .= " AND callstart >='" . $start_date . "' AND callstart <= '" . $end_date . "' AND invoiceid=0 group by calltype"; |
|
148 | 148 | //echo $cdr_query; |
149 | - $cdr_data = $this->db->query($cdr_query); |
|
150 | - if ($cdr_data->num_rows > 0) { |
|
151 | - $cdr_data = $cdr_data->result_array(); |
|
152 | - //echo '<pre>'; print_r($cdr_data); exit; |
|
153 | - foreach ($cdr_data as $cdrvalue) { |
|
154 | - $cdrvalue['debit'] = round($cdrvalue['debit'], self::$global_config['system_config']['decimalpoints']); |
|
155 | - $tempArr = array("accountid" => $account['id'], "reseller_id" => $account['reseller_id'], "item_id" => "0", |
|
156 | - "description" => $cdrvalue['calltype'] . " CALLS for the period (" . $start_date . " to " . $end_date, "debit" => $cdrvalue['debit'], "item_type" => $cdrvalue['calltype'], "created_date" => $end_date); |
|
157 | - $this->db->insert("invoice_details", $tempArr); |
|
158 | - } |
|
159 | - } |
|
160 | - $inv_data_query = "select count(id) as count,sum(debit) as debit,sum(credit) as credit from invoice_details where accountid=" . $account['id'] . " AND created_date >='" . $start_date . "' AND created_date <= '" . $end_date . "' AND invoiceid=0 AND item_type != 'FREECALL'"; |
|
149 | + $cdr_data = $this->db->query($cdr_query); |
|
150 | + if ($cdr_data->num_rows > 0) { |
|
151 | + $cdr_data = $cdr_data->result_array(); |
|
152 | + //echo '<pre>'; print_r($cdr_data); exit; |
|
153 | + foreach ($cdr_data as $cdrvalue) { |
|
154 | + $cdrvalue['debit'] = round($cdrvalue['debit'], self::$global_config['system_config']['decimalpoints']); |
|
155 | + $tempArr = array("accountid" => $account['id'], "reseller_id" => $account['reseller_id'], "item_id" => "0", |
|
156 | + "description" => $cdrvalue['calltype'] . " CALLS for the period (" . $start_date . " to " . $end_date, "debit" => $cdrvalue['debit'], "item_type" => $cdrvalue['calltype'], "created_date" => $end_date); |
|
157 | + $this->db->insert("invoice_details", $tempArr); |
|
158 | + } |
|
159 | + } |
|
160 | + $inv_data_query = "select count(id) as count,sum(debit) as debit,sum(credit) as credit from invoice_details where accountid=" . $account['id'] . " AND created_date >='" . $start_date . "' AND created_date <= '" . $end_date . "' AND invoiceid=0 AND item_type != 'FREECALL'"; |
|
161 | 161 | //echo $inv_data_query; |
162 | - $invoice_data = $this->db->query($inv_data_query); |
|
163 | - if ($invoice_data->num_rows > 0) { |
|
164 | - $invoice_data = $invoice_data->result_array(); |
|
165 | - foreach ($invoice_data as $data_value) { |
|
166 | - if ($data_value['count'] > 0) { |
|
167 | - $sub_total = ($data_value['debit'] - $data_value['credit']); |
|
168 | - $sub_total = round($sub_total, self::$global_config['system_config']['decimalpoints']); |
|
169 | - return $sub_total; |
|
170 | - } |
|
171 | - } |
|
172 | - } |
|
173 | - return "0"; |
|
174 | - } |
|
162 | + $invoice_data = $this->db->query($inv_data_query); |
|
163 | + if ($invoice_data->num_rows > 0) { |
|
164 | + $invoice_data = $invoice_data->result_array(); |
|
165 | + foreach ($invoice_data as $data_value) { |
|
166 | + if ($data_value['count'] > 0) { |
|
167 | + $sub_total = ($data_value['debit'] - $data_value['credit']); |
|
168 | + $sub_total = round($sub_total, self::$global_config['system_config']['decimalpoints']); |
|
169 | + return $sub_total; |
|
170 | + } |
|
171 | + } |
|
172 | + } |
|
173 | + return "0"; |
|
174 | + } |
|
175 | 175 | |
176 | - //Change Order of arguements |
|
177 | - function update_cdrs_data($accountid, $invoiceid, $start_date = "", $end_date = "") { |
|
178 | - $inv_data_query = "update invoice_details SET invoiceid = '" . $invoiceid . "' where accountid=" . $accountid; |
|
179 | - $inv_data_query .= " AND created_date >='" . $start_date . "' AND created_date <= '" . $end_date . "' AND invoiceid=0 AND item_type !='PAYMENT'"; |
|
180 | - $this->db->query($inv_data_query); |
|
181 | - return true; |
|
182 | - } |
|
176 | + //Change Order of arguements |
|
177 | + function update_cdrs_data($accountid, $invoiceid, $start_date = "", $end_date = "") { |
|
178 | + $inv_data_query = "update invoice_details SET invoiceid = '" . $invoiceid . "' where accountid=" . $accountid; |
|
179 | + $inv_data_query .= " AND created_date >='" . $start_date . "' AND created_date <= '" . $end_date . "' AND invoiceid=0 AND item_type !='PAYMENT'"; |
|
180 | + $this->db->query($inv_data_query); |
|
181 | + return true; |
|
182 | + } |
|
183 | 183 | |
184 | - function create_invoice($account, $from_date, $to_date, $last_invoice_ID, $INVprefix, $invoiceconf) { |
|
185 | - //$due_date = gmdate("Y-m-d H:i:s",strtotime($to_date." +".$invoiceconf['interval']." days")); |
|
186 | - if ($invoiceconf['interval'] > 0) { |
|
187 | - $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +" . $invoiceconf['interval'] . " days")); |
|
188 | - } else { |
|
189 | - $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +7 days")); |
|
190 | - } |
|
191 | - // echo "due daye-------".$due_date.'----------'.$to_date.'------------> Invoice interval'.$invoiceconf['interval']; |
|
192 | - $balance = ($account['credit_limit'] - $account['balance']); |
|
193 | - $automatic_flag = self::$global_config['system_config']['automatic_invoice']; |
|
184 | + function create_invoice($account, $from_date, $to_date, $last_invoice_ID, $INVprefix, $invoiceconf) { |
|
185 | + //$due_date = gmdate("Y-m-d H:i:s",strtotime($to_date." +".$invoiceconf['interval']." days")); |
|
186 | + if ($invoiceconf['interval'] > 0) { |
|
187 | + $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +" . $invoiceconf['interval'] . " days")); |
|
188 | + } else { |
|
189 | + $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +7 days")); |
|
190 | + } |
|
191 | + // echo "due daye-------".$due_date.'----------'.$to_date.'------------> Invoice interval'.$invoiceconf['interval']; |
|
192 | + $balance = ($account['credit_limit'] - $account['balance']); |
|
193 | + $automatic_flag = self::$global_config['system_config']['automatic_invoice']; |
|
194 | 194 | if($automatic_flag == 1){ |
195 | - $invoice_data = array("accountid" => $account['id'], "invoice_prefix" => $INVprefix, "invoiceid" => $last_invoice_ID, "reseller_id" => |
|
196 | - $account['reseller_id'], "invoice_date" => gmdate("Y-m-d H:i:s"), "from_date" => $from_date, "to_date" => $to_date, "due_date" => $due_date, "status" => 1, "amount" => "0.00", "balance" => $balance); |
|
195 | + $invoice_data = array("accountid" => $account['id'], "invoice_prefix" => $INVprefix, "invoiceid" => $last_invoice_ID, "reseller_id" => |
|
196 | + $account['reseller_id'], "invoice_date" => gmdate("Y-m-d H:i:s"), "from_date" => $from_date, "to_date" => $to_date, "due_date" => $due_date, "status" => 1, "amount" => "0.00", "balance" => $balance); |
|
197 | 197 | }else{ |
198 | - $invoice_data = array("accountid" => $account['id'], "invoice_prefix" => $INVprefix, "invoiceid" => $last_invoice_ID, "reseller_id" => |
|
199 | - $account['reseller_id'], "invoice_date" => gmdate("Y-m-d H:i:s"), "from_date" => $from_date, "to_date" => $to_date, "due_date" => $due_date, "status" => 1, "amount" => "0.00", "balance" => $balance, "confirm" => 1); |
|
198 | + $invoice_data = array("accountid" => $account['id'], "invoice_prefix" => $INVprefix, "invoiceid" => $last_invoice_ID, "reseller_id" => |
|
199 | + $account['reseller_id'], "invoice_date" => gmdate("Y-m-d H:i:s"), "from_date" => $from_date, "to_date" => $to_date, "due_date" => $due_date, "status" => 1, "amount" => "0.00", "balance" => $balance, "confirm" => 1); |
|
200 | 200 | } |
201 | - // echo "<pre>"; print_r($invoice_data); exit; |
|
202 | - $this->db->insert("invoices", $invoice_data); |
|
203 | - $invoiceid = $this->db->insert_id(); |
|
201 | + // echo "<pre>"; print_r($invoice_data); exit; |
|
202 | + $this->db->insert("invoices", $invoice_data); |
|
203 | + $invoiceid = $this->db->insert_id(); |
|
204 | 204 | if($automatic_flag == 0){ |
205 | - $this->download_invoice($invoiceid, $account, $invoiceconf); |
|
205 | + $this->download_invoice($invoiceid, $account, $invoiceconf); |
|
206 | + } |
|
207 | + return $invoiceid; |
|
206 | 208 | } |
207 | - return $invoiceid; |
|
208 | - } |
|
209 | 209 | |
210 | - function set_invoice_total($invoiceid, $accountid) { |
|
211 | - $query = $this->db_model->getSelect("SUM(debit) as total", "invoice_details", array("invoiceid" => $invoiceid, "item_type <>" => "FREECALL")); |
|
212 | - $query = $query->result_array(); |
|
213 | - $sub_total = $query["0"]["total"]; |
|
214 | - $updateArr = array("amount" => $sub_total); |
|
215 | - $this->db->where(array("id" => $invoiceid)); |
|
216 | - $this->db->update("invoices", $updateArr); |
|
210 | + function set_invoice_total($invoiceid, $accountid) { |
|
211 | + $query = $this->db_model->getSelect("SUM(debit) as total", "invoice_details", array("invoiceid" => $invoiceid, "item_type <>" => "FREECALL")); |
|
212 | + $query = $query->result_array(); |
|
213 | + $sub_total = $query["0"]["total"]; |
|
214 | + $updateArr = array("amount" => $sub_total); |
|
215 | + $this->db->where(array("id" => $invoiceid)); |
|
216 | + $this->db->update("invoices", $updateArr); |
|
217 | 217 | |
218 | - $updateArr = array("balance" => "0.00"); |
|
219 | - $this->db->where(array("id" => $accountid)); |
|
220 | - $this->db->update("accounts", $updateArr); |
|
218 | + $updateArr = array("balance" => "0.00"); |
|
219 | + $this->db->where(array("id" => $accountid)); |
|
220 | + $this->db->update("accounts", $updateArr); |
|
221 | 221 | |
222 | - return true; |
|
223 | - } |
|
222 | + return true; |
|
223 | + } |
|
224 | 224 | |
225 | - function download_invoice($invoiceid, $accountdata, $invoice_conf) { |
|
226 | - $invoicedata = $this->db_model->getSelect("*", "invoices", array("id" => $invoiceid)); |
|
227 | - $invoicedata = $invoicedata->result_array(); |
|
228 | - $invoicedata = $invoicedata[0]; |
|
229 | - $FilePath = FCPATH . "invoices/" . $accountdata["id"] . '/' . $invoicedata['invoice_prefix']."".$invoicedata['invoiceid'] . "_invoice.pdf"; |
|
230 | - $Filenm = $invoicedata['invoice_prefix'] ."_". $invoicedata['invoiceid'] . "_invoice.pdf"; |
|
231 | - $this->common->get_invoice_template($invoicedata, $accountdata, false); |
|
232 | - if ($invoice_conf['invoice_notification']) { |
|
233 | - $this->send_email_notification($FilePath, $Filenm, $accountdata, $invoice_conf, $invoicedata); |
|
234 | - } |
|
235 | - } |
|
225 | + function download_invoice($invoiceid, $accountdata, $invoice_conf) { |
|
226 | + $invoicedata = $this->db_model->getSelect("*", "invoices", array("id" => $invoiceid)); |
|
227 | + $invoicedata = $invoicedata->result_array(); |
|
228 | + $invoicedata = $invoicedata[0]; |
|
229 | + $FilePath = FCPATH . "invoices/" . $accountdata["id"] . '/' . $invoicedata['invoice_prefix']."".$invoicedata['invoiceid'] . "_invoice.pdf"; |
|
230 | + $Filenm = $invoicedata['invoice_prefix'] ."_". $invoicedata['invoiceid'] . "_invoice.pdf"; |
|
231 | + $this->common->get_invoice_template($invoicedata, $accountdata, false); |
|
232 | + if ($invoice_conf['invoice_notification']) { |
|
233 | + $this->send_email_notification($FilePath, $Filenm, $accountdata, $invoice_conf, $invoicedata); |
|
234 | + } |
|
235 | + } |
|
236 | 236 | |
237 | - function send_email_notification($FilePath, $Filenm, $AccountData, $invoice_conf, $invData) { |
|
238 | - $TemplateData = array(); |
|
239 | - $where = array('name' => 'email_new_invoice'); |
|
240 | - $EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where); |
|
241 | - foreach ($EmailTemplate->result_array() as $TemplateVal) { |
|
242 | - $TemplateData = $TemplateVal; |
|
243 | - $TemplateData['subject'] = str_replace('#NAME#', $AccountData['first_name'] . " " . $AccountData['last_name'], $TemplateData['subject']); |
|
244 | - $TemplateData['subject'] = str_replace('#INVOICE_NUMBER#', $invData['invoice_prefix'] . $invData['invoiceid'], $TemplateData['subject']); |
|
245 | - $TemplateData['template'] = str_replace('#NAME#', $AccountData['first_name'] . " " . $AccountData['last_name'], $TemplateData['template']); |
|
246 | - $TemplateData['template'] = str_replace('#INVOICE_NUMBER#', $invData['invoice_prefix'] . $invData['invoiceid'], $TemplateData['template']); |
|
247 | - $TemplateData['template'] = str_replace('#AMOUNT#', $invData['amount'], $TemplateData['template']); |
|
237 | + function send_email_notification($FilePath, $Filenm, $AccountData, $invoice_conf, $invData) { |
|
238 | + $TemplateData = array(); |
|
239 | + $where = array('name' => 'email_new_invoice'); |
|
240 | + $EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where); |
|
241 | + foreach ($EmailTemplate->result_array() as $TemplateVal) { |
|
242 | + $TemplateData = $TemplateVal; |
|
243 | + $TemplateData['subject'] = str_replace('#NAME#', $AccountData['first_name'] . " " . $AccountData['last_name'], $TemplateData['subject']); |
|
244 | + $TemplateData['subject'] = str_replace('#INVOICE_NUMBER#', $invData['invoice_prefix'] . $invData['invoiceid'], $TemplateData['subject']); |
|
245 | + $TemplateData['template'] = str_replace('#NAME#', $AccountData['first_name'] . " " . $AccountData['last_name'], $TemplateData['template']); |
|
246 | + $TemplateData['template'] = str_replace('#INVOICE_NUMBER#', $invData['invoice_prefix'] . $invData['invoiceid'], $TemplateData['template']); |
|
247 | + $TemplateData['template'] = str_replace('#AMOUNT#', $invData['amount'], $TemplateData['template']); |
|
248 | 248 | |
249 | - $TemplateData['template'] = str_replace("#COMPANY_EMAIL#", $invoice_conf['emailaddress'], $TemplateData['template']); |
|
250 | - $TemplateData['template'] = str_replace("#COMPANY_NAME#", $invoice_conf['company_name'], $TemplateData['template']); |
|
251 | - $TemplateData['template'] = str_replace("#COMPANY_WEBSITE#", $invoice_conf['website'], $TemplateData['template']); |
|
252 | - $TemplateData['template'] = str_replace("#INVOICE_DATE#",$invData['invoice_date'], $TemplateData['template']); |
|
253 | - $TemplateData['template'] = str_replace("#DUE_DATE#", $invData['due_date'], $TemplateData['template']); |
|
254 | - } |
|
255 | - $dir_path = getcwd() . "/attachments/"; |
|
256 | - $path = $dir_path . $Filenm; |
|
257 | - $command = "cp " . $FilePath . " " . $path; |
|
258 | - exec($command); |
|
259 | - $email_array = array('accountid' => $AccountData['id'], |
|
260 | - 'subject' => $TemplateData['subject'], |
|
261 | - 'body' => $TemplateData['template'], |
|
262 | - 'from' => $invoice_conf['emailaddress'], |
|
263 | - 'to' => $AccountData['email'], |
|
264 | - 'status' => "1", |
|
265 | - 'attachment' => $Filenm, |
|
266 | - 'template' => ''); |
|
267 | - //echo "<pre>"; print_r($TemplateData); exit; |
|
268 | - $this->db->insert("mail_details", $email_array); |
|
269 | - } |
|
249 | + $TemplateData['template'] = str_replace("#COMPANY_EMAIL#", $invoice_conf['emailaddress'], $TemplateData['template']); |
|
250 | + $TemplateData['template'] = str_replace("#COMPANY_NAME#", $invoice_conf['company_name'], $TemplateData['template']); |
|
251 | + $TemplateData['template'] = str_replace("#COMPANY_WEBSITE#", $invoice_conf['website'], $TemplateData['template']); |
|
252 | + $TemplateData['template'] = str_replace("#INVOICE_DATE#",$invData['invoice_date'], $TemplateData['template']); |
|
253 | + $TemplateData['template'] = str_replace("#DUE_DATE#", $invData['due_date'], $TemplateData['template']); |
|
254 | + } |
|
255 | + $dir_path = getcwd() . "/attachments/"; |
|
256 | + $path = $dir_path . $Filenm; |
|
257 | + $command = "cp " . $FilePath . " " . $path; |
|
258 | + exec($command); |
|
259 | + $email_array = array('accountid' => $AccountData['id'], |
|
260 | + 'subject' => $TemplateData['subject'], |
|
261 | + 'body' => $TemplateData['template'], |
|
262 | + 'from' => $invoice_conf['emailaddress'], |
|
263 | + 'to' => $AccountData['email'], |
|
264 | + 'status' => "1", |
|
265 | + 'attachment' => $Filenm, |
|
266 | + 'template' => ''); |
|
267 | + //echo "<pre>"; print_r($TemplateData); exit; |
|
268 | + $this->db->insert("mail_details", $email_array); |
|
269 | + } |
|
270 | 270 | |
271 | 271 | } |
272 | 272 |
@@ -22,27 +22,27 @@ |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | class Lowcreditlimit extends CI_Controller { |
25 | - function __construct() |
|
26 | - { |
|
25 | + function __construct() |
|
26 | + { |
|
27 | 27 | parent::__construct(); |
28 | 28 | if(!defined( 'CRON' ) ) |
29 | 29 | exit(); |
30 | - $this->load->model("db_model"); |
|
31 | - $this->load->library("astpp/common"); |
|
32 | - } |
|
33 | - function low_creditlimit(){ |
|
34 | - $where = array("posttoexternal"=>1,"deleted" => "0","status"=>"0"); |
|
35 | - $query = $this->db_model->getSelect("*", "accounts", $where); |
|
36 | - if($query->num_rows >0){ |
|
37 | - $account_data = $query->result_array(); |
|
38 | - foreach($account_data as $data_key =>$account_value){ |
|
39 | - if(($account_value["balance"]) >= $account_value["credit_limit"]){ |
|
40 | - $this->common->mail_to_users("email_low_balance",$account_value); |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
44 | - exit; |
|
45 | - } |
|
30 | + $this->load->model("db_model"); |
|
31 | + $this->load->library("astpp/common"); |
|
32 | + } |
|
33 | + function low_creditlimit(){ |
|
34 | + $where = array("posttoexternal"=>1,"deleted" => "0","status"=>"0"); |
|
35 | + $query = $this->db_model->getSelect("*", "accounts", $where); |
|
36 | + if($query->num_rows >0){ |
|
37 | + $account_data = $query->result_array(); |
|
38 | + foreach($account_data as $data_key =>$account_value){ |
|
39 | + if(($account_value["balance"]) >= $account_value["credit_limit"]){ |
|
40 | + $this->common->mail_to_users("email_low_balance",$account_value); |
|
41 | + } |
|
42 | + } |
|
43 | + } |
|
44 | + exit; |
|
45 | + } |
|
46 | 46 | } |
47 | 47 | ?> |
48 | 48 |
@@ -21,60 +21,60 @@ |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | class Currencyupdate extends CI_Controller { |
24 | - function __construct() |
|
25 | - { |
|
26 | - parent::__construct(); |
|
27 | - // if(!defined( 'CRON' ) ) |
|
28 | - // exit(); |
|
29 | - $this->load->model("db_model"); |
|
30 | - $this->load->library("astpp/common"); |
|
31 | - } |
|
32 | - function update_currency(){ |
|
33 | - $where = array("currency <>"=> Common_model::$global_config['system_config']['base_currency']); |
|
34 | - $query = $this->db_model->getSelect("*", "currency", $where); |
|
24 | + function __construct() |
|
25 | + { |
|
26 | + parent::__construct(); |
|
27 | + // if(!defined( 'CRON' ) ) |
|
28 | + // exit(); |
|
29 | + $this->load->model("db_model"); |
|
30 | + $this->load->library("astpp/common"); |
|
31 | + } |
|
32 | + function update_currency(){ |
|
33 | + $where = array("currency <>"=> Common_model::$global_config['system_config']['base_currency']); |
|
34 | + $query = $this->db_model->getSelect("*", "currency", $where); |
|
35 | 35 | |
36 | - if($query->num_rows >0){ |
|
37 | - $currency_data =$query->result_array(); |
|
38 | - $url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s="; |
|
39 | - foreach ($currency_data as $currency_value) { |
|
40 | - $url .= Common_model::$global_config['system_config']['base_currency'].$currency_value['currency'].'=X+'; |
|
41 | - } |
|
42 | - $url .= '&f=l1'; |
|
36 | + if($query->num_rows >0){ |
|
37 | + $currency_data =$query->result_array(); |
|
38 | + $url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s="; |
|
39 | + foreach ($currency_data as $currency_value) { |
|
40 | + $url .= Common_model::$global_config['system_config']['base_currency'].$currency_value['currency'].'=X+'; |
|
41 | + } |
|
42 | + $url .= '&f=l1'; |
|
43 | 43 | |
44 | - $sql=''; |
|
45 | - $response = $this->curl_response($url); |
|
46 | - $content_data = explode(' ',$response); |
|
44 | + $sql=''; |
|
45 | + $response = $this->curl_response($url); |
|
46 | + $content_data = explode(' ',$response); |
|
47 | 47 | |
48 | - foreach ($content_data as $content_data1){ |
|
49 | - $currency_arr= explode("\n", $content_data1); |
|
50 | - foreach($currency_arr as $final_val) |
|
51 | - { |
|
52 | - $currency_final = array(); |
|
53 | - $currency_final= explode(',', $final_val); |
|
54 | - if(isset($currency_final[1]) && $currency_final[1] != "" && $currency_final[0]!='' && $currency_final[1] != 'N/A'){ |
|
55 | - $sql = "UPDATE currency SET currencyRate = ".$currency_final[1]." WHERE currency = '".substr($currency_final[0],4,3)."'"; |
|
56 | - $this->db->query($sql); |
|
57 | - } |
|
58 | - } |
|
59 | - } |
|
60 | - $sql = "UPDATE currency SET currencyRate = '1' WHERE currency = '".Common_model::$global_config['system_config']['base_currency']."'"; |
|
61 | - $this->db->query($sql); |
|
62 | - } |
|
63 | - $this->session->set_flashdata("astpp_errormsg", "Currency exchange rates successfully updated."); |
|
64 | - redirect(base_url()."/systems/currency_list/"); |
|
65 | - exit; |
|
48 | + foreach ($content_data as $content_data1){ |
|
49 | + $currency_arr= explode("\n", $content_data1); |
|
50 | + foreach($currency_arr as $final_val) |
|
51 | + { |
|
52 | + $currency_final = array(); |
|
53 | + $currency_final= explode(',', $final_val); |
|
54 | + if(isset($currency_final[1]) && $currency_final[1] != "" && $currency_final[0]!='' && $currency_final[1] != 'N/A'){ |
|
55 | + $sql = "UPDATE currency SET currencyRate = ".$currency_final[1]." WHERE currency = '".substr($currency_final[0],4,3)."'"; |
|
56 | + $this->db->query($sql); |
|
57 | + } |
|
58 | + } |
|
59 | + } |
|
60 | + $sql = "UPDATE currency SET currencyRate = '1' WHERE currency = '".Common_model::$global_config['system_config']['base_currency']."'"; |
|
61 | + $this->db->query($sql); |
|
62 | + } |
|
63 | + $this->session->set_flashdata("astpp_errormsg", "Currency exchange rates successfully updated."); |
|
64 | + redirect(base_url()."/systems/currency_list/"); |
|
65 | + exit; |
|
66 | 66 | } |
67 | 67 | function curl_response($url) |
68 | 68 | { |
69 | - $ch = curl_init(); // Initialising cURL |
|
70 | - curl_setopt ( $ch, CURLOPT_URL, $url ); |
|
71 | - curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 ); |
|
72 | - curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
73 | - curl_setopt ( $ch, CURLOPT_ENCODING, "" ); |
|
74 | - curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)" ); |
|
75 | - $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable |
|
76 | - curl_close($ch); // Closing cURL |
|
77 | - return $data; |
|
69 | + $ch = curl_init(); // Initialising cURL |
|
70 | + curl_setopt ( $ch, CURLOPT_URL, $url ); |
|
71 | + curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 ); |
|
72 | + curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
73 | + curl_setopt ( $ch, CURLOPT_ENCODING, "" ); |
|
74 | + curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)" ); |
|
75 | + $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable |
|
76 | + curl_close($ch); // Closing cURL |
|
77 | + return $data; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | ?> |
@@ -22,26 +22,26 @@ |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | class Lowbalance extends CI_Controller { |
25 | - function __construct() |
|
26 | - { |
|
25 | + function __construct() |
|
26 | + { |
|
27 | 27 | parent::__construct(); |
28 | 28 | if(!defined( 'CRON' ) ) |
29 | 29 | exit(); |
30 | - $this->load->model("db_model"); |
|
31 | - $this->load->library("astpp/common"); |
|
32 | - } |
|
33 | - function low_balance(){ |
|
34 | - $where = array("posttoexternal"=>0,"notify_flag"=>0,"deleted" => "0","status"=>"0"); |
|
35 | - $query = $this->db_model->getSelect("*", "accounts", $where); |
|
36 | - if($query->num_rows >0){ |
|
37 | - $account_data = $query->result_array(); |
|
38 | - foreach($account_data as $data_key =>$accountinfo){ |
|
39 | - if(($accountinfo["balance"]) <= $accountinfo["notify_credit_limit"]){ |
|
40 | - $this->common->mail_to_users("email_low_balance",$accountinfo); |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
44 | - exit; |
|
45 | - } |
|
30 | + $this->load->model("db_model"); |
|
31 | + $this->load->library("astpp/common"); |
|
32 | + } |
|
33 | + function low_balance(){ |
|
34 | + $where = array("posttoexternal"=>0,"notify_flag"=>0,"deleted" => "0","status"=>"0"); |
|
35 | + $query = $this->db_model->getSelect("*", "accounts", $where); |
|
36 | + if($query->num_rows >0){ |
|
37 | + $account_data = $query->result_array(); |
|
38 | + foreach($account_data as $data_key =>$accountinfo){ |
|
39 | + if(($accountinfo["balance"]) <= $accountinfo["notify_credit_limit"]){ |
|
40 | + $this->common->mail_to_users("email_low_balance",$accountinfo); |
|
41 | + } |
|
42 | + } |
|
43 | + } |
|
44 | + exit; |
|
45 | + } |
|
46 | 46 | } |
47 | 47 | ?> |
@@ -29,64 +29,64 @@ |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | function uset_timezone(){ |
32 | - $account_data = $this->CI->session->userdata('accountinfo'); |
|
33 | - return $account_data['timezone_id'] ; |
|
32 | + $account_data = $this->CI->session->userdata('accountinfo'); |
|
33 | + return $account_data['timezone_id'] ; |
|
34 | 34 | } |
35 | 35 | function display_GMT($currDate,$fulldate = 1) |
36 | 36 | { |
37 | - $number = $this->uset_timezone(); |
|
38 | - $SERVER_GMT='0'; |
|
37 | + $number = $this->uset_timezone(); |
|
38 | + $SERVER_GMT='0'; |
|
39 | 39 | |
40 | - $result=$this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
41 | - $timezone_offset = $result->result(); |
|
40 | + $result=$this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
41 | + $timezone_offset = $result->result(); |
|
42 | 42 | |
43 | - $USER_GMT = $timezone_offset['0']->gmtoffset; |
|
43 | + $USER_GMT = $timezone_offset['0']->gmtoffset; |
|
44 | 44 | |
45 | - $date_time_array = getdate(strtotime($currDate)); |
|
45 | + $date_time_array = getdate(strtotime($currDate)); |
|
46 | 46 | |
47 | - $hours = $date_time_array['hours']; |
|
48 | - $minutes = $date_time_array['minutes']; |
|
49 | - $seconds = $date_time_array['seconds']; |
|
50 | - $month = $date_time_array['mon']; |
|
51 | - $day = $date_time_array['mday']; |
|
52 | - $year = $date_time_array['year']; |
|
53 | - $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year); |
|
47 | + $hours = $date_time_array['hours']; |
|
48 | + $minutes = $date_time_array['minutes']; |
|
49 | + $seconds = $date_time_array['seconds']; |
|
50 | + $month = $date_time_array['mon']; |
|
51 | + $day = $date_time_array['mday']; |
|
52 | + $year = $date_time_array['year']; |
|
53 | + $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year); |
|
54 | 54 | |
55 | - $timestamp = $timestamp+($USER_GMT-$SERVER_GMT); |
|
56 | - if ($fulldate == 1) { |
|
55 | + $timestamp = $timestamp+($USER_GMT-$SERVER_GMT); |
|
56 | + if ($fulldate == 1) { |
|
57 | 57 | $date = date("Y-m-d H:i:s", $timestamp); |
58 | - } else { |
|
59 | - $date = date("Y-m-d", $timestamp); |
|
60 | - } |
|
58 | + } else { |
|
59 | + $date = date("Y-m-d", $timestamp); |
|
60 | + } |
|
61 | 61 | |
62 | - return $date; |
|
62 | + return $date; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | function convert_to_GMT($currDate,$fulldate = 1){ |
66 | - $number = $this->uset_timezone(); |
|
67 | - $SERVER_GMT='0'; |
|
66 | + $number = $this->uset_timezone(); |
|
67 | + $SERVER_GMT='0'; |
|
68 | 68 | |
69 | - $result=$this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
70 | - $timezone_offset = $result->result(); |
|
69 | + $result=$this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
70 | + $timezone_offset = $result->result(); |
|
71 | 71 | |
72 | - $USER_GMT = $timezone_offset['0']->gmtoffset; |
|
72 | + $USER_GMT = $timezone_offset['0']->gmtoffset; |
|
73 | 73 | |
74 | - $date_time_array = getdate(strtotime($currDate)); |
|
75 | - $hours = $date_time_array['hours']; |
|
76 | - $minutes = $date_time_array['minutes']; |
|
77 | - $seconds = $date_time_array['seconds']; |
|
78 | - $month = $date_time_array['mon']; |
|
79 | - $day = $date_time_array['mday']; |
|
80 | - $year = $date_time_array['year']; |
|
81 | - $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year); |
|
74 | + $date_time_array = getdate(strtotime($currDate)); |
|
75 | + $hours = $date_time_array['hours']; |
|
76 | + $minutes = $date_time_array['minutes']; |
|
77 | + $seconds = $date_time_array['seconds']; |
|
78 | + $month = $date_time_array['mon']; |
|
79 | + $day = $date_time_array['mday']; |
|
80 | + $year = $date_time_array['year']; |
|
81 | + $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year); |
|
82 | 82 | |
83 | - $timestamp = $timestamp - ($SERVER_GMT - $USER_GMT); |
|
84 | - if ($fulldate == 1) { |
|
85 | - $date = date("Y-m-d H:i:s", $timestamp); |
|
86 | - } else { |
|
87 | - $date = date("Y-m-d", $timestamp); |
|
88 | - } |
|
89 | - return $date; |
|
83 | + $timestamp = $timestamp - ($SERVER_GMT - $USER_GMT); |
|
84 | + if ($fulldate == 1) { |
|
85 | + $date = date("Y-m-d H:i:s", $timestamp); |
|
86 | + } else { |
|
87 | + $date = date("Y-m-d", $timestamp); |
|
88 | + } |
|
89 | + return $date; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | ?> |
@@ -12,96 +12,96 @@ |
||
12 | 12 | */ |
13 | 13 | class CSVReader { |
14 | 14 | |
15 | - var $fields; /** columns names retrieved after parsing */ |
|
16 | - var $separator = ','; /** separator used to explode each line */ |
|
15 | + var $fields; /** columns names retrieved after parsing */ |
|
16 | + var $separator = ','; /** separator used to explode each line */ |
|
17 | 17 | |
18 | - /** |
|
19 | - * Parse a text containing CSV formatted data. |
|
20 | - * |
|
21 | - * @access public |
|
22 | - * @param string |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - function parse_text($p_Text) { |
|
26 | - $lines = explode("\n", $p_Text); |
|
27 | - return $this->parse_lines($lines); |
|
28 | - } |
|
18 | + /** |
|
19 | + * Parse a text containing CSV formatted data. |
|
20 | + * |
|
21 | + * @access public |
|
22 | + * @param string |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + function parse_text($p_Text) { |
|
26 | + $lines = explode("\n", $p_Text); |
|
27 | + return $this->parse_lines($lines); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Parse a file containing CSV formatted data. |
|
32 | - * |
|
33 | - * @access public |
|
34 | - * @param string |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - function parse_file($p_Filepath,$config_variable,$check_header_flag=false) { |
|
38 | - $lines = file($p_Filepath); |
|
39 | - //Giving line numbers |
|
40 | - for($i=0;$i<sizeof($lines);$i++) |
|
41 | - { |
|
30 | + /** |
|
31 | + * Parse a file containing CSV formatted data. |
|
32 | + * |
|
33 | + * @access public |
|
34 | + * @param string |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + function parse_file($p_Filepath,$config_variable,$check_header_flag=false) { |
|
38 | + $lines = file($p_Filepath); |
|
39 | + //Giving line numbers |
|
40 | + for($i=0;$i<sizeof($lines);$i++) |
|
41 | + { |
|
42 | 42 | |
43 | - if(trim($lines[$i]) != "") |
|
44 | - { |
|
45 | - $columnname = explode($this->separator, $lines[$i]); |
|
46 | - for($i=0;$i<sizeof($columnname);$i++) |
|
47 | - { |
|
48 | - $columnname[$i]=$columnname[$i]; |
|
49 | - } |
|
50 | - break; |
|
51 | - } |
|
52 | - } |
|
43 | + if(trim($lines[$i]) != "") |
|
44 | + { |
|
45 | + $columnname = explode($this->separator, $lines[$i]); |
|
46 | + for($i=0;$i<sizeof($columnname);$i++) |
|
47 | + { |
|
48 | + $columnname[$i]=$columnname[$i]; |
|
49 | + } |
|
50 | + break; |
|
51 | + } |
|
52 | + } |
|
53 | 53 | return $this->parse_lines($lines,$config_variable,$check_header_flag); |
54 | - } |
|
55 | - /** |
|
56 | - * Parse an array of text lines containing CSV formatted data. |
|
57 | - * |
|
58 | - * @access public |
|
59 | - * @param array |
|
60 | - * @return array |
|
61 | - */ |
|
62 | - function parse_lines($p_CSVLines,$config_variable,$check_header_flag=false) { |
|
54 | + } |
|
55 | + /** |
|
56 | + * Parse an array of text lines containing CSV formatted data. |
|
57 | + * |
|
58 | + * @access public |
|
59 | + * @param array |
|
60 | + * @return array |
|
61 | + */ |
|
62 | + function parse_lines($p_CSVLines,$config_variable,$check_header_flag=false) { |
|
63 | 63 | // echo "<pre>"; |
64 | - $t=0; |
|
65 | - $content=array(); |
|
66 | - $custom_array=array(); |
|
67 | - $i=0; |
|
68 | - $flag_data=false; |
|
69 | - $data_arr[0]=$config_variable; |
|
70 | - $field_name_arr=array_keys($config_variable); |
|
64 | + $t=0; |
|
65 | + $content=array(); |
|
66 | + $custom_array=array(); |
|
67 | + $i=0; |
|
68 | + $flag_data=false; |
|
69 | + $data_arr[0]=$config_variable; |
|
70 | + $field_name_arr=array_keys($config_variable); |
|
71 | 71 | foreach( $p_CSVLines as $line_num => $line ) |
72 | - { |
|
72 | + { |
|
73 | 73 | $line=trim($line); |
74 | - if(!empty($line)){ |
|
75 | - // skip empty lines |
|
76 | - $elements = explode($this->separator, $line); |
|
74 | + if(!empty($line)){ |
|
75 | + // skip empty lines |
|
76 | + $elements = explode($this->separator, $line); |
|
77 | 77 | |
78 | - if(array_filter($elements,'trim')) { |
|
78 | + if(array_filter($elements,'trim')) { |
|
79 | 79 | $custom_array[]=$elements; |
80 | - } |
|
81 | - $i++; |
|
80 | + } |
|
81 | + $i++; |
|
82 | 82 | } |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - if($check_header_flag == 'on'){ |
|
86 | - unset($custom_array[0]); |
|
87 | - } |
|
85 | + if($check_header_flag == 'on'){ |
|
86 | + unset($custom_array[0]); |
|
87 | + } |
|
88 | 88 | foreach($custom_array as $data){ |
89 | 89 | $j=0; |
90 | 90 | foreach($data as $key=>$value){ |
91 | - $value=str_replace('"', '', $value); |
|
92 | - $value=str_replace("'", '', $value); |
|
93 | - if(isset($field_name_arr[$j])){ |
|
94 | - $field_key_value =$config_variable[$field_name_arr[$j]]; |
|
91 | + $value=str_replace('"', '', $value); |
|
92 | + $value=str_replace("'", '', $value); |
|
93 | + if(isset($field_name_arr[$j])){ |
|
94 | + $field_key_value =$config_variable[$field_name_arr[$j]]; |
|
95 | 95 | $value= strip_slashes(trim($value)); |
96 | - $value = preg_replace('#<script.*</script>#is', '', $value); |
|
97 | - if(isset($field_key_value) && !empty($field_key_value)) |
|
96 | + $value = preg_replace('#<script.*</script>#is', '', $value); |
|
97 | + if(isset($field_key_value) && !empty($field_key_value)) |
|
98 | 98 | $content[$field_key_value] = strip_tags(filter_var($value, FILTER_SANITIZE_STRING)); |
99 | 99 | $j++; |
100 | - } |
|
100 | + } |
|
101 | 101 | } |
102 | 102 | $data_arr[]=$content; |
103 | - } |
|
104 | - return $data_arr; |
|
105 | - } |
|
103 | + } |
|
104 | + return $data_arr; |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | ?> |
@@ -23,453 +23,453 @@ discard block |
||
23 | 23 | ############################################################################### |
24 | 24 | |
25 | 25 | if (!defined('BASEPATH')) |
26 | - exit('No direct script access allowed'); |
|
26 | + exit('No direct script access allowed'); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Dynamically build forms for display |
30 | 30 | */ |
31 | 31 | class common { |
32 | 32 | |
33 | - protected $CI; // codeigniter |
|
33 | + protected $CI; // codeigniter |
|
34 | 34 | |
35 | - function __construct($library_name = '') { |
|
35 | + function __construct($library_name = '') { |
|
36 | 36 | |
37 | - $this->CI = & get_instance(); |
|
38 | - $this->CI->load->library("timezone"); |
|
39 | - $this->CI->load->model('db_model'); |
|
40 | - $this->CI->load->library('email'); |
|
41 | - $this->CI->load->library('session'); |
|
42 | - } |
|
37 | + $this->CI = & get_instance(); |
|
38 | + $this->CI->load->library("timezone"); |
|
39 | + $this->CI->load->model('db_model'); |
|
40 | + $this->CI->load->library('email'); |
|
41 | + $this->CI->load->library('session'); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | // __construct |
45 | - /** |
|
46 | - * adds raw html to the field array |
|
47 | - * @param type $label |
|
48 | - * @param type $field add |
|
49 | - */ |
|
50 | - function generate_password() { |
|
51 | - $pass = substr(md5(rand(0, 1000000000)), 0, common_model::$global_config['system_config']['pinlength']); |
|
52 | - return $pass; |
|
53 | - } |
|
54 | - |
|
55 | - function find_uniq_rendno($size = '', $field = '', $tablename = '') { |
|
56 | - |
|
57 | - if ($tablename != '') { |
|
58 | - $accounttype_array = array(); |
|
59 | - $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
60 | - $where = array($field => $uname); |
|
61 | - $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where); |
|
62 | - $acc_result = $acc_result->result(); |
|
63 | - while ($acc_result[0]->count != 0) { |
|
64 | - $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
65 | - $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where); |
|
66 | - } |
|
67 | - } else { |
|
68 | - $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
69 | - } |
|
70 | - return $uname; |
|
71 | - } |
|
72 | - |
|
73 | - function find_uniq_rendno_customer($size = '', $field = '', $tablename = '') { |
|
74 | - if ($tablename != '') { |
|
75 | - $accounttype_array = array(); |
|
76 | - $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
77 | - $where = array($field => $uname); |
|
78 | - $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where); |
|
79 | - $acc_result = $acc_result->result(); |
|
80 | - while ($acc_result[0]->count != 0) { |
|
81 | - $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
82 | - $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where); |
|
83 | - } |
|
84 | - } else { |
|
85 | - $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
86 | - } |
|
87 | - $start_prifix_value = common_model::$global_config['system_config']['startingdigit']; |
|
88 | - if ($tablename == 'accounts' && $start_prifix_value != 0) { |
|
89 | - $length = strlen($start_prifix_value); |
|
90 | - $uname = substr($uname, $length); |
|
91 | - $uname = $start_prifix_value . $uname; |
|
92 | - } |
|
93 | - return $uname; |
|
94 | - } |
|
95 | - |
|
96 | - function random_string($length) { |
|
97 | - $chars = "1234567890"; //length:36 |
|
98 | - $final_rand = ''; |
|
99 | - for ($i = 0; $i < $length; $i++) { |
|
100 | - $final_rand .= $chars[rand(0, strlen($chars) - 1)]; |
|
101 | - } |
|
102 | - return $final_rand; |
|
103 | - } |
|
104 | - |
|
105 | - function find_uniq_rendno_accno($length = '', $field = '', $tablename = '', $default, $creation_count) { |
|
106 | - $number = array(); |
|
107 | - $j = 0; |
|
108 | - |
|
109 | - $total_count = pow(10, $length); |
|
110 | - for ($i = 1; $i <= $total_count; $i++) { |
|
111 | - |
|
112 | - $flag = false; |
|
113 | - $uname = $this->random_string($length); |
|
114 | - $uname = strtolower($uname); |
|
115 | - if (isset($default)) |
|
116 | - $uname = $default . $uname; |
|
117 | - if (!in_array($uname, $number)) { |
|
118 | - $where = array($field => $uname); |
|
119 | - $acc_result = $this->CI->db_model->getSelect('Count(id) as count', $tablename, $where); |
|
120 | - $acc_result = $acc_result->result_array(); |
|
121 | - if ($acc_result[0]['count'] == 0 && !in_array($uname, $number)) { |
|
122 | - $number[] = $uname; |
|
123 | - $j++; |
|
124 | - } |
|
125 | - if ($j == $creation_count) { |
|
126 | - break; |
|
127 | - } |
|
128 | - } else { |
|
129 | - $total_count++; |
|
130 | - } |
|
131 | - } |
|
132 | - return $number; |
|
133 | - } |
|
134 | - |
|
135 | - function get_field_count($select, $table, $where) { |
|
45 | + /** |
|
46 | + * adds raw html to the field array |
|
47 | + * @param type $label |
|
48 | + * @param type $field add |
|
49 | + */ |
|
50 | + function generate_password() { |
|
51 | + $pass = substr(md5(rand(0, 1000000000)), 0, common_model::$global_config['system_config']['pinlength']); |
|
52 | + return $pass; |
|
53 | + } |
|
54 | + |
|
55 | + function find_uniq_rendno($size = '', $field = '', $tablename = '') { |
|
56 | + |
|
57 | + if ($tablename != '') { |
|
58 | + $accounttype_array = array(); |
|
59 | + $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
60 | + $where = array($field => $uname); |
|
61 | + $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where); |
|
62 | + $acc_result = $acc_result->result(); |
|
63 | + while ($acc_result[0]->count != 0) { |
|
64 | + $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
65 | + $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where); |
|
66 | + } |
|
67 | + } else { |
|
68 | + $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
69 | + } |
|
70 | + return $uname; |
|
71 | + } |
|
72 | + |
|
73 | + function find_uniq_rendno_customer($size = '', $field = '', $tablename = '') { |
|
74 | + if ($tablename != '') { |
|
75 | + $accounttype_array = array(); |
|
76 | + $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
77 | + $where = array($field => $uname); |
|
78 | + $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where); |
|
79 | + $acc_result = $acc_result->result(); |
|
80 | + while ($acc_result[0]->count != 0) { |
|
81 | + $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
82 | + $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where); |
|
83 | + } |
|
84 | + } else { |
|
85 | + $uname = rand(pow(10, $size - 1), pow(10, $size) - 1); |
|
86 | + } |
|
87 | + $start_prifix_value = common_model::$global_config['system_config']['startingdigit']; |
|
88 | + if ($tablename == 'accounts' && $start_prifix_value != 0) { |
|
89 | + $length = strlen($start_prifix_value); |
|
90 | + $uname = substr($uname, $length); |
|
91 | + $uname = $start_prifix_value . $uname; |
|
92 | + } |
|
93 | + return $uname; |
|
94 | + } |
|
95 | + |
|
96 | + function random_string($length) { |
|
97 | + $chars = "1234567890"; //length:36 |
|
98 | + $final_rand = ''; |
|
99 | + for ($i = 0; $i < $length; $i++) { |
|
100 | + $final_rand .= $chars[rand(0, strlen($chars) - 1)]; |
|
101 | + } |
|
102 | + return $final_rand; |
|
103 | + } |
|
104 | + |
|
105 | + function find_uniq_rendno_accno($length = '', $field = '', $tablename = '', $default, $creation_count) { |
|
106 | + $number = array(); |
|
107 | + $j = 0; |
|
108 | + |
|
109 | + $total_count = pow(10, $length); |
|
110 | + for ($i = 1; $i <= $total_count; $i++) { |
|
111 | + |
|
112 | + $flag = false; |
|
113 | + $uname = $this->random_string($length); |
|
114 | + $uname = strtolower($uname); |
|
115 | + if (isset($default)) |
|
116 | + $uname = $default . $uname; |
|
117 | + if (!in_array($uname, $number)) { |
|
118 | + $where = array($field => $uname); |
|
119 | + $acc_result = $this->CI->db_model->getSelect('Count(id) as count', $tablename, $where); |
|
120 | + $acc_result = $acc_result->result_array(); |
|
121 | + if ($acc_result[0]['count'] == 0 && !in_array($uname, $number)) { |
|
122 | + $number[] = $uname; |
|
123 | + $j++; |
|
124 | + } |
|
125 | + if ($j == $creation_count) { |
|
126 | + break; |
|
127 | + } |
|
128 | + } else { |
|
129 | + $total_count++; |
|
130 | + } |
|
131 | + } |
|
132 | + return $number; |
|
133 | + } |
|
134 | + |
|
135 | + function get_field_count($select, $table, $where) { |
|
136 | 136 | // echo $select."=====".$table."===".$where; |
137 | - if (is_array($where)) { |
|
138 | - $where = $where; |
|
139 | - } else { |
|
140 | - $where = array($select => $where); |
|
141 | - } |
|
142 | - $field_name = $this->CI->db_model->countQuery($select, $table, $where); |
|
143 | - if (isset($field_name) && !empty($field_name)) { |
|
144 | - return $field_name; |
|
145 | - } else { |
|
146 | - return "0"; |
|
147 | - } |
|
148 | - } |
|
149 | - |
|
150 | - function get_field_name($select, $table, $where) { |
|
151 | - if (is_array($where)) { |
|
152 | - $where = $where; |
|
153 | - } else { |
|
154 | - $where = array("id" => $where); |
|
155 | - } |
|
156 | - $field_name = $this->CI->db_model->getSelect($select, $table, $where); |
|
157 | - $field_name = $field_name->result(); |
|
158 | - if (isset($field_name) && !empty($field_name)) { |
|
159 | - return $field_name[0]->$select; |
|
160 | - } else { |
|
161 | - return ""; |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - function get_field_name_coma_new($select, $table, $where) { |
|
166 | - $value = ''; |
|
167 | - if (is_array($where)) { |
|
168 | - $where = $where; |
|
169 | - } else { |
|
170 | - $where = explode(',', $where); |
|
171 | - } |
|
172 | - $select1 = explode(',', $select); |
|
173 | - for ($i = 0; $i < count($where); $i++) { |
|
174 | - $where_in = array("id" => $where[$i]); |
|
175 | - |
|
176 | - $field_name = $this->CI->db_model->getSelect($select, $table, $where_in); |
|
177 | - $field_name = $field_name->result(); |
|
178 | - if (isset($field_name) && !empty($field_name)) { |
|
179 | - foreach ($select1 as $sel) { |
|
180 | - if ($sel == 'number') { |
|
181 | - $value.="(" . $field_name[0]->$sel . ")"; |
|
182 | - } else { |
|
183 | - $value.= $field_name[0]->$sel . " "; |
|
184 | - } |
|
185 | - } |
|
186 | - } else { |
|
187 | - $value = ""; |
|
188 | - } |
|
189 | - } |
|
190 | - return rtrim($value, ','); |
|
191 | - } |
|
192 | - |
|
193 | - function check_did_avl($select, $table, $where) { |
|
194 | - $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
195 | - $flag_status = ""; |
|
196 | - $where = array("number" => $where); |
|
197 | - $field_name = $this->CI->db_model->getSelect("id,accountid,parent_id", 'dids', $where); |
|
198 | - $field_name = $field_name->result(); |
|
199 | - if (isset($field_name) && !empty($field_name)) { |
|
200 | - if (isset($field_name[0]) && $accountinfo['type'] != 1) { |
|
201 | - if ($field_name[0]->accountid != 0 && $field_name[0]->parent_id ==0) { |
|
202 | - $flag_status = "<a href='../did_list_release/" . $field_name[0]->id . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(C)<span></a>"; |
|
203 | - } else if ($field_name[0]->parent_id != 0) { |
|
204 | - $flag_status = "<a href='../did_list_release/" . $field_name[0]->id . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
|
205 | - } else { |
|
206 | - $flag_status = "<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
207 | - } |
|
208 | - } else { |
|
209 | - $reseller_id = $accountinfo['type'] != 1 ? 0 : $accountinfo['id']; |
|
210 | - $where = array("note" => $field_name[0]->number, 'parent_id' => $reseller_id); |
|
211 | - $field_name_re = $this->CI->db_model->getSelect("reseller_id", 'reseller_pricing', $where); |
|
212 | - $field_name_re = $field_name_re->result(); |
|
213 | - |
|
214 | - if (isset($field_name_re) && !empty($field_name_re)) { |
|
215 | - $flag_status = "<a href='../did_list_release/" . $field_name[0]->id . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
|
216 | - } else { |
|
217 | - $flag_status = "<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
218 | - } |
|
219 | - } |
|
220 | - } else { |
|
221 | - $flag_status = "<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
222 | - } |
|
223 | - return $flag_status; |
|
224 | - } |
|
225 | - function check_did_avl_export($number){ |
|
226 | - $this->CI->db->where('number',$number); |
|
227 | - $this->CI->db->select('id,accountid,parent_id'); |
|
228 | - $status=null; |
|
229 | - $did_info=(array)$this->CI->db->get('dids')->first_row(); |
|
230 | - $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
231 | - if($did_info['accountid'] ==0 && $did_info['parent_id']==0){ |
|
137 | + if (is_array($where)) { |
|
138 | + $where = $where; |
|
139 | + } else { |
|
140 | + $where = array($select => $where); |
|
141 | + } |
|
142 | + $field_name = $this->CI->db_model->countQuery($select, $table, $where); |
|
143 | + if (isset($field_name) && !empty($field_name)) { |
|
144 | + return $field_name; |
|
145 | + } else { |
|
146 | + return "0"; |
|
147 | + } |
|
148 | + } |
|
149 | + |
|
150 | + function get_field_name($select, $table, $where) { |
|
151 | + if (is_array($where)) { |
|
152 | + $where = $where; |
|
153 | + } else { |
|
154 | + $where = array("id" => $where); |
|
155 | + } |
|
156 | + $field_name = $this->CI->db_model->getSelect($select, $table, $where); |
|
157 | + $field_name = $field_name->result(); |
|
158 | + if (isset($field_name) && !empty($field_name)) { |
|
159 | + return $field_name[0]->$select; |
|
160 | + } else { |
|
161 | + return ""; |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + function get_field_name_coma_new($select, $table, $where) { |
|
166 | + $value = ''; |
|
167 | + if (is_array($where)) { |
|
168 | + $where = $where; |
|
169 | + } else { |
|
170 | + $where = explode(',', $where); |
|
171 | + } |
|
172 | + $select1 = explode(',', $select); |
|
173 | + for ($i = 0; $i < count($where); $i++) { |
|
174 | + $where_in = array("id" => $where[$i]); |
|
175 | + |
|
176 | + $field_name = $this->CI->db_model->getSelect($select, $table, $where_in); |
|
177 | + $field_name = $field_name->result(); |
|
178 | + if (isset($field_name) && !empty($field_name)) { |
|
179 | + foreach ($select1 as $sel) { |
|
180 | + if ($sel == 'number') { |
|
181 | + $value.="(" . $field_name[0]->$sel . ")"; |
|
182 | + } else { |
|
183 | + $value.= $field_name[0]->$sel . " "; |
|
184 | + } |
|
185 | + } |
|
186 | + } else { |
|
187 | + $value = ""; |
|
188 | + } |
|
189 | + } |
|
190 | + return rtrim($value, ','); |
|
191 | + } |
|
192 | + |
|
193 | + function check_did_avl($select, $table, $where) { |
|
194 | + $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
195 | + $flag_status = ""; |
|
196 | + $where = array("number" => $where); |
|
197 | + $field_name = $this->CI->db_model->getSelect("id,accountid,parent_id", 'dids', $where); |
|
198 | + $field_name = $field_name->result(); |
|
199 | + if (isset($field_name) && !empty($field_name)) { |
|
200 | + if (isset($field_name[0]) && $accountinfo['type'] != 1) { |
|
201 | + if ($field_name[0]->accountid != 0 && $field_name[0]->parent_id ==0) { |
|
202 | + $flag_status = "<a href='../did_list_release/" . $field_name[0]->id . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(C)<span></a>"; |
|
203 | + } else if ($field_name[0]->parent_id != 0) { |
|
204 | + $flag_status = "<a href='../did_list_release/" . $field_name[0]->id . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
|
205 | + } else { |
|
206 | + $flag_status = "<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
207 | + } |
|
208 | + } else { |
|
209 | + $reseller_id = $accountinfo['type'] != 1 ? 0 : $accountinfo['id']; |
|
210 | + $where = array("note" => $field_name[0]->number, 'parent_id' => $reseller_id); |
|
211 | + $field_name_re = $this->CI->db_model->getSelect("reseller_id", 'reseller_pricing', $where); |
|
212 | + $field_name_re = $field_name_re->result(); |
|
213 | + |
|
214 | + if (isset($field_name_re) && !empty($field_name_re)) { |
|
215 | + $flag_status = "<a href='../did_list_release/" . $field_name[0]->id . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
|
216 | + } else { |
|
217 | + $flag_status = "<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
218 | + } |
|
219 | + } |
|
220 | + } else { |
|
221 | + $flag_status = "<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
222 | + } |
|
223 | + return $flag_status; |
|
224 | + } |
|
225 | + function check_did_avl_export($number){ |
|
226 | + $this->CI->db->where('number',$number); |
|
227 | + $this->CI->db->select('id,accountid,parent_id'); |
|
228 | + $status=null; |
|
229 | + $did_info=(array)$this->CI->db->get('dids')->first_row(); |
|
230 | + $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
231 | + if($did_info['accountid'] ==0 && $did_info['parent_id']==0){ |
|
232 | 232 | $status='Not in use'; |
233 | - } |
|
234 | - elseif($accountinfo['type'] !=1){ |
|
233 | + } |
|
234 | + elseif($accountinfo['type'] !=1){ |
|
235 | 235 | if($did_info['accountid'] ==0 && $did_info['parent_id'] > 0){ |
236 | 236 | $status='Purchase by Reseller'; |
237 | 237 | } |
238 | 238 | if($did_info['accountid'] > 0 && $did_info['parent_id'] == 0){ |
239 | 239 | $status='Purchase by Customer'; |
240 | 240 | } |
241 | - }else{ |
|
242 | - $where_arr=array('note'=>$did_info['number'],"parent_id"=>$accountinfo['id']); |
|
243 | - $this->db->where($where); |
|
244 | - $this->CI->db->select('reseller_id,parent_id'); |
|
245 | - $reseller_pricing = (array)$this->db->get('reseller_pricing')->first_row(); |
|
246 | - if($reseller_pricing['reseller_id']==0 && $did_info['accountid']==0 && $did_info['parent_id']==$accountinfo['id']){ |
|
247 | - $status='Not in use'; |
|
248 | - } |
|
249 | - if($reseller_pricing['reseller_id']==0 && $did_info['accountid']==0){ |
|
250 | - $status='Not in use'; |
|
251 | - } |
|
252 | - } |
|
253 | - return $status; |
|
241 | + }else{ |
|
242 | + $where_arr=array('note'=>$did_info['number'],"parent_id"=>$accountinfo['id']); |
|
243 | + $this->db->where($where); |
|
244 | + $this->CI->db->select('reseller_id,parent_id'); |
|
245 | + $reseller_pricing = (array)$this->db->get('reseller_pricing')->first_row(); |
|
246 | + if($reseller_pricing['reseller_id']==0 && $did_info['accountid']==0 && $did_info['parent_id']==$accountinfo['id']){ |
|
247 | + $status='Not in use'; |
|
248 | + } |
|
249 | + if($reseller_pricing['reseller_id']==0 && $did_info['accountid']==0){ |
|
250 | + $status='Not in use'; |
|
251 | + } |
|
252 | + } |
|
253 | + return $status; |
|
254 | 254 | |
255 | - } |
|
256 | - function check_did_avl_reseller($select, $table, $where) { |
|
257 | - $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
258 | - $flag_status = "<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
259 | - $this->CI->db->where('number',$where); |
|
260 | - $this->CI->db->select('id,accountid,parent_id,number'); |
|
261 | - $did_info=(array)$this->CI->db->get('dids')->first_row(); |
|
262 | - if($did_info['accountid'] > 0 && $did_info['parent_id'] == $accountinfo['id']){ |
|
263 | - $flag_status = "<a href='../did_list_release/" . $did_info['id'] . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(C)<span></a>"; |
|
264 | - } |
|
265 | - else if($accountinfo['type']!=1 && $did_info['parent_id'] != $accountinfo['id']){ |
|
266 | - $flag_status = "<a href='../did_list_release/" . $did_info['id'] . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
|
267 | - }else{ |
|
268 | - $reseller_id= $accountinfo['type'] != 1 ? 0 : $accountinfo['id']; |
|
269 | - $where = array("note" => $did_info['number'],'parent_id'=>$reseller_id); |
|
270 | - $this->CI->db->where($where); |
|
271 | - $this->CI->db->select('reseller_id,id'); |
|
272 | - $reseller_pricing_info=(array)$this->CI->db->get('reseller_pricing')->first_row(); |
|
273 | - if (isset($reseller_pricing_info) && !empty($reseller_pricing_info)) { |
|
255 | + } |
|
256 | + function check_did_avl_reseller($select, $table, $where) { |
|
257 | + $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
258 | + $flag_status = "<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
259 | + $this->CI->db->where('number',$where); |
|
260 | + $this->CI->db->select('id,accountid,parent_id,number'); |
|
261 | + $did_info=(array)$this->CI->db->get('dids')->first_row(); |
|
262 | + if($did_info['accountid'] > 0 && $did_info['parent_id'] == $accountinfo['id']){ |
|
263 | + $flag_status = "<a href='../did_list_release/" . $did_info['id'] . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(C)<span></a>"; |
|
264 | + } |
|
265 | + else if($accountinfo['type']!=1 && $did_info['parent_id'] != $accountinfo['id']){ |
|
266 | + $flag_status = "<a href='../did_list_release/" . $did_info['id'] . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
|
267 | + }else{ |
|
268 | + $reseller_id= $accountinfo['type'] != 1 ? 0 : $accountinfo['id']; |
|
269 | + $where = array("note" => $did_info['number'],'parent_id'=>$reseller_id); |
|
270 | + $this->CI->db->where($where); |
|
271 | + $this->CI->db->select('reseller_id,id'); |
|
272 | + $reseller_pricing_info=(array)$this->CI->db->get('reseller_pricing')->first_row(); |
|
273 | + if (isset($reseller_pricing_info) && !empty($reseller_pricing_info)) { |
|
274 | 274 | $flag_status="<a href='../did/did_reseller_edit/delete/".$reseller_pricing_info['id']."' title='Reliase' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
275 | - }else{ |
|
276 | - $flag_status="<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
277 | - } |
|
278 | - } |
|
279 | - return $flag_status; |
|
280 | - } |
|
275 | + }else{ |
|
276 | + $flag_status="<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
|
277 | + } |
|
278 | + } |
|
279 | + return $flag_status; |
|
280 | + } |
|
281 | 281 | |
282 | 282 | // get data for Comma seprated |
283 | - function get_field_name_coma($select, $table, $where) { |
|
284 | - $value = ''; |
|
285 | - if (is_array($where)) { |
|
286 | - $where = $where; |
|
287 | - } else { |
|
288 | - $where = explode(',', $where); |
|
289 | - } |
|
290 | - for ($i = 0; $i < count($where); $i++) { |
|
291 | - $where_in = array("id" => $where[$i]); |
|
292 | - |
|
293 | - $field_name = $this->CI->db_model->getSelect($select, $table, $where_in); |
|
294 | - $field_name = $field_name->result(); |
|
295 | - if (isset($field_name) && !empty($field_name)) { |
|
296 | - $value.= $field_name[0]->$select . ","; |
|
297 | - } else { |
|
298 | - $value = ""; |
|
299 | - } |
|
300 | - } |
|
301 | - return rtrim($value, ','); |
|
302 | - } |
|
303 | - |
|
304 | - function set_invoice_option($select = "", $table = "", $call_type = "", $edit_value = '') { |
|
305 | - |
|
306 | - $invoice_date = false; |
|
307 | - $uri_segment = $this->CI->uri->segments; |
|
308 | - if (isset($uri_segment[3]) && $uri_segment[3] > 0 && empty($edit_value)) { |
|
309 | - $field_name = $this->CI->db_model->getSelect("sweep_id,invoice_day", "accounts", array("id" => $uri_segment[3])); |
|
310 | - $field_name = $field_name->result_array(); |
|
311 | - $select = $field_name[0]["sweep_id"]; |
|
312 | - $invoice_date = $field_name[0]["invoice_day"]; |
|
313 | - } else { |
|
314 | - $invoice_date = $edit_value; |
|
315 | - } |
|
316 | - if ($select == "" || $select == "0") { |
|
317 | - $daily_arr = array("0" => "0"); |
|
318 | - return $daily_arr; |
|
319 | - } |
|
320 | - if ($select == 1) { |
|
321 | - $week_arr = array("1" => "Monday", "2" => "Tuesday", "3" => "Wednesday", "4" => "Thursday", "5" => "Friday", |
|
322 | - "6" => "Saturday", "7" => "Sunday"); |
|
323 | - $rawDate = date("Y-m-d"); |
|
324 | - $day = date('N', strtotime($rawDate)); |
|
325 | - if (isset($uri_segment[3])) { |
|
326 | - return $week_arr; |
|
327 | - } else { |
|
328 | - $week_drp = form_dropdown(array("name" => 'invoice_day','style'=>"width: 100% !important;" , "class" => "invoice_day"), $week_arr, $day); |
|
329 | - return $week_drp; |
|
330 | - } |
|
331 | - } |
|
332 | - if ($select != 0 && $select != 1) { |
|
333 | - for ($i = 1; $i < 29; $i++) { |
|
334 | - $mon_arr[$i] = $i; |
|
335 | - } |
|
336 | - if (isset($uri_segment[3]) && $uri_segment[3] > 0 && empty($edit_value)) { |
|
337 | - return $mon_arr; |
|
338 | - } else { |
|
339 | - $day = $invoice_date > 0 ? $invoice_date : date('d'); |
|
340 | - $month_drp = form_dropdown(array("name" => 'invoice_day',"class" => "width_dropdown invoice_day"), $mon_arr, $day); |
|
341 | - return $month_drp; |
|
342 | - } |
|
343 | - } |
|
344 | - } |
|
345 | - |
|
346 | - function set_status($status = '') { |
|
347 | - $status_array = array('0' => 'Active', '1' => 'Inactive',); |
|
348 | - return $status_array; |
|
349 | - } |
|
350 | - |
|
351 | - function set_routetype($status = '') { |
|
352 | - $status_array = array( '0' => 'LCR','1' => 'COST',); |
|
353 | - return $status_array; |
|
354 | - } |
|
355 | - |
|
356 | - function set_prorate($status = '') { |
|
357 | - $status_array = array('0' => 'Yes', '1' => 'No',); |
|
358 | - return $status_array; |
|
359 | - } |
|
360 | - /* |
|
283 | + function get_field_name_coma($select, $table, $where) { |
|
284 | + $value = ''; |
|
285 | + if (is_array($where)) { |
|
286 | + $where = $where; |
|
287 | + } else { |
|
288 | + $where = explode(',', $where); |
|
289 | + } |
|
290 | + for ($i = 0; $i < count($where); $i++) { |
|
291 | + $where_in = array("id" => $where[$i]); |
|
292 | + |
|
293 | + $field_name = $this->CI->db_model->getSelect($select, $table, $where_in); |
|
294 | + $field_name = $field_name->result(); |
|
295 | + if (isset($field_name) && !empty($field_name)) { |
|
296 | + $value.= $field_name[0]->$select . ","; |
|
297 | + } else { |
|
298 | + $value = ""; |
|
299 | + } |
|
300 | + } |
|
301 | + return rtrim($value, ','); |
|
302 | + } |
|
303 | + |
|
304 | + function set_invoice_option($select = "", $table = "", $call_type = "", $edit_value = '') { |
|
305 | + |
|
306 | + $invoice_date = false; |
|
307 | + $uri_segment = $this->CI->uri->segments; |
|
308 | + if (isset($uri_segment[3]) && $uri_segment[3] > 0 && empty($edit_value)) { |
|
309 | + $field_name = $this->CI->db_model->getSelect("sweep_id,invoice_day", "accounts", array("id" => $uri_segment[3])); |
|
310 | + $field_name = $field_name->result_array(); |
|
311 | + $select = $field_name[0]["sweep_id"]; |
|
312 | + $invoice_date = $field_name[0]["invoice_day"]; |
|
313 | + } else { |
|
314 | + $invoice_date = $edit_value; |
|
315 | + } |
|
316 | + if ($select == "" || $select == "0") { |
|
317 | + $daily_arr = array("0" => "0"); |
|
318 | + return $daily_arr; |
|
319 | + } |
|
320 | + if ($select == 1) { |
|
321 | + $week_arr = array("1" => "Monday", "2" => "Tuesday", "3" => "Wednesday", "4" => "Thursday", "5" => "Friday", |
|
322 | + "6" => "Saturday", "7" => "Sunday"); |
|
323 | + $rawDate = date("Y-m-d"); |
|
324 | + $day = date('N', strtotime($rawDate)); |
|
325 | + if (isset($uri_segment[3])) { |
|
326 | + return $week_arr; |
|
327 | + } else { |
|
328 | + $week_drp = form_dropdown(array("name" => 'invoice_day','style'=>"width: 100% !important;" , "class" => "invoice_day"), $week_arr, $day); |
|
329 | + return $week_drp; |
|
330 | + } |
|
331 | + } |
|
332 | + if ($select != 0 && $select != 1) { |
|
333 | + for ($i = 1; $i < 29; $i++) { |
|
334 | + $mon_arr[$i] = $i; |
|
335 | + } |
|
336 | + if (isset($uri_segment[3]) && $uri_segment[3] > 0 && empty($edit_value)) { |
|
337 | + return $mon_arr; |
|
338 | + } else { |
|
339 | + $day = $invoice_date > 0 ? $invoice_date : date('d'); |
|
340 | + $month_drp = form_dropdown(array("name" => 'invoice_day',"class" => "width_dropdown invoice_day"), $mon_arr, $day); |
|
341 | + return $month_drp; |
|
342 | + } |
|
343 | + } |
|
344 | + } |
|
345 | + |
|
346 | + function set_status($status = '') { |
|
347 | + $status_array = array('0' => 'Active', '1' => 'Inactive',); |
|
348 | + return $status_array; |
|
349 | + } |
|
350 | + |
|
351 | + function set_routetype($status = '') { |
|
352 | + $status_array = array( '0' => 'LCR','1' => 'COST',); |
|
353 | + return $status_array; |
|
354 | + } |
|
355 | + |
|
356 | + function set_prorate($status = '') { |
|
357 | + $status_array = array('0' => 'Yes', '1' => 'No',); |
|
358 | + return $status_array; |
|
359 | + } |
|
360 | + /* |
|
361 | 361 | Add For Package Inbound or Outbound or both? |
362 | 362 | */ |
363 | - function set_package_type($applicable_for = "") { |
|
364 | - $package_applicable = array('0' => 'Outbound', '1' => 'Inbound', '2' => 'Both'); |
|
365 | - return $package_applicable; |
|
366 | - } |
|
367 | - |
|
368 | - function get_package_type($status = '', $table = "", $applicable_for) { |
|
369 | - $package_applicable = array('0' => 'Outbound', '1' => 'Inbound', '2' => 'Both'); |
|
370 | - return $package_applicable[$applicable_for]; |
|
371 | - } |
|
372 | - /******************************************** */ |
|
373 | - function set_allow($status = '') { |
|
374 | - $status_array = array('1' => 'Yes', '0' => 'No'); |
|
375 | - return $status_array; |
|
376 | - } |
|
377 | - function set_allow_invoice($status = '') { |
|
378 | - $status_array = array('1' => 'Yes', '0' => 'No'); |
|
379 | - return $status_array; |
|
380 | - } |
|
381 | - function set_pin_allow($status=''){ |
|
382 | - $status_array = array('0' => 'Disable','1' => 'Enable'); |
|
383 | - return $status_array; |
|
384 | - } |
|
385 | - function set_pin_allow_customer($status=''){ |
|
386 | - $status_array = array('0' => 'No','1' => 'Yes'); |
|
387 | - return $status_array; |
|
388 | - } |
|
389 | - function get_allow($select = "", $table = "", $status) { |
|
390 | - return ($status == 1) ? "Yes" : "No"; |
|
391 | - } |
|
392 | - |
|
393 | - function set_call_type($call_type = "") { |
|
394 | - $call_type_array = array("-1" => "--Select--",'1' => 'DID-Local',"3"=>"SIP-DID", '0' => 'PSTN', '2' => 'Other',); |
|
395 | - return $call_type_array; |
|
396 | - } |
|
397 | - function set_call_type_search(){ |
|
363 | + function set_package_type($applicable_for = "") { |
|
364 | + $package_applicable = array('0' => 'Outbound', '1' => 'Inbound', '2' => 'Both'); |
|
365 | + return $package_applicable; |
|
366 | + } |
|
367 | + |
|
368 | + function get_package_type($status = '', $table = "", $applicable_for) { |
|
369 | + $package_applicable = array('0' => 'Outbound', '1' => 'Inbound', '2' => 'Both'); |
|
370 | + return $package_applicable[$applicable_for]; |
|
371 | + } |
|
372 | + /******************************************** */ |
|
373 | + function set_allow($status = '') { |
|
374 | + $status_array = array('1' => 'Yes', '0' => 'No'); |
|
375 | + return $status_array; |
|
376 | + } |
|
377 | + function set_allow_invoice($status = '') { |
|
378 | + $status_array = array('1' => 'Yes', '0' => 'No'); |
|
379 | + return $status_array; |
|
380 | + } |
|
381 | + function set_pin_allow($status=''){ |
|
382 | + $status_array = array('0' => 'Disable','1' => 'Enable'); |
|
383 | + return $status_array; |
|
384 | + } |
|
385 | + function set_pin_allow_customer($status=''){ |
|
386 | + $status_array = array('0' => 'No','1' => 'Yes'); |
|
387 | + return $status_array; |
|
388 | + } |
|
389 | + function get_allow($select = "", $table = "", $status) { |
|
390 | + return ($status == 1) ? "Yes" : "No"; |
|
391 | + } |
|
392 | + |
|
393 | + function set_call_type($call_type = "") { |
|
394 | + $call_type_array = array("-1" => "--Select--",'1' => 'DID-Local',"3"=>"SIP-DID", '0' => 'PSTN', '2' => 'Other',); |
|
395 | + return $call_type_array; |
|
396 | + } |
|
397 | + function set_call_type_search(){ |
|
398 | 398 | $call_type_array = array("" => "--Select--",'1' => 'DID-Local',"3"=>"SIP-DID", '0' => 'PSTN', '2' => 'Other',); |
399 | - return $call_type_array; |
|
400 | - } |
|
401 | - function get_call_type($select = "", $table = "", $call_type) { |
|
402 | - $call_type_array = array('1' => 'DID-Local',"3"=>"SIP-DID",'0' => 'PSTN', '2' => 'Other','-1'=>""); |
|
403 | - return $call_type_array[$call_type]; |
|
404 | - } |
|
405 | - |
|
406 | - function get_custom_call_type($call_type) { |
|
407 | - $call_type_array = array('DID-Local' => '1',"SIP-DID"=>"3",'PSTN' => '0','Other' => '2',""=>"-1"); |
|
408 | - return $call_type_array[$call_type]; |
|
409 | - } |
|
410 | - |
|
411 | - function set_sip_config_option($option = "") { |
|
412 | - $config_option = array("true" => "True", "false" => "False"); |
|
413 | - return $config_option; |
|
414 | - } |
|
415 | - |
|
416 | - function get_entity_type($select = "", $table = "", $entity_type) { |
|
417 | - $entity_array = array('-1' => "Administrator", '0' => 'Customer', '1' => 'Reseller', '2' => 'Admin', '3' => "Provider", "4" => "Subadmin", "5" => "Callshop"); |
|
418 | - return($entity_array[$entity_type]); |
|
419 | - } |
|
420 | - |
|
421 | - function set_entity_type_customer($entity_type = "") { |
|
422 | - $entity_array = array('' => "--Select--", '0' => 'Customer', '3' => "Provider"); |
|
423 | - return $entity_array; |
|
424 | - } |
|
425 | - |
|
426 | - function set_entity_type_admin($entity_type = "") { |
|
427 | - $entity_array = array('' => "--Select--", '2' => 'Admin', "4" => "Sub Admin"); |
|
428 | - return $entity_array; |
|
429 | - } |
|
399 | + return $call_type_array; |
|
400 | + } |
|
401 | + function get_call_type($select = "", $table = "", $call_type) { |
|
402 | + $call_type_array = array('1' => 'DID-Local',"3"=>"SIP-DID",'0' => 'PSTN', '2' => 'Other','-1'=>""); |
|
403 | + return $call_type_array[$call_type]; |
|
404 | + } |
|
405 | + |
|
406 | + function get_custom_call_type($call_type) { |
|
407 | + $call_type_array = array('DID-Local' => '1',"SIP-DID"=>"3",'PSTN' => '0','Other' => '2',""=>"-1"); |
|
408 | + return $call_type_array[$call_type]; |
|
409 | + } |
|
410 | + |
|
411 | + function set_sip_config_option($option = "") { |
|
412 | + $config_option = array("true" => "True", "false" => "False"); |
|
413 | + return $config_option; |
|
414 | + } |
|
415 | + |
|
416 | + function get_entity_type($select = "", $table = "", $entity_type) { |
|
417 | + $entity_array = array('-1' => "Administrator", '0' => 'Customer', '1' => 'Reseller', '2' => 'Admin', '3' => "Provider", "4" => "Subadmin", "5" => "Callshop"); |
|
418 | + return($entity_array[$entity_type]); |
|
419 | + } |
|
420 | + |
|
421 | + function set_entity_type_customer($entity_type = "") { |
|
422 | + $entity_array = array('' => "--Select--", '0' => 'Customer', '3' => "Provider"); |
|
423 | + return $entity_array; |
|
424 | + } |
|
425 | + |
|
426 | + function set_entity_type_admin($entity_type = "") { |
|
427 | + $entity_array = array('' => "--Select--", '2' => 'Admin', "4" => "Sub Admin"); |
|
428 | + return $entity_array; |
|
429 | + } |
|
430 | 430 | |
431 | 431 | function set_entity_type_email_mass($entity_type = "") { |
432 | - $entity_array = array('' => "--Select--", '0' => 'Customer','1'=>'Reseller','3' => "Provider"); |
|
433 | - return $entity_array; |
|
434 | - } |
|
435 | - |
|
436 | - function set_sip_config_options($option = "") { |
|
437 | - $config_option = array("false" => "False", "true" => "True"); |
|
438 | - return $config_option; |
|
439 | - } |
|
440 | - |
|
441 | - function set_sip_config_default($option = "") { |
|
442 | - $config_option = array("" => "--SELECT--", "false" => "False", "true" => "True"); |
|
443 | - return $config_option; |
|
444 | - } |
|
445 | - |
|
446 | - function set_sip_bind_params($option = "") { |
|
447 | - $config_option = array("" => "--SELECT--", "udp" => "UDP", "tcp" => "TCP"); |
|
448 | - return $config_option; |
|
449 | - } |
|
450 | - |
|
451 | - function set_sip_vad_option() { |
|
452 | - $config_option = array("in" => "In", "out" => "Out", "both" => "Both"); |
|
453 | - return $config_option; |
|
454 | - } |
|
455 | - |
|
456 | - function set_sip_drp_option($option = "") { |
|
457 | - $status_array = array('no' => 'No', 'yes' => 'Yes'); |
|
458 | - return $status_array; |
|
459 | - } |
|
460 | - |
|
461 | - function set_status_callingcard($status = '') { |
|
462 | - $status_array = array('1' => 'Active', '0' => 'Inactive', '2' => 'Deleted'); |
|
463 | - return $status_array; |
|
464 | - } |
|
432 | + $entity_array = array('' => "--Select--", '0' => 'Customer','1'=>'Reseller','3' => "Provider"); |
|
433 | + return $entity_array; |
|
434 | + } |
|
435 | + |
|
436 | + function set_sip_config_options($option = "") { |
|
437 | + $config_option = array("false" => "False", "true" => "True"); |
|
438 | + return $config_option; |
|
439 | + } |
|
440 | + |
|
441 | + function set_sip_config_default($option = "") { |
|
442 | + $config_option = array("" => "--SELECT--", "false" => "False", "true" => "True"); |
|
443 | + return $config_option; |
|
444 | + } |
|
445 | + |
|
446 | + function set_sip_bind_params($option = "") { |
|
447 | + $config_option = array("" => "--SELECT--", "udp" => "UDP", "tcp" => "TCP"); |
|
448 | + return $config_option; |
|
449 | + } |
|
450 | + |
|
451 | + function set_sip_vad_option() { |
|
452 | + $config_option = array("in" => "In", "out" => "Out", "both" => "Both"); |
|
453 | + return $config_option; |
|
454 | + } |
|
455 | + |
|
456 | + function set_sip_drp_option($option = "") { |
|
457 | + $status_array = array('no' => 'No', 'yes' => 'Yes'); |
|
458 | + return $status_array; |
|
459 | + } |
|
460 | + |
|
461 | + function set_status_callingcard($status = '') { |
|
462 | + $status_array = array('1' => 'Active', '0' => 'Inactive', '2' => 'Deleted'); |
|
463 | + return $status_array; |
|
464 | + } |
|
465 | 465 | /* |
466 | 466 | show status on all grid |
467 | 467 | */ |
468 | 468 | function get_status($select = "", $table = "", $status) { |
469 | - if($select !='export'){ |
|
470 | - $status_tab=$this->encode($table); |
|
471 | - $status['table']="'".$status_tab."'"; |
|
472 | - if($status['status'] == 0){ |
|
469 | + if($select !='export'){ |
|
470 | + $status_tab=$this->encode($table); |
|
471 | + $status['table']="'".$status_tab."'"; |
|
472 | + if($status['status'] == 0){ |
|
473 | 473 | $status_array = '<div style="width: 100%; text-align: -moz-center; padding: 0;"><input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id=switch'.$status['id'].' value='.$status['status'].' onclick="javascript:processForm('.$status['id'].','.$status['table'].')" checked> |
474 | 474 | <label class="onoffswitch-label" for=switch'.$status["id"].'> |
475 | 475 | <span class="onoffswitch-inner"></span> |
@@ -484,246 +484,246 @@ discard block |
||
484 | 484 | return ($status == 0) ? "Active" : "Inactive"; |
485 | 485 | } |
486 | 486 | return $status_array; |
487 | - } |
|
487 | + } |
|
488 | 488 | |
489 | - function get_routetype($select = "", $table = "", $status) { |
|
490 | - return ($status == 0) ? "LCR" : "COST"; |
|
491 | - } |
|
489 | + function get_routetype($select = "", $table = "", $status) { |
|
490 | + return ($status == 0) ? "LCR" : "COST"; |
|
491 | + } |
|
492 | 492 | |
493 | 493 | function get_prorate($select = "", $table = "", $status) { |
494 | - return ($status == 0) ? "Yes" : "No"; |
|
495 | - } |
|
494 | + return ($status == 0) ? "Yes" : "No"; |
|
495 | + } |
|
496 | 496 | |
497 | - function get_import_status($status){ |
|
498 | - return strtolower(trim($status)) == 'active' ? 0 : 1; |
|
497 | + function get_import_status($status){ |
|
498 | + return strtolower(trim($status)) == 'active' ? 0 : 1; |
|
499 | 499 | |
500 | - } |
|
501 | - function get_did_status($select,$table,$status){ |
|
500 | + } |
|
501 | + function get_did_status($select,$table,$status){ |
|
502 | 502 | |
503 | - return ($status['status']==0) ? "<span class='label label-sm label-inverse arrowed-in' title='release'>Active<span>" : "<span class='label label-sm' title='release'>Inactive<span>"; |
|
504 | - } |
|
503 | + return ($status['status']==0) ? "<span class='label label-sm label-inverse arrowed-in' title='release'>Active<span>" : "<span class='label label-sm' title='release'>Inactive<span>"; |
|
504 | + } |
|
505 | 505 | |
506 | 506 | |
507 | - function get_invoice_date($select, $accountid = 0, $reseller_id, $order_by = 'id') { |
|
508 | - $where = array("reseller_id" => $reseller_id); |
|
509 | - if ($accountid > 0) { |
|
510 | - $where['accountid'] = $accountid; |
|
511 | - } |
|
512 | - $invoice_res = $this->CI->db_model->select($select, "invoices", $where, $order_by, "DESC", "1", "0"); |
|
513 | - if ($invoice_res->num_rows > 0) { |
|
514 | - $invoice_info = (array) $invoice_res->first_row(); |
|
515 | - return $invoice_info[$select]; |
|
516 | - } |
|
517 | - return false; |
|
518 | - } |
|
519 | - |
|
520 | - function convert_to_date($select = '', $table = '', $from_date) { |
|
521 | - |
|
522 | - $from_date = date('Y-m-d', strtotime($from_date)); |
|
523 | - return $from_date; |
|
524 | - } |
|
525 | - |
|
526 | - |
|
527 | - function get_account_balance($select = "", $table = "", $amount) { |
|
528 | - $this->CI->load->model('common_model'); |
|
529 | - if ($amount == 0) { |
|
530 | - return $amount; |
|
531 | - } else { |
|
532 | - $balance = $this->CI->common_model->add_calculate_currency(($amount), "", '', true, true); |
|
533 | - |
|
534 | - return $balance; |
|
535 | - } |
|
536 | - } |
|
537 | - |
|
538 | - function convert_to_currency($select = "", $table = "", $amount) { |
|
539 | - $this->CI->load->model('common_model'); |
|
540 | - return $this->CI->common_model->calculate_currency($amount,'','',true,false); |
|
541 | - } |
|
542 | - function account_number_icon($select = "", $table = "", $number){ |
|
543 | - $return_value=''; |
|
544 | - $where=array('number'=>$number); |
|
545 | - $account_res = (array)$this->CI->db->get_where("accounts",$where)->first_row(); |
|
546 | - if($account_res['type'] == 0){ |
|
547 | - $return_value= '<div class="flx_font flx_magenta" title="Customer">C</div>'." <span title='Edit'>". $account_res['number']." </span>"; |
|
548 | - } |
|
549 | - if($account_res['type']==3){ |
|
550 | - $return_value='<div class="flx_font flx_blue" title="Provider">P</div>'." <span title='Edit'>".$account_res['number']." </span>"; |
|
551 | - } |
|
552 | - if($account_res['type']== -1 || $account_res['type']==2){ |
|
553 | - $return_value='<div class="flx_font flx_pink" title="Admin">A</div>'." <span title='Edit'>".$account_res['number']." </span>"; |
|
554 | - } |
|
555 | - if($account_res['type']== 4){ |
|
556 | - $return_value='<div class="flx_font flx_purple" title="Subadmin">S</div>'." <span title='Edit'>".$account_res['number']." </span>"; |
|
557 | - } |
|
558 | - return $return_value; |
|
559 | - } |
|
560 | - function convert_to_currency_account($select = "", $table = "", $amount) { |
|
561 | - $this->CI->load->model('common_model'); |
|
562 | - return $this->CI->common_model->calculate_currency_customer($amount); |
|
563 | - } |
|
564 | - |
|
565 | - function get_paid_status($select = "", $table = "", $status) { |
|
566 | - return ($status == 1) ? "Paid" : "Unpaid"; |
|
567 | - } |
|
568 | - |
|
569 | - function set_account_type($status = '') { |
|
570 | - $status_array = array('0' => 'Prepaid', '1' => 'Postpaid'); |
|
571 | - return $status_array; |
|
572 | - } |
|
573 | - |
|
574 | - function set_account_type_search($status = '') { |
|
575 | - $status_array = array('' => "--Select--", '0' => 'Prepaid', '1' => 'Postpaid'); |
|
576 | - return $status_array; |
|
577 | - } |
|
578 | - |
|
579 | - function get_account_type($select = "", $table = "", $PTE) { |
|
580 | - return ($PTE == 1) ? "Postpaid" : "Prepaid"; |
|
581 | - } |
|
582 | - |
|
583 | - /****** |
|
507 | + function get_invoice_date($select, $accountid = 0, $reseller_id, $order_by = 'id') { |
|
508 | + $where = array("reseller_id" => $reseller_id); |
|
509 | + if ($accountid > 0) { |
|
510 | + $where['accountid'] = $accountid; |
|
511 | + } |
|
512 | + $invoice_res = $this->CI->db_model->select($select, "invoices", $where, $order_by, "DESC", "1", "0"); |
|
513 | + if ($invoice_res->num_rows > 0) { |
|
514 | + $invoice_info = (array) $invoice_res->first_row(); |
|
515 | + return $invoice_info[$select]; |
|
516 | + } |
|
517 | + return false; |
|
518 | + } |
|
519 | + |
|
520 | + function convert_to_date($select = '', $table = '', $from_date) { |
|
521 | + |
|
522 | + $from_date = date('Y-m-d', strtotime($from_date)); |
|
523 | + return $from_date; |
|
524 | + } |
|
525 | + |
|
526 | + |
|
527 | + function get_account_balance($select = "", $table = "", $amount) { |
|
528 | + $this->CI->load->model('common_model'); |
|
529 | + if ($amount == 0) { |
|
530 | + return $amount; |
|
531 | + } else { |
|
532 | + $balance = $this->CI->common_model->add_calculate_currency(($amount), "", '', true, true); |
|
533 | + |
|
534 | + return $balance; |
|
535 | + } |
|
536 | + } |
|
537 | + |
|
538 | + function convert_to_currency($select = "", $table = "", $amount) { |
|
539 | + $this->CI->load->model('common_model'); |
|
540 | + return $this->CI->common_model->calculate_currency($amount,'','',true,false); |
|
541 | + } |
|
542 | + function account_number_icon($select = "", $table = "", $number){ |
|
543 | + $return_value=''; |
|
544 | + $where=array('number'=>$number); |
|
545 | + $account_res = (array)$this->CI->db->get_where("accounts",$where)->first_row(); |
|
546 | + if($account_res['type'] == 0){ |
|
547 | + $return_value= '<div class="flx_font flx_magenta" title="Customer">C</div>'." <span title='Edit'>". $account_res['number']." </span>"; |
|
548 | + } |
|
549 | + if($account_res['type']==3){ |
|
550 | + $return_value='<div class="flx_font flx_blue" title="Provider">P</div>'." <span title='Edit'>".$account_res['number']." </span>"; |
|
551 | + } |
|
552 | + if($account_res['type']== -1 || $account_res['type']==2){ |
|
553 | + $return_value='<div class="flx_font flx_pink" title="Admin">A</div>'." <span title='Edit'>".$account_res['number']." </span>"; |
|
554 | + } |
|
555 | + if($account_res['type']== 4){ |
|
556 | + $return_value='<div class="flx_font flx_purple" title="Subadmin">S</div>'." <span title='Edit'>".$account_res['number']." </span>"; |
|
557 | + } |
|
558 | + return $return_value; |
|
559 | + } |
|
560 | + function convert_to_currency_account($select = "", $table = "", $amount) { |
|
561 | + $this->CI->load->model('common_model'); |
|
562 | + return $this->CI->common_model->calculate_currency_customer($amount); |
|
563 | + } |
|
564 | + |
|
565 | + function get_paid_status($select = "", $table = "", $status) { |
|
566 | + return ($status == 1) ? "Paid" : "Unpaid"; |
|
567 | + } |
|
568 | + |
|
569 | + function set_account_type($status = '') { |
|
570 | + $status_array = array('0' => 'Prepaid', '1' => 'Postpaid'); |
|
571 | + return $status_array; |
|
572 | + } |
|
573 | + |
|
574 | + function set_account_type_search($status = '') { |
|
575 | + $status_array = array('' => "--Select--", '0' => 'Prepaid', '1' => 'Postpaid'); |
|
576 | + return $status_array; |
|
577 | + } |
|
578 | + |
|
579 | + function get_account_type($select = "", $table = "", $PTE) { |
|
580 | + return ($PTE == 1) ? "Postpaid" : "Prepaid"; |
|
581 | + } |
|
582 | + |
|
583 | + /****** |
|
584 | 584 | Payment to refill |
585 | 585 | ******/ |
586 | 586 | |
587 | - function get_refill_by($select = "", $table = "", $type) { |
|
588 | - if ($type == '-1') { |
|
589 | - $type = "Admin"; |
|
590 | - } else { |
|
591 | - $type = $this->get_field_name("number", "accounts", array("id" => $type)); |
|
592 | - } |
|
593 | - return $type; |
|
594 | - } |
|
595 | - |
|
596 | - /******************* */ |
|
597 | - |
|
598 | - function get_payment_by($select = "", $table = "", $type) { |
|
599 | - if ($type == '-1') { |
|
600 | - $type = "Admin"; |
|
601 | - } else { |
|
602 | - $type = $this->get_field_name("number", "accounts", array("id" => $type)); |
|
603 | - } |
|
604 | - return $type; |
|
605 | - } |
|
606 | - |
|
607 | - function set_payment_type($payment_type = '') { |
|
608 | - /* |
|
587 | + function get_refill_by($select = "", $table = "", $type) { |
|
588 | + if ($type == '-1') { |
|
589 | + $type = "Admin"; |
|
590 | + } else { |
|
591 | + $type = $this->get_field_name("number", "accounts", array("id" => $type)); |
|
592 | + } |
|
593 | + return $type; |
|
594 | + } |
|
595 | + |
|
596 | + /******************* */ |
|
597 | + |
|
598 | + function get_payment_by($select = "", $table = "", $type) { |
|
599 | + if ($type == '-1') { |
|
600 | + $type = "Admin"; |
|
601 | + } else { |
|
602 | + $type = $this->get_field_name("number", "accounts", array("id" => $type)); |
|
603 | + } |
|
604 | + return $type; |
|
605 | + } |
|
606 | + |
|
607 | + function set_payment_type($payment_type = '') { |
|
608 | + /* |
|
609 | 609 | * Recharge to Refill |
610 | 610 | */ |
611 | - $status_array = array('0' => 'Refill', '1' => 'Postcharge',); |
|
612 | - return $status_array; |
|
613 | - } |
|
614 | - |
|
615 | - function search_int_type($status = '') { |
|
616 | - $status_array = array('1' => 'Is Equal To', '2' => 'Is Not Equal To', '3' => 'Greater Than', '4' => 'Less Than', '5' => 'Greater Or Equal Than', '6' => 'Less Or Equal Than'); |
|
617 | - return $status_array; |
|
618 | - } |
|
619 | - |
|
620 | - function update_int_type($status = '') { |
|
621 | - $status_array = array('1' => 'Preserve', '2' => 'Set To', '3' => 'Increase By', '4' => 'Decrease By'); |
|
622 | - return $status_array; |
|
623 | - } |
|
624 | - |
|
625 | - function update_drp_type($status = '') { |
|
626 | - $status_array = array('1' => 'Preserve', '2' => 'Set To'); |
|
627 | - return $status_array; |
|
628 | - } |
|
629 | - |
|
630 | - function search_string_type($status = '') { |
|
631 | - $status_array = array('5'=>"Begins With",'1' => 'Contains', '2' => 'Doesnt Contain', '3' => 'Is Equal To', '4' => 'Is Not Equal To',"6"=>"Ends With"); |
|
632 | - return $status_array; |
|
633 | - } |
|
634 | - |
|
635 | - function set_protocal($protpcal = '') { |
|
636 | - $status_array = array('SIP' => 'SIP', 'IAX2' => 'IAX2', 'Zap' => 'Zap', 'Local' => 'Local', 'OH323' => 'OH323', 'OOH323C' => 'OOH323C'); |
|
637 | - return $status_array; |
|
638 | - } |
|
639 | - |
|
640 | - /* |
|
611 | + $status_array = array('0' => 'Refill', '1' => 'Postcharge',); |
|
612 | + return $status_array; |
|
613 | + } |
|
614 | + |
|
615 | + function search_int_type($status = '') { |
|
616 | + $status_array = array('1' => 'Is Equal To', '2' => 'Is Not Equal To', '3' => 'Greater Than', '4' => 'Less Than', '5' => 'Greater Or Equal Than', '6' => 'Less Or Equal Than'); |
|
617 | + return $status_array; |
|
618 | + } |
|
619 | + |
|
620 | + function update_int_type($status = '') { |
|
621 | + $status_array = array('1' => 'Preserve', '2' => 'Set To', '3' => 'Increase By', '4' => 'Decrease By'); |
|
622 | + return $status_array; |
|
623 | + } |
|
624 | + |
|
625 | + function update_drp_type($status = '') { |
|
626 | + $status_array = array('1' => 'Preserve', '2' => 'Set To'); |
|
627 | + return $status_array; |
|
628 | + } |
|
629 | + |
|
630 | + function search_string_type($status = '') { |
|
631 | + $status_array = array('5'=>"Begins With",'1' => 'Contains', '2' => 'Doesnt Contain', '3' => 'Is Equal To', '4' => 'Is Not Equal To',"6"=>"Ends With"); |
|
632 | + return $status_array; |
|
633 | + } |
|
634 | + |
|
635 | + function set_protocal($protpcal = '') { |
|
636 | + $status_array = array('SIP' => 'SIP', 'IAX2' => 'IAX2', 'Zap' => 'Zap', 'Local' => 'Local', 'OH323' => 'OH323', 'OOH323C' => 'OOH323C'); |
|
637 | + return $status_array; |
|
638 | + } |
|
639 | + |
|
640 | + /* |
|
641 | 641 | * |
642 | 642 | * Purpose : Add Profit Margin report |
643 | 643 | * Version 2.1 |
644 | 644 | */ |
645 | 645 | |
646 | - function set_notify_by($status = '') { |
|
647 | - $status_array = array('' => 'Select Notify By', '0' => 'CSV', '1' => 'Email'); |
|
648 | - return $status_array; |
|
649 | - } |
|
646 | + function set_notify_by($status = '') { |
|
647 | + $status_array = array('' => 'Select Notify By', '0' => 'CSV', '1' => 'Email'); |
|
648 | + return $status_array; |
|
649 | + } |
|
650 | 650 | |
651 | - function convert_to_percentage($select = "", $table = "", $amount) { |
|
652 | - return round($amount, 2) . " %"; |
|
653 | - } |
|
651 | + function convert_to_percentage($select = "", $table = "", $amount) { |
|
652 | + return round($amount, 2) . " %"; |
|
653 | + } |
|
654 | 654 | |
655 | - function convert_to_minutes($select = "", $table = "", $amount) { |
|
656 | - return str_replace('.', ':', round($amount / 60, 2)); |
|
657 | - } |
|
655 | + function convert_to_minutes($select = "", $table = "", $amount) { |
|
656 | + return str_replace('.', ':', round($amount / 60, 2)); |
|
657 | + } |
|
658 | 658 | |
659 | - function set_filter_type_search($status = '') { |
|
660 | - $status_array = array('pricelist_id' => 'Rate Group', 'accountid' => 'Customer', 'reseller_id' => 'Reseller'); |
|
661 | - return $status_array; |
|
662 | - } |
|
659 | + function set_filter_type_search($status = '') { |
|
660 | + $status_array = array('pricelist_id' => 'Rate Group', 'accountid' => 'Customer', 'reseller_id' => 'Reseller'); |
|
661 | + return $status_array; |
|
662 | + } |
|
663 | 663 | |
664 | - function set_routetype_status($select= ''){ |
|
665 | - $status_array = array("" => "--Select--", |
|
666 | - "0" => "LCR", |
|
667 | - "1" => "COST" |
|
668 | - ); |
|
669 | - return $status_array; |
|
664 | + function set_routetype_status($select= ''){ |
|
665 | + $status_array = array("" => "--Select--", |
|
666 | + "0" => "LCR", |
|
667 | + "1" => "COST" |
|
668 | + ); |
|
669 | + return $status_array; |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | |
673 | - //attachment download in email module... |
|
674 | - function attachment_icons($select = "", $table = "", $attachement = "") { |
|
675 | - if ($attachement != "") { |
|
676 | - $array = explode(",", $attachement); |
|
677 | - $str = ''; |
|
678 | - foreach ($array as $key => $val) { |
|
679 | - $link = base_url() . "email/email_history_list_attachment/" . $val; |
|
680 | - $str.="<a href='" . $link . "' title='" . $val . "' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a> "; |
|
681 | - } |
|
682 | - return $str; |
|
683 | - } else { |
|
684 | - return ""; |
|
685 | - } |
|
686 | - } |
|
687 | - |
|
688 | - /* * ************************************************************* */ |
|
689 | - |
|
690 | - function set_despostion($dis = '') { |
|
691 | - $status_array = array("" => "--Select Disposition--", |
|
692 | - "UNSPECIFIED" => "UNSPECIFIED", |
|
693 | - "UNALLOCATED_NUMBER" => "UNALLOCATED_NUMBER", |
|
694 | - "NO_ROUTE_DESTINATION" => "NO_ROUTE_DESTINATION", |
|
695 | - "CHANNEL_UNACCEPTABLE" => "CHANNEL_UNACCEPTABLE", |
|
696 | - "NORMAL_CLEARING" => "NORMAL_CLEARING", |
|
697 | - "SUCCESS" => "SUCCESS", |
|
698 | - "USER_BUSY" => "USER_BUSY", |
|
699 | - "NO_USER_RESPONSE" => "NO_USER_RESPONSE", |
|
700 | - "NO_ANSWER" => "NO_ANSWER", |
|
701 | - "CALL_REJECTED" => "CALL_REJECTED", |
|
702 | - "NUMBER_CHANGED" => "NUMBER_CHANGED", |
|
703 | - "DESTINATION_OUT_OF_ORDER" => "DESTINATION_OUT_OF_ORDER", |
|
704 | - "INVALID_NUMBER_FORMAT" => "INVALID_NUMBER_FORMAT", |
|
705 | - "FACILITY_REJECTED" => "FACILITY_REJECTED", |
|
706 | - "NORMAL_UNSPECIFIED" => "NORMAL_UNSPECIFIED", |
|
707 | - "NORMAL_CIRCUIT_CONGESTION" => "NORMAL_CIRCUIT_CONGESTION", |
|
708 | - "NETWORK_OUT_OF_ORDER" => "NETWORK_OUT_OF_ORDER", |
|
709 | - "NORMAL_TEMPORARY_FAILURE" => "NORMAL_TEMPORARY_FAILURE", |
|
710 | - "SWITCH_CONGESTION" => "SWITCH_CONGESTION", |
|
711 | - "FACILITY_NOT_SUBSCRIBED" => "FACILITY_NOT_SUBSCRIBED", |
|
712 | - "OUTGOING_CALL_BARRED" => "OUTGOING_CALL_BARRED", |
|
713 | - "BEARERCAPABILITY_NOTAUTH" => "BEARERCAPABILITY_NOTAUTH", |
|
714 | - "BEARERCAPABILITY_NOTAVAIL" => "BEARERCAPABILITY_NOTAVAIL", |
|
715 | - "SERVICE_UNAVAILABLE" => "SERVICE_UNAVAILABLE", |
|
716 | - "BEARERCAPABILITY_NOTIMPL" => "BEARERCAPABILITY_NOTIMPL", |
|
717 | - "CHAN_NOT_IMPLEMENTED" => "CHAN_NOT_IMPLEMENTED", |
|
718 | - "FACILITY_NOT_IMPLEMENTED" => "FACILITY_NOT_IMPLEMENTED", |
|
719 | - "SERVICE_NOT_IMPLEMENTED" => "SERVICE_NOT_IMPLEMENTED", |
|
720 | - "INCOMPATIBLE_DESTINATION" => "INCOMPATIBLE_DESTINATION", |
|
721 | - "RECOVERY_ON_TIMER_EXPIRE" => "RECOVERY_ON_TIMER_EXPIRE", |
|
722 | - "ORIGINATOR_CANCEL" => "ORIGINATOR_CANCEL", |
|
723 | - "ALLOTTED_TIMEOUT" => "ALLOTTED_TIMEOUT", |
|
724 | - "MEDIA_TIMEOUT" => "MEDIA_TIMEOUT", |
|
725 | - "PROGRESS_TIMEOUT" => "PROGRESS_TIMEOUT", |
|
726 | - "AUTHENTICATION_FAIL" => "AUTHENTICATION_FAIL", |
|
673 | + //attachment download in email module... |
|
674 | + function attachment_icons($select = "", $table = "", $attachement = "") { |
|
675 | + if ($attachement != "") { |
|
676 | + $array = explode(",", $attachement); |
|
677 | + $str = ''; |
|
678 | + foreach ($array as $key => $val) { |
|
679 | + $link = base_url() . "email/email_history_list_attachment/" . $val; |
|
680 | + $str.="<a href='" . $link . "' title='" . $val . "' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a> "; |
|
681 | + } |
|
682 | + return $str; |
|
683 | + } else { |
|
684 | + return ""; |
|
685 | + } |
|
686 | + } |
|
687 | + |
|
688 | + /* * ************************************************************* */ |
|
689 | + |
|
690 | + function set_despostion($dis = '') { |
|
691 | + $status_array = array("" => "--Select Disposition--", |
|
692 | + "UNSPECIFIED" => "UNSPECIFIED", |
|
693 | + "UNALLOCATED_NUMBER" => "UNALLOCATED_NUMBER", |
|
694 | + "NO_ROUTE_DESTINATION" => "NO_ROUTE_DESTINATION", |
|
695 | + "CHANNEL_UNACCEPTABLE" => "CHANNEL_UNACCEPTABLE", |
|
696 | + "NORMAL_CLEARING" => "NORMAL_CLEARING", |
|
697 | + "SUCCESS" => "SUCCESS", |
|
698 | + "USER_BUSY" => "USER_BUSY", |
|
699 | + "NO_USER_RESPONSE" => "NO_USER_RESPONSE", |
|
700 | + "NO_ANSWER" => "NO_ANSWER", |
|
701 | + "CALL_REJECTED" => "CALL_REJECTED", |
|
702 | + "NUMBER_CHANGED" => "NUMBER_CHANGED", |
|
703 | + "DESTINATION_OUT_OF_ORDER" => "DESTINATION_OUT_OF_ORDER", |
|
704 | + "INVALID_NUMBER_FORMAT" => "INVALID_NUMBER_FORMAT", |
|
705 | + "FACILITY_REJECTED" => "FACILITY_REJECTED", |
|
706 | + "NORMAL_UNSPECIFIED" => "NORMAL_UNSPECIFIED", |
|
707 | + "NORMAL_CIRCUIT_CONGESTION" => "NORMAL_CIRCUIT_CONGESTION", |
|
708 | + "NETWORK_OUT_OF_ORDER" => "NETWORK_OUT_OF_ORDER", |
|
709 | + "NORMAL_TEMPORARY_FAILURE" => "NORMAL_TEMPORARY_FAILURE", |
|
710 | + "SWITCH_CONGESTION" => "SWITCH_CONGESTION", |
|
711 | + "FACILITY_NOT_SUBSCRIBED" => "FACILITY_NOT_SUBSCRIBED", |
|
712 | + "OUTGOING_CALL_BARRED" => "OUTGOING_CALL_BARRED", |
|
713 | + "BEARERCAPABILITY_NOTAUTH" => "BEARERCAPABILITY_NOTAUTH", |
|
714 | + "BEARERCAPABILITY_NOTAVAIL" => "BEARERCAPABILITY_NOTAVAIL", |
|
715 | + "SERVICE_UNAVAILABLE" => "SERVICE_UNAVAILABLE", |
|
716 | + "BEARERCAPABILITY_NOTIMPL" => "BEARERCAPABILITY_NOTIMPL", |
|
717 | + "CHAN_NOT_IMPLEMENTED" => "CHAN_NOT_IMPLEMENTED", |
|
718 | + "FACILITY_NOT_IMPLEMENTED" => "FACILITY_NOT_IMPLEMENTED", |
|
719 | + "SERVICE_NOT_IMPLEMENTED" => "SERVICE_NOT_IMPLEMENTED", |
|
720 | + "INCOMPATIBLE_DESTINATION" => "INCOMPATIBLE_DESTINATION", |
|
721 | + "RECOVERY_ON_TIMER_EXPIRE" => "RECOVERY_ON_TIMER_EXPIRE", |
|
722 | + "ORIGINATOR_CANCEL" => "ORIGINATOR_CANCEL", |
|
723 | + "ALLOTTED_TIMEOUT" => "ALLOTTED_TIMEOUT", |
|
724 | + "MEDIA_TIMEOUT" => "MEDIA_TIMEOUT", |
|
725 | + "PROGRESS_TIMEOUT" => "PROGRESS_TIMEOUT", |
|
726 | + "AUTHENTICATION_FAIL" => "AUTHENTICATION_FAIL", |
|
727 | 727 | "ACCOUNT_INACTIVE_DELETED" => "ACCOUNT_INACTIVE_DELETED", |
728 | 728 | "ACCOUNT_EXPIRE" => "ACCOUNT_EXPIRE", |
729 | 729 | "NO_SUFFICIENT_FUND" => "NO_SUFFICIENT_FUND", |
@@ -732,141 +732,141 @@ discard block |
||
732 | 732 | "RESELLER_COST_CHEAP" => "RESELLER_COST_CHEAP", |
733 | 733 | "TERMINATION_RATE_NOT_FOUND" => "TERMINATION_RATE_NOT_FOUND", |
734 | 734 | "DID_DESTINATION_NOT_FOUND" => "DID_DESTINATION_NOT_FOUND", |
735 | - ); |
|
736 | - return $status_array; |
|
737 | - } |
|
738 | - |
|
739 | - function set_calltype($type = '') { |
|
740 | - $status_array = array("" => "--Select Type--", |
|
741 | - "STANDARD" => "STANDARD", |
|
742 | - "DID" => "DID", |
|
743 | - "CALLINGCARD" => "CALLINGCARD", |
|
744 | - "FREE" => "FREE", |
|
745 | - ); |
|
746 | - return $status_array; |
|
747 | - } |
|
748 | - |
|
749 | - function set_search_status($select = '') { |
|
750 | - $status_array = array("" => "--Select--", |
|
751 | - "0" => "Active", |
|
752 | - "1" => "Inactive" |
|
753 | - ); |
|
754 | - return $status_array; |
|
755 | - } |
|
735 | + ); |
|
736 | + return $status_array; |
|
737 | + } |
|
738 | + |
|
739 | + function set_calltype($type = '') { |
|
740 | + $status_array = array("" => "--Select Type--", |
|
741 | + "STANDARD" => "STANDARD", |
|
742 | + "DID" => "DID", |
|
743 | + "CALLINGCARD" => "CALLINGCARD", |
|
744 | + "FREE" => "FREE", |
|
745 | + ); |
|
746 | + return $status_array; |
|
747 | + } |
|
748 | + |
|
749 | + function set_search_status($select = '') { |
|
750 | + $status_array = array("" => "--Select--", |
|
751 | + "0" => "Active", |
|
752 | + "1" => "Inactive" |
|
753 | + ); |
|
754 | + return $status_array; |
|
755 | + } |
|
756 | 756 | |
757 | - function set_Billing_Schedule_status($select = '') { |
|
758 | - $status_array = array("" => "--Select--", |
|
759 | - "0" => "Daily", |
|
760 | - "2" => "Monthly" |
|
761 | - ); |
|
762 | - return $status_array; |
|
763 | - } |
|
764 | - |
|
765 | - function get_action_buttons($buttons_arr, $linkid) { |
|
766 | - $ret_url = ''; |
|
767 | - if (!empty($buttons_arr) && $buttons_arr != '') { |
|
768 | - foreach ($buttons_arr as $button_key => $buttons_params) { |
|
769 | - if (strtoupper($button_key) == "EDIT") { |
|
770 | - $ret_url .= $this->build_edit_button($buttons_params, $linkid); |
|
771 | - } |
|
772 | - /* |
|
757 | + function set_Billing_Schedule_status($select = '') { |
|
758 | + $status_array = array("" => "--Select--", |
|
759 | + "0" => "Daily", |
|
760 | + "2" => "Monthly" |
|
761 | + ); |
|
762 | + return $status_array; |
|
763 | + } |
|
764 | + |
|
765 | + function get_action_buttons($buttons_arr, $linkid) { |
|
766 | + $ret_url = ''; |
|
767 | + if (!empty($buttons_arr) && $buttons_arr != '') { |
|
768 | + foreach ($buttons_arr as $button_key => $buttons_params) { |
|
769 | + if (strtoupper($button_key) == "EDIT") { |
|
770 | + $ret_url .= $this->build_edit_button($buttons_params, $linkid); |
|
771 | + } |
|
772 | + /* |
|
773 | 773 | * |
774 | 774 | * Purpose : Add resend link |
775 | 775 | * Version 2.1 |
776 | 776 | */ |
777 | - if (strtoupper($button_key) == "RESEND") { |
|
778 | - $ret_url .= $this->build_edit_button_resend($buttons_params, $linkid); |
|
779 | - } |
|
780 | - /* * ************************************* */ |
|
781 | - if (strtoupper($button_key) == "EDIT_RESTORE") { |
|
782 | - $ret_url .= $this->build_edit_button_restore($buttons_params, $linkid); |
|
783 | - } |
|
784 | - if (strtoupper($button_key) == "DELETE") { |
|
785 | - $ret_url .= $this->build_delete_button($buttons_params->url, $linkid); |
|
786 | - } |
|
787 | - if (strtoupper($button_key) == "VIEW") { |
|
788 | - $ret_url .= $this->build_view_button($buttons_params, $linkid); |
|
789 | - } |
|
790 | - if (strtoupper($button_key) == "TAXES") { |
|
791 | - $ret_url .= $this->build_add_taxes_button($buttons_params, $linkid); |
|
792 | - } |
|
793 | - if (strtoupper($button_key) == "BLUEBOX_LOGIN") { |
|
794 | - $ret_url .= $this->build_bluebox_login($buttons_params->url, $linkid); |
|
795 | - } |
|
796 | - if (strtoupper($button_key) == "CALLERID") { |
|
797 | - $ret_url .= $this->build_add_callerid_button($buttons_params, $linkid); |
|
798 | - } |
|
799 | - if (strtoupper($button_key) == "PAYMENT") { |
|
800 | - $ret_url .= $this->build_add_payment_button($buttons_params->url, $linkid); |
|
801 | - } |
|
802 | - if (strtoupper($button_key) == "DOWNLOAD") { |
|
803 | - $ret_url .= $this->build_add_download_button($buttons_params->url, $linkid); |
|
804 | - } |
|
805 | - if (strtoupper($button_key) == "START") { |
|
806 | - $ret_url .= $this->build_start_button($buttons_params->url, $linkid); |
|
807 | - } |
|
808 | - if (strtoupper($button_key) == "STOP") { |
|
809 | - $ret_url .= $this->build_stop_button($buttons_params->url, $linkid); |
|
810 | - } |
|
811 | - if (strtoupper($button_key) == "RELOAD") { |
|
812 | - $ret_url .= $this->build_reload_button($buttons_params->url, $linkid); |
|
813 | - } |
|
814 | - if (strtoupper($button_key) == "RESCAN") { |
|
815 | - $ret_url .= $this->build_rescan_button($buttons_params->url, $linkid); |
|
816 | - } |
|
817 | - |
|
818 | - if (strtoupper($button_key) == "DOWNLOAD_DATABASE") { |
|
819 | - $ret_url .= $this->build_add_download_database_button($buttons_params->url, $linkid); |
|
820 | - } |
|
821 | - if (strtoupper($button_key) == "DELETE_ANIMAP") { |
|
822 | - $ret_url .= $this->build_delete_button_animap($buttons_params->url, $linkid); |
|
823 | - } |
|
824 | - if (strtoupper($button_key) == "EDIT_ANIMAP") { |
|
825 | - $ret_url .= $this->build_edit_button_animap($buttons_params, $linkid); |
|
826 | - } |
|
827 | - if (strtoupper($button_key) == "ANIMAP") { |
|
828 | - $ret_url .= $this->build_animap_button($buttons_params, $linkid); |
|
829 | - } |
|
830 | - } |
|
831 | - } |
|
832 | - return $ret_url; |
|
833 | - } |
|
834 | - |
|
835 | - function build_delete_button_animap($url, $linkid) { |
|
836 | - $link = base_url() . $url . "" . $linkid; |
|
837 | - return '<a href="javascript:void(0)" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg_destination(' . $linkid . ');"><i class="fa fa-trash fa-fw"></i></a>'; |
|
838 | - } |
|
839 | - |
|
840 | - function build_edit_button_animap($button_params, $linkid) { |
|
841 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
842 | - return '<a href="javascript:void(0);" id="destination_new" class="btn btn-royelblue btn-sm" onclick="return get_destination(' . $linkid . ');" title="Update"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
843 | - } |
|
844 | - |
|
845 | - function build_animap_button($button_params, $linkid) { |
|
846 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
847 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm animap_image" rel="facebox" title="ANI Map"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
848 | - } |
|
849 | - |
|
850 | - function build_edit_button($button_params, $linkid) { |
|
851 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
777 | + if (strtoupper($button_key) == "RESEND") { |
|
778 | + $ret_url .= $this->build_edit_button_resend($buttons_params, $linkid); |
|
779 | + } |
|
780 | + /* * ************************************* */ |
|
781 | + if (strtoupper($button_key) == "EDIT_RESTORE") { |
|
782 | + $ret_url .= $this->build_edit_button_restore($buttons_params, $linkid); |
|
783 | + } |
|
784 | + if (strtoupper($button_key) == "DELETE") { |
|
785 | + $ret_url .= $this->build_delete_button($buttons_params->url, $linkid); |
|
786 | + } |
|
787 | + if (strtoupper($button_key) == "VIEW") { |
|
788 | + $ret_url .= $this->build_view_button($buttons_params, $linkid); |
|
789 | + } |
|
790 | + if (strtoupper($button_key) == "TAXES") { |
|
791 | + $ret_url .= $this->build_add_taxes_button($buttons_params, $linkid); |
|
792 | + } |
|
793 | + if (strtoupper($button_key) == "BLUEBOX_LOGIN") { |
|
794 | + $ret_url .= $this->build_bluebox_login($buttons_params->url, $linkid); |
|
795 | + } |
|
796 | + if (strtoupper($button_key) == "CALLERID") { |
|
797 | + $ret_url .= $this->build_add_callerid_button($buttons_params, $linkid); |
|
798 | + } |
|
799 | + if (strtoupper($button_key) == "PAYMENT") { |
|
800 | + $ret_url .= $this->build_add_payment_button($buttons_params->url, $linkid); |
|
801 | + } |
|
802 | + if (strtoupper($button_key) == "DOWNLOAD") { |
|
803 | + $ret_url .= $this->build_add_download_button($buttons_params->url, $linkid); |
|
804 | + } |
|
805 | + if (strtoupper($button_key) == "START") { |
|
806 | + $ret_url .= $this->build_start_button($buttons_params->url, $linkid); |
|
807 | + } |
|
808 | + if (strtoupper($button_key) == "STOP") { |
|
809 | + $ret_url .= $this->build_stop_button($buttons_params->url, $linkid); |
|
810 | + } |
|
811 | + if (strtoupper($button_key) == "RELOAD") { |
|
812 | + $ret_url .= $this->build_reload_button($buttons_params->url, $linkid); |
|
813 | + } |
|
814 | + if (strtoupper($button_key) == "RESCAN") { |
|
815 | + $ret_url .= $this->build_rescan_button($buttons_params->url, $linkid); |
|
816 | + } |
|
817 | + |
|
818 | + if (strtoupper($button_key) == "DOWNLOAD_DATABASE") { |
|
819 | + $ret_url .= $this->build_add_download_database_button($buttons_params->url, $linkid); |
|
820 | + } |
|
821 | + if (strtoupper($button_key) == "DELETE_ANIMAP") { |
|
822 | + $ret_url .= $this->build_delete_button_animap($buttons_params->url, $linkid); |
|
823 | + } |
|
824 | + if (strtoupper($button_key) == "EDIT_ANIMAP") { |
|
825 | + $ret_url .= $this->build_edit_button_animap($buttons_params, $linkid); |
|
826 | + } |
|
827 | + if (strtoupper($button_key) == "ANIMAP") { |
|
828 | + $ret_url .= $this->build_animap_button($buttons_params, $linkid); |
|
829 | + } |
|
830 | + } |
|
831 | + } |
|
832 | + return $ret_url; |
|
833 | + } |
|
834 | + |
|
835 | + function build_delete_button_animap($url, $linkid) { |
|
836 | + $link = base_url() . $url . "" . $linkid; |
|
837 | + return '<a href="javascript:void(0)" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg_destination(' . $linkid . ');"><i class="fa fa-trash fa-fw"></i></a>'; |
|
838 | + } |
|
839 | + |
|
840 | + function build_edit_button_animap($button_params, $linkid) { |
|
841 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
842 | + return '<a href="javascript:void(0);" id="destination_new" class="btn btn-royelblue btn-sm" onclick="return get_destination(' . $linkid . ');" title="Update"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
843 | + } |
|
844 | + |
|
845 | + function build_animap_button($button_params, $linkid) { |
|
846 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
847 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm animap_image" rel="facebox" title="ANI Map"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
848 | + } |
|
849 | + |
|
850 | + function build_edit_button($button_params, $linkid) { |
|
851 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
852 | 852 | |
853 | - if ($button_params->mode == 'popup') { |
|
854 | - $rel = (isset($button_params->layout) && $button_params->layout != '')?"facebox_".$button_params->layout:"facebox"; |
|
855 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="'.$rel.'" title="Edit" ="small"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
853 | + if ($button_params->mode == 'popup') { |
|
854 | + $rel = (isset($button_params->layout) && $button_params->layout != '')?"facebox_".$button_params->layout:"facebox"; |
|
855 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="'.$rel.'" title="Edit" ="small"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
856 | 856 | |
857 | - }else if(strpos($link,'customer_edit') !== false){ |
|
858 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
859 | - }else { |
|
860 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
861 | - } |
|
862 | - } |
|
863 | - |
|
864 | - /** |
|
857 | + }else if(strpos($link,'customer_edit') !== false){ |
|
858 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
859 | + }else { |
|
860 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
861 | + } |
|
862 | + } |
|
863 | + |
|
864 | + /** |
|
865 | 865 | For Edit on Account number or name |
866 | - **/ |
|
867 | - function build_custome_edit_button($button_params, $field, $linkid) { |
|
868 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
869 | - if(isset($button_params->layout)){ |
|
866 | + **/ |
|
867 | + function build_custome_edit_button($button_params, $field, $linkid) { |
|
868 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
869 | + if(isset($button_params->layout)){ |
|
870 | 870 | if ($button_params->mode == 'popup') { |
871 | 871 | return '<a href="' . $link . '" style="cursor:pointer;color:#005298;" rel="facebox_medium" title="Update">' . $field . '</a> '; |
872 | 872 | } else { |
@@ -879,258 +879,258 @@ discard block |
||
879 | 879 | return '<a href="' . $link . '" style="cursor:pointer;color:#005298;" title="Edit">' . $field . '</a> '; |
880 | 880 | } |
881 | 881 | } |
882 | - } |
|
883 | - |
|
884 | - /************************************ */ |
|
885 | - |
|
886 | - function build_edit_button_restore($button_params, $linkid) { |
|
887 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
888 | - if ($button_params->mode == 'popup') { |
|
889 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Restore" onClick="return get_alert_msg();"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
890 | - } else { |
|
891 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Restore" onClick="return get_alert_msg_restore();"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
892 | - } |
|
893 | - } |
|
894 | - |
|
895 | - function build_delete_button($url, $linkid) { |
|
896 | - $flag='0'; |
|
897 | - $data= explode("/",$url); |
|
898 | - $link = base_url() . $url . "" . $linkid; |
|
899 | - foreach($data as $key=>$value){ |
|
900 | - if($value == 'price_delete') |
|
901 | - $flag = '1'; |
|
902 | - if($value == 'trunk_remove') |
|
903 | - $flag='2'; |
|
904 | - if($value == 'customer_delete' ||$value =='provider_delete') |
|
905 | - $flag='3'; |
|
906 | - if($value == 'reseller_delete') |
|
907 | - $flag='4'; |
|
908 | - } |
|
909 | - if($flag=='1'){ |
|
910 | - $where=array('pricelist_id'=>$linkid,'deleted !=' =>'1'); |
|
911 | - $customer_cnt=$this->get_field_count('id','accounts',$where); |
|
912 | - $where=array('pricelist_id'=>$linkid); |
|
913 | - $rategroup_cnt=$this->get_field_count('id','routes',$where); |
|
914 | - if($rategroup_cnt > 0 || $customer_cnt > 0 ){ |
|
882 | + } |
|
883 | + |
|
884 | + /************************************ */ |
|
885 | + |
|
886 | + function build_edit_button_restore($button_params, $linkid) { |
|
887 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
888 | + if ($button_params->mode == 'popup') { |
|
889 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Restore" onClick="return get_alert_msg();"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
890 | + } else { |
|
891 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Restore" onClick="return get_alert_msg_restore();"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
892 | + } |
|
893 | + } |
|
894 | + |
|
895 | + function build_delete_button($url, $linkid) { |
|
896 | + $flag='0'; |
|
897 | + $data= explode("/",$url); |
|
898 | + $link = base_url() . $url . "" . $linkid; |
|
899 | + foreach($data as $key=>$value){ |
|
900 | + if($value == 'price_delete') |
|
901 | + $flag = '1'; |
|
902 | + if($value == 'trunk_remove') |
|
903 | + $flag='2'; |
|
904 | + if($value == 'customer_delete' ||$value =='provider_delete') |
|
905 | + $flag='3'; |
|
906 | + if($value == 'reseller_delete') |
|
907 | + $flag='4'; |
|
908 | + } |
|
909 | + if($flag=='1'){ |
|
910 | + $where=array('pricelist_id'=>$linkid,'deleted !=' =>'1'); |
|
911 | + $customer_cnt=$this->get_field_count('id','accounts',$where); |
|
912 | + $where=array('pricelist_id'=>$linkid); |
|
913 | + $rategroup_cnt=$this->get_field_count('id','routes',$where); |
|
914 | + if($rategroup_cnt > 0 || $customer_cnt > 0 ){ |
|
915 | 915 | |
916 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$rategroup_cnt.','.$customer_cnt.','.$linkid.',1);"><i class="fa fa-trash fa-fw"></i></a>'; |
|
917 | - } |
|
918 | - else{ |
|
919 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
|
920 | - } |
|
921 | - } |
|
922 | - if($flag=='2'){ |
|
923 | - $where=array('trunk_id'=>$linkid); |
|
924 | - $trunk_cnt=$this->get_field_count('id','outbound_routes',$where); |
|
925 | - if($trunk_cnt > 0){ |
|
926 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$trunk_cnt.',null,'.$linkid.',2);"><i class="fa fa-trash fa-fw"></i></a>'; |
|
927 | - } |
|
928 | - else{ |
|
929 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
|
930 | - } |
|
931 | - } |
|
932 | - if($flag == '3'){ |
|
916 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$rategroup_cnt.','.$customer_cnt.','.$linkid.',1);"><i class="fa fa-trash fa-fw"></i></a>'; |
|
917 | + } |
|
918 | + else{ |
|
919 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
|
920 | + } |
|
921 | + } |
|
922 | + if($flag=='2'){ |
|
923 | + $where=array('trunk_id'=>$linkid); |
|
924 | + $trunk_cnt=$this->get_field_count('id','outbound_routes',$where); |
|
925 | + if($trunk_cnt > 0){ |
|
926 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$trunk_cnt.',null,'.$linkid.',2);"><i class="fa fa-trash fa-fw"></i></a>'; |
|
927 | + } |
|
928 | + else{ |
|
929 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
|
930 | + } |
|
931 | + } |
|
932 | + if($flag == '3'){ |
|
933 | 933 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message(0,null,'.$linkid.',3);"> |
934 | 934 | <i class="fa fa-trash fa-fw"></i></a>'; |
935 | - } |
|
936 | - if($flag == '4'){ |
|
935 | + } |
|
936 | + if($flag == '4'){ |
|
937 | 937 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message(0,null,'.$linkid.',4);"> |
938 | 938 | <i class="fa fa-trash fa-fw"></i></a>'; |
939 | - } |
|
940 | - if($flag=='0' && $url.$linkid !='accounts/admin_delete/1' ){ |
|
941 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
|
942 | - } |
|
943 | - } |
|
944 | - |
|
945 | - function build_view_button($button_params, $linkid) { |
|
946 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
947 | - if ($button_params->mode == 'popup') { |
|
939 | + } |
|
940 | + if($flag=='0' && $url.$linkid !='accounts/admin_delete/1' ){ |
|
941 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
|
942 | + } |
|
943 | + } |
|
944 | + |
|
945 | + function build_view_button($button_params, $linkid) { |
|
946 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
947 | + if ($button_params->mode == 'popup') { |
|
948 | 948 | $rel = (isset($button_params->layout) && $button_params->layout != '')?"facebox_".$button_params->layout:"facebox"; |
949 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="'.$rel.'" title="View Details"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
950 | - } else { |
|
951 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="View Details"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
952 | - } |
|
953 | - } |
|
954 | - |
|
955 | - function build_add_taxes_button($button_params, $linkid) { |
|
956 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
957 | - if ($button_params->mode == 'popup') { |
|
958 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Add Account Taxes"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
959 | - } else { |
|
960 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Add Account Taxes"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
961 | - } |
|
962 | - } |
|
963 | - |
|
964 | - function build_add_download_database_button($url, $linkid) { |
|
965 | - $link = base_url() . $url . "" . $linkid; |
|
966 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm " title="Download Database" ><i class="fa-fw fa fa-file-archive-o"></i></a> '; |
|
967 | - } |
|
968 | - |
|
969 | - function build_add_callerid_button($button_params, $linkid) { |
|
970 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
971 | - if ($button_params->mode == 'popup') { |
|
972 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Force Caller Id"><i class="fa fa-mobile-phone fa-fw"></i></a> '; |
|
973 | - } else { |
|
974 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="CallerID"><i class="fa fa-mobile-phone fa-fw"></i></a> '; |
|
975 | - } |
|
976 | - } |
|
977 | - |
|
978 | - function build_start_button($url, $linkid) { |
|
979 | - $link = base_url() . $url . "" . $linkid; |
|
980 | - |
|
981 | - return '<a href="' . $link . '" class="" title="Start" style="text-decoration:none;color: #428BCA;"><b>Start |</b></a> '; |
|
982 | - } |
|
983 | - |
|
984 | - function build_stop_button($url, $linkid) { |
|
985 | - $link = base_url() . $url . "" . $linkid; |
|
986 | - return '<a href="' . $link . '" class="" title="Stop" style="text-decoration:none;color: #428BCA;" ><b>Stop |</b></a> '; |
|
987 | - } |
|
988 | - |
|
989 | - function build_reload_button($url, $linkid) { |
|
990 | - $link = base_url() . $url . "" . $linkid; |
|
991 | - return '<a href="' . $link . '" class="" title="reload" style="text-decoration:none;color: #428BCA;"><b>Reload |</b></a> '; |
|
992 | - } |
|
993 | - |
|
994 | - function build_rescan_button($url, $linkid) { |
|
995 | - $link = base_url() . $url . "" . $linkid; |
|
996 | - return '<a href="' . $link . '" class="" title="rescan" style="text-decoration:none;color: #428BCA;"><b>Rescan</b></a> '; |
|
997 | - } |
|
998 | - |
|
999 | - function build_add_payment_button($url, $linkid) { |
|
1000 | - $link = base_url() . $url . "" . $linkid; |
|
1001 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Refill" ><i class="fa fa-usd fa-fw"></i></a> '; |
|
1002 | - } |
|
1003 | - |
|
1004 | - function build_add_download_button($url, $linkid) { |
|
1005 | - $link = base_url() . $url . "" . $linkid; |
|
1006 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a> '; |
|
1007 | - } |
|
1008 | - |
|
1009 | - /* |
|
949 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="'.$rel.'" title="View Details"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
950 | + } else { |
|
951 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="View Details"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
952 | + } |
|
953 | + } |
|
954 | + |
|
955 | + function build_add_taxes_button($button_params, $linkid) { |
|
956 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
957 | + if ($button_params->mode == 'popup') { |
|
958 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Add Account Taxes"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
959 | + } else { |
|
960 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Add Account Taxes"><i class="fa fa-reorder fa-fw"></i></a> '; |
|
961 | + } |
|
962 | + } |
|
963 | + |
|
964 | + function build_add_download_database_button($url, $linkid) { |
|
965 | + $link = base_url() . $url . "" . $linkid; |
|
966 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm " title="Download Database" ><i class="fa-fw fa fa-file-archive-o"></i></a> '; |
|
967 | + } |
|
968 | + |
|
969 | + function build_add_callerid_button($button_params, $linkid) { |
|
970 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
971 | + if ($button_params->mode == 'popup') { |
|
972 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Force Caller Id"><i class="fa fa-mobile-phone fa-fw"></i></a> '; |
|
973 | + } else { |
|
974 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="CallerID"><i class="fa fa-mobile-phone fa-fw"></i></a> '; |
|
975 | + } |
|
976 | + } |
|
977 | + |
|
978 | + function build_start_button($url, $linkid) { |
|
979 | + $link = base_url() . $url . "" . $linkid; |
|
980 | + |
|
981 | + return '<a href="' . $link . '" class="" title="Start" style="text-decoration:none;color: #428BCA;"><b>Start |</b></a> '; |
|
982 | + } |
|
983 | + |
|
984 | + function build_stop_button($url, $linkid) { |
|
985 | + $link = base_url() . $url . "" . $linkid; |
|
986 | + return '<a href="' . $link . '" class="" title="Stop" style="text-decoration:none;color: #428BCA;" ><b>Stop |</b></a> '; |
|
987 | + } |
|
988 | + |
|
989 | + function build_reload_button($url, $linkid) { |
|
990 | + $link = base_url() . $url . "" . $linkid; |
|
991 | + return '<a href="' . $link . '" class="" title="reload" style="text-decoration:none;color: #428BCA;"><b>Reload |</b></a> '; |
|
992 | + } |
|
993 | + |
|
994 | + function build_rescan_button($url, $linkid) { |
|
995 | + $link = base_url() . $url . "" . $linkid; |
|
996 | + return '<a href="' . $link . '" class="" title="rescan" style="text-decoration:none;color: #428BCA;"><b>Rescan</b></a> '; |
|
997 | + } |
|
998 | + |
|
999 | + function build_add_payment_button($url, $linkid) { |
|
1000 | + $link = base_url() . $url . "" . $linkid; |
|
1001 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Refill" ><i class="fa fa-usd fa-fw"></i></a> '; |
|
1002 | + } |
|
1003 | + |
|
1004 | + function build_add_download_button($url, $linkid) { |
|
1005 | + $link = base_url() . $url . "" . $linkid; |
|
1006 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a> '; |
|
1007 | + } |
|
1008 | + |
|
1009 | + /* |
|
1010 | 1010 | * Purpose : Add following for resent icon |
1011 | 1011 | * Version 2.1 |
1012 | 1012 | */ |
1013 | 1013 | |
1014 | - function build_edit_button_resend($button_params, $linkid) { |
|
1015 | - $link = base_url() . $button_params->url . "" . $linkid; |
|
1016 | - if ($button_params->mode == 'popup') { |
|
1017 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Resend Mail"><i class="fa fa-repeat"></i></a> '; |
|
1018 | - } else { |
|
1019 | - return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Resend Mail"><i class="fa fa-repeat"></i></a> '; |
|
1020 | - } |
|
1021 | - } |
|
1014 | + function build_edit_button_resend($button_params, $linkid) { |
|
1015 | + $link = base_url() . $button_params->url . "" . $linkid; |
|
1016 | + if ($button_params->mode == 'popup') { |
|
1017 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="facebox" title="Resend Mail"><i class="fa fa-repeat"></i></a> '; |
|
1018 | + } else { |
|
1019 | + return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Resend Mail"><i class="fa fa-repeat"></i></a> '; |
|
1020 | + } |
|
1021 | + } |
|
1022 | 1022 | |
1023 | - /* |
|
1023 | + /* |
|
1024 | 1024 | * ---------------------------------------------------------------------------- |
1025 | 1025 | */ |
1026 | 1026 | |
1027 | - function get_only_numeric_val($select = "", $table = "", $string) { |
|
1028 | - return filter_var($string, FILTER_SANITIZE_NUMBER_INT); |
|
1029 | - } |
|
1027 | + function get_only_numeric_val($select = "", $table = "", $string) { |
|
1028 | + return filter_var($string, FILTER_SANITIZE_NUMBER_INT); |
|
1029 | + } |
|
1030 | 1030 | |
1031 | - function mail_to_users($type, $accountinfo, $attachment = "", $amount = "") { |
|
1031 | + function mail_to_users($type, $accountinfo, $attachment = "", $amount = "") { |
|
1032 | 1032 | $subject = ""; |
1033 | - $settings_reply_email = '[email protected]'; |
|
1034 | - $reseller_id=$accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : 0; |
|
1033 | + $settings_reply_email = '[email protected]'; |
|
1034 | + $reseller_id=$accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : 0; |
|
1035 | 1035 | $where="accountid IN ('".$reseller_id."','1')"; |
1036 | - $this->CI->db->where($where); |
|
1037 | - $this->CI->db->select('emailaddress'); |
|
1038 | - $this->CI->db->order_by('accountid', 'desc'); |
|
1039 | - $this->CI->db->limit(1); |
|
1040 | - $invoiceconf = $this->CI->db->get('invoice_conf'); |
|
1041 | - $invoiceconf = (array)$invoiceconf->first_row(); |
|
1042 | - $settings_reply_email=$invoiceconf['emailaddress']; |
|
1043 | - $company_name=Common_model::$global_config['system_config']['company_name']; |
|
1044 | - $company_website=Common_model::$global_config['system_config']['company_website']; |
|
1045 | - $where = array('name' => $type); |
|
1046 | - $query = $this->CI->db_model->getSelect("*", "default_templates", $where); |
|
1047 | - $query = $query->result(); |
|
1048 | - $message = $query[0]->template; |
|
1049 | - $useremail = $accountinfo['email']; |
|
1050 | - $message = html_entity_decode($message); |
|
1051 | - $message = str_replace("#COMPANY_EMAIL#", $settings_reply_email, $message); |
|
1052 | - $message = str_replace("#COMPANY_NAME#", $company_name, $message); |
|
1053 | - $message = str_replace("#COMPANY_WEBSITE#", $company_website, $message); |
|
1054 | - $message = str_replace("</p>", "", $message); |
|
1036 | + $this->CI->db->where($where); |
|
1037 | + $this->CI->db->select('emailaddress'); |
|
1038 | + $this->CI->db->order_by('accountid', 'desc'); |
|
1039 | + $this->CI->db->limit(1); |
|
1040 | + $invoiceconf = $this->CI->db->get('invoice_conf'); |
|
1041 | + $invoiceconf = (array)$invoiceconf->first_row(); |
|
1042 | + $settings_reply_email=$invoiceconf['emailaddress']; |
|
1043 | + $company_name=Common_model::$global_config['system_config']['company_name']; |
|
1044 | + $company_website=Common_model::$global_config['system_config']['company_website']; |
|
1045 | + $where = array('name' => $type); |
|
1046 | + $query = $this->CI->db_model->getSelect("*", "default_templates", $where); |
|
1047 | + $query = $query->result(); |
|
1048 | + $message = $query[0]->template; |
|
1049 | + $useremail = $accountinfo['email']; |
|
1050 | + $message = html_entity_decode($message); |
|
1051 | + $message = str_replace("#COMPANY_EMAIL#", $settings_reply_email, $message); |
|
1052 | + $message = str_replace("#COMPANY_NAME#", $company_name, $message); |
|
1053 | + $message = str_replace("#COMPANY_WEBSITE#", $company_website, $message); |
|
1054 | + $message = str_replace("</p>", "", $message); |
|
1055 | 1055 | if(isset($accountinfo['refill_amount']) && $accountinfo['refill_amount']!= ""){ |
1056 | 1056 | $refillamount = $accountinfo['refill_amount']; |
1057 | 1057 | }else{ |
1058 | 1058 | $refillamount = "0"; |
1059 | 1059 | } |
1060 | 1060 | |
1061 | - switch ($type) { |
|
1062 | - case 'email_add_user': |
|
1063 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1064 | - $message = str_replace('#NUMBER#', $accountinfo['number'], $message); |
|
1065 | - $message = str_replace('#PASSWORD#', $accountinfo['password'], $message); |
|
1066 | - $message = str_replace('#LINK#', $accountinfo['confirm'], $message); |
|
1067 | - break; |
|
1068 | - case 'email_forgot_user': |
|
1069 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1070 | - $message = str_replace('#NUMBER#', $accountinfo['number'], $message); |
|
1071 | - $message = str_replace('#PASSWORD#', $accountinfo['password'], $message); |
|
1072 | - $message = str_replace('#LINK#', $accountinfo['link'], $message); |
|
1073 | - break; |
|
1074 | - |
|
1075 | - case 'email_forgot_confirmation': |
|
1076 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1077 | - $message = str_replace('#CONFIRM#', $accountinfo['confirm'], $message); |
|
1078 | - break; |
|
1079 | - |
|
1080 | - case 'email_signup_confirmation': |
|
1081 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1082 | - $message = str_replace('#CONFIRM#', $accountinfo['confirm'], $message); |
|
1083 | - break; |
|
1084 | - case 'add_sip_device': |
|
1085 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1086 | - $message = str_replace('#USERNAME#', $accountinfo['number'], $message); |
|
1087 | - $message = str_replace('#PASSWORD#', $accountinfo['password'], $message); |
|
1088 | - break; |
|
1061 | + switch ($type) { |
|
1062 | + case 'email_add_user': |
|
1063 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1064 | + $message = str_replace('#NUMBER#', $accountinfo['number'], $message); |
|
1065 | + $message = str_replace('#PASSWORD#', $accountinfo['password'], $message); |
|
1066 | + $message = str_replace('#LINK#', $accountinfo['confirm'], $message); |
|
1067 | + break; |
|
1068 | + case 'email_forgot_user': |
|
1069 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1070 | + $message = str_replace('#NUMBER#', $accountinfo['number'], $message); |
|
1071 | + $message = str_replace('#PASSWORD#', $accountinfo['password'], $message); |
|
1072 | + $message = str_replace('#LINK#', $accountinfo['link'], $message); |
|
1073 | + break; |
|
1074 | + |
|
1075 | + case 'email_forgot_confirmation': |
|
1076 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1077 | + $message = str_replace('#CONFIRM#', $accountinfo['confirm'], $message); |
|
1078 | + break; |
|
1079 | + |
|
1080 | + case 'email_signup_confirmation': |
|
1081 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1082 | + $message = str_replace('#CONFIRM#', $accountinfo['confirm'], $message); |
|
1083 | + break; |
|
1084 | + case 'add_sip_device': |
|
1085 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1086 | + $message = str_replace('#USERNAME#', $accountinfo['number'], $message); |
|
1087 | + $message = str_replace('#PASSWORD#', $accountinfo['password'], $message); |
|
1088 | + break; |
|
1089 | 1089 | |
1090 | - case 'voip_account_refilled': |
|
1091 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1092 | - $message = str_replace('#REFILLBALANCE#', $accountinfo['refill_amount'], $message); |
|
1093 | - $message = str_replace('#BALANCE#', $accountinfo['refill_amount'] + $accountinfo['balance'], $message); |
|
1094 | - break; |
|
1095 | - case 'voip_child_account_refilled': |
|
1096 | - $reseller_number= $this->CI->common->get_field_name('number', 'accounts', $accountinfo['reseller_id']); |
|
1097 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1098 | - $message = str_replace('#REFILLBALANCE#', $accountinfo['refill_amount'], $message); |
|
1099 | - $message = str_replace('#BALANCE#', $accountinfo['balance'], $message); |
|
1100 | - $message = str_replace('#ACCOUNTNUMBER#',$reseller_number, $message); |
|
1101 | - break; |
|
1102 | - case 'add_subscription': |
|
1103 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1104 | - break; |
|
1105 | - case 'remove_subscription': |
|
1106 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1107 | - break; |
|
1108 | - case 'add_package': |
|
1109 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1110 | - break; |
|
1111 | - case 'remove_package': |
|
1112 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1113 | - break; |
|
1114 | - case 'email_calling_card': |
|
1115 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1116 | - $message = str_replace('#CARDNUMBER#', $accountinfo['cardnumber'], $message); |
|
1117 | - $message = str_replace('#PIN#', $accountinfo['pin'], $message); |
|
1118 | - $message = str_replace('#BALANCE#', $accountinfo['balance'], $message); |
|
1119 | - break; |
|
1120 | - case 'email_low_balance'; |
|
1121 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1122 | - $to_currency = $this->CI->common->get_field_name('currency', 'currency', $accountinfo['currency_id']); |
|
1123 | - $balance = $this->CI->common_model->calculate_currency($accountinfo['balance'], "", $to_currency, true, true); |
|
1124 | - $message = str_replace('#BALANCE#', $accountinfo['balance'], $message); |
|
1125 | - break; |
|
1126 | - case 'email_new_invoice'; |
|
1127 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1128 | - $message = str_replace('#AMOUNT#', $amount, $message); |
|
1129 | - $message = str_replace('#INVOICE_NUMBER#', $amount, $message); |
|
1130 | - $subject = $query[0]->subject; |
|
1131 | - $subject = str_replace("#INVOICE_NUMBER#", $amount, $subject); |
|
1132 | - break; |
|
1133 | - case 'email_add_did'; |
|
1090 | + case 'voip_account_refilled': |
|
1091 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1092 | + $message = str_replace('#REFILLBALANCE#', $accountinfo['refill_amount'], $message); |
|
1093 | + $message = str_replace('#BALANCE#', $accountinfo['refill_amount'] + $accountinfo['balance'], $message); |
|
1094 | + break; |
|
1095 | + case 'voip_child_account_refilled': |
|
1096 | + $reseller_number= $this->CI->common->get_field_name('number', 'accounts', $accountinfo['reseller_id']); |
|
1097 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1098 | + $message = str_replace('#REFILLBALANCE#', $accountinfo['refill_amount'], $message); |
|
1099 | + $message = str_replace('#BALANCE#', $accountinfo['balance'], $message); |
|
1100 | + $message = str_replace('#ACCOUNTNUMBER#',$reseller_number, $message); |
|
1101 | + break; |
|
1102 | + case 'add_subscription': |
|
1103 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1104 | + break; |
|
1105 | + case 'remove_subscription': |
|
1106 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1107 | + break; |
|
1108 | + case 'add_package': |
|
1109 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1110 | + break; |
|
1111 | + case 'remove_package': |
|
1112 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1113 | + break; |
|
1114 | + case 'email_calling_card': |
|
1115 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1116 | + $message = str_replace('#CARDNUMBER#', $accountinfo['cardnumber'], $message); |
|
1117 | + $message = str_replace('#PIN#', $accountinfo['pin'], $message); |
|
1118 | + $message = str_replace('#BALANCE#', $accountinfo['balance'], $message); |
|
1119 | + break; |
|
1120 | + case 'email_low_balance'; |
|
1121 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1122 | + $to_currency = $this->CI->common->get_field_name('currency', 'currency', $accountinfo['currency_id']); |
|
1123 | + $balance = $this->CI->common_model->calculate_currency($accountinfo['balance'], "", $to_currency, true, true); |
|
1124 | + $message = str_replace('#BALANCE#', $accountinfo['balance'], $message); |
|
1125 | + break; |
|
1126 | + case 'email_new_invoice'; |
|
1127 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1128 | + $message = str_replace('#AMOUNT#', $amount, $message); |
|
1129 | + $message = str_replace('#INVOICE_NUMBER#', $amount, $message); |
|
1130 | + $subject = $query[0]->subject; |
|
1131 | + $subject = str_replace("#INVOICE_NUMBER#", $amount, $subject); |
|
1132 | + break; |
|
1133 | + case 'email_add_did'; |
|
1134 | 1134 | if(isset($accountinfo['did_maxchannels']) && $accountinfo['did_maxchannels']!= ""){ |
1135 | 1135 | $accountinfo['did_maxchannels'] = $accountinfo['did_maxchannels']; |
1136 | 1136 | }else if($accountinfo['did_maxchannels'] == "0"){ |
@@ -1138,758 +1138,758 @@ discard block |
||
1138 | 1138 | }else{ |
1139 | 1139 | $accountinfo['did_maxchannels'] = "Unlimited"; |
1140 | 1140 | } |
1141 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1142 | - $message = str_replace('#DIDNUMBER#', $accountinfo['did_number'] , $message); |
|
1143 | - $message = str_replace('#COUNTRYNAME#',$accountinfo['did_country_id'], $message); |
|
1144 | - $message = str_replace('#SETUPFEE#',$accountinfo['did_setup'], $message); |
|
1145 | - $message = str_replace('#MONTHLYFEE#',$accountinfo['did_monthlycost'], $message); |
|
1146 | - $message = str_replace('#MAXCHANNEL#',$accountinfo['did_maxchannels'], $message); |
|
1147 | - $message = str_replace('#NUMBER#', $accountinfo['number'], $message); |
|
1141 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1142 | + $message = str_replace('#DIDNUMBER#', $accountinfo['did_number'] , $message); |
|
1143 | + $message = str_replace('#COUNTRYNAME#',$accountinfo['did_country_id'], $message); |
|
1144 | + $message = str_replace('#SETUPFEE#',$accountinfo['did_setup'], $message); |
|
1145 | + $message = str_replace('#MONTHLYFEE#',$accountinfo['did_monthlycost'], $message); |
|
1146 | + $message = str_replace('#MAXCHANNEL#',$accountinfo['did_maxchannels'], $message); |
|
1147 | + $message = str_replace('#NUMBER#', $accountinfo['number'], $message); |
|
1148 | 1148 | $subject = $query[0]->subject; |
1149 | 1149 | $subject = str_replace("#NUMBER#", $accountinfo['number'], $subject); |
1150 | 1150 | $subject = str_replace("#DIDNUMBER#", $accountinfo['did_number'], $subject); |
1151 | - break; |
|
1152 | - case 'email_remove_did'; |
|
1153 | - $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1154 | - $message = str_replace('#DIDNUMBER#', $accountinfo['did_number'],$message); |
|
1155 | - $message = str_replace('#NUMBER#', $accountinfo['number'], $message); |
|
1151 | + break; |
|
1152 | + case 'email_remove_did'; |
|
1153 | + $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
|
1154 | + $message = str_replace('#DIDNUMBER#', $accountinfo['did_number'],$message); |
|
1155 | + $message = str_replace('#NUMBER#', $accountinfo['number'], $message); |
|
1156 | 1156 | $subject = $query[0]->subject; |
1157 | 1157 | $subject = str_replace("#NUMBER#", $accountinfo['number'], $subject); |
1158 | 1158 | $subject = str_replace("#DIDNUMBER#", $accountinfo['did_number'], $subject); |
1159 | - break; |
|
1160 | - } |
|
1159 | + break; |
|
1160 | + } |
|
1161 | 1161 | |
1162 | - if($subject == ""){ |
|
1162 | + if($subject == ""){ |
|
1163 | 1163 | $subject = $query[0]->subject; |
1164 | 1164 | $subject = str_replace("#NAME#", $accountinfo['first_name'] . " " . $accountinfo['last_name'], $subject); |
1165 | 1165 | $subject = str_replace("#COMPANY_NAME#", $company_name, $subject); |
1166 | 1166 | } |
1167 | - $account_id = (isset($accountinfo['last_id']) && $accountinfo['last_id'] != "") ? $accountinfo['last_id'] : $accountinfo['id']; |
|
1168 | - $reseller_id = $accountinfo['reseller_id']; |
|
1169 | - if ($reseller_id != "0") { |
|
1170 | - $reseller_result = $this->CI->db_model->getSelect("email", "accounts", array("id" => $reseller_id)); |
|
1171 | - $reseller_info = (array)$reseller_result->first_row(); |
|
1172 | - $settings_reply_email = $reseller_info['email']; |
|
1173 | - } |
|
1174 | - $this->emailFunction($settings_reply_email, $useremail, $subject, $message, $company_name, $attachment, $account_id, $reseller_id); |
|
1175 | - |
|
1176 | - } |
|
1177 | - |
|
1178 | - function emailFunction($from, $to, $subject, $message, $company_name = "", $attachment = "", $account_id, $reseller_id) { |
|
1179 | - $send_mail_details = array('from' => $from, |
|
1180 | - 'to' => $to, |
|
1181 | - 'subject' => $subject, |
|
1182 | - 'body' => $message, |
|
1183 | - 'accountid' => $account_id, |
|
1184 | - 'status' => '1', |
|
1185 | - 'attachment' => $attachment, |
|
1186 | - 'reseller_id' => $reseller_id, |
|
1187 | - ); |
|
1167 | + $account_id = (isset($accountinfo['last_id']) && $accountinfo['last_id'] != "") ? $accountinfo['last_id'] : $accountinfo['id']; |
|
1168 | + $reseller_id = $accountinfo['reseller_id']; |
|
1169 | + if ($reseller_id != "0") { |
|
1170 | + $reseller_result = $this->CI->db_model->getSelect("email", "accounts", array("id" => $reseller_id)); |
|
1171 | + $reseller_info = (array)$reseller_result->first_row(); |
|
1172 | + $settings_reply_email = $reseller_info['email']; |
|
1173 | + } |
|
1174 | + $this->emailFunction($settings_reply_email, $useremail, $subject, $message, $company_name, $attachment, $account_id, $reseller_id); |
|
1175 | + |
|
1176 | + } |
|
1177 | + |
|
1178 | + function emailFunction($from, $to, $subject, $message, $company_name = "", $attachment = "", $account_id, $reseller_id) { |
|
1179 | + $send_mail_details = array('from' => $from, |
|
1180 | + 'to' => $to, |
|
1181 | + 'subject' => $subject, |
|
1182 | + 'body' => $message, |
|
1183 | + 'accountid' => $account_id, |
|
1184 | + 'status' => '1', |
|
1185 | + 'attachment' => $attachment, |
|
1186 | + 'reseller_id' => $reseller_id, |
|
1187 | + ); |
|
1188 | 1188 | |
1189 | - $this->CI->db->insert('mail_details', $send_mail_details); |
|
1190 | - return $this->CI->db->insert_id(); |
|
1191 | - } |
|
1189 | + $this->CI->db->insert('mail_details', $send_mail_details); |
|
1190 | + return $this->CI->db->insert_id(); |
|
1191 | + } |
|
1192 | 1192 | |
1193 | - /* |
|
1193 | + /* |
|
1194 | 1194 | convert GMT id 0000 condition |
1195 | 1195 | */ |
1196 | 1196 | |
1197 | - function convert_GMT_to($select = "", $table = "", $date) { |
|
1198 | - if ($date == '0000-00-00 00:00:00') { |
|
1199 | - return $date; |
|
1200 | - } else { |
|
1201 | - return $this->CI->timezone->display_GMT($date); |
|
1202 | - } |
|
1203 | - } |
|
1204 | - |
|
1205 | - function convert_GMT($date) { |
|
1206 | - return $this->CI->timezone->convert_to_GMT($select = "", $table = "", $date); |
|
1207 | - } |
|
1208 | - |
|
1209 | - function convert_to_ucfirst($select = "", $table = "", $str_value) { |
|
1210 | - return ucfirst($str_value); |
|
1211 | - } |
|
1212 | - |
|
1213 | - function set_charge_type($status = '') { |
|
1214 | - $status_array = array('1' => 'Accounts', '2' => 'Rate Group'); |
|
1215 | - return $status_array; |
|
1216 | - } |
|
1217 | - |
|
1218 | - function build_concat_string($select, $table, $id_where = '') { |
|
1219 | - $select_params = explode(',', $select); |
|
1220 | - $where = array("1"); |
|
1221 | - if ($id_where != '') { |
|
1222 | - $where = array("id" => $id_where); |
|
1223 | - } |
|
1224 | - $select_params = explode(',', $select); |
|
1225 | - if (isset($select_params[3])) { |
|
1226 | - $cnt_str = " $select_params[0],' ',$select_params[1],' ','(',$select_params[2],')' "; |
|
1227 | - } else { |
|
1228 | - $cnt_str = " $select_params[0],' (',$select_params[1],')' "; |
|
1229 | - } |
|
1230 | - $select = "concat($cnt_str) as $select_params[0] "; |
|
1231 | - $drp_array = $this->CI->db_model->getSelect($select, $table, $where); |
|
1232 | - $drp_array = $drp_array->result(); |
|
1233 | - if (isset($drp_array[0])) |
|
1234 | - return $drp_array[0]->$select_params[0]; |
|
1235 | - } |
|
1236 | - |
|
1237 | - /* |
|
1197 | + function convert_GMT_to($select = "", $table = "", $date) { |
|
1198 | + if ($date == '0000-00-00 00:00:00') { |
|
1199 | + return $date; |
|
1200 | + } else { |
|
1201 | + return $this->CI->timezone->display_GMT($date); |
|
1202 | + } |
|
1203 | + } |
|
1204 | + |
|
1205 | + function convert_GMT($date) { |
|
1206 | + return $this->CI->timezone->convert_to_GMT($select = "", $table = "", $date); |
|
1207 | + } |
|
1208 | + |
|
1209 | + function convert_to_ucfirst($select = "", $table = "", $str_value) { |
|
1210 | + return ucfirst($str_value); |
|
1211 | + } |
|
1212 | + |
|
1213 | + function set_charge_type($status = '') { |
|
1214 | + $status_array = array('1' => 'Accounts', '2' => 'Rate Group'); |
|
1215 | + return $status_array; |
|
1216 | + } |
|
1217 | + |
|
1218 | + function build_concat_string($select, $table, $id_where = '') { |
|
1219 | + $select_params = explode(',', $select); |
|
1220 | + $where = array("1"); |
|
1221 | + if ($id_where != '') { |
|
1222 | + $where = array("id" => $id_where); |
|
1223 | + } |
|
1224 | + $select_params = explode(',', $select); |
|
1225 | + if (isset($select_params[3])) { |
|
1226 | + $cnt_str = " $select_params[0],' ',$select_params[1],' ','(',$select_params[2],')' "; |
|
1227 | + } else { |
|
1228 | + $cnt_str = " $select_params[0],' (',$select_params[1],')' "; |
|
1229 | + } |
|
1230 | + $select = "concat($cnt_str) as $select_params[0] "; |
|
1231 | + $drp_array = $this->CI->db_model->getSelect($select, $table, $where); |
|
1232 | + $drp_array = $drp_array->result(); |
|
1233 | + if (isset($drp_array[0])) |
|
1234 | + return $drp_array[0]->$select_params[0]; |
|
1235 | + } |
|
1236 | + |
|
1237 | + /* |
|
1238 | 1238 | * Change invoice_total to invoice details |
1239 | 1239 | */ |
1240 | 1240 | |
1241 | - function get_invoice_total($select = '', $table = '', $id) { |
|
1242 | - $where_arr = array('invoiceid' => $id, 'item_type <>' => "FREE"); |
|
1243 | - $this->CI->db->where($where_arr); |
|
1244 | - $this->CI->db->select('*'); |
|
1245 | - $result = $this->CI->db->get('invoice_details'); |
|
1246 | - if ($result->num_rows() > 0) { |
|
1247 | - $result = $result->result_array(); |
|
1248 | - if($select == 'debit'){ |
|
1241 | + function get_invoice_total($select = '', $table = '', $id) { |
|
1242 | + $where_arr = array('invoiceid' => $id, 'item_type <>' => "FREE"); |
|
1243 | + $this->CI->db->where($where_arr); |
|
1244 | + $this->CI->db->select('*'); |
|
1245 | + $result = $this->CI->db->get('invoice_details'); |
|
1246 | + if ($result->num_rows() > 0) { |
|
1247 | + $result = $result->result_array(); |
|
1248 | + if($select == 'debit'){ |
|
1249 | 1249 | if($result[0]['item_type'] == 'POSTCHARG'){ |
1250 | - return $this->convert_to_currency('', '', $result[0]['debit']); |
|
1250 | + return $this->convert_to_currency('', '', $result[0]['debit']); |
|
1251 | 1251 | }else{ |
1252 | - return $this->convert_to_currency('', '', $result[0]['credit']); |
|
1252 | + return $this->convert_to_currency('', '', $result[0]['credit']); |
|
1253 | 1253 | } |
1254 | - }else{ |
|
1254 | + }else{ |
|
1255 | 1255 | return $result[0][$select]; |
1256 | - } |
|
1257 | - } else { |
|
1258 | - return null; |
|
1259 | - } |
|
1260 | - } |
|
1261 | - |
|
1262 | - function get_array($select, $table_name, $where = false) { |
|
1263 | - $new_array = array(); |
|
1264 | - $select_params = array(); |
|
1265 | - $select_params = explode(",", $select); |
|
1266 | - if (isset($select_params[3])) { |
|
1267 | - $cnt_str = " $select_params[1],'(',$select_params[2],' ',$select_params[3],')' "; |
|
1268 | - $select = "concat($cnt_str) as $select_params[3] "; |
|
1269 | - $field_name = $select_params[3]; |
|
1270 | - } elseif (isset($select_params[2])) { |
|
1271 | - $cnt_str = " $select_params[1],' ','(',$select_params[2],')' "; |
|
1272 | - $select = "concat($cnt_str) as $select_params[2] "; |
|
1273 | - $field_name = $select_params[2]; |
|
1274 | - } else { |
|
1275 | - $select = $select_params[1]; |
|
1276 | - $field_name = $select_params[1]; |
|
1277 | - } |
|
1278 | - if ($where) { |
|
1279 | - $this->CI->db->where($where); |
|
1280 | - } |
|
1281 | - $this->CI->db->select("$select_params[0],$select", false); |
|
1282 | - $result = $this->CI->db->get($table_name); |
|
1283 | - foreach ($result->result_array() as $key => $value) { |
|
1284 | - $new_array[$value[$select_params[0]]] = $value[$field_name]; |
|
1285 | - } |
|
1286 | - ksort($new_array); |
|
1287 | - return $new_array; |
|
1288 | - } |
|
1289 | - |
|
1290 | - function get_timezone_offset() { |
|
1291 | - $gmtoffset = 0; |
|
1292 | - $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
1293 | - $account_result = $this->CI->db->get_where('accounts', array('id' => $accountinfo['id'])); |
|
1294 | - $account_result = $account_result->result_array(); |
|
1295 | - $accountinfo = $account_result[0]; |
|
1296 | - $timezone_id_arr = array($accountinfo['timezone_id']); |
|
1297 | - $this->CI->db->where_in('id', $timezone_id_arr); |
|
1298 | - $this->CI->db->select('gmtoffset'); |
|
1299 | - $this->CI->db->from('timezone'); |
|
1300 | - $timezone_result = $this->CI->db->get(); |
|
1301 | - if ($timezone_result->num_rows() > 0) { |
|
1302 | - |
|
1303 | - $timezone_result = $timezone_result->result_array(); |
|
1304 | - foreach ($timezone_result as $data) { |
|
1305 | - $gmtoffset+=$data['gmtoffset']; |
|
1306 | - } |
|
1307 | - } |
|
1256 | + } |
|
1257 | + } else { |
|
1258 | + return null; |
|
1259 | + } |
|
1260 | + } |
|
1261 | + |
|
1262 | + function get_array($select, $table_name, $where = false) { |
|
1263 | + $new_array = array(); |
|
1264 | + $select_params = array(); |
|
1265 | + $select_params = explode(",", $select); |
|
1266 | + if (isset($select_params[3])) { |
|
1267 | + $cnt_str = " $select_params[1],'(',$select_params[2],' ',$select_params[3],')' "; |
|
1268 | + $select = "concat($cnt_str) as $select_params[3] "; |
|
1269 | + $field_name = $select_params[3]; |
|
1270 | + } elseif (isset($select_params[2])) { |
|
1271 | + $cnt_str = " $select_params[1],' ','(',$select_params[2],')' "; |
|
1272 | + $select = "concat($cnt_str) as $select_params[2] "; |
|
1273 | + $field_name = $select_params[2]; |
|
1274 | + } else { |
|
1275 | + $select = $select_params[1]; |
|
1276 | + $field_name = $select_params[1]; |
|
1277 | + } |
|
1278 | + if ($where) { |
|
1279 | + $this->CI->db->where($where); |
|
1280 | + } |
|
1281 | + $this->CI->db->select("$select_params[0],$select", false); |
|
1282 | + $result = $this->CI->db->get($table_name); |
|
1283 | + foreach ($result->result_array() as $key => $value) { |
|
1284 | + $new_array[$value[$select_params[0]]] = $value[$field_name]; |
|
1285 | + } |
|
1286 | + ksort($new_array); |
|
1287 | + return $new_array; |
|
1288 | + } |
|
1289 | + |
|
1290 | + function get_timezone_offset() { |
|
1291 | + $gmtoffset = 0; |
|
1292 | + $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
1293 | + $account_result = $this->CI->db->get_where('accounts', array('id' => $accountinfo['id'])); |
|
1294 | + $account_result = $account_result->result_array(); |
|
1295 | + $accountinfo = $account_result[0]; |
|
1296 | + $timezone_id_arr = array($accountinfo['timezone_id']); |
|
1297 | + $this->CI->db->where_in('id', $timezone_id_arr); |
|
1298 | + $this->CI->db->select('gmtoffset'); |
|
1299 | + $this->CI->db->from('timezone'); |
|
1300 | + $timezone_result = $this->CI->db->get(); |
|
1301 | + if ($timezone_result->num_rows() > 0) { |
|
1302 | + |
|
1303 | + $timezone_result = $timezone_result->result_array(); |
|
1304 | + foreach ($timezone_result as $data) { |
|
1305 | + $gmtoffset+=$data['gmtoffset']; |
|
1306 | + } |
|
1307 | + } |
|
1308 | 1308 | // echo $gmtoffset;exit; |
1309 | - return $gmtoffset; |
|
1310 | - } |
|
1311 | - /** Version 2.1 |
|
1312 | - * Purpose : Set default data for new created profile |
|
1313 | - * */ |
|
1314 | - function sip_profile_date() { |
|
1315 | - $defualt_profile_data = '{"rtp_ip":"$${local_ip_v4}","dialplan":"XML","user-agent-string":"ASTPP","debug":"0","sip-trace":"no","tls":"false","inbound-reg-force-matching-username":"true","disable-transcoding":"true","all-reg-options-ping":"false","unregister-on-options-fail":"true","log-auth-failures":"true","status":"0","inbound-bypass-media":"false","inbound-proxy-media":"false","disable-transfer":"true","enable-100rel":"false","rtp-timeout-sec":"60","dtmf-duration":"2000","manual-redirect":"false","aggressive-nat-detection":"false","enable-timer":"false","minimum-session-expires":"120","session-timeout-pt":"1800","auth-calls":"true","apply-inbound-acl":"default","inbound-codec-prefs":"PCMU,PCMA,G729","outbound-codec-prefs":"PCMU,PCMA,G729","inbound-late-negotiation":"false"}'; |
|
1316 | - return $defualt_profile_data; |
|
1317 | - } |
|
1309 | + return $gmtoffset; |
|
1310 | + } |
|
1311 | + /** Version 2.1 |
|
1312 | + * Purpose : Set default data for new created profile |
|
1313 | + * */ |
|
1314 | + function sip_profile_date() { |
|
1315 | + $defualt_profile_data = '{"rtp_ip":"$${local_ip_v4}","dialplan":"XML","user-agent-string":"ASTPP","debug":"0","sip-trace":"no","tls":"false","inbound-reg-force-matching-username":"true","disable-transcoding":"true","all-reg-options-ping":"false","unregister-on-options-fail":"true","log-auth-failures":"true","status":"0","inbound-bypass-media":"false","inbound-proxy-media":"false","disable-transfer":"true","enable-100rel":"false","rtp-timeout-sec":"60","dtmf-duration":"2000","manual-redirect":"false","aggressive-nat-detection":"false","enable-timer":"false","minimum-session-expires":"120","session-timeout-pt":"1800","auth-calls":"true","apply-inbound-acl":"default","inbound-codec-prefs":"PCMU,PCMA,G729","outbound-codec-prefs":"PCMU,PCMA,G729","inbound-late-negotiation":"false"}'; |
|
1316 | + return $defualt_profile_data; |
|
1317 | + } |
|
1318 | 1318 | |
1319 | - /* ===================================================================== */ |
|
1320 | - /* |
|
1319 | + /* ===================================================================== */ |
|
1320 | + /* |
|
1321 | 1321 | * Purpose : Add following for mass mail and mail history |
1322 | 1322 | * Version 2.1 |
1323 | 1323 | */ |
1324 | 1324 | |
1325 | - function set_search_temp($select = '') { |
|
1326 | - $status_array = array("0" => "--Select--", |
|
1327 | - "1" => "Voip account refilled", |
|
1328 | - "3" => "Email add user", |
|
1329 | - "4" => "Add sip device", |
|
1330 | - "8" => "Email add did", |
|
1331 | - "9" => "Email remove did", |
|
1332 | - "10" => "Email new invoice", |
|
1333 | - "11" => "Email low balance", |
|
1334 | - "12" => "Email signup confirmation", |
|
1335 | - "13" => "Password successfully changed", |
|
1336 | - "14" => "Reset your password", |
|
1337 | - "15" => "Email add subscription", |
|
1338 | - "16" => "Email remove subscription", |
|
1339 | - "17" => "Email add package", |
|
1340 | - "18" => "Email remove package", |
|
1341 | - "19" => "Voip child accont refilled", |
|
1342 | - ); |
|
1343 | - return $status_array; |
|
1344 | - } |
|
1345 | - |
|
1346 | - /* *** |
|
1325 | + function set_search_temp($select = '') { |
|
1326 | + $status_array = array("0" => "--Select--", |
|
1327 | + "1" => "Voip account refilled", |
|
1328 | + "3" => "Email add user", |
|
1329 | + "4" => "Add sip device", |
|
1330 | + "8" => "Email add did", |
|
1331 | + "9" => "Email remove did", |
|
1332 | + "10" => "Email new invoice", |
|
1333 | + "11" => "Email low balance", |
|
1334 | + "12" => "Email signup confirmation", |
|
1335 | + "13" => "Password successfully changed", |
|
1336 | + "14" => "Reset your password", |
|
1337 | + "15" => "Email add subscription", |
|
1338 | + "16" => "Email remove subscription", |
|
1339 | + "17" => "Email add package", |
|
1340 | + "18" => "Email remove package", |
|
1341 | + "19" => "Voip child accont refilled", |
|
1342 | + ); |
|
1343 | + return $status_array; |
|
1344 | + } |
|
1345 | + |
|
1346 | + /* *** |
|
1347 | 1347 | Refill coupon dropdown |
1348 | 1348 | * ** */ |
1349 | 1349 | |
1350 | - function set_refill_coupon_status($select = '', $table = '', $status = '') { |
|
1351 | - $refill_coupon_array = array("" => "--Select--", '2' => 'Yes', '0' => 'No'); |
|
1352 | - return $refill_coupon_array; |
|
1353 | - } |
|
1350 | + function set_refill_coupon_status($select = '', $table = '', $status = '') { |
|
1351 | + $refill_coupon_array = array("" => "--Select--", '2' => 'Yes', '0' => 'No'); |
|
1352 | + return $refill_coupon_array; |
|
1353 | + } |
|
1354 | 1354 | |
1355 | - function get_refill_coupon_status($select = '', $table = '', $status) { |
|
1356 | - $refill_coupon_array = array('0' => 'Inactive', '1' => 'Active', '2' => 'Inuse', "3" => "Expired"); |
|
1357 | - return $refill_coupon_array[$status]; |
|
1358 | - } |
|
1355 | + function get_refill_coupon_status($select = '', $table = '', $status) { |
|
1356 | + $refill_coupon_array = array('0' => 'Inactive', '1' => 'Active', '2' => 'Inuse', "3" => "Expired"); |
|
1357 | + return $refill_coupon_array[$status]; |
|
1358 | + } |
|
1359 | 1359 | |
1360 | - function firstused_check($select = '', $table = '', $status) { |
|
1360 | + function firstused_check($select = '', $table = '', $status) { |
|
1361 | 1361 | |
1362 | - if ($status == '0000-00-00 00:00:00') { |
|
1363 | - return '-'; |
|
1364 | - } |
|
1365 | - return $status; |
|
1366 | - } |
|
1362 | + if ($status == '0000-00-00 00:00:00') { |
|
1363 | + return '-'; |
|
1364 | + } |
|
1365 | + return $status; |
|
1366 | + } |
|
1367 | 1367 | |
1368 | - function get_refill_coupon_used($select = '', $table = '', $status) { |
|
1369 | - return $status['status'] == 2 ? '<img src= "'.base_url().'assets/images/true.png" style="height:20px;width:20px;" title="Yes">' : '<img src= "'. base_url().'/assets/images/false.png" style="height:20px;width:20px;" title="No">'; |
|
1370 | - } |
|
1368 | + function get_refill_coupon_used($select = '', $table = '', $status) { |
|
1369 | + return $status['status'] == 2 ? '<img src= "'.base_url().'assets/images/true.png" style="height:20px;width:20px;" title="Yes">' : '<img src= "'. base_url().'/assets/images/false.png" style="height:20px;width:20px;" title="No">'; |
|
1370 | + } |
|
1371 | 1371 | |
1372 | - /* * ******* |
|
1372 | + /* * ******* |
|
1373 | 1373 | Password encode decode |
1374 | 1374 | * ******* */ |
1375 | 1375 | |
1376 | - function encode_params($string) { |
|
1377 | - $data = base64_encode($string); |
|
1378 | - $data = str_replace(array('+', '/', '='), array('-', '$', ''), $data); |
|
1379 | - return $data; |
|
1380 | - } |
|
1381 | - |
|
1382 | - function encode($value) { |
|
1383 | - $text = $value; |
|
1384 | - $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
1385 | - $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
1386 | - $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->CI->config->item('private_key'), $text, MCRYPT_MODE_ECB, $iv); |
|
1387 | - return trim($this->encode_params($crypttext)); |
|
1388 | - } |
|
1389 | - |
|
1390 | - function decode_params($string) { |
|
1391 | - $data = str_replace(array('-', '$'), array('+', '/'), $string); |
|
1392 | - $mod4 = strlen($data) % 4; |
|
1393 | - if ($mod4) { |
|
1394 | - $data .= substr('====', $mod4); |
|
1395 | - } |
|
1396 | - return base64_decode($data); |
|
1397 | - } |
|
1398 | - |
|
1399 | - function decode($value) { |
|
1400 | - $crypttext = $this->decode_params($value); |
|
1401 | - $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
1402 | - $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
1403 | - $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->CI->config->item('private_key'), $crypttext, MCRYPT_MODE_ECB, $iv); |
|
1404 | - return trim($decrypttext); |
|
1405 | - } |
|
1406 | - |
|
1407 | - /****** |
|
1376 | + function encode_params($string) { |
|
1377 | + $data = base64_encode($string); |
|
1378 | + $data = str_replace(array('+', '/', '='), array('-', '$', ''), $data); |
|
1379 | + return $data; |
|
1380 | + } |
|
1381 | + |
|
1382 | + function encode($value) { |
|
1383 | + $text = $value; |
|
1384 | + $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
1385 | + $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
1386 | + $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->CI->config->item('private_key'), $text, MCRYPT_MODE_ECB, $iv); |
|
1387 | + return trim($this->encode_params($crypttext)); |
|
1388 | + } |
|
1389 | + |
|
1390 | + function decode_params($string) { |
|
1391 | + $data = str_replace(array('-', '$'), array('+', '/'), $string); |
|
1392 | + $mod4 = strlen($data) % 4; |
|
1393 | + if ($mod4) { |
|
1394 | + $data .= substr('====', $mod4); |
|
1395 | + } |
|
1396 | + return base64_decode($data); |
|
1397 | + } |
|
1398 | + |
|
1399 | + function decode($value) { |
|
1400 | + $crypttext = $this->decode_params($value); |
|
1401 | + $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
1402 | + $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
1403 | + $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->CI->config->item('private_key'), $crypttext, MCRYPT_MODE_ECB, $iv); |
|
1404 | + return trim($decrypttext); |
|
1405 | + } |
|
1406 | + |
|
1407 | + /****** |
|
1408 | 1408 | Recording enable/disable dropdown |
1409 | 1409 | * ** */ |
1410 | 1410 | |
1411 | - function set_recording($status = '') { |
|
1412 | - $status_array = array('0' => 'On', '1' => 'Off',); |
|
1413 | - return $status_array; |
|
1414 | - } |
|
1411 | + function set_recording($status = '') { |
|
1412 | + $status_array = array('0' => 'On', '1' => 'Off',); |
|
1413 | + return $status_array; |
|
1414 | + } |
|
1415 | 1415 | |
1416 | - /* * ************************** */ |
|
1416 | + /* * ************************** */ |
|
1417 | 1417 | |
1418 | - function email_status($select = "", $table = "", $status) { |
|
1419 | - $status = ($status['status'] == 0) ? "Sent" : "Not Sent"; |
|
1418 | + function email_status($select = "", $table = "", $status) { |
|
1419 | + $status = ($status['status'] == 0) ? "Sent" : "Not Sent"; |
|
1420 | 1420 | return $status; |
1421 | - } |
|
1421 | + } |
|
1422 | 1422 | |
1423 | - function email_search_status($select = '') { |
|
1424 | - $status_array = array("" => "--Select--", |
|
1425 | - "0" => "Sent", |
|
1426 | - "1" => "Not Sent" |
|
1427 | - ); |
|
1428 | - return $status_array; |
|
1429 | - } |
|
1423 | + function email_search_status($select = '') { |
|
1424 | + $status_array = array("" => "--Select--", |
|
1425 | + "0" => "Sent", |
|
1426 | + "1" => "Not Sent" |
|
1427 | + ); |
|
1428 | + return $status_array; |
|
1429 | + } |
|
1430 | 1430 | |
1431 | - /* ===================================================================== */ |
|
1431 | + /* ===================================================================== */ |
|
1432 | 1432 | |
1433 | 1433 | |
1434 | - /* |
|
1434 | + /* |
|
1435 | 1435 | * Purpose : Add following for setting page |
1436 | 1436 | * Version 2.1 |
1437 | 1437 | */ |
1438 | 1438 | |
1439 | - function paypal_status($status = '') { |
|
1440 | - $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1441 | - return $status_array; |
|
1442 | - } |
|
1443 | - function playback_audio_notification($status = '') { |
|
1444 | - $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1445 | - return $status_array; |
|
1446 | - } |
|
1447 | - function custom_status($status){ |
|
1439 | + function paypal_status($status = '') { |
|
1440 | + $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1441 | + return $status_array; |
|
1442 | + } |
|
1443 | + function playback_audio_notification($status = '') { |
|
1444 | + $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1445 | + return $status_array; |
|
1446 | + } |
|
1447 | + function custom_status($status){ |
|
1448 | 1448 | $status_array = array('0' => 'Yes', '1' => 'No'); |
1449 | - return $status_array; |
|
1450 | - } |
|
1449 | + return $status_array; |
|
1450 | + } |
|
1451 | 1451 | |
1452 | - function custom_status_active($status){ |
|
1453 | - $status_array = array('0' => 'Active', '1' => 'InActive'); |
|
1454 | - return $status_array; |
|
1455 | - } |
|
1456 | - function custom_status_true($status){ |
|
1457 | - $status_array = array('0' => 'TRUE', '1' => 'FALSE'); |
|
1458 | - return $status_array; |
|
1459 | - } |
|
1460 | - function custom_status_voicemail($status){ |
|
1461 | - $status_array = array('true' => 'True', 'false' => 'False'); |
|
1462 | - return $status_array; |
|
1463 | - } |
|
1464 | - |
|
1465 | - /****** |
|
1452 | + function custom_status_active($status){ |
|
1453 | + $status_array = array('0' => 'Active', '1' => 'InActive'); |
|
1454 | + return $status_array; |
|
1455 | + } |
|
1456 | + function custom_status_true($status){ |
|
1457 | + $status_array = array('0' => 'TRUE', '1' => 'FALSE'); |
|
1458 | + return $status_array; |
|
1459 | + } |
|
1460 | + function custom_status_voicemail($status){ |
|
1461 | + $status_array = array('true' => 'True', 'false' => 'False'); |
|
1462 | + return $status_array; |
|
1463 | + } |
|
1464 | + |
|
1465 | + /****** |
|
1466 | 1466 | For enable Signup module |
1467 | 1467 | * */ |
1468 | - function create_sipdevice($status = '') { |
|
1469 | - $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1470 | - return $status_array; |
|
1471 | - } |
|
1468 | + function create_sipdevice($status = '') { |
|
1469 | + $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1470 | + return $status_array; |
|
1471 | + } |
|
1472 | 1472 | |
1473 | - function enable_signup($status = '') { |
|
1474 | - $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1475 | - return $status_array; |
|
1476 | - } |
|
1473 | + function enable_signup($status = '') { |
|
1474 | + $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1475 | + return $status_array; |
|
1476 | + } |
|
1477 | 1477 | |
1478 | 1478 | function balance_announce($status = '') { |
1479 | - $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1480 | - return $status_array; |
|
1481 | - } |
|
1479 | + $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1480 | + return $status_array; |
|
1481 | + } |
|
1482 | 1482 | function minutes_announce($status = '') { |
1483 | - $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1484 | - return $status_array; |
|
1485 | - } |
|
1483 | + $status_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1484 | + return $status_array; |
|
1485 | + } |
|
1486 | 1486 | |
1487 | - function enable_disable_option(){ |
|
1488 | - $option_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1489 | - return $option_array; |
|
1490 | - } |
|
1491 | - |
|
1492 | - function paypal_mode($status = '') { |
|
1493 | - $status_array = array('0' => 'Live', '1' => 'Sandbox',); |
|
1494 | - return $status_array; |
|
1495 | - } |
|
1496 | - |
|
1497 | - function paypal_fee($status = '') { |
|
1498 | - $status_array = array('0' => 'Paid By Admin', '1' => 'Paid By Customer',); |
|
1499 | - return $status_array; |
|
1500 | - } |
|
1501 | - |
|
1502 | - function email() { |
|
1503 | - $status_array = array('1' => 'Enable', '0' => 'Disable',); |
|
1504 | - return $status_array; |
|
1505 | - } |
|
1506 | - |
|
1507 | - function smtp() { |
|
1508 | - return $this->set_allow(); |
|
1509 | - } |
|
1510 | - |
|
1511 | - function debug() { |
|
1512 | - $status_array = array('1' => 'Enable', '0' => 'Disable',); |
|
1513 | - return $status_array; |
|
1514 | - } |
|
1515 | - function default_signup_rategroup(){ |
|
1516 | - $this->CI->db->select("id,name"); |
|
1517 | - $this->CI->db->where("status",0); |
|
1518 | - $this->CI->db->where("reseller_id",0); |
|
1519 | - $pricelist_result=$this->CI->db->get("pricelists")->result_array(); |
|
1520 | - $pricelist_arr=array(); |
|
1521 | - foreach($pricelist_result as $result){ |
|
1522 | - $pricelist_arr[$result['id']]=$result['name']; |
|
1523 | - } |
|
1524 | - return $pricelist_arr; |
|
1487 | + function enable_disable_option(){ |
|
1488 | + $option_array = array('0' => 'Enable', '1' => 'Disable'); |
|
1489 | + return $option_array; |
|
1490 | + } |
|
1491 | + |
|
1492 | + function paypal_mode($status = '') { |
|
1493 | + $status_array = array('0' => 'Live', '1' => 'Sandbox',); |
|
1494 | + return $status_array; |
|
1495 | + } |
|
1496 | + |
|
1497 | + function paypal_fee($status = '') { |
|
1498 | + $status_array = array('0' => 'Paid By Admin', '1' => 'Paid By Customer',); |
|
1499 | + return $status_array; |
|
1500 | + } |
|
1501 | + |
|
1502 | + function email() { |
|
1503 | + $status_array = array('1' => 'Enable', '0' => 'Disable',); |
|
1504 | + return $status_array; |
|
1505 | + } |
|
1506 | + |
|
1507 | + function smtp() { |
|
1508 | + return $this->set_allow(); |
|
1509 | + } |
|
1510 | + |
|
1511 | + function debug() { |
|
1512 | + $status_array = array('1' => 'Enable', '0' => 'Disable',); |
|
1513 | + return $status_array; |
|
1514 | + } |
|
1515 | + function default_signup_rategroup(){ |
|
1516 | + $this->CI->db->select("id,name"); |
|
1517 | + $this->CI->db->where("status",0); |
|
1518 | + $this->CI->db->where("reseller_id",0); |
|
1519 | + $pricelist_result=$this->CI->db->get("pricelists")->result_array(); |
|
1520 | + $pricelist_arr=array(); |
|
1521 | + foreach($pricelist_result as $result){ |
|
1522 | + $pricelist_arr[$result['id']]=$result['name']; |
|
1523 | + } |
|
1524 | + return $pricelist_arr; |
|
1525 | 1525 | |
1526 | - } |
|
1527 | - /****** |
|
1526 | + } |
|
1527 | + /****** |
|
1528 | 1528 | Enable Fax feature |
1529 | 1529 | * */ |
1530 | - function outbound_fax() { |
|
1531 | - $status_array = array('0' => 'Enable', '1' => 'Disable',); |
|
1532 | - return $status_array; |
|
1533 | - } |
|
1534 | - |
|
1535 | - function inbound_fax() { |
|
1536 | - $status_array = array('0' => 'Enable', '1' => 'Disable',); |
|
1537 | - return $status_array; |
|
1538 | - } |
|
1539 | - |
|
1540 | - |
|
1541 | - function opensips() { |
|
1542 | - $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1543 | - return $status_array; |
|
1544 | - } |
|
1545 | - |
|
1546 | - function cc_ani_auth() { |
|
1547 | - $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1548 | - return $status_array; |
|
1549 | - } |
|
1550 | - |
|
1551 | - function calling_cards_balance_announce() { |
|
1552 | - $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1553 | - return $status_array; |
|
1554 | - } |
|
1555 | - |
|
1556 | - function calling_cards_timelimit_announce() { |
|
1557 | - $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1558 | - return $status_array; |
|
1559 | - } |
|
1560 | - |
|
1561 | - function calling_cards_rate_announce() { |
|
1562 | - $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1563 | - return $status_array; |
|
1564 | - } |
|
1565 | - |
|
1566 | - function startingdigit() { |
|
1567 | - $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1568 | - return $status_array; |
|
1569 | - } |
|
1570 | - |
|
1571 | - function SMPT() { |
|
1572 | - $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1573 | - return $status_array; |
|
1574 | - } |
|
1575 | - |
|
1576 | - function country() { |
|
1577 | - return $this->CI->common_model->get_country_list(); |
|
1578 | - } |
|
1579 | - |
|
1580 | - function default_timezone() { |
|
1581 | - return $this->CI->db_model->build_dropdown('id,gmtzone', 'timezone'); |
|
1582 | - } |
|
1583 | - |
|
1584 | - function timezone() { |
|
1585 | - return $this->CI->db_model->build_dropdown('gmttime,gmttime', 'timezone'); |
|
1586 | - } |
|
1587 | - |
|
1588 | - function base_currency() { |
|
1589 | - return $this->CI->db_model->build_dropdown('currency,currencyname', 'currency'); |
|
1590 | - } |
|
1591 | - |
|
1592 | - /****** |
|
1530 | + function outbound_fax() { |
|
1531 | + $status_array = array('0' => 'Enable', '1' => 'Disable',); |
|
1532 | + return $status_array; |
|
1533 | + } |
|
1534 | + |
|
1535 | + function inbound_fax() { |
|
1536 | + $status_array = array('0' => 'Enable', '1' => 'Disable',); |
|
1537 | + return $status_array; |
|
1538 | + } |
|
1539 | + |
|
1540 | + |
|
1541 | + function opensips() { |
|
1542 | + $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1543 | + return $status_array; |
|
1544 | + } |
|
1545 | + |
|
1546 | + function cc_ani_auth() { |
|
1547 | + $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1548 | + return $status_array; |
|
1549 | + } |
|
1550 | + |
|
1551 | + function calling_cards_balance_announce() { |
|
1552 | + $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1553 | + return $status_array; |
|
1554 | + } |
|
1555 | + |
|
1556 | + function calling_cards_timelimit_announce() { |
|
1557 | + $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1558 | + return $status_array; |
|
1559 | + } |
|
1560 | + |
|
1561 | + function calling_cards_rate_announce() { |
|
1562 | + $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1563 | + return $status_array; |
|
1564 | + } |
|
1565 | + |
|
1566 | + function startingdigit() { |
|
1567 | + $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1568 | + return $status_array; |
|
1569 | + } |
|
1570 | + |
|
1571 | + function SMPT() { |
|
1572 | + $status_array = array('1' => 'Enable', '0' => 'Disable'); |
|
1573 | + return $status_array; |
|
1574 | + } |
|
1575 | + |
|
1576 | + function country() { |
|
1577 | + return $this->CI->common_model->get_country_list(); |
|
1578 | + } |
|
1579 | + |
|
1580 | + function default_timezone() { |
|
1581 | + return $this->CI->db_model->build_dropdown('id,gmtzone', 'timezone'); |
|
1582 | + } |
|
1583 | + |
|
1584 | + function timezone() { |
|
1585 | + return $this->CI->db_model->build_dropdown('gmttime,gmttime', 'timezone'); |
|
1586 | + } |
|
1587 | + |
|
1588 | + function base_currency() { |
|
1589 | + return $this->CI->db_model->build_dropdown('currency,currencyname', 'currency'); |
|
1590 | + } |
|
1591 | + |
|
1592 | + /****** |
|
1593 | 1593 | Calculate Currency manually. |
1594 | 1594 | */ |
1595 | 1595 | |
1596 | - function calculate_currency_manually($currency_info, $amount, $show_currency_flag = true,$number_format=true) { |
|
1597 | - $decimal_points = $currency_info['decimalpoints']; |
|
1598 | - $system_currency_rate = $currency_info['base_currency']['currencyrate']; |
|
1599 | - $user_currency_rate = $currency_info['user_currency']['currencyrate']; |
|
1600 | - $calculated_amount=(float)(($amount * $currency_info['user_currency']['currencyrate']) / $currency_info['base_currency']['currencyrate']); |
|
1601 | - if($number_format){ |
|
1602 | - $calculated_amount = number_format($calculated_amount,$currency_info['decimalpoints']); |
|
1603 | - } |
|
1604 | - if ($show_currency_flag){ |
|
1605 | - return $calculated_amount." ".$currency_info['user_currency']['currency']; |
|
1606 | - }else{ |
|
1607 | - return $calculated_amount; |
|
1608 | - } |
|
1609 | - } |
|
1610 | - |
|
1611 | - /* |
|
1596 | + function calculate_currency_manually($currency_info, $amount, $show_currency_flag = true,$number_format=true) { |
|
1597 | + $decimal_points = $currency_info['decimalpoints']; |
|
1598 | + $system_currency_rate = $currency_info['base_currency']['currencyrate']; |
|
1599 | + $user_currency_rate = $currency_info['user_currency']['currencyrate']; |
|
1600 | + $calculated_amount=(float)(($amount * $currency_info['user_currency']['currencyrate']) / $currency_info['base_currency']['currencyrate']); |
|
1601 | + if($number_format){ |
|
1602 | + $calculated_amount = number_format($calculated_amount,$currency_info['decimalpoints']); |
|
1603 | + } |
|
1604 | + if ($show_currency_flag){ |
|
1605 | + return $calculated_amount." ".$currency_info['user_currency']['currency']; |
|
1606 | + }else{ |
|
1607 | + return $calculated_amount; |
|
1608 | + } |
|
1609 | + } |
|
1610 | + |
|
1611 | + /* |
|
1612 | 1612 | Using By Summary Report search |
1613 | 1613 | */ |
1614 | 1614 | |
1615 | - function search_report_in($select = '') { |
|
1616 | - $status_array = array("minutes" => "Minutes", "seconds" => "Seconds"); |
|
1617 | - return $status_array; |
|
1618 | - } |
|
1619 | - |
|
1620 | - function set_summarycustomer_groupby($status = '') { |
|
1621 | - $status_array = array('' => "--Select--", 'accountid' => 'Account', 'pattern' => 'Code','package_id'=>"Package"); |
|
1622 | - return $status_array; |
|
1623 | - } |
|
1624 | - |
|
1625 | - function set_summaryprovider_groupby($status = '') { |
|
1626 | - $status_array = array('' => "--Select--", 'provider_id' => 'Account', 'trunk_id' => "Trunks", 'pattern' => 'Code'); |
|
1627 | - return $status_array; |
|
1628 | - } |
|
1629 | - |
|
1630 | - function get_currency_info() { |
|
1631 | - //System Currency info |
|
1632 | - $base_currency = Common_model::$global_config['system_config']['base_currency']; |
|
1633 | - //Get Account Information from session to get currency_id |
|
1634 | - $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
1635 | - //Get User Currency id |
|
1636 | - $user_currency_id = $accountinfo['currency_id'] > 0 ? $accountinfo['currency_id'] : $base_currency; |
|
1637 | - $where = "currency = '" . $base_currency . "' OR id= " . $user_currency_id; |
|
1638 | - $this->CI->db->where($where); |
|
1639 | - $this->CI->db->select('*'); |
|
1640 | - $currency_result = $this->CI->db->get('currency'); |
|
1641 | - |
|
1642 | - if ($currency_result->num_rows() == 2) { |
|
1643 | - $currency_result = $currency_result->result_array(); |
|
1644 | - foreach ($currency_result as $key => $records) { |
|
1645 | - //User Currency is currency details of logged in user. |
|
1646 | - if ($records['id'] == $user_currency_id) { |
|
1647 | - $currency_info['user_currency'] = $records; |
|
1648 | - } |
|
1649 | - //System Currency is currency details of system. |
|
1650 | - if ($records['currency'] == Common_model::$global_config['system_config']['base_currency']) { |
|
1651 | - $currency_info['base_currency'] = $records; |
|
1652 | - } |
|
1653 | - } |
|
1654 | - } else if ($currency_result->num_rows() == 1) { |
|
1655 | - $currency_info['user_currency'] = $currency_info['base_currency'] = (array) $currency_result->first_row(); |
|
1656 | - } |
|
1657 | - //Get Decimal points as per defined from system. |
|
1658 | - $currency_info['decimalpoints'] = Common_model::$global_config['system_config']['decimalpoints']; |
|
1659 | - return $currency_info; |
|
1660 | - } |
|
1661 | - |
|
1662 | - function convert_to_show_in($search_name = "", $table = "", $second) { |
|
1663 | - $search_arr = $this->CI->session->userdata($search_name); |
|
1664 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1665 | - return ($show_seconds === 'minutes') ? ($second > 0 ) ? |
|
1666 | - sprintf('%02d',$second / 60) . ":" . sprintf('%02d', ($second % 60)) : "00:00" : sprintf('%02d', $second); |
|
1667 | - } |
|
1668 | - |
|
1669 | - function array_column($input, $columnKey, $indexKey = null) { |
|
1670 | - $array = array(); |
|
1671 | - foreach ($input as $value) { |
|
1672 | - if (!isset($value[$columnKey])) { |
|
1673 | - trigger_error("Key \"$columnKey\" does not exist in array"); |
|
1674 | - return false; |
|
1675 | - } |
|
1676 | - |
|
1677 | - if (is_null($indexKey)) { |
|
1678 | - $array[] = $value[$columnKey]; |
|
1679 | - } else { |
|
1680 | - if (!isset($value[$indexKey])) { |
|
1681 | - trigger_error("Key \"$indexKey\" does not exist in array"); |
|
1682 | - return false; |
|
1683 | - } |
|
1684 | - if (!is_scalar($value[$indexKey])) { |
|
1685 | - trigger_error("Key \"$indexKey\" does not contain scalar value"); |
|
1686 | - return false; |
|
1687 | - } |
|
1688 | - $array[$value[$indexKey]] = $value[$columnKey]; |
|
1689 | - } |
|
1690 | - } |
|
1691 | - |
|
1692 | - return $array; |
|
1693 | - } |
|
1694 | - |
|
1695 | - function group_by_time() { |
|
1696 | - $status_array = array('' => "--Select--", 'HOUR' => 'Hour', 'DAY' => "Day", 'MONTH' => 'Month', "YEAR" => "Year"); |
|
1697 | - return $status_array; |
|
1698 | - } |
|
1699 | - |
|
1700 | - function currency_decimal($amount) { |
|
1615 | + function search_report_in($select = '') { |
|
1616 | + $status_array = array("minutes" => "Minutes", "seconds" => "Seconds"); |
|
1617 | + return $status_array; |
|
1618 | + } |
|
1619 | + |
|
1620 | + function set_summarycustomer_groupby($status = '') { |
|
1621 | + $status_array = array('' => "--Select--", 'accountid' => 'Account', 'pattern' => 'Code','package_id'=>"Package"); |
|
1622 | + return $status_array; |
|
1623 | + } |
|
1624 | + |
|
1625 | + function set_summaryprovider_groupby($status = '') { |
|
1626 | + $status_array = array('' => "--Select--", 'provider_id' => 'Account', 'trunk_id' => "Trunks", 'pattern' => 'Code'); |
|
1627 | + return $status_array; |
|
1628 | + } |
|
1629 | + |
|
1630 | + function get_currency_info() { |
|
1631 | + //System Currency info |
|
1632 | + $base_currency = Common_model::$global_config['system_config']['base_currency']; |
|
1633 | + //Get Account Information from session to get currency_id |
|
1634 | + $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
1635 | + //Get User Currency id |
|
1636 | + $user_currency_id = $accountinfo['currency_id'] > 0 ? $accountinfo['currency_id'] : $base_currency; |
|
1637 | + $where = "currency = '" . $base_currency . "' OR id= " . $user_currency_id; |
|
1638 | + $this->CI->db->where($where); |
|
1639 | + $this->CI->db->select('*'); |
|
1640 | + $currency_result = $this->CI->db->get('currency'); |
|
1641 | + |
|
1642 | + if ($currency_result->num_rows() == 2) { |
|
1643 | + $currency_result = $currency_result->result_array(); |
|
1644 | + foreach ($currency_result as $key => $records) { |
|
1645 | + //User Currency is currency details of logged in user. |
|
1646 | + if ($records['id'] == $user_currency_id) { |
|
1647 | + $currency_info['user_currency'] = $records; |
|
1648 | + } |
|
1649 | + //System Currency is currency details of system. |
|
1650 | + if ($records['currency'] == Common_model::$global_config['system_config']['base_currency']) { |
|
1651 | + $currency_info['base_currency'] = $records; |
|
1652 | + } |
|
1653 | + } |
|
1654 | + } else if ($currency_result->num_rows() == 1) { |
|
1655 | + $currency_info['user_currency'] = $currency_info['base_currency'] = (array) $currency_result->first_row(); |
|
1656 | + } |
|
1657 | + //Get Decimal points as per defined from system. |
|
1658 | + $currency_info['decimalpoints'] = Common_model::$global_config['system_config']['decimalpoints']; |
|
1659 | + return $currency_info; |
|
1660 | + } |
|
1661 | + |
|
1662 | + function convert_to_show_in($search_name = "", $table = "", $second) { |
|
1663 | + $search_arr = $this->CI->session->userdata($search_name); |
|
1664 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1665 | + return ($show_seconds === 'minutes') ? ($second > 0 ) ? |
|
1666 | + sprintf('%02d',$second / 60) . ":" . sprintf('%02d', ($second % 60)) : "00:00" : sprintf('%02d', $second); |
|
1667 | + } |
|
1668 | + |
|
1669 | + function array_column($input, $columnKey, $indexKey = null) { |
|
1670 | + $array = array(); |
|
1671 | + foreach ($input as $value) { |
|
1672 | + if (!isset($value[$columnKey])) { |
|
1673 | + trigger_error("Key \"$columnKey\" does not exist in array"); |
|
1674 | + return false; |
|
1675 | + } |
|
1676 | + |
|
1677 | + if (is_null($indexKey)) { |
|
1678 | + $array[] = $value[$columnKey]; |
|
1679 | + } else { |
|
1680 | + if (!isset($value[$indexKey])) { |
|
1681 | + trigger_error("Key \"$indexKey\" does not exist in array"); |
|
1682 | + return false; |
|
1683 | + } |
|
1684 | + if (!is_scalar($value[$indexKey])) { |
|
1685 | + trigger_error("Key \"$indexKey\" does not contain scalar value"); |
|
1686 | + return false; |
|
1687 | + } |
|
1688 | + $array[$value[$indexKey]] = $value[$columnKey]; |
|
1689 | + } |
|
1690 | + } |
|
1691 | + |
|
1692 | + return $array; |
|
1693 | + } |
|
1694 | + |
|
1695 | + function group_by_time() { |
|
1696 | + $status_array = array('' => "--Select--", 'HOUR' => 'Hour', 'DAY' => "Day", 'MONTH' => 'Month', "YEAR" => "Year"); |
|
1697 | + return $status_array; |
|
1698 | + } |
|
1699 | + |
|
1700 | + function currency_decimal($amount) { |
|
1701 | 1701 | $amount = str_replace( ',', '', $amount ); |
1702 | - $decimal_amount = Common_model::$global_config['system_config']['decimalpoints']; |
|
1703 | - $number_convert = number_format((float) $amount, $decimal_amount, '.', ''); |
|
1704 | - return $number_convert; |
|
1705 | - } |
|
1706 | - |
|
1707 | - function add_invoice_details($account_arr, $charge_type, $amount,$description) { |
|
1708 | - $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
1709 | - $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
1710 | - $where = "accountid IN ('" . $reseller_id . "','1')"; |
|
1711 | - $this->CI->db->where($where); |
|
1712 | - $this->CI->db->select('*'); |
|
1713 | - $this->CI->db->order_by('accountid', 'desc'); |
|
1714 | - $this->CI->db->limit(1); |
|
1715 | - $invoiceconf = $this->CI->db->get('invoice_conf'); |
|
1716 | - $invoice_conf = (array) $invoiceconf->first_row(); |
|
1717 | - $last_invoiceid = $this->get_invoice_date('invoiceid', '', $account_arr['reseller_id']); |
|
1718 | - if ($last_invoiceid && $last_invoiceid > 0) { |
|
1719 | - $last_invoiceid = ($last_invoiceid + 1); |
|
1720 | - } else { |
|
1721 | - $last_invoiceid = $invoice_conf['invoice_start_from']; |
|
1722 | - } |
|
1723 | - $last_invoiceid = str_pad($last_invoiceid, (strlen($last_invoiceid) + 4), '0', STR_PAD_LEFT); |
|
1724 | - $invoice_prefix = $invoice_conf['invoice_prefix']; |
|
1725 | - $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +" . $invoice_conf['interval'] . " days")); |
|
1726 | - $invoiceid = $account_arr['posttoexternal'] == 0 ? $this->CI->common_model->generate_receipt($account_arr['id'], $amount, $account_arr, $last_invoiceid, $invoice_prefix, $due_date) : 0; |
|
1702 | + $decimal_amount = Common_model::$global_config['system_config']['decimalpoints']; |
|
1703 | + $number_convert = number_format((float) $amount, $decimal_amount, '.', ''); |
|
1704 | + return $number_convert; |
|
1705 | + } |
|
1706 | + |
|
1707 | + function add_invoice_details($account_arr, $charge_type, $amount,$description) { |
|
1708 | + $accountinfo = $this->CI->session->userdata('accountinfo'); |
|
1709 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
1710 | + $where = "accountid IN ('" . $reseller_id . "','1')"; |
|
1711 | + $this->CI->db->where($where); |
|
1712 | + $this->CI->db->select('*'); |
|
1713 | + $this->CI->db->order_by('accountid', 'desc'); |
|
1714 | + $this->CI->db->limit(1); |
|
1715 | + $invoiceconf = $this->CI->db->get('invoice_conf'); |
|
1716 | + $invoice_conf = (array) $invoiceconf->first_row(); |
|
1717 | + $last_invoiceid = $this->get_invoice_date('invoiceid', '', $account_arr['reseller_id']); |
|
1718 | + if ($last_invoiceid && $last_invoiceid > 0) { |
|
1719 | + $last_invoiceid = ($last_invoiceid + 1); |
|
1720 | + } else { |
|
1721 | + $last_invoiceid = $invoice_conf['invoice_start_from']; |
|
1722 | + } |
|
1723 | + $last_invoiceid = str_pad($last_invoiceid, (strlen($last_invoiceid) + 4), '0', STR_PAD_LEFT); |
|
1724 | + $invoice_prefix = $invoice_conf['invoice_prefix']; |
|
1725 | + $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +" . $invoice_conf['interval'] . " days")); |
|
1726 | + $invoiceid = $account_arr['posttoexternal'] == 0 ? $this->CI->common_model->generate_receipt($account_arr['id'], $amount, $account_arr, $last_invoiceid, $invoice_prefix, $due_date) : 0; |
|
1727 | 1727 | |
1728 | - $insert_arr = array("accountid" => $account_arr['id'], |
|
1729 | - "description" => $description, |
|
1730 | - "debit" => $amount, |
|
1731 | - "credit" => '0', |
|
1732 | - "created_date" => gmdate("Y-m-d H:i:s"), |
|
1733 | - "invoiceid" => $invoiceid, |
|
1734 | - "reseller_id" => $account_arr['reseller_id'], |
|
1735 | - "item_type" => $charge_type, |
|
1736 | - "item_id" => '0', |
|
1737 | - ); |
|
1738 | - $this->CI->db->insert("invoice_details", $insert_arr); |
|
1739 | - return true; |
|
1740 | - } |
|
1741 | - /* ASTPP 3.0 Remove all information related to going to delete customer. |
|
1728 | + $insert_arr = array("accountid" => $account_arr['id'], |
|
1729 | + "description" => $description, |
|
1730 | + "debit" => $amount, |
|
1731 | + "credit" => '0', |
|
1732 | + "created_date" => gmdate("Y-m-d H:i:s"), |
|
1733 | + "invoiceid" => $invoiceid, |
|
1734 | + "reseller_id" => $account_arr['reseller_id'], |
|
1735 | + "item_type" => $charge_type, |
|
1736 | + "item_id" => '0', |
|
1737 | + ); |
|
1738 | + $this->CI->db->insert("invoice_details", $insert_arr); |
|
1739 | + return true; |
|
1740 | + } |
|
1741 | + /* ASTPP 3.0 Remove all information related to going to delete customer. |
|
1742 | 1742 | */ |
1743 | - function customer_delete_dependencies($id){ |
|
1744 | - $this->delete_data('ani_map',array('accountid'=>$id)); |
|
1745 | - $this->delete_data('block_patterns',array('accountid'=>$id)); |
|
1746 | - $this->delete_data('charge_to_account',array('accountid'=>$id)); |
|
1747 | - $this->delete_data('counters',array('accountid'=>$id)); |
|
1748 | - $this->delete_data('ip_map',array('accountid'=>$id)); |
|
1749 | - $this->delete_data('sip_devices',array('accountid'=>$id)); |
|
1750 | - $this->delete_data('speed_dial',array('accountid'=>$id)); |
|
1751 | - $this->delete_data('taxes_to_accounts',array('accountid'=>$id)); |
|
1752 | - $this->delete_data('mail_details',array('accountid'=>$id)); |
|
1753 | - $this->update_data('dids',array("accountid"=>$id),array('accountid'=>0)); |
|
1754 | - $this->update_data("accounts",array("id"=>$id),array("deleted"=>1)); |
|
1755 | - } |
|
1756 | - /* |
|
1743 | + function customer_delete_dependencies($id){ |
|
1744 | + $this->delete_data('ani_map',array('accountid'=>$id)); |
|
1745 | + $this->delete_data('block_patterns',array('accountid'=>$id)); |
|
1746 | + $this->delete_data('charge_to_account',array('accountid'=>$id)); |
|
1747 | + $this->delete_data('counters',array('accountid'=>$id)); |
|
1748 | + $this->delete_data('ip_map',array('accountid'=>$id)); |
|
1749 | + $this->delete_data('sip_devices',array('accountid'=>$id)); |
|
1750 | + $this->delete_data('speed_dial',array('accountid'=>$id)); |
|
1751 | + $this->delete_data('taxes_to_accounts',array('accountid'=>$id)); |
|
1752 | + $this->delete_data('mail_details',array('accountid'=>$id)); |
|
1753 | + $this->update_data('dids',array("accountid"=>$id),array('accountid'=>0)); |
|
1754 | + $this->update_data("accounts",array("id"=>$id),array("deleted"=>1)); |
|
1755 | + } |
|
1756 | + /* |
|
1757 | 1757 | * ASTPP 3.0 |
1758 | 1758 | * Remove all information related to going to delete reseller. |
1759 | 1759 | */ |
1760 | - function reseller_delete_dependencies($id){ |
|
1761 | - $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
1762 | - $child_arr=$this->select_data("accounts",array("reseller_id"=>$id,"type"=>0),'id,reseller_id'); |
|
1763 | - if($child_arr){ |
|
1764 | - foreach($child_arr as $value){ |
|
1765 | - $this->customer_delete_dependencies($value['id']); |
|
1766 | - } |
|
1767 | - } |
|
1768 | - $package_arr=$this->select_data("packages",array("reseller_id"=>$id),'id'); |
|
1769 | - if($package_arr){ |
|
1770 | - foreach($package_arr as $value){ |
|
1771 | - $this->delete_data('package_patterns',array("id"=>$value['id'])); |
|
1772 | - } |
|
1773 | - } |
|
1774 | - $acc_arr=$this->select_data('accounts',array("id"=>$id),'id,reseller_id'); |
|
1775 | - $parent_id=0; |
|
1776 | - if($acc_arr){ |
|
1777 | - $parent_id=$acc_arr[0]['reseller_id']; |
|
1778 | - } |
|
1779 | - $pricelist_arr=$this->select_data('pricelists',array('reseller_id'=>$id),'id'); |
|
1780 | - if($pricelist_arr){ |
|
1781 | - foreach($pricelist_arr as $value){ |
|
1782 | - $this->delete_data("routing",array("pricelist_id"=>$value['id'])); |
|
1783 | - $this->delete_data("routes",array("pricelist_id"=>$value['id'])); |
|
1784 | - $this->update_data('pricelists',array('id'=>$value['id']),array('status'=>2)); |
|
1785 | - } |
|
1786 | - } |
|
1787 | - $charge_arr=$this->select_data('charges',array('reseller_id'=>$id),'id'); |
|
1788 | - if($charge_arr){ |
|
1789 | - foreach($charge_arr as $value){ |
|
1790 | - $this->delete_data("charge_to_account",array("charge_id"=>$value['id'])); |
|
1791 | - } |
|
1792 | - } |
|
1793 | - $this->delete_data('charges',array('reseller_id'=>$id)); |
|
1794 | - $this->update_data('dids',array('parent_id'=>$id),array("parent_id"=>$parent_id)); |
|
1795 | - $this->delete_data('reseller_pricing',array("reseller_id"=>$id)); |
|
1796 | - $this->delete_data('refill_coupon',array("reseller_id"=>$id)); |
|
1797 | - $this->delete_data('mail_details',array('accountid'=>$id)); |
|
1798 | - $taxes_arr=$this->select_data('taxes',array("reseller_id"=>$id),'id'); |
|
1799 | - if($taxes_arr){ |
|
1800 | - foreach($taxes_arr as $value){ |
|
1801 | - $this->delete_data("taxes_to_accounts",array("taxes_id"=>$value['id'])); |
|
1802 | - } |
|
1803 | - } |
|
1804 | - $this->delete_data('taxes',array("reseller_id"=>$id)); |
|
1805 | - $this->delete_data('default_templates',array("reseller_id"=>$id)); |
|
1806 | - $package_arr=$this->select_data('packages',array('reseller_id'=>$id),'id'); |
|
1807 | - if($package_arr){ |
|
1808 | - $this->delete_data("counters",array("package_id"=>$value['id'])); |
|
1809 | - $this->delete_data("package_patterns",array("package_id"=>$value['id'])); |
|
1810 | - } |
|
1811 | - $this->delete_data('invoice_conf',array('accountid'=>$id)); |
|
1812 | - $this->delete_data('packages',array("reseller_id"=>$id)); |
|
1813 | - $this->update_data('accounts',array("id"=>$id),array("deleted"=>1)); |
|
1814 | - } |
|
1815 | - function subreseller_list($parent_id = '') { |
|
1816 | - $customer_id = $parent_id; |
|
1817 | - $this->reseller_delete_dependencies($parent_id); |
|
1818 | - $query = 'select id,type from accounts where reseller_id = ' . $parent_id .' AND deleted =0'; |
|
1819 | - $result = $this->CI->db->query($query); |
|
1820 | - if ($result->num_rows() > 0) { |
|
1821 | - $result = $result->result_array(); |
|
1822 | - foreach ($result as $data) { |
|
1823 | - if($data['type']==1){ |
|
1760 | + function reseller_delete_dependencies($id){ |
|
1761 | + $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
1762 | + $child_arr=$this->select_data("accounts",array("reseller_id"=>$id,"type"=>0),'id,reseller_id'); |
|
1763 | + if($child_arr){ |
|
1764 | + foreach($child_arr as $value){ |
|
1765 | + $this->customer_delete_dependencies($value['id']); |
|
1766 | + } |
|
1767 | + } |
|
1768 | + $package_arr=$this->select_data("packages",array("reseller_id"=>$id),'id'); |
|
1769 | + if($package_arr){ |
|
1770 | + foreach($package_arr as $value){ |
|
1771 | + $this->delete_data('package_patterns',array("id"=>$value['id'])); |
|
1772 | + } |
|
1773 | + } |
|
1774 | + $acc_arr=$this->select_data('accounts',array("id"=>$id),'id,reseller_id'); |
|
1775 | + $parent_id=0; |
|
1776 | + if($acc_arr){ |
|
1777 | + $parent_id=$acc_arr[0]['reseller_id']; |
|
1778 | + } |
|
1779 | + $pricelist_arr=$this->select_data('pricelists',array('reseller_id'=>$id),'id'); |
|
1780 | + if($pricelist_arr){ |
|
1781 | + foreach($pricelist_arr as $value){ |
|
1782 | + $this->delete_data("routing",array("pricelist_id"=>$value['id'])); |
|
1783 | + $this->delete_data("routes",array("pricelist_id"=>$value['id'])); |
|
1784 | + $this->update_data('pricelists',array('id'=>$value['id']),array('status'=>2)); |
|
1785 | + } |
|
1786 | + } |
|
1787 | + $charge_arr=$this->select_data('charges',array('reseller_id'=>$id),'id'); |
|
1788 | + if($charge_arr){ |
|
1789 | + foreach($charge_arr as $value){ |
|
1790 | + $this->delete_data("charge_to_account",array("charge_id"=>$value['id'])); |
|
1791 | + } |
|
1792 | + } |
|
1793 | + $this->delete_data('charges',array('reseller_id'=>$id)); |
|
1794 | + $this->update_data('dids',array('parent_id'=>$id),array("parent_id"=>$parent_id)); |
|
1795 | + $this->delete_data('reseller_pricing',array("reseller_id"=>$id)); |
|
1796 | + $this->delete_data('refill_coupon',array("reseller_id"=>$id)); |
|
1797 | + $this->delete_data('mail_details',array('accountid'=>$id)); |
|
1798 | + $taxes_arr=$this->select_data('taxes',array("reseller_id"=>$id),'id'); |
|
1799 | + if($taxes_arr){ |
|
1800 | + foreach($taxes_arr as $value){ |
|
1801 | + $this->delete_data("taxes_to_accounts",array("taxes_id"=>$value['id'])); |
|
1802 | + } |
|
1803 | + } |
|
1804 | + $this->delete_data('taxes',array("reseller_id"=>$id)); |
|
1805 | + $this->delete_data('default_templates',array("reseller_id"=>$id)); |
|
1806 | + $package_arr=$this->select_data('packages',array('reseller_id'=>$id),'id'); |
|
1807 | + if($package_arr){ |
|
1808 | + $this->delete_data("counters",array("package_id"=>$value['id'])); |
|
1809 | + $this->delete_data("package_patterns",array("package_id"=>$value['id'])); |
|
1810 | + } |
|
1811 | + $this->delete_data('invoice_conf',array('accountid'=>$id)); |
|
1812 | + $this->delete_data('packages',array("reseller_id"=>$id)); |
|
1813 | + $this->update_data('accounts',array("id"=>$id),array("deleted"=>1)); |
|
1814 | + } |
|
1815 | + function subreseller_list($parent_id = '') { |
|
1816 | + $customer_id = $parent_id; |
|
1817 | + $this->reseller_delete_dependencies($parent_id); |
|
1818 | + $query = 'select id,type from accounts where reseller_id = ' . $parent_id .' AND deleted =0'; |
|
1819 | + $result = $this->CI->db->query($query); |
|
1820 | + if ($result->num_rows() > 0) { |
|
1821 | + $result = $result->result_array(); |
|
1822 | + foreach ($result as $data) { |
|
1823 | + if($data['type']==1){ |
|
1824 | 1824 | $this->reseller_delete_dependencies($data['id']); |
1825 | 1825 | $this->subreseller_list($data['id']); |
1826 | - }else{ |
|
1826 | + }else{ |
|
1827 | 1827 | $this->customer_delete_dependencies($data['id']); |
1828 | - } |
|
1829 | - } |
|
1830 | - } |
|
1831 | - } |
|
1828 | + } |
|
1829 | + } |
|
1830 | + } |
|
1831 | + } |
|
1832 | 1832 | |
1833 | - function delete_data($table_name,$where_arr){ |
|
1834 | - $this->CI->db->where($where_arr); |
|
1835 | - $this->CI->db->delete($table_name); |
|
1836 | - } |
|
1837 | - function update_data($table_name,$where_arr,$update_arr){ |
|
1838 | - $this->CI->db->where($where_arr); |
|
1839 | - $this->CI->db->update($table_name,$update_arr); |
|
1840 | - } |
|
1841 | - function select_data($table_name,$where_arr,$select){ |
|
1842 | - $this->CI->db->where($where_arr); |
|
1843 | - $this->CI->db->select($select); |
|
1844 | - $result=$this->CI->db->get($table_name); |
|
1845 | - if($result->num_rows() > 0){ |
|
1846 | - return $result->result_array(); |
|
1847 | - }else{ |
|
1848 | - return false; |
|
1849 | - } |
|
1850 | - } |
|
1833 | + function delete_data($table_name,$where_arr){ |
|
1834 | + $this->CI->db->where($where_arr); |
|
1835 | + $this->CI->db->delete($table_name); |
|
1836 | + } |
|
1837 | + function update_data($table_name,$where_arr,$update_arr){ |
|
1838 | + $this->CI->db->where($where_arr); |
|
1839 | + $this->CI->db->update($table_name,$update_arr); |
|
1840 | + } |
|
1841 | + function select_data($table_name,$where_arr,$select){ |
|
1842 | + $this->CI->db->where($where_arr); |
|
1843 | + $this->CI->db->select($select); |
|
1844 | + $result=$this->CI->db->get($table_name); |
|
1845 | + if($result->num_rows() > 0){ |
|
1846 | + return $result->result_array(); |
|
1847 | + }else{ |
|
1848 | + return false; |
|
1849 | + } |
|
1850 | + } |
|
1851 | 1851 | |
1852 | - function set_call_waiting($status = '') { |
|
1852 | + function set_call_waiting($status = '') { |
|
1853 | 1853 | $status_array = array('0' => 'Enable', '1' => 'Disable'); |
1854 | 1854 | return $status_array; |
1855 | 1855 | } |
1856 | - function get_call_waiting($select = "", $table = "", $status) { |
|
1857 | - return ($status == 0) ? "Enable" : "Disable"; |
|
1856 | + function get_call_waiting($select = "", $table = "", $status) { |
|
1857 | + return ($status == 0) ? "Enable" : "Disable"; |
|
1858 | 1858 | } |
1859 | 1859 | function set_invoice_details($select= ''){ |
1860 | - $status_array = array("invoice_select" => "--Select--", |
|
1861 | - "invoice_inactive" => "Deleted Invoices", |
|
1862 | - "invoice_active" => "All Invoices", |
|
1863 | - ); |
|
1864 | - return $status_array; |
|
1860 | + $status_array = array("invoice_select" => "--Select--", |
|
1861 | + "invoice_inactive" => "Deleted Invoices", |
|
1862 | + "invoice_active" => "All Invoices", |
|
1863 | + ); |
|
1864 | + return $status_array; |
|
1865 | 1865 | } |
1866 | 1866 | function get_invoice_template($invoicedata,$accountdata,$flag){ |
1867 | - $login_info = $this->CI->session->userdata('accountinfo'); |
|
1868 | - |
|
1869 | - $invoice_config = $this->CI->db_model->getSelect("*", "invoice_conf", array('accountid'=>$login_info['id'])); |
|
1870 | - $invoice_config= $invoice_config->result_array(); |
|
1871 | - $invoice_config_res= $invoice_config[0]; |
|
1872 | - |
|
1873 | - $accountdata["currency_id"] = $this->get_field_name('currency', 'currency', $accountdata["currency_id"]); |
|
1874 | - $accountdata["country"] = $this->get_field_name('country', 'countrycode', $accountdata["country_id"]); |
|
1875 | - $data["to_currency"] = Common_model::$global_config['system_config']['base_currency']; |
|
1876 | - if($login_info['type'] == -1){ |
|
1877 | - $currency = $data["to_currency"]; |
|
1878 | - }elseif($login_info['type'] == 1){ |
|
1867 | + $login_info = $this->CI->session->userdata('accountinfo'); |
|
1868 | + |
|
1869 | + $invoice_config = $this->CI->db_model->getSelect("*", "invoice_conf", array('accountid'=>$login_info['id'])); |
|
1870 | + $invoice_config= $invoice_config->result_array(); |
|
1871 | + $invoice_config_res= $invoice_config[0]; |
|
1872 | + |
|
1873 | + $accountdata["currency_id"] = $this->get_field_name('currency', 'currency', $accountdata["currency_id"]); |
|
1874 | + $accountdata["country"] = $this->get_field_name('country', 'countrycode', $accountdata["country_id"]); |
|
1875 | + $data["to_currency"] = Common_model::$global_config['system_config']['base_currency']; |
|
1876 | + if($login_info['type'] == -1){ |
|
1877 | + $currency = $data["to_currency"]; |
|
1878 | + }elseif($login_info['type'] == 1){ |
|
1879 | 1879 | $accountdata["currency_id"] = $this->get_field_name('currency', 'currency', $login_info["currency_id"]); |
1880 | - $currency = $accountdata["currency_id"]; |
|
1881 | - }else{ |
|
1882 | - $currency = $accountdata["currency_id"]; |
|
1883 | - } |
|
1884 | - $decimal_amount=Common_model::$global_config['system_config']['decimalpoints']; |
|
1885 | - ob_start(); |
|
1886 | - $this->CI->load->library('/html2pdf/html2pdf'); |
|
1887 | - $this->CI->html2pdf = new HTML2PDF('P','A4','en'); |
|
1888 | - $this->CI->html2pdf->pdf->SetDisplayMode('fullpage'); |
|
1889 | - $template_config=$this->CI->config->item('invoice_template'); |
|
1890 | - include($template_config.'invoice_template.php'); |
|
1891 | - $content = ob_get_clean(); |
|
1892 | - ob_clean(); |
|
1880 | + $currency = $accountdata["currency_id"]; |
|
1881 | + }else{ |
|
1882 | + $currency = $accountdata["currency_id"]; |
|
1883 | + } |
|
1884 | + $decimal_amount=Common_model::$global_config['system_config']['decimalpoints']; |
|
1885 | + ob_start(); |
|
1886 | + $this->CI->load->library('/html2pdf/html2pdf'); |
|
1887 | + $this->CI->html2pdf = new HTML2PDF('P','A4','en'); |
|
1888 | + $this->CI->html2pdf->pdf->SetDisplayMode('fullpage'); |
|
1889 | + $template_config=$this->CI->config->item('invoice_template'); |
|
1890 | + include($template_config.'invoice_template.php'); |
|
1891 | + $content = ob_get_clean(); |
|
1892 | + ob_clean(); |
|
1893 | 1893 | |
1894 | 1894 | $ACCOUNTADD = ''; |
1895 | 1895 | $ACCOUNTADD_CUSTOMER =''; |
@@ -1912,57 +1912,57 @@ discard block |
||
1912 | 1912 | $due_date =date("Y-m-d",$duedate); |
1913 | 1913 | |
1914 | 1914 | /*************************** Company Address Code START ***************************************************/ |
1915 | - $ACCOUNTADD .= '<tr>'; |
|
1916 | - $ACCOUNTADD .= '<td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>'.$invoice_config_res['company_name'].'</b></td>'; |
|
1917 | - $ACCOUNTADD .= '</tr>'; |
|
1915 | + $ACCOUNTADD .= '<tr>'; |
|
1916 | + $ACCOUNTADD .= '<td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>'.$invoice_config_res['company_name'].'</b></td>'; |
|
1917 | + $ACCOUNTADD .= '</tr>'; |
|
1918 | 1918 | if ( $invoice_config_res['address'] != ""){ |
1919 | 1919 | |
1920 | - $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['address'].'</td></tr>'; |
|
1921 | - } |
|
1920 | + $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['address'].'</td></tr>'; |
|
1921 | + } |
|
1922 | 1922 | if ( $invoice_config_res['city'] != ""){ |
1923 | 1923 | |
1924 | - $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['city'].'</td></tr>'; |
|
1925 | - } |
|
1924 | + $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['city'].'</td></tr>'; |
|
1925 | + } |
|
1926 | 1926 | if ( $invoice_config_res['province'] != ""){ |
1927 | 1927 | |
1928 | - $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['province'].'</td></tr>'; |
|
1929 | - } |
|
1928 | + $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['province'].'</td></tr>'; |
|
1929 | + } |
|
1930 | 1930 | if ( $invoice_config_res['country'] != ""){ |
1931 | 1931 | |
1932 | - $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['country'].'</td></tr>'; |
|
1933 | - } |
|
1932 | + $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['country'].'</td></tr>'; |
|
1933 | + } |
|
1934 | 1934 | if ( $invoice_config_res['zipcode'] != ""){ |
1935 | 1935 | |
1936 | - $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['zipcode'].'</td></tr>'; |
|
1937 | - } |
|
1936 | + $ACCOUNTADD .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$invoice_config_res['zipcode'].'</td></tr>'; |
|
1937 | + } |
|
1938 | 1938 | /*************************** Company Address Code END ***************************************************/ |
1939 | 1939 | |
1940 | 1940 | /*************************** Customer Address Code START ***************************************************/ |
1941 | 1941 | |
1942 | - $ACCOUNTADD_CUSTOMER .= '<table><tr>'; |
|
1943 | - $ACCOUNTADD_CUSTOMER .= '<td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>'.$accountdata['company_name'].'</b></td></tr>'; |
|
1942 | + $ACCOUNTADD_CUSTOMER .= '<table><tr>'; |
|
1943 | + $ACCOUNTADD_CUSTOMER .= '<td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>'.$accountdata['company_name'].'</b></td></tr>'; |
|
1944 | 1944 | |
1945 | 1945 | if ( $accountdata['address_1'] != ""){ |
1946 | 1946 | |
1947 | - $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['address_1'].'</td></tr>'; |
|
1948 | - } |
|
1947 | + $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['address_1'].'</td></tr>'; |
|
1948 | + } |
|
1949 | 1949 | if ( $accountdata['city'] != ""){ |
1950 | 1950 | |
1951 | - $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['city'].'</td></tr>'; |
|
1952 | - } |
|
1951 | + $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['city'].'</td></tr>'; |
|
1952 | + } |
|
1953 | 1953 | if ( $accountdata['province'] != ""){ |
1954 | 1954 | |
1955 | - $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['province'].'</td></tr>'; |
|
1956 | - } |
|
1955 | + $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['province'].'</td></tr>'; |
|
1956 | + } |
|
1957 | 1957 | if ( $accountdata['country'] != ""){ |
1958 | 1958 | |
1959 | - $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['country'].'</td></tr>'; |
|
1960 | - } |
|
1959 | + $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['country'].'</td></tr>'; |
|
1960 | + } |
|
1961 | 1961 | if ( $accountdata['postal_code'] != ""){ |
1962 | 1962 | |
1963 | - $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['postal_code'].'</td></tr>'; |
|
1964 | - } |
|
1965 | - $ACCOUNTADD_CUSTOMER .="</table>"; |
|
1963 | + $ACCOUNTADD_CUSTOMER .= '<tr><td style="width:100%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$accountdata['postal_code'].'</td></tr>'; |
|
1964 | + } |
|
1965 | + $ACCOUNTADD_CUSTOMER .="</table>"; |
|
1966 | 1966 | /*************************** Customer Address Code END ***************************************************/ |
1967 | 1967 | |
1968 | 1968 | |
@@ -1970,26 +1970,26 @@ discard block |
||
1970 | 1970 | |
1971 | 1971 | $ACCOUNT_DESCRIPTION .= '<tr style="background-color:#375C7C;">'; |
1972 | 1972 | $ACCOUNT_DESCRIPTION .= '<td style="width:20%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Date</td>'; |
1973 | - $ACCOUNT_DESCRIPTION .= '<td style="width:40%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Description</td>'; |
|
1974 | - $ACCOUNT_DESCRIPTION .= '<td style="width:20%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Charge Type</td>'; |
|
1973 | + $ACCOUNT_DESCRIPTION .= '<td style="width:40%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Description</td>'; |
|
1974 | + $ACCOUNT_DESCRIPTION .= '<td style="width:20%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Charge Type</td>'; |
|
1975 | 1975 | $ACCOUNT_DESCRIPTION .= '<td style="width:20%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;text-align:right;">Amount ('.$currency .')</td>'; |
1976 | - $ACCOUNT_DESCRIPTION .= '</tr>'; |
|
1976 | + $ACCOUNT_DESCRIPTION .= '</tr>'; |
|
1977 | 1977 | |
1978 | 1978 | |
1979 | 1979 | $ACCOUNT_CDRS .= '<tr style="background-color:#375C7C;">'; |
1980 | 1980 | $ACCOUNT_CDRS .= '<td style="width:40%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Description</td>'; |
1981 | 1981 | $ACCOUNT_CDRS .= '<td style="width:20%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Duration (Seconds)</td>'; |
1982 | - $ACCOUNT_CDRS .= '<td style="width:20%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Total Calls</td>'; |
|
1982 | + $ACCOUNT_CDRS .= '<td style="width:20%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;">Total Calls</td>'; |
|
1983 | 1983 | $ACCOUNT_CDRS .= '<td style="width:20%;font-size: 12px;color:#fff;font-family:arial; line-height: 22px;text-align:right;">Amount ('.$currency .')</td>'; |
1984 | - $ACCOUNT_CDRS .= '</tr>'; |
|
1984 | + $ACCOUNT_CDRS .= '</tr>'; |
|
1985 | 1985 | |
1986 | 1986 | /*** manual invoice **/ |
1987 | 1987 | $this->CI->db->where('item_type <>','INVPAY'); |
1988 | - $invoice_details = $this->CI->db_model->getSelect('*', 'invoice_details',array("invoiceid"=> $invoicedata['id'],'item_type <>'=> 'TAX' )); |
|
1988 | + $invoice_details = $this->CI->db_model->getSelect('*', 'invoice_details',array("invoiceid"=> $invoicedata['id'],'item_type <>'=> 'TAX' )); |
|
1989 | 1989 | $invoice_details= $invoice_details->result_array(); |
1990 | 1990 | $total_sum=0; |
1991 | 1991 | foreach($invoice_details as $charge_res){ |
1992 | - if($charge_res['item_type'] == 'DIDCHRG' || $charge_res['item_type'] == 'SUBCHRG' || $charge_res['item_type'] == 'manual_inv' ){ |
|
1992 | + if($charge_res['item_type'] == 'DIDCHRG' || $charge_res['item_type'] == 'SUBCHRG' || $charge_res['item_type'] == 'manual_inv' ){ |
|
1993 | 1993 | if($charge_res['item_type'] == 'manual_inv'){ |
1994 | 1994 | $charge_res['item_type'] = 'Manual Invoice'; |
1995 | 1995 | } |
@@ -2007,10 +2007,10 @@ discard block |
||
2007 | 2007 | |
2008 | 2008 | $ACCOUNT_DESCRIPTION .= '<td style="width:20%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;text-align:right;">'.$this->currency_decimal($this->CI->common_model->calculate_currency($charge_res['debit'])).'</td>'; |
2009 | 2009 | $ACCOUNT_DESCRIPTION .= '</tr>'; |
2010 | - }else{ |
|
2011 | - $cdrs_data = $this->CI->db_model->getSelect("sum(billseconds) as billseconds,count(*) as count", "cdrs", array("accountid" => $charge_res['accountid'],"calltype" => $charge_res['item_type'])); |
|
2012 | - $cdrs_result = $cdrs_data->result_array(); |
|
2013 | - if($cdrs_result[0]['count'] > 0 ){ |
|
2010 | + }else{ |
|
2011 | + $cdrs_data = $this->CI->db_model->getSelect("sum(billseconds) as billseconds,count(*) as count", "cdrs", array("accountid" => $charge_res['accountid'],"calltype" => $charge_res['item_type'])); |
|
2012 | + $cdrs_result = $cdrs_data->result_array(); |
|
2013 | + if($cdrs_result[0]['count'] > 0 ){ |
|
2014 | 2014 | $cdrs_record_count=$cdrs_result[0]['count'] ; |
2015 | 2015 | $cdrs_record_billseconds=$cdrs_result[0]['billseconds'] ; |
2016 | 2016 | /*echo '<pre>'.$cdrs_record_count; |
@@ -2022,8 +2022,8 @@ discard block |
||
2022 | 2022 | $ACCOUNT_CDRS .= '<td style="width:20%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;">'.$cdrs_record_count.'</td>'; |
2023 | 2023 | $ACCOUNT_CDRS .= '<td style="width:20%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;text-align:right;">'.$this->currency_decimal($this->CI->common_model->calculate_currency($charge_res['debit'])).'</td>'; |
2024 | 2024 | $ACCOUNT_CDRS .= '</tr>'; |
2025 | - } |
|
2026 | - } |
|
2025 | + } |
|
2026 | + } |
|
2027 | 2027 | $total_sum += $charge_res['debit']; |
2028 | 2028 | } |
2029 | 2029 | /*************************** Charge Histry Code END ***************************************************/ |
@@ -2031,7 +2031,7 @@ discard block |
||
2031 | 2031 | /**********************************Tax Apply Start********************************************************************/ |
2032 | 2032 | $total_sum = $total_sum; |
2033 | 2033 | $total_sum=$this->currency_decimal($this->CI->common_model->calculate_currency($total_sum)); |
2034 | - $invoice_tax = $this->CI->db_model->getSelect('*', 'invoice_details',array("invoiceid"=> $invoicedata['id'],'item_type '=> 'TAX')); |
|
2034 | + $invoice_tax = $this->CI->db_model->getSelect('*', 'invoice_details',array("invoiceid"=> $invoicedata['id'],'item_type '=> 'TAX')); |
|
2035 | 2035 | //$ACCOUNT_TOTAL .= '<td><table style="width:100%;margin-left:360px;">'; |
2036 | 2036 | |
2037 | 2037 | $ACCOUNT_TOTAL .= '<tr>'; |
@@ -2039,7 +2039,7 @@ discard block |
||
2039 | 2039 | $ACCOUNT_TOTAL .= '<td style="width:40%;font-size: 12px;color:#000;font-family:arial; line-height: 22px;"></td>'; |
2040 | 2040 | // $ACCOUNT_TOTAL .= '<td style="width:20%;font-size: 12px;color:#000;font-family:arial; line-height: 22px;"><b>Total Exclusive:</b></td>'; |
2041 | 2041 | // $ACCOUNT_TOTAL .= '<td style="width:20%;font-size: 12px;color:#000;font-family:arial; line-height: 22px;text-align:right;">'.$total_sum .'</td>'; |
2042 | - $ACCOUNT_TOTAL .= '</tr>'; |
|
2042 | + $ACCOUNT_TOTAL .= '</tr>'; |
|
2043 | 2043 | |
2044 | 2044 | if($invoice_tax->num_rows() > 0 ){ |
2045 | 2045 | foreach($invoice_tax->result_array() as $invoice_tax){ |
@@ -2077,16 +2077,16 @@ discard block |
||
2077 | 2077 | |
2078 | 2078 | /*************************** Invoice Details Code START ***************************************************/ |
2079 | 2079 | |
2080 | - $ACCOUNTADD_RIGHT .= '<table style="width:100%;"><tr style="width:100%;"><td style="width:40%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>Number:</b></td>'; |
|
2081 | - $ACCOUNTADD_RIGHT .= '<td style="width:60%;font-size: 10px;color:#525252;font-family:arial;text-align:right; line-height: 22px;">'.$invoicedata["invoice_prefix"].$invoicedata["invoiceid"].'</td></tr>'; |
|
2080 | + $ACCOUNTADD_RIGHT .= '<table style="width:100%;"><tr style="width:100%;"><td style="width:40%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>Number:</b></td>'; |
|
2081 | + $ACCOUNTADD_RIGHT .= '<td style="width:60%;font-size: 10px;color:#525252;font-family:arial;text-align:right; line-height: 22px;">'.$invoicedata["invoice_prefix"].$invoicedata["invoiceid"].'</td></tr>'; |
|
2082 | 2082 | |
2083 | - $ACCOUNTADD_RIGHT .= '<tr style="width:100%;"><td style="width:40%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>Date:</b></td>'; |
|
2084 | - $ACCOUNTADD_RIGHT .= '<td style="width:60%;font-size: 10px;color:#525252;font-family:arial;text-align:right; line-height: 22px;">'.$from_date.'</td></tr>'; |
|
2085 | - $ACCOUNTADD_RIGHT .= '<tr style="width:100%;"><td style="width:40%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>Due Date:</b></td>'; |
|
2086 | - $ACCOUNTADD_RIGHT .= '<td style="width:60%;font-size: 10px;color:#525252;font-family:arial;text-align:right; line-height: 22px;">'.$due_date.'</td></tr>'; |
|
2083 | + $ACCOUNTADD_RIGHT .= '<tr style="width:100%;"><td style="width:40%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>Date:</b></td>'; |
|
2084 | + $ACCOUNTADD_RIGHT .= '<td style="width:60%;font-size: 10px;color:#525252;font-family:arial;text-align:right; line-height: 22px;">'.$from_date.'</td></tr>'; |
|
2085 | + $ACCOUNTADD_RIGHT .= '<tr style="width:100%;"><td style="width:40%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;"><b>Due Date:</b></td>'; |
|
2086 | + $ACCOUNTADD_RIGHT .= '<td style="width:60%;font-size: 10px;color:#525252;font-family:arial;text-align:right; line-height: 22px;">'.$due_date.'</td></tr>'; |
|
2087 | 2087 | |
2088 | - $ACCOUNTADD_RIGHT .= '<tr style="background-color:#375C7C;width:100%; line-height: 30px;"><td style="width:40%;font-size: 12px;color:#fff;font-family:arial; line-height: 30px;"><b>Total Due:</b></td>'; |
|
2089 | - $ACCOUNTADD_RIGHT .= '<td style="width:60%;font-size: 10px;color:#fff;font-family:arial;text-align:right; line-height: 30px;">'.$this->currency_decimal($sub_total).'</td></tr>'; |
|
2088 | + $ACCOUNTADD_RIGHT .= '<tr style="background-color:#375C7C;width:100%; line-height: 30px;"><td style="width:40%;font-size: 12px;color:#fff;font-family:arial; line-height: 30px;"><b>Total Due:</b></td>'; |
|
2089 | + $ACCOUNTADD_RIGHT .= '<td style="width:60%;font-size: 10px;color:#fff;font-family:arial;text-align:right; line-height: 30px;">'.$this->currency_decimal($sub_total).'</td></tr>'; |
|
2090 | 2090 | $ACCOUNTADD_RIGHT .= "</table>"; |
2091 | 2091 | |
2092 | 2092 | /*************************** Invoice Details Code END ***************************************************/ |
@@ -2097,8 +2097,8 @@ discard block |
||
2097 | 2097 | |
2098 | 2098 | |
2099 | 2099 | /*************************** Invoice Note Code END ***************************************************/ |
2100 | - $invoice_notes = $this->CI->db_model->getSelect('*', 'invoices', array('id'=>$invoicedata['id'])); |
|
2101 | - $invoice_notes=$invoice_notes->result_array(); |
|
2100 | + $invoice_notes = $this->CI->db_model->getSelect('*', 'invoices', array('id'=>$invoicedata['id'])); |
|
2101 | + $invoice_notes=$invoice_notes->result_array(); |
|
2102 | 2102 | if(isset($invoice_notes[0]['notes'])){ |
2103 | 2103 | $invoice_notes=$invoice_notes[0]['notes']; |
2104 | 2104 | }else{ |
@@ -2125,106 +2125,106 @@ discard block |
||
2125 | 2125 | $ACCOUNT_TOTAL_FINAL .= '<td style="width:40%;font-size: 12px;color:#000;font-family:arial; line-height: 22px;"></td>'; |
2126 | 2126 | $ACCOUNT_TOTAL_FINAL .= '</tr>'; |
2127 | 2127 | |
2128 | - // $content = str_replace("<LOGO>",$image_logo,$content); |
|
2129 | - $content = str_replace("<ACCOUNTADD>",$ACCOUNTADD,$content); |
|
2130 | - $content = str_replace("<ACCOUNTADD_CUSTOMER>",$ACCOUNTADD_CUSTOMER,$content); |
|
2131 | - $content = str_replace("<ACCOUNTADD_RIGHT>",$ACCOUNTADD_RIGHT,$content); |
|
2128 | + // $content = str_replace("<LOGO>",$image_logo,$content); |
|
2129 | + $content = str_replace("<ACCOUNTADD>",$ACCOUNTADD,$content); |
|
2130 | + $content = str_replace("<ACCOUNTADD_CUSTOMER>",$ACCOUNTADD_CUSTOMER,$content); |
|
2131 | + $content = str_replace("<ACCOUNTADD_RIGHT>",$ACCOUNTADD_RIGHT,$content); |
|
2132 | 2132 | $content = str_replace("<ACCOUNT_DESCRIPTION>",$ACCOUNT_DESCRIPTION,$content); |
2133 | 2133 | $content = str_replace("<ACCOUNT_CDRS>",$ACCOUNT_CDRS,$content); |
2134 | 2134 | $content = str_replace("<ACCOUNT_TOTAL>",$ACCOUNT_TOTAL,$content); |
2135 | 2135 | $content = str_replace("<ACCOUNT_TOTAL_FINAL>",$ACCOUNT_TOTAL_FINAL,$content); |
2136 | - $content = str_replace("<NOTES>",$invoice_notes,$content); |
|
2136 | + $content = str_replace("<NOTES>",$invoice_notes,$content); |
|
2137 | 2137 | |
2138 | 2138 | //echo $content; exit; |
2139 | 2139 | |
2140 | 2140 | $invoice_path=$this->CI->config->item('invoices_path'); |
2141 | 2141 | $download_path = $invoice_path.$accountdata["id"].'/'.$invoicedata['invoice_prefix'].$invoicedata['invoiceid']."_invoice.pdf"; |
2142 | - //echo $download_path; exit; |
|
2143 | - $this->CI->html2pdf->pdf->SetDisplayMode('fullpage'); |
|
2144 | - $this->CI->html2pdf->writeHTML($content); |
|
2142 | + //echo $download_path; exit; |
|
2143 | + $this->CI->html2pdf->pdf->SetDisplayMode('fullpage'); |
|
2144 | + $this->CI->html2pdf->writeHTML($content); |
|
2145 | 2145 | |
2146 | - if($flag== 'TRUE'){ |
|
2147 | - $download_path = $invoicedata['invoice_prefix'].$invoicedata['invoiceid'].".pdf"; |
|
2146 | + if($flag== 'TRUE'){ |
|
2147 | + $download_path = $invoicedata['invoice_prefix'].$invoicedata['invoiceid'].".pdf"; |
|
2148 | 2148 | |
2149 | - $this->CI->html2pdf->Output($download_path,"D"); |
|
2150 | - }else{ |
|
2151 | - $current_dir = getcwd()."/invoices/"; |
|
2152 | - $dir_name = $accountdata["id"]; |
|
2153 | - if(!is_dir($current_dir.$dir_name)){ |
|
2154 | - mkdir($current_dir.$dir_name,0777, true); |
|
2155 | - chmod($current_dir.$dir_name, 0777); |
|
2156 | - } |
|
2157 | - $invoice_path=$this->CI->config->item('invoices_path'); |
|
2158 | - $download_path = $invoice_path.$accountdata["id"].'/'.$invoicedata['invoice_prefix'].$invoicedata['invoiceid']."_invoice.pdf"; |
|
2159 | - $this->CI->html2pdf->Output($download_path,"F"); |
|
2160 | - } |
|
2149 | + $this->CI->html2pdf->Output($download_path,"D"); |
|
2150 | + }else{ |
|
2151 | + $current_dir = getcwd()."/invoices/"; |
|
2152 | + $dir_name = $accountdata["id"]; |
|
2153 | + if(!is_dir($current_dir.$dir_name)){ |
|
2154 | + mkdir($current_dir.$dir_name,0777, true); |
|
2155 | + chmod($current_dir.$dir_name, 0777); |
|
2156 | + } |
|
2157 | + $invoice_path=$this->CI->config->item('invoices_path'); |
|
2158 | + $download_path = $invoice_path.$accountdata["id"].'/'.$invoicedata['invoice_prefix'].$invoicedata['invoiceid']."_invoice.pdf"; |
|
2159 | + $this->CI->html2pdf->Output($download_path,"F"); |
|
2160 | + } |
|
2161 | 2161 | } |
2162 | - function reseller_select_value($select, $table, $id_where = '') { |
|
2163 | - $select_params = explode(',', $select); |
|
2164 | - $where = array("1"); |
|
2165 | - if ($id_where != '') { |
|
2166 | - $where = array("id" => $id_where); |
|
2167 | - } |
|
2168 | - $select_params = explode(',', $select); |
|
2169 | - $cnt_str = " $select_params[0],' ',$select_params[1],' ','(',$select_params[2],')' "; |
|
2170 | - $select = "concat($cnt_str) as $select_params[2] "; |
|
2171 | - $drp_array = $this->CI->db_model->getSelect($select, $table, $where); |
|
2172 | - $drp_array = $drp_array->result(); |
|
2173 | - if (isset($drp_array[0])) |
|
2174 | - return $drp_array[0]->$select_params[2]; |
|
2162 | + function reseller_select_value($select, $table, $id_where = '') { |
|
2163 | + $select_params = explode(',', $select); |
|
2164 | + $where = array("1"); |
|
2165 | + if ($id_where != '') { |
|
2166 | + $where = array("id" => $id_where); |
|
2167 | + } |
|
2168 | + $select_params = explode(',', $select); |
|
2169 | + $cnt_str = " $select_params[0],' ',$select_params[1],' ','(',$select_params[2],')' "; |
|
2170 | + $select = "concat($cnt_str) as $select_params[2] "; |
|
2171 | + $drp_array = $this->CI->db_model->getSelect($select, $table, $where); |
|
2172 | + $drp_array = $drp_array->result(); |
|
2173 | + if (isset($drp_array[0])) |
|
2174 | + return $drp_array[0]->$select_params[2]; |
|
2175 | 2175 | else |
2176 | 2176 | return 'Admin'; |
2177 | - } |
|
2177 | + } |
|
2178 | 2178 | |
2179 | - function get_subreseller_info($parent_id){ |
|
2180 | - if(!empty($parent_id)){ |
|
2179 | + function get_subreseller_info($parent_id){ |
|
2180 | + if(!empty($parent_id)){ |
|
2181 | 2181 | $str=$parent_id.","; |
2182 | - }else{ |
|
2183 | - $str=null; |
|
2184 | - } |
|
2185 | - $query = "select id from accounts where reseller_id = '$parent_id' AND deleted =0 AND type=1"; |
|
2186 | - $result = $this->CI->db->query($query); |
|
2187 | - if($result->num_rows() > 0){ |
|
2188 | - $result = $result->result_array(); |
|
2182 | + }else{ |
|
2183 | + $str=null; |
|
2184 | + } |
|
2185 | + $query = "select id from accounts where reseller_id = '$parent_id' AND deleted =0 AND type=1"; |
|
2186 | + $result = $this->CI->db->query($query); |
|
2187 | + if($result->num_rows() > 0){ |
|
2188 | + $result = $result->result_array(); |
|
2189 | 2189 | foreach ($result as $data){ |
2190 | - if(!empty($data['id'])){ |
|
2191 | - $str.=$this->get_subreseller_info($data['id']); |
|
2192 | - } |
|
2190 | + if(!empty($data['id'])){ |
|
2191 | + $str.=$this->get_subreseller_info($data['id']); |
|
2192 | + } |
|
2193 | 2193 | } |
2194 | 2194 | } |
2195 | 2195 | return $str; |
2196 | - } |
|
2197 | - function get_parent_info($child_id,$parent_id){ |
|
2198 | - if(!empty($child_id)){ |
|
2196 | + } |
|
2197 | + function get_parent_info($child_id,$parent_id){ |
|
2198 | + if(!empty($child_id)){ |
|
2199 | 2199 | $str=$child_id.","; |
2200 | - }else{ |
|
2201 | - $str=null; |
|
2202 | - } |
|
2203 | - if($child_id > 0){ |
|
2204 | - $query = "select reseller_id from accounts where id = '$child_id'"; |
|
2205 | - $result = $this->CI->db->query($query); |
|
2206 | - if($result->num_rows() > 0){ |
|
2207 | - $parent_info = (array)$result->first_row(); |
|
2200 | + }else{ |
|
2201 | + $str=null; |
|
2202 | + } |
|
2203 | + if($child_id > 0){ |
|
2204 | + $query = "select reseller_id from accounts where id = '$child_id'"; |
|
2205 | + $result = $this->CI->db->query($query); |
|
2206 | + if($result->num_rows() > 0){ |
|
2207 | + $parent_info = (array)$result->first_row(); |
|
2208 | 2208 | if($parent_info['reseller_id'] != $parent_id){ |
2209 | - $str.=$this->get_parent_info($parent_info['reseller_id'],$parent_id); |
|
2209 | + $str.=$this->get_parent_info($parent_info['reseller_id'],$parent_id); |
|
2210 | 2210 | } |
2211 | 2211 | } |
2212 | 2212 | } |
2213 | 2213 | return $str; |
2214 | - } |
|
2215 | - function get_did_accountid($select,$table,$where){ |
|
2216 | - $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
2217 | - $this->CI->db->where('note',$where); |
|
2218 | - $this->CI->db->where('parent_id',$accountinfo['id']); |
|
2219 | - $this->CI->db->select('reseller_id'); |
|
2220 | - $reseller_pricing_result=$this->CI->db->get('reseller_pricing'); |
|
2221 | - $account_info=(array)$reseller_pricing_result->first_row(); |
|
2222 | - $account_name=$this->get_field_name_coma_new('first_name,last_name,number','accounts',$account_info['reseller_id']); |
|
2223 | - return $account_name; |
|
2224 | - } |
|
2225 | - |
|
2226 | - function get_status_new($select = "",$table = "",$status = "") { |
|
2227 | - return ($status['status']==0) ? "<span class='label label-sm label-inverse arrowed-in' title='release'>Active<span>" : "<span class='label label-sm' title='release'>Inactive<span>"; |
|
2228 | - } |
|
2214 | + } |
|
2215 | + function get_did_accountid($select,$table,$where){ |
|
2216 | + $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
2217 | + $this->CI->db->where('note',$where); |
|
2218 | + $this->CI->db->where('parent_id',$accountinfo['id']); |
|
2219 | + $this->CI->db->select('reseller_id'); |
|
2220 | + $reseller_pricing_result=$this->CI->db->get('reseller_pricing'); |
|
2221 | + $account_info=(array)$reseller_pricing_result->first_row(); |
|
2222 | + $account_name=$this->get_field_name_coma_new('first_name,last_name,number','accounts',$account_info['reseller_id']); |
|
2223 | + return $account_name; |
|
2224 | + } |
|
2225 | + |
|
2226 | + function get_status_new($select = "",$table = "",$status = "") { |
|
2227 | + return ($status['status']==0) ? "<span class='label label-sm label-inverse arrowed-in' title='release'>Active<span>" : "<span class='label label-sm' title='release'>Inactive<span>"; |
|
2228 | + } |
|
2229 | 2229 | |
2230 | 2230 | } |