@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | |
25 | 25 | class DID_model extends CI_Model { |
26 | 26 | |
27 | - function DID_model() { |
|
28 | - parent::__construct(); |
|
29 | - } |
|
27 | + function DID_model() { |
|
28 | + parent::__construct(); |
|
29 | + } |
|
30 | 30 | |
31 | - function add_did($add_array) { |
|
31 | + function add_did($add_array) { |
|
32 | 32 | if($add_array['accountid'] > 0 ){ |
33 | 33 | $add_array['assign_date']=gmdate('Y-m-d H:i:s'); |
34 | 34 | } |
35 | 35 | unset($add_array["action"]); |
36 | 36 | $this->db->insert("dids", $add_array); |
37 | - if($add_array['accountid'] > 0 ){ |
|
37 | + if($add_array['accountid'] > 0 ){ |
|
38 | 38 | $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$add_array['accountid']))->first_row(); |
39 | 39 | $currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$accountinfo['currency_id'])); |
40 | 40 | $available_bal = $this->db_model->update_balance( $add_array["setup"], $add_array['accountid'], "debit"); |
@@ -46,103 +46,103 @@ discard block |
||
46 | 46 | $accountinfo['did_monthlycost'] =$this->common_model->calculate_currency($add_array['monthlycost'],'',$currency_name,true,true); |
47 | 47 | $accountinfo['did_maxchannels'] = $add_array['maxchannels']; |
48 | 48 | $this->common->mail_to_users('email_add_did', $accountinfo); |
49 | - } |
|
50 | - return true; |
|
51 | - } |
|
52 | - function insert_pricelist() { |
|
53 | - $insert_array = array('name' => 'default', 'markup' => '', 'inc' => ''); |
|
54 | - return $this->db->insert_id(); |
|
55 | - } |
|
49 | + } |
|
50 | + return true; |
|
51 | + } |
|
52 | + function insert_pricelist() { |
|
53 | + $insert_array = array('name' => 'default', 'markup' => '', 'inc' => ''); |
|
54 | + return $this->db->insert_id(); |
|
55 | + } |
|
56 | 56 | |
57 | - function edit_did($data, $id,$number) { |
|
58 | - unset($data["action"]); |
|
59 | - $this->db->where('number',$number); |
|
60 | - $this->db->select('parent_id,accountid'); |
|
61 | - $did_result=$this->db->get('dids'); |
|
62 | - $did_result=(array)$did_result->first_row(); |
|
63 | - if($did_result['accountid'] > 0 || $did_result['parent_id'] > 0){ |
|
64 | - $data['accountid']=$did_result['accountid']; |
|
65 | - $data['parent_id']=$did_result['parent_id']; |
|
66 | - } |
|
57 | + function edit_did($data, $id,$number) { |
|
58 | + unset($data["action"]); |
|
59 | + $this->db->where('number',$number); |
|
60 | + $this->db->select('parent_id,accountid'); |
|
61 | + $did_result=$this->db->get('dids'); |
|
62 | + $did_result=(array)$did_result->first_row(); |
|
63 | + if($did_result['accountid'] > 0 || $did_result['parent_id'] > 0){ |
|
64 | + $data['accountid']=$did_result['accountid']; |
|
65 | + $data['parent_id']=$did_result['parent_id']; |
|
66 | + } |
|
67 | 67 | /** |
68 | 68 | ASTPP 3.0 |
69 | 69 | In did edit last modified date and assign date update |
70 | - **/ |
|
71 | - $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
72 | - if($did_result['accountid'] ==0 && $data['accountid'] > 0 ){ |
|
73 | - $data['assign_date']=gmdate("Y-m-d H:i:s"); |
|
70 | + **/ |
|
71 | + $data['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
72 | + if($did_result['accountid'] ==0 && $data['accountid'] > 0 ){ |
|
73 | + $data['assign_date']=gmdate("Y-m-d H:i:s"); |
|
74 | 74 | } |
75 | 75 | $this->db->where("number", $number); |
76 | 76 | $this->db->where("id", $id); |
77 | 77 | $this->db->update("dids", $data); |
78 | - /**************************************/ |
|
79 | - if($did_result['parent_id'] > 0 ){ |
|
80 | - $update_array['call_type']=$data['call_type']; |
|
81 | - $update_array['extensions']=$data['extensions']; |
|
82 | - $this->db->where("note", $number); |
|
83 | - $this->db->update("reseller_pricing", $update_array); |
|
84 | - } |
|
85 | - if($did_result['accountid'] ==0 && $data['accountid'] > 0 ){ |
|
86 | - $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$data['accountid']))->first_row(); |
|
87 | - $currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$accountinfo['currency_id'])); |
|
88 | - $available_bal = $this->db_model->update_balance( $data["setup"], $data['accountid'], "debit"); |
|
89 | - $this->common->add_invoice_details($accountinfo, "DIDCHRG", $data["setup"], $number); |
|
90 | - $accountinfo['did_number'] = $number; |
|
91 | - $country_id = $this->common->get_field_name('country', 'countrycode', $data['country_id']); |
|
92 | - $accountinfo['did_country_id'] = $country_id; |
|
93 | - $accountinfo['did_setup'] = $this->common_model->calculate_currency($data['setup'],'',$currency_name,true,true); |
|
94 | - $accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($data['monthlycost'],'',$currency_name,true,true); |
|
95 | - $accountinfo['did_maxchannels'] = $data['maxchannels']; |
|
96 | - $this->common->mail_to_users('email_add_did', $accountinfo); |
|
97 | - } |
|
98 | - } |
|
78 | + /**************************************/ |
|
79 | + if($did_result['parent_id'] > 0 ){ |
|
80 | + $update_array['call_type']=$data['call_type']; |
|
81 | + $update_array['extensions']=$data['extensions']; |
|
82 | + $this->db->where("note", $number); |
|
83 | + $this->db->update("reseller_pricing", $update_array); |
|
84 | + } |
|
85 | + if($did_result['accountid'] ==0 && $data['accountid'] > 0 ){ |
|
86 | + $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$data['accountid']))->first_row(); |
|
87 | + $currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$accountinfo['currency_id'])); |
|
88 | + $available_bal = $this->db_model->update_balance( $data["setup"], $data['accountid'], "debit"); |
|
89 | + $this->common->add_invoice_details($accountinfo, "DIDCHRG", $data["setup"], $number); |
|
90 | + $accountinfo['did_number'] = $number; |
|
91 | + $country_id = $this->common->get_field_name('country', 'countrycode', $data['country_id']); |
|
92 | + $accountinfo['did_country_id'] = $country_id; |
|
93 | + $accountinfo['did_setup'] = $this->common_model->calculate_currency($data['setup'],'',$currency_name,true,true); |
|
94 | + $accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($data['monthlycost'],'',$currency_name,true,true); |
|
95 | + $accountinfo['did_maxchannels'] = $data['maxchannels']; |
|
96 | + $this->common->mail_to_users('email_add_did', $accountinfo); |
|
97 | + } |
|
98 | + } |
|
99 | 99 | |
100 | - function getdid_list($flag, $start = 0, $limit = 0) { |
|
101 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
102 | - $parent_id= $accountinfo['type']==1 ? $accountinfo['reseller_id'] : 0 ; |
|
100 | + function getdid_list($flag, $start = 0, $limit = 0) { |
|
101 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
102 | + $parent_id= $accountinfo['type']==1 ? $accountinfo['reseller_id'] : 0 ; |
|
103 | 103 | |
104 | - if($accountinfo['type']==1) |
|
105 | - { |
|
106 | - $where = array('reseller_id' => $accountinfo['id'],"parent_id"=>$parent_id); |
|
104 | + if($accountinfo['type']==1) |
|
105 | + { |
|
106 | + $where = array('reseller_id' => $accountinfo['id'],"parent_id"=>$parent_id); |
|
107 | 107 | if ($flag) { |
108 | 108 | if($accountinfo['reseller_id'] > 0 ){ |
109 | - $search_string=$this->db_model->build_search_string('did_list_search'); |
|
110 | - $search_string= !empty($search_string) ? " AND ".$search_string : null; |
|
111 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
109 | + $search_string=$this->db_model->build_search_string('did_list_search'); |
|
110 | + $search_string= !empty($search_string) ? " AND ".$search_string : null; |
|
111 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
112 | 112 | $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
113 | - } |
|
114 | - $this->db->limit($limit, $start); |
|
115 | - $query=$this->db->query("SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=".$accountinfo['id']." AND a.parent_id =".$accountinfo['reseller_id'].$search_string); |
|
113 | + } |
|
114 | + $this->db->limit($limit, $start); |
|
115 | + $query=$this->db->query("SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=".$accountinfo['id']." AND a.parent_id =".$accountinfo['reseller_id'].$search_string); |
|
116 | 116 | } |
117 | 117 | else{ |
118 | - $this->db_model->build_search('did_list_search'); |
|
119 | - $query = $this->db_model->select("*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start); |
|
118 | + $this->db_model->build_search('did_list_search'); |
|
119 | + $query = $this->db_model->select("*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start); |
|
120 | 120 | } |
121 | 121 | } else { |
122 | 122 | $this->db_model->build_search('did_list_search'); |
123 | 123 | $query = $this->db_model->countQuery("*", "reseller_pricing", $where); |
124 | 124 | } |
125 | 125 | |
126 | - } |
|
127 | - else |
|
128 | - { |
|
129 | - $this->db_model->build_search('did_list_search'); |
|
130 | - if ($flag) { |
|
131 | - /* |
|
126 | + } |
|
127 | + else |
|
128 | + { |
|
129 | + $this->db_model->build_search('did_list_search'); |
|
130 | + if ($flag) { |
|
131 | + /* |
|
132 | 132 | ASTPP 3.0 last_modified_date,assign_date put in query. |
133 | 133 | */ |
134 | 134 | $this->db->select('dids.id,dids.connectcost,dids.includedseconds,dids.last_modified_date,dids.assign_date,dids.number,dids.extensions,dids.call_type,dids.country_id,dids.init_inc,dids.inc,dids.cost,dids.setup,dids.monthlycost,dids.status,(CASE when parent_id > 0 THEN (SELECT reseller_id as accountid from reseller_pricing where dids.number=reseller_pricing.note AND reseller_pricing.parent_id=0) ELSE dids.accountid END ) as accountid'); |
135 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
136 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
137 | - } |
|
135 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
136 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
137 | + } |
|
138 | 138 | /*********************************************************88*/ |
139 | 139 | $this->db->limit($limit, $start); |
140 | 140 | $query=$this->db->get('dids'); |
141 | - } else { |
|
141 | + } else { |
|
142 | 142 | $query = $this->db_model->countQuery("*", "dids"); |
143 | - } |
|
144 | - } |
|
145 | - return $query; |
|
143 | + } |
|
144 | + } |
|
145 | + return $query; |
|
146 | 146 | } |
147 | 147 | function remove_did($id) { |
148 | 148 | /** |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | $this->db->select('accountid,number,parent_id'); |
155 | 155 | $did_info=(array)$this->db->get('dids')->first_row(); |
156 | 156 | $this->db->where("id", $id); |
157 | - $this->db->delete("dids"); |
|
158 | - $this->db->where("note", $did_info['number']); |
|
159 | - $this->db->delete("reseller_pricing"); |
|
160 | - if($did_info['accountid'] == 0 && $did_info['parent_id'] > 0){ |
|
157 | + $this->db->delete("dids"); |
|
158 | + $this->db->where("note", $did_info['number']); |
|
159 | + $this->db->delete("reseller_pricing"); |
|
160 | + if($did_info['accountid'] == 0 && $did_info['parent_id'] > 0){ |
|
161 | 161 | $accountinfo=$this->session->userdata('accountinfo'); |
162 | 162 | $did_info['accountid']=$accouninfo['id']; |
163 | 163 | $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$did_info['parent_id']))->first_row(); |
@@ -168,177 +168,177 @@ discard block |
||
168 | 168 | $accountinfo['did_number'] = $did_info['number']; |
169 | 169 | $this->common->mail_to_users('email_remove_did', $accountinfo); |
170 | 170 | } |
171 | - return true; |
|
172 | - } |
|
171 | + return true; |
|
172 | + } |
|
173 | 173 | |
174 | - function get_coutry_id_by_name($field_value) { |
|
175 | - $this->db->where("country", ucfirst($field_value)); |
|
176 | - $query = $this->db->get('countrycode'); |
|
177 | - $data = $query->result(); |
|
178 | - if ($query->num_rows > 0) |
|
179 | - return $data[0]->id; |
|
180 | - else |
|
181 | - return ''; |
|
182 | - } |
|
174 | + function get_coutry_id_by_name($field_value) { |
|
175 | + $this->db->where("country", ucfirst($field_value)); |
|
176 | + $query = $this->db->get('countrycode'); |
|
177 | + $data = $query->result(); |
|
178 | + if ($query->num_rows > 0) |
|
179 | + return $data[0]->id; |
|
180 | + else |
|
181 | + return ''; |
|
182 | + } |
|
183 | 183 | |
184 | - function bulk_insert_dids($field_value) { |
|
185 | - $this->db->insert_batch('dids', $field_value); |
|
186 | - $affected_row = $this->db->affected_rows(); |
|
187 | - return $affected_row; |
|
188 | - } |
|
184 | + function bulk_insert_dids($field_value) { |
|
185 | + $this->db->insert_batch('dids', $field_value); |
|
186 | + $affected_row = $this->db->affected_rows(); |
|
187 | + return $affected_row; |
|
188 | + } |
|
189 | 189 | |
190 | - function get_account($accountdata) { |
|
191 | - $q = "SELECT * FROM accounts WHERE number = '" . $this->db->escape_str($accountdata) . "' AND status = 0"; |
|
192 | - $query = $this->db->query($q); |
|
193 | - if ($query->num_rows() > 0) { |
|
194 | - $row = $query->row_array(); |
|
195 | - return $row; |
|
196 | - } |
|
190 | + function get_account($accountdata) { |
|
191 | + $q = "SELECT * FROM accounts WHERE number = '" . $this->db->escape_str($accountdata) . "' AND status = 0"; |
|
192 | + $query = $this->db->query($q); |
|
193 | + if ($query->num_rows() > 0) { |
|
194 | + $row = $query->row_array(); |
|
195 | + return $row; |
|
196 | + } |
|
197 | 197 | |
198 | - $q = "SELECT * FROM accounts WHERE cc = '" . $this->db->escape_str($accountdata) . "' AND status = 0"; |
|
199 | - $query = $this->db->query($q); |
|
200 | - if ($query->num_rows() > 0) { |
|
201 | - $row = $query->row_array(); |
|
202 | - return $row; |
|
203 | - } |
|
198 | + $q = "SELECT * FROM accounts WHERE cc = '" . $this->db->escape_str($accountdata) . "' AND status = 0"; |
|
199 | + $query = $this->db->query($q); |
|
200 | + if ($query->num_rows() > 0) { |
|
201 | + $row = $query->row_array(); |
|
202 | + return $row; |
|
203 | + } |
|
204 | 204 | |
205 | - $q = "SELECT * FROM accounts WHERE accountid = '" . $this->db->escape_str($accountdata) . "' AND status = 0"; |
|
206 | - $query = $this->db->query($q); |
|
207 | - if ($query->num_rows() > 0) { |
|
208 | - $row = $query->row_array(); |
|
209 | - return $row; |
|
210 | - } |
|
205 | + $q = "SELECT * FROM accounts WHERE accountid = '" . $this->db->escape_str($accountdata) . "' AND status = 0"; |
|
206 | + $query = $this->db->query($q); |
|
207 | + if ($query->num_rows() > 0) { |
|
208 | + $row = $query->row_array(); |
|
209 | + return $row; |
|
210 | + } |
|
211 | 211 | |
212 | - return NULL; |
|
213 | - } |
|
212 | + return NULL; |
|
213 | + } |
|
214 | 214 | |
215 | - function get_did_reseller_new($did, $reseller_id = "") { |
|
216 | - $sql = "SELECT dids.number AS number, " |
|
217 | - . "reseller_pricing.monthlycost AS monthlycost, " |
|
218 | - . "reseller_pricing.prorate AS prorate, " |
|
219 | - . "reseller_pricing.setup AS setup, " |
|
220 | - . "reseller_pricing.cost AS cost, " |
|
221 | - . "reseller_pricing.connectcost AS connectcost, " |
|
222 | - . "reseller_pricing.includedseconds AS includedseconds, " |
|
223 | - . "reseller_pricing.inc AS inc, " |
|
224 | - . "reseller_pricing.disconnectionfee AS disconnectionfee, " |
|
225 | - . "dids.provider_id AS provider_id, " |
|
226 | - . "dids.country_id AS country_id, " |
|
227 | - . "dids.city AS city, " |
|
228 | - . "dids.province AS province, " |
|
229 | - . "dids.extensions AS extensions, " |
|
230 | - . "dids.accountid AS account, " |
|
231 | - . "dids.variables AS variables, " |
|
232 | - . "dids.options AS options, " |
|
233 | - . "dids.maxchannels AS maxchannels, " |
|
234 | - . "dids.chargeonallocation AS chargeonallocation, " |
|
235 | - . "dids.allocation_bill_status AS allocation_bill_status, " |
|
236 | - . "dids.limittime AS limittime, " |
|
237 | - . "dids.dial_as AS dial_as, " |
|
238 | - . "dids.status AS status " |
|
239 | - . "FROM dids, reseller_pricing " |
|
240 | - . "WHERE dids.id = " . $did |
|
241 | - . " AND reseller_pricing.type = '1' AND reseller_pricing.reseller_id = " |
|
242 | - . $reseller_id; |
|
243 | - $query = $this->db->query($sql); |
|
244 | - if ($query->num_rows() > 0) { |
|
245 | - return $query->row_array(); |
|
246 | - } |
|
247 | - } |
|
215 | + function get_did_reseller_new($did, $reseller_id = "") { |
|
216 | + $sql = "SELECT dids.number AS number, " |
|
217 | + . "reseller_pricing.monthlycost AS monthlycost, " |
|
218 | + . "reseller_pricing.prorate AS prorate, " |
|
219 | + . "reseller_pricing.setup AS setup, " |
|
220 | + . "reseller_pricing.cost AS cost, " |
|
221 | + . "reseller_pricing.connectcost AS connectcost, " |
|
222 | + . "reseller_pricing.includedseconds AS includedseconds, " |
|
223 | + . "reseller_pricing.inc AS inc, " |
|
224 | + . "reseller_pricing.disconnectionfee AS disconnectionfee, " |
|
225 | + . "dids.provider_id AS provider_id, " |
|
226 | + . "dids.country_id AS country_id, " |
|
227 | + . "dids.city AS city, " |
|
228 | + . "dids.province AS province, " |
|
229 | + . "dids.extensions AS extensions, " |
|
230 | + . "dids.accountid AS account, " |
|
231 | + . "dids.variables AS variables, " |
|
232 | + . "dids.options AS options, " |
|
233 | + . "dids.maxchannels AS maxchannels, " |
|
234 | + . "dids.chargeonallocation AS chargeonallocation, " |
|
235 | + . "dids.allocation_bill_status AS allocation_bill_status, " |
|
236 | + . "dids.limittime AS limittime, " |
|
237 | + . "dids.dial_as AS dial_as, " |
|
238 | + . "dids.status AS status " |
|
239 | + . "FROM dids, reseller_pricing " |
|
240 | + . "WHERE dids.id = " . $did |
|
241 | + . " AND reseller_pricing.type = '1' AND reseller_pricing.reseller_id = " |
|
242 | + . $reseller_id; |
|
243 | + $query = $this->db->query($sql); |
|
244 | + if ($query->num_rows() > 0) { |
|
245 | + return $query->row_array(); |
|
246 | + } |
|
247 | + } |
|
248 | 248 | |
249 | - function get_did_by_number($number) { |
|
250 | - $this->db->where("id", $number); |
|
251 | - $this->db->or_where("number", $number); |
|
252 | - $query = $this->db->get("dids"); |
|
253 | - if ($query->num_rows() > 0) |
|
254 | - return $query->row_array(); |
|
255 | - else |
|
256 | - return false; |
|
257 | - } |
|
249 | + function get_did_by_number($number) { |
|
250 | + $this->db->where("id", $number); |
|
251 | + $this->db->or_where("number", $number); |
|
252 | + $query = $this->db->get("dids"); |
|
253 | + if ($query->num_rows() > 0) |
|
254 | + return $query->row_array(); |
|
255 | + else |
|
256 | + return false; |
|
257 | + } |
|
258 | 258 | function edit_did_reseller($did_id,$post) { |
259 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
259 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
260 | 260 | |
261 | - $where_array=array('reseller_id' => $accountinfo['id'], 'note' => $post['number'], 'type' => '1'); |
|
261 | + $where_array=array('reseller_id' => $accountinfo['id'], 'note' => $post['number'], 'type' => '1'); |
|
262 | 262 | $this->db->where($where_array); |
263 | 263 | $flag='0'; |
264 | - $query = $this->db->get('reseller_pricing'); |
|
265 | - if($query->num_rows() > 0){ |
|
264 | + $query = $this->db->get('reseller_pricing'); |
|
265 | + if($query->num_rows() > 0){ |
|
266 | 266 | $flag='1'; |
267 | - } |
|
267 | + } |
|
268 | 268 | |
269 | - $this->insert_reseller_pricing($accountinfo, $post); |
|
270 | - return $flag; |
|
271 | - } |
|
269 | + $this->insert_reseller_pricing($accountinfo, $post); |
|
270 | + return $flag; |
|
271 | + } |
|
272 | 272 | |
273 | - function delete_pricing_reseller($username, $number) { |
|
274 | - $where = array('reseller_id' => $username, 'note' => $number, 'type' => '1'); |
|
275 | - $this->db->where($where); |
|
276 | - $this->db->delete('reseller_pricing'); |
|
277 | - return true; |
|
278 | - } |
|
273 | + function delete_pricing_reseller($username, $number) { |
|
274 | + $where = array('reseller_id' => $username, 'note' => $number, 'type' => '1'); |
|
275 | + $this->db->where($where); |
|
276 | + $this->db->delete('reseller_pricing'); |
|
277 | + return true; |
|
278 | + } |
|
279 | 279 | |
280 | 280 | function insert_reseller_pricing($accountinfo, $post) { |
281 | - $insert_array = array('reseller_id' => $accountinfo['id'], 'type' => '1', 'note' => $post['number'], |
|
282 | - 'parent_id'=>$accountinfo['reseller_id'], |
|
283 | - 'monthlycost' => $post['monthlycost'], |
|
284 | - 'prorate' => $post['prorate'], |
|
285 | - 'setup' => $post['setup'], |
|
286 | - 'cost' => $post['cost'], |
|
287 | - 'inc' => $post['inc'], |
|
288 | - 'extensions'=>$post['extensions'], |
|
289 | - 'call_type'=>$post['call_type'], |
|
290 | - 'disconnectionfee' => $post['disconnectionfee'], |
|
291 | - 'connectcost' => $post['connectcost'], |
|
292 | - 'includedseconds' => $post['includedseconds'], |
|
293 | - 'status' => '0', |
|
294 | - 'assign_date'=>gmdate('Y-m-d H:i:s')); |
|
281 | + $insert_array = array('reseller_id' => $accountinfo['id'], 'type' => '1', 'note' => $post['number'], |
|
282 | + 'parent_id'=>$accountinfo['reseller_id'], |
|
283 | + 'monthlycost' => $post['monthlycost'], |
|
284 | + 'prorate' => $post['prorate'], |
|
285 | + 'setup' => $post['setup'], |
|
286 | + 'cost' => $post['cost'], |
|
287 | + 'inc' => $post['inc'], |
|
288 | + 'extensions'=>$post['extensions'], |
|
289 | + 'call_type'=>$post['call_type'], |
|
290 | + 'disconnectionfee' => $post['disconnectionfee'], |
|
291 | + 'connectcost' => $post['connectcost'], |
|
292 | + 'includedseconds' => $post['includedseconds'], |
|
293 | + 'status' => '0', |
|
294 | + 'assign_date'=>gmdate('Y-m-d H:i:s')); |
|
295 | 295 | |
296 | - $this->db->insert('reseller_pricing', $insert_array); |
|
297 | - return true; |
|
298 | - } |
|
296 | + $this->db->insert('reseller_pricing', $insert_array); |
|
297 | + return true; |
|
298 | + } |
|
299 | 299 | |
300 | - function update_dids_reseller($post) { |
|
301 | - $where = array('id' => $post['did_id']); |
|
302 | - $update_array = array('dial_as' => $post['dial_as'], 'extensions' => $post['extension']); |
|
303 | - $this->db->where($where); |
|
304 | - $this->db->update('dids', $update_array); |
|
305 | - } |
|
300 | + function update_dids_reseller($post) { |
|
301 | + $where = array('id' => $post['did_id']); |
|
302 | + $update_array = array('dial_as' => $post['dial_as'], 'extensions' => $post['extension']); |
|
303 | + $this->db->where($where); |
|
304 | + $this->db->update('dids', $update_array); |
|
305 | + } |
|
306 | 306 | |
307 | - function delete_routes($id, $number, $pricelist_id) { |
|
308 | - $number = "^" . $number . ".*"; |
|
309 | - $where = array('pricelist_id' => $pricelist_id, 'pattern' => $number); |
|
310 | - $this->db->where($where); |
|
311 | - $this->db->delete('routes'); |
|
312 | - } |
|
307 | + function delete_routes($id, $number, $pricelist_id) { |
|
308 | + $number = "^" . $number . ".*"; |
|
309 | + $where = array('pricelist_id' => $pricelist_id, 'pattern' => $number); |
|
310 | + $this->db->where($where); |
|
311 | + $this->db->delete('routes'); |
|
312 | + } |
|
313 | 313 | |
314 | - function insert_routes($post, $pricelist_id) { |
|
315 | - $commment = "DID:" . $post['country'] . "," . $post['province'] . "," . $post['city']; |
|
316 | - $insert_array = array('pattern' => "^" . $post['number'] . ".*", 'comment' => $commment, 'pricelist_id' => $pricelist_id, |
|
317 | - 'connectcost' => $post['connectcost'], 'includedseconds' => $post['included'], 'cost' => $post['cost'], 'inc' => $post['inc']); |
|
318 | - $this->db->insert('routes', $insert_array); |
|
319 | - return true; |
|
320 | - } |
|
314 | + function insert_routes($post, $pricelist_id) { |
|
315 | + $commment = "DID:" . $post['country'] . "," . $post['province'] . "," . $post['city']; |
|
316 | + $insert_array = array('pattern' => "^" . $post['number'] . ".*", 'comment' => $commment, 'pricelist_id' => $pricelist_id, |
|
317 | + 'connectcost' => $post['connectcost'], 'includedseconds' => $post['included'], 'cost' => $post['cost'], 'inc' => $post['inc']); |
|
318 | + $this->db->insert('routes', $insert_array); |
|
319 | + return true; |
|
320 | + } |
|
321 | 321 | |
322 | - function add_invoice_data($accountid,$charge_type,$description,$credit) |
|
323 | - { |
|
322 | + function add_invoice_data($accountid,$charge_type,$description,$credit) |
|
323 | + { |
|
324 | 324 | $insert_array = array('accountid' => $accountid, |
325 | - 'charge_type' => $charge_type, |
|
326 | - 'description' => $description, |
|
327 | - 'credit' => $credit, |
|
328 | - 'charge_id' => '0', |
|
329 | - 'package_id' => '0' |
|
330 | - ); |
|
325 | + 'charge_type' => $charge_type, |
|
326 | + 'description' => $description, |
|
327 | + 'credit' => $credit, |
|
328 | + 'charge_id' => '0', |
|
329 | + 'package_id' => '0' |
|
330 | + ); |
|
331 | 331 | |
332 | - $this->db->insert('invoice_item', $insert_array); |
|
333 | - return true; |
|
334 | - } |
|
335 | - function check_unique_did($number) |
|
336 | - { |
|
332 | + $this->db->insert('invoice_item', $insert_array); |
|
333 | + return true; |
|
334 | + } |
|
335 | + function check_unique_did($number) |
|
336 | + { |
|
337 | 337 | |
338 | - $where=array('number'=>$number); |
|
339 | - $query = $this->db_model->countQuery("*", "dids", $where); |
|
340 | - return $query; |
|
341 | - } |
|
338 | + $where=array('number'=>$number); |
|
339 | + $query = $this->db_model->countQuery("*", "dids", $where); |
|
340 | + return $query; |
|
341 | + } |
|
342 | 342 | |
343 | 343 | |
344 | 344 | } |
@@ -23,142 +23,142 @@ discard block |
||
23 | 23 | |
24 | 24 | class Package extends MX_Controller { |
25 | 25 | |
26 | - function Package() { |
|
27 | - parent::__construct(); |
|
26 | + function Package() { |
|
27 | + parent::__construct(); |
|
28 | 28 | |
29 | - $this->load->helper('template_inheritance'); |
|
29 | + $this->load->helper('template_inheritance'); |
|
30 | 30 | |
31 | - $this->load->library('session'); |
|
32 | - $this->load->library('package_form'); |
|
33 | - $this->load->library('astpp/form'); |
|
34 | - $this->load->model('package_model'); |
|
35 | - $this->load->library('csvreader'); |
|
31 | + $this->load->library('session'); |
|
32 | + $this->load->library('package_form'); |
|
33 | + $this->load->library('astpp/form'); |
|
34 | + $this->load->model('package_model'); |
|
35 | + $this->load->library('csvreader'); |
|
36 | 36 | |
37 | - if ($this->session->userdata('user_login') == FALSE) |
|
38 | - redirect(base_url() . '/astpp/login'); |
|
39 | - } |
|
37 | + if ($this->session->userdata('user_login') == FALSE) |
|
38 | + redirect(base_url() . '/astpp/login'); |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | - function package_list() { |
|
43 | - $data['username'] = $this->session->userdata('user_name'); |
|
44 | - $data['page_title'] = 'Packages'; |
|
42 | + function package_list() { |
|
43 | + $data['username'] = $this->session->userdata('user_name'); |
|
44 | + $data['page_title'] = 'Packages'; |
|
45 | 45 | $data['search_flag'] = true; |
46 | - $this->session->set_userdata('advance_search', 0); |
|
47 | - $data['grid_fields'] = $this->package_form->build_package_list_for_admin(); |
|
48 | - $data["grid_buttons"] = $this->package_form->build_grid_buttons(); |
|
49 | - $data['form_search'] = $this->form->build_serach_form($this->package_form->get_package_search_form()); |
|
50 | - $this->load->view('view_package_list', $data); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * -------Here we write code for controller accounts functions account_list------ |
|
55 | - * Listing of Accounts table data through php function json_encode |
|
56 | - */ |
|
57 | - function package_list_json() { |
|
58 | - $json_data = array(); |
|
59 | - $count_all = $this->package_model->getpackage_list(false); |
|
60 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
61 | - $json_data = $paging_data["json_paging"]; |
|
62 | - |
|
63 | - $query = $this->package_model->getpackage_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
64 | - $grid_fields = json_decode($this->package_form->build_package_list_for_admin()); |
|
65 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
66 | - |
|
67 | - echo json_encode($json_data); |
|
68 | - } |
|
69 | - function package_list_reseller($accountid,$accounttype){ |
|
46 | + $this->session->set_userdata('advance_search', 0); |
|
47 | + $data['grid_fields'] = $this->package_form->build_package_list_for_admin(); |
|
48 | + $data["grid_buttons"] = $this->package_form->build_grid_buttons(); |
|
49 | + $data['form_search'] = $this->form->build_serach_form($this->package_form->get_package_search_form()); |
|
50 | + $this->load->view('view_package_list', $data); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * -------Here we write code for controller accounts functions account_list------ |
|
55 | + * Listing of Accounts table data through php function json_encode |
|
56 | + */ |
|
57 | + function package_list_json() { |
|
58 | + $json_data = array(); |
|
59 | + $count_all = $this->package_model->getpackage_list(false); |
|
60 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
61 | + $json_data = $paging_data["json_paging"]; |
|
62 | + |
|
63 | + $query = $this->package_model->getpackage_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
64 | + $grid_fields = json_decode($this->package_form->build_package_list_for_admin()); |
|
65 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
66 | + |
|
67 | + echo json_encode($json_data); |
|
68 | + } |
|
69 | + function package_list_reseller($accountid,$accounttype){ |
|
70 | 70 | $json_data = array(); |
71 | - $count_all = $this->package_model->get_reseller_package_list(false,$accountid,$accounttype); |
|
72 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
73 | - $json_data = $paging_data["json_paging"]; |
|
74 | - $query = $this->package_model->get_reseller_package_list(true,$accountid,$accounttype,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
75 | - $grid_fields = json_decode($this->package_form->build_package_list_for_reseller()); |
|
76 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
77 | - echo json_encode($json_data); |
|
78 | - } |
|
71 | + $count_all = $this->package_model->get_reseller_package_list(false,$accountid,$accounttype); |
|
72 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
73 | + $json_data = $paging_data["json_paging"]; |
|
74 | + $query = $this->package_model->get_reseller_package_list(true,$accountid,$accounttype,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
75 | + $grid_fields = json_decode($this->package_form->build_package_list_for_reseller()); |
|
76 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
77 | + echo json_encode($json_data); |
|
78 | + } |
|
79 | 79 | function package_list_search() { |
80 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
81 | - |
|
82 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
83 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
84 | - $action = $this->input->post(); |
|
85 | - unset($action['action']); |
|
86 | - unset($action['advance_search']); |
|
87 | - $this->session->set_userdata('package_list_search', $action); |
|
88 | - } |
|
89 | - if (@$ajax_search != 1) { |
|
90 | - redirect(base_url() . 'package/package_list/'); |
|
91 | - } |
|
92 | - } |
|
80 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
81 | + |
|
82 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
83 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
84 | + $action = $this->input->post(); |
|
85 | + unset($action['action']); |
|
86 | + unset($action['advance_search']); |
|
87 | + $this->session->set_userdata('package_list_search', $action); |
|
88 | + } |
|
89 | + if (@$ajax_search != 1) { |
|
90 | + redirect(base_url() . 'package/package_list/'); |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - function package_list_clearsearchfilter() { |
|
95 | - $this->session->set_userdata('advance_search', 0); |
|
96 | - $this->session->set_userdata('package_list_search', ""); |
|
97 | - } |
|
94 | + function package_list_clearsearchfilter() { |
|
95 | + $this->session->set_userdata('advance_search', 0); |
|
96 | + $this->session->set_userdata('package_list_search', ""); |
|
97 | + } |
|
98 | 98 | |
99 | - function package_add($type = "") { |
|
100 | - $data['page_title'] = 'Create Package'; |
|
101 | - $data['form'] = $this->form->build_form($this->package_form->get_package_form_fields(), ''); |
|
102 | - $this->load->view('view_package_add', $data); |
|
103 | - } |
|
99 | + function package_add($type = "") { |
|
100 | + $data['page_title'] = 'Create Package'; |
|
101 | + $data['form'] = $this->form->build_form($this->package_form->get_package_form_fields(), ''); |
|
102 | + $this->load->view('view_package_add', $data); |
|
103 | + } |
|
104 | 104 | |
105 | - function package_edit($edit_id = '') { |
|
105 | + function package_edit($edit_id = '') { |
|
106 | 106 | $data['page_title'] = 'Package Details'; |
107 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
108 | - $reseller_id=$accountinfo['type'] == 1 ? $accountinfo['id']:0; |
|
109 | - $package_result = $this->db_model->getSelect("*", " packages", array('id' => $edit_id,"reseller_id"=>$reseller_id)); |
|
110 | - if ($package_result->num_rows > 0) { |
|
111 | - $package_info=(array)$package_result->first_row(); |
|
112 | - $data['form'] = $this->form->build_form($this->package_form->get_package_form_fields($package_info['id']), $package_info); |
|
113 | - $data['edit_id']=$package_info['id']; |
|
114 | - $this->load->view('view_packages_edit', $data); |
|
115 | - } else { |
|
116 | - redirect(base_url() . 'package/package_list/'); |
|
117 | - } |
|
118 | - } |
|
119 | - |
|
120 | - function package_save($id="") { |
|
121 | - $add_array = $this->input->post(); |
|
122 | - $data['form'] = $this->form->build_form($this->package_form->get_package_form_fields($add_array['id']), $add_array); |
|
123 | - if ($add_array['id'] != '') { |
|
124 | - if ($this->form_validation->run() == FALSE) { |
|
125 | - $data['edit_id']= $add_array['id']; |
|
126 | - $data['validation_errors'] = validation_errors(); |
|
127 | - $this->load->view('view_packages_edit', $data); |
|
128 | - } else { |
|
129 | - $this->package_model->edit_package($add_array, $add_array['id']); |
|
130 | - $this->session->set_flashdata('astpp_errormsg', 'Package updated successfully!'); |
|
131 | - redirect(base_url() . 'package/package_list/'); |
|
132 | - exit; |
|
133 | - } |
|
134 | - } else { |
|
135 | - $data['page_title'] = 'Create Package'; |
|
136 | - if ($this->form_validation->run() == FALSE) { |
|
137 | - $data['validation_errors'] = validation_errors(); |
|
138 | - $this->load->view('view_package_add', $data); |
|
139 | - } else { |
|
140 | - |
|
141 | - $this->package_model->add_package($add_array); |
|
107 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
108 | + $reseller_id=$accountinfo['type'] == 1 ? $accountinfo['id']:0; |
|
109 | + $package_result = $this->db_model->getSelect("*", " packages", array('id' => $edit_id,"reseller_id"=>$reseller_id)); |
|
110 | + if ($package_result->num_rows > 0) { |
|
111 | + $package_info=(array)$package_result->first_row(); |
|
112 | + $data['form'] = $this->form->build_form($this->package_form->get_package_form_fields($package_info['id']), $package_info); |
|
113 | + $data['edit_id']=$package_info['id']; |
|
114 | + $this->load->view('view_packages_edit', $data); |
|
115 | + } else { |
|
116 | + redirect(base_url() . 'package/package_list/'); |
|
117 | + } |
|
118 | + } |
|
119 | + |
|
120 | + function package_save($id="") { |
|
121 | + $add_array = $this->input->post(); |
|
122 | + $data['form'] = $this->form->build_form($this->package_form->get_package_form_fields($add_array['id']), $add_array); |
|
123 | + if ($add_array['id'] != '') { |
|
124 | + if ($this->form_validation->run() == FALSE) { |
|
125 | + $data['edit_id']= $add_array['id']; |
|
126 | + $data['validation_errors'] = validation_errors(); |
|
127 | + $this->load->view('view_packages_edit', $data); |
|
128 | + } else { |
|
129 | + $this->package_model->edit_package($add_array, $add_array['id']); |
|
130 | + $this->session->set_flashdata('astpp_errormsg', 'Package updated successfully!'); |
|
131 | + redirect(base_url() . 'package/package_list/'); |
|
132 | + exit; |
|
133 | + } |
|
134 | + } else { |
|
135 | + $data['page_title'] = 'Create Package'; |
|
136 | + if ($this->form_validation->run() == FALSE) { |
|
137 | + $data['validation_errors'] = validation_errors(); |
|
138 | + $this->load->view('view_package_add', $data); |
|
139 | + } else { |
|
140 | + |
|
141 | + $this->package_model->add_package($add_array); |
|
142 | 142 | /** |
143 | 143 | ASTPP 3.0 |
144 | 144 | For Email Broadcast when package is add |
145 | 145 | **/ |
146 | 146 | $accountinfo = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $add_array['pricelist_id'],"status"=>0, "deleted"=>0)); |
147 | 147 | $accountinfo = $accountinfo->result_array(); |
148 | - $this->session->set_flashdata('astpp_errormsg', 'Package added successfully!'); |
|
148 | + $this->session->set_flashdata('astpp_errormsg', 'Package added successfully!'); |
|
149 | 149 | foreach($accountinfo as $key => $value){ |
150 | 150 | $this->common->mail_to_users('add_package', $value); |
151 | 151 | } |
152 | 152 | /**************************************/ |
153 | - redirect(base_url() . 'package/package_list/'); |
|
154 | - exit; |
|
155 | - } |
|
156 | - } |
|
157 | - } |
|
153 | + redirect(base_url() . 'package/package_list/'); |
|
154 | + exit; |
|
155 | + } |
|
156 | + } |
|
157 | + } |
|
158 | 158 | |
159 | 159 | |
160 | 160 | |
161 | - function package_delete($id) { |
|
161 | + function package_delete($id) { |
|
162 | 162 | /** |
163 | 163 | ASTPP 3.0 |
164 | 164 | For Email Broadcast when package is add |
@@ -167,188 +167,188 @@ discard block |
||
167 | 167 | $package_detail = $package_detail->result_array(); |
168 | 168 | $package_detail = $package_detail[0]; |
169 | 169 | $accountinfo = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $package_detail['pricelist_id'],"status"=>0, "deleted"=>0)); |
170 | - $this->package_model->remove_package($id); |
|
171 | - $this->session->set_flashdata('astpp_notification', 'Package removed successfully!'); |
|
170 | + $this->package_model->remove_package($id); |
|
171 | + $this->session->set_flashdata('astpp_notification', 'Package removed successfully!'); |
|
172 | 172 | foreach($accountinfo->result_array() as $key => $value){ |
173 | 173 | $this->common->mail_to_users('remove_package', $value); |
174 | 174 | } |
175 | 175 | /******************************************/ |
176 | - redirect(base_url() . 'package/package_list/'); |
|
177 | - } |
|
176 | + redirect(base_url() . 'package/package_list/'); |
|
177 | + } |
|
178 | 178 | |
179 | - function package_delete_multiple() { |
|
180 | - $ids = $this->input->post("selected_ids", true); |
|
181 | - $where = "id IN ($ids)"; |
|
182 | - $this->db->where($where); |
|
183 | - echo $this->db->delete("packages"); |
|
184 | - } |
|
185 | - |
|
186 | - function package_pattern_list($package_id){ |
|
179 | + function package_delete_multiple() { |
|
180 | + $ids = $this->input->post("selected_ids", true); |
|
181 | + $where = "id IN ($ids)"; |
|
182 | + $this->db->where($where); |
|
183 | + echo $this->db->delete("packages"); |
|
184 | + } |
|
185 | + |
|
186 | + function package_pattern_list($package_id){ |
|
187 | 187 | $data['page_title'] = 'Package Codes'; |
188 | - if(!empty($package_id)){ |
|
189 | - $data['grid_fields'] = $this->package_form->build_pattern_list_for_customer($package_id); |
|
190 | - $data['grid_buttons'] = $this->package_form->set_pattern_grid_buttons($package_id); |
|
191 | - $data["edit_id"] = $package_id; |
|
192 | - $this->load->view("view_package_pattern_list",$data); |
|
193 | - }else{ |
|
194 | - redirect(base_url()."package/package_list/"); |
|
195 | - } |
|
196 | - } |
|
197 | - function package_pattern_list_json($package_id){ |
|
198 | - $json_data = array(); |
|
199 | - $instant_search=$this->session->userdata('left_panel_search_package_pattern'); |
|
200 | - $like_str=!empty($instant_search) ? "(patterns like '%$instant_search%' OR destination like '%$instant_search%' )" :null; |
|
201 | - if(!empty($like_str)) |
|
202 | - $this->db->where($like_str); |
|
203 | - $where = array('package_id' => $package_id); |
|
204 | - $count_all = $this->db_model->countQuery("*", "package_patterns", $where); |
|
205 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
206 | - $json_data = $paging_data["json_paging"]; |
|
207 | - if(!empty($like_str)) |
|
208 | - $this->db->where($like_str); |
|
209 | - $pattern_data = $this->db_model->select("*", "package_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
188 | + if(!empty($package_id)){ |
|
189 | + $data['grid_fields'] = $this->package_form->build_pattern_list_for_customer($package_id); |
|
190 | + $data['grid_buttons'] = $this->package_form->set_pattern_grid_buttons($package_id); |
|
191 | + $data["edit_id"] = $package_id; |
|
192 | + $this->load->view("view_package_pattern_list",$data); |
|
193 | + }else{ |
|
194 | + redirect(base_url()."package/package_list/"); |
|
195 | + } |
|
196 | + } |
|
197 | + function package_pattern_list_json($package_id){ |
|
198 | + $json_data = array(); |
|
199 | + $instant_search=$this->session->userdata('left_panel_search_package_pattern'); |
|
200 | + $like_str=!empty($instant_search) ? "(patterns like '%$instant_search%' OR destination like '%$instant_search%' )" :null; |
|
201 | + if(!empty($like_str)) |
|
202 | + $this->db->where($like_str); |
|
203 | + $where = array('package_id' => $package_id); |
|
204 | + $count_all = $this->db_model->countQuery("*", "package_patterns", $where); |
|
205 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
206 | + $json_data = $paging_data["json_paging"]; |
|
207 | + if(!empty($like_str)) |
|
208 | + $this->db->where($like_str); |
|
209 | + $pattern_data = $this->db_model->select("*", "package_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
210 | 210 | |
211 | - $grid_fields = json_decode($this->package_form->build_pattern_list_for_customer($package_id)); |
|
212 | - $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields); |
|
213 | - |
|
214 | - echo json_encode($json_data); |
|
215 | - } |
|
216 | - function package_counter() { |
|
217 | - $data['username'] = $this->session->userdata('user_name'); |
|
218 | - $data['page_title'] = 'Usage Report'; |
|
219 | - $data['grid_fields'] = $this->package_form->build_package_counter_list_for_admin(); |
|
211 | + $grid_fields = json_decode($this->package_form->build_pattern_list_for_customer($package_id)); |
|
212 | + $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields); |
|
213 | + |
|
214 | + echo json_encode($json_data); |
|
215 | + } |
|
216 | + function package_counter() { |
|
217 | + $data['username'] = $this->session->userdata('user_name'); |
|
218 | + $data['page_title'] = 'Usage Report'; |
|
219 | + $data['grid_fields'] = $this->package_form->build_package_counter_list_for_admin(); |
|
220 | 220 | $data["grid_buttons"] = $this->package_form->build_package_counter_report(); |
221 | - $this->load->view('view_package_counter_report', $data); |
|
222 | - } |
|
223 | - |
|
224 | - /** |
|
225 | - * -------Here we write code for controller accounts functions account_list------ |
|
226 | - * Listing of Accounts table data through php function json_encode |
|
227 | - */ |
|
228 | - function package_counter_json() { |
|
229 | - $json_data = array(); |
|
230 | - $count_all = $this->package_model->getpackage_counter_list(false); |
|
231 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
232 | - $json_data = $paging_data["json_paging"]; |
|
233 | - |
|
234 | - $query = $this->package_model->getpackage_counter_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
235 | - $grid_fields = json_decode($this->package_form->build_package_counter_list_for_admin()); |
|
236 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
237 | - |
|
238 | - echo json_encode($json_data); |
|
239 | - } |
|
240 | - function package_counter_report_export(){ |
|
241 | - $query = $this->db_model->getSelect("*", "counters", ''); |
|
242 | - $outbound_array = array(); |
|
243 | - ob_clean(); |
|
244 | - $outbound_array[] = array("Package Name", "Account", "Used Seconds"); |
|
245 | - if ($query->num_rows() > 0) { |
|
246 | - |
|
247 | - foreach ($query->result_array() as $row) { |
|
248 | - $outbound_array[] = array( |
|
249 | - $this->common->get_field_name('package_name', 'packages', $row['package_id']), |
|
250 | - $this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', $row['accountid']), |
|
251 | - $row['seconds'] |
|
252 | - ); |
|
253 | - } |
|
254 | - } |
|
255 | - $this->load->helper('csv'); |
|
256 | - array_to_csv($outbound_array, 'Usage_Report_' . date("Y-m-d") . '.csv'); |
|
221 | + $this->load->view('view_package_counter_report', $data); |
|
222 | + } |
|
223 | + |
|
224 | + /** |
|
225 | + * -------Here we write code for controller accounts functions account_list------ |
|
226 | + * Listing of Accounts table data through php function json_encode |
|
227 | + */ |
|
228 | + function package_counter_json() { |
|
229 | + $json_data = array(); |
|
230 | + $count_all = $this->package_model->getpackage_counter_list(false); |
|
231 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
232 | + $json_data = $paging_data["json_paging"]; |
|
233 | + |
|
234 | + $query = $this->package_model->getpackage_counter_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
235 | + $grid_fields = json_decode($this->package_form->build_package_counter_list_for_admin()); |
|
236 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
237 | + |
|
238 | + echo json_encode($json_data); |
|
239 | + } |
|
240 | + function package_counter_report_export(){ |
|
241 | + $query = $this->db_model->getSelect("*", "counters", ''); |
|
242 | + $outbound_array = array(); |
|
243 | + ob_clean(); |
|
244 | + $outbound_array[] = array("Package Name", "Account", "Used Seconds"); |
|
245 | + if ($query->num_rows() > 0) { |
|
246 | + |
|
247 | + foreach ($query->result_array() as $row) { |
|
248 | + $outbound_array[] = array( |
|
249 | + $this->common->get_field_name('package_name', 'packages', $row['package_id']), |
|
250 | + $this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', $row['accountid']), |
|
251 | + $row['seconds'] |
|
252 | + ); |
|
253 | + } |
|
254 | + } |
|
255 | + $this->load->helper('csv'); |
|
256 | + array_to_csv($outbound_array, 'Usage_Report_' . date("Y-m-d") . '.csv'); |
|
257 | 257 | |
258 | - } |
|
259 | - function package_pattern_json($package_id){ |
|
260 | - $json_data = array(); |
|
261 | - $where = array('package_id' => $package_id); |
|
258 | + } |
|
259 | + function package_pattern_json($package_id){ |
|
260 | + $json_data = array(); |
|
261 | + $where = array('package_id' => $package_id); |
|
262 | 262 | |
263 | - $count_all = $this->db_model->countQuery("*", "package_patterns", $where); |
|
264 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
265 | - $json_data = $paging_data["json_paging"]; |
|
263 | + $count_all = $this->db_model->countQuery("*", "package_patterns", $where); |
|
264 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
265 | + $json_data = $paging_data["json_paging"]; |
|
266 | 266 | |
267 | - $pattern_data = $this->db_model->select("*", "package_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
268 | - $grid_fields = json_decode($this->package_form->build_pattern_list_for_customer($package_id)); |
|
269 | - $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields); |
|
267 | + $pattern_data = $this->db_model->select("*", "package_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
268 | + $grid_fields = json_decode($this->package_form->build_pattern_list_for_customer($package_id)); |
|
269 | + $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields); |
|
270 | 270 | |
271 | - echo json_encode($json_data); |
|
272 | - } |
|
271 | + echo json_encode($json_data); |
|
272 | + } |
|
273 | 273 | |
274 | - function package_patterns_add($packageid) { |
|
275 | - $data['username'] = $this->session->userdata('user_name'); |
|
276 | - $data['page_title'] = 'Unblocked Prefixes'; |
|
277 | - $this->session->set_userdata('advance_search', 0); |
|
278 | - $this->load->module('rates/rates'); |
|
279 | - $data['patters_grid_fields'] = $this->rates->rates_form->build_block_pattern_list_for_customer(); |
|
280 | - $data["packageid"] = $packageid; |
|
281 | - $this->load->view('view_prefix_list', $data); |
|
282 | - } |
|
283 | - function package_patterns_add_json($accountid) { |
|
284 | - $this->load->module('rates/rates'); |
|
285 | - $json_data = array(); |
|
286 | - $count_all = $this->rates_model->getunblocked_package_pattern($accountid,false); |
|
287 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
288 | - $json_data = $paging_data["json_paging"]; |
|
289 | - |
|
290 | - $query = $this->rates->rates_model->getunblocked_package_pattern($accountid,true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
291 | - $grid_fields = json_decode($this->rates->rates_form->build_block_pattern_list_for_customer()); |
|
292 | - $json_data['rows'] = $this->rates->form->build_grid($query, $grid_fields); |
|
293 | - |
|
294 | - echo json_encode($json_data); |
|
295 | - } |
|
296 | - function package_patterns_add_info($packageid) { |
|
297 | - $result = $this->package_model->insert_package_pattern($this->input->post('prefixies', true),$packageid); |
|
298 | - unset($_POST); |
|
299 | - echo $result; |
|
300 | - exit; |
|
301 | - } |
|
302 | - function package_patterns_delete($packageid, $patternid) { |
|
303 | - $this->db->delete("package_patterns", array("id" => $patternid)); |
|
304 | - redirect(base_url() . "package/package_pattern_list/$packageid"); |
|
305 | - } |
|
306 | - function package_patterns_selected_delete(){ |
|
307 | - $ids = $this->input->post("selected_ids", true); |
|
308 | - $where = "id IN ($ids)"; |
|
309 | - unset($_POST); |
|
310 | - echo $this->db->delete("package_patterns",$where); |
|
311 | - } |
|
274 | + function package_patterns_add($packageid) { |
|
275 | + $data['username'] = $this->session->userdata('user_name'); |
|
276 | + $data['page_title'] = 'Unblocked Prefixes'; |
|
277 | + $this->session->set_userdata('advance_search', 0); |
|
278 | + $this->load->module('rates/rates'); |
|
279 | + $data['patters_grid_fields'] = $this->rates->rates_form->build_block_pattern_list_for_customer(); |
|
280 | + $data["packageid"] = $packageid; |
|
281 | + $this->load->view('view_prefix_list', $data); |
|
282 | + } |
|
283 | + function package_patterns_add_json($accountid) { |
|
284 | + $this->load->module('rates/rates'); |
|
285 | + $json_data = array(); |
|
286 | + $count_all = $this->rates_model->getunblocked_package_pattern($accountid,false); |
|
287 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
288 | + $json_data = $paging_data["json_paging"]; |
|
289 | + |
|
290 | + $query = $this->rates->rates_model->getunblocked_package_pattern($accountid,true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
291 | + $grid_fields = json_decode($this->rates->rates_form->build_block_pattern_list_for_customer()); |
|
292 | + $json_data['rows'] = $this->rates->form->build_grid($query, $grid_fields); |
|
293 | + |
|
294 | + echo json_encode($json_data); |
|
295 | + } |
|
296 | + function package_patterns_add_info($packageid) { |
|
297 | + $result = $this->package_model->insert_package_pattern($this->input->post('prefixies', true),$packageid); |
|
298 | + unset($_POST); |
|
299 | + echo $result; |
|
300 | + exit; |
|
301 | + } |
|
302 | + function package_patterns_delete($packageid, $patternid) { |
|
303 | + $this->db->delete("package_patterns", array("id" => $patternid)); |
|
304 | + redirect(base_url() . "package/package_pattern_list/$packageid"); |
|
305 | + } |
|
306 | + function package_patterns_selected_delete(){ |
|
307 | + $ids = $this->input->post("selected_ids", true); |
|
308 | + $where = "id IN ($ids)"; |
|
309 | + unset($_POST); |
|
310 | + echo $this->db->delete("package_patterns",$where); |
|
311 | + } |
|
312 | 312 | |
313 | - function package_quick_search($module_name){ |
|
314 | - $action = $this->input->post(); |
|
315 | - $this->session->set_userdata('left_panel_search_package_pattern',""); |
|
316 | - if(!empty($action['left_panel_search'])){ |
|
317 | - $this->session->set_userdata('left_panel_search_package_pattern', $action['left_panel_search']); |
|
318 | - } |
|
319 | - } |
|
313 | + function package_quick_search($module_name){ |
|
314 | + $action = $this->input->post(); |
|
315 | + $this->session->set_userdata('left_panel_search_package_pattern',""); |
|
316 | + if(!empty($action['left_panel_search'])){ |
|
317 | + $this->session->set_userdata('left_panel_search_package_pattern', $action['left_panel_search']); |
|
318 | + } |
|
319 | + } |
|
320 | 320 | |
321 | 321 | |
322 | 322 | function package_patterns_import($edit_id) { |
323 | 323 | //echo "nick";exit; |
324 | - $data['page_title'] = 'Import Package Patterns'; |
|
325 | - $this->session->set_userdata('import_package_code_csv',""); |
|
326 | - $error_data = $this->session->userdata('import_package_code_csv_error'); |
|
327 | - $full_path = $this->config->item('rates-file-path'); |
|
328 | - if(file_exists($full_path.$error_data) && $error_data != ""){ |
|
329 | - unlink($full_path.$error_data); |
|
330 | - $this->session->set_userdata('import_package_code_csv_error',""); |
|
331 | - } |
|
332 | - $data['edit_id'] = $edit_id; |
|
333 | - $this->load->view('view_import_package_code', $data); |
|
334 | - } |
|
324 | + $data['page_title'] = 'Import Package Patterns'; |
|
325 | + $this->session->set_userdata('import_package_code_csv',""); |
|
326 | + $error_data = $this->session->userdata('import_package_code_csv_error'); |
|
327 | + $full_path = $this->config->item('rates-file-path'); |
|
328 | + if(file_exists($full_path.$error_data) && $error_data != ""){ |
|
329 | + unlink($full_path.$error_data); |
|
330 | + $this->session->set_userdata('import_package_code_csv_error',""); |
|
331 | + } |
|
332 | + $data['edit_id'] = $edit_id; |
|
333 | + $this->load->view('view_import_package_code', $data); |
|
334 | + } |
|
335 | 335 | |
336 | 336 | |
337 | - function package_patterns_download_sample_file($file_name){ |
|
338 | - $this->load->helper('download'); |
|
337 | + function package_patterns_download_sample_file($file_name){ |
|
338 | + $this->load->helper('download'); |
|
339 | 339 | $full_path = base_url()."assets/Rates_File/".$file_name.".csv"; |
340 | - $arrContextOptions=array( |
|
340 | + $arrContextOptions=array( |
|
341 | 341 | "ssl"=>array( |
342 | 342 | "verify_peer"=>false, |
343 | 343 | "verify_peer_name"=>false, |
344 | 344 | ), |
345 | 345 | ); |
346 | - $file = file_get_contents($full_path, false, stream_context_create($arrContextOptions)); |
|
347 | - force_download("samplefile.csv", $file); |
|
348 | - } |
|
346 | + $file = file_get_contents($full_path, false, stream_context_create($arrContextOptions)); |
|
347 | + force_download("samplefile.csv", $file); |
|
348 | + } |
|
349 | 349 | |
350 | 350 | |
351 | - function package_patterns_preview_file($edit_id){ |
|
351 | + function package_patterns_preview_file($edit_id){ |
|
352 | 352 | $invalid_flag= false; |
353 | 353 | $data=array(); |
354 | 354 | $data['page_title'] = 'Import Package Patterns'; |
@@ -360,79 +360,79 @@ discard block |
||
360 | 360 | $new_final_arr_key = $this->config->item('package-code-field'); |
361 | 361 | if(!$get_extension){ |
362 | 362 | $data['error']= "Please Upload File Atleast"; |
363 | - } |
|
364 | - //echo "<pre>";print_r($_FILES);exit; |
|
365 | - if (isset($_FILES['package_code_import']['name']) && $_FILES['package_code_import']['name'] != "" ) { |
|
366 | - list($txt,$ext) = explode(".", $_FILES['package_code_import']['name']); |
|
363 | + } |
|
364 | + //echo "<pre>";print_r($_FILES);exit; |
|
365 | + if (isset($_FILES['package_code_import']['name']) && $_FILES['package_code_import']['name'] != "" ) { |
|
366 | + list($txt,$ext) = explode(".", $_FILES['package_code_import']['name']); |
|
367 | 367 | |
368 | - if($ext == "csv" && $_FILES['package_code_import']['size'] > 0){ |
|
369 | - $error = $_FILES['package_code_import']['error']; |
|
370 | - if ($error == 0) { |
|
371 | - $uploadedFile = $_FILES["package_code_import"]["tmp_name"]; |
|
372 | - $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header); |
|
373 | - if(!empty($csv_data)){ |
|
374 | - $full_path = $this->config->item('rates-file-path'); |
|
375 | - //echo "<pre>";print_r($full_path);exit; |
|
376 | - $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s"). "." . $ext; |
|
377 | - //echo "<pre>";print_r($actual_file_name);exit; |
|
378 | - if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) { |
|
368 | + if($ext == "csv" && $_FILES['package_code_import']['size'] > 0){ |
|
369 | + $error = $_FILES['package_code_import']['error']; |
|
370 | + if ($error == 0) { |
|
371 | + $uploadedFile = $_FILES["package_code_import"]["tmp_name"]; |
|
372 | + $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header); |
|
373 | + if(!empty($csv_data)){ |
|
374 | + $full_path = $this->config->item('rates-file-path'); |
|
375 | + //echo "<pre>";print_r($full_path);exit; |
|
376 | + $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s"). "." . $ext; |
|
377 | + //echo "<pre>";print_r($actual_file_name);exit; |
|
378 | + if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) { |
|
379 | 379 | $flag=false; |
380 | 380 | //$data['trunkid']=isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0; |
381 | - $data['csv_tmp_data'] = $csv_data; |
|
382 | - //$data['pricelistid'] = $_POST['pricelist_id']; |
|
383 | - $data['page_title'] = "Package Patterns Preview"; |
|
384 | - $data['check_header']=$check_header; |
|
385 | - $this->session->set_userdata('import_package_code_csv',$actual_file_name); |
|
386 | - }else{ |
|
387 | - $data['error'] = "File Uploading Fail Please Try Again"; |
|
388 | - } |
|
389 | - } |
|
390 | - } |
|
391 | - else{ |
|
392 | - $data['error']=="File Uploading Fail Please Try Again"; |
|
393 | - } |
|
394 | - } |
|
395 | - else { |
|
396 | - $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
|
397 | - } |
|
398 | - }else{ |
|
381 | + $data['csv_tmp_data'] = $csv_data; |
|
382 | + //$data['pricelistid'] = $_POST['pricelist_id']; |
|
383 | + $data['page_title'] = "Package Patterns Preview"; |
|
384 | + $data['check_header']=$check_header; |
|
385 | + $this->session->set_userdata('import_package_code_csv',$actual_file_name); |
|
386 | + }else{ |
|
387 | + $data['error'] = "File Uploading Fail Please Try Again"; |
|
388 | + } |
|
389 | + } |
|
390 | + } |
|
391 | + else{ |
|
392 | + $data['error']=="File Uploading Fail Please Try Again"; |
|
393 | + } |
|
394 | + } |
|
395 | + else { |
|
396 | + $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
|
397 | + } |
|
398 | + }else{ |
|
399 | 399 | $invalid_flag=true; |
400 | - } |
|
401 | - if ($invalid_flag) { |
|
402 | - $str = ''; |
|
403 | - if (empty($_FILES['package_code_import']['name'])) { |
|
404 | - $str.= '<br/>Please Select File.'; |
|
405 | - } |
|
406 | - $data['error']=$str; |
|
407 | - } |
|
408 | - $data['edit_id'] = $edit_id; |
|
409 | - $this->load->view('view_import_package_code', $data); |
|
410 | - } |
|
400 | + } |
|
401 | + if ($invalid_flag) { |
|
402 | + $str = ''; |
|
403 | + if (empty($_FILES['package_code_import']['name'])) { |
|
404 | + $str.= '<br/>Please Select File.'; |
|
405 | + } |
|
406 | + $data['error']=$str; |
|
407 | + } |
|
408 | + $data['edit_id'] = $edit_id; |
|
409 | + $this->load->view('view_import_package_code', $data); |
|
410 | + } |
|
411 | 411 | |
412 | 412 | |
413 | - function package_patterns_import_file($edit_id,$check_header=false) { |
|
413 | + function package_patterns_import_file($edit_id,$check_header=false) { |
|
414 | 414 | //echo $edit_id."===="; exit; |
415 | - $new_final_arr = array(); |
|
416 | - $invalid_array = array(); |
|
417 | - $new_final_arr_key = $this->config->item('package-code-field'); |
|
415 | + $new_final_arr = array(); |
|
416 | + $invalid_array = array(); |
|
417 | + $new_final_arr_key = $this->config->item('package-code-field'); |
|
418 | 418 | $screen_path = $this->config->item('screen_path'); |
419 | 419 | $reseller_id=0; |
420 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
421 | - $reseller_id = $this->session->userdata["accountinfo"]['id']; |
|
422 | - } |
|
420 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
421 | + $reseller_id = $this->session->userdata["accountinfo"]['id']; |
|
422 | + } |
|
423 | 423 | |
424 | 424 | $full_path = $this->config->item('rates-file-path'); |
425 | 425 | //echo "<pre>";print_r($full_path);exit; |
426 | - $originationrate_file_name = $this->session->userdata('import_package_code_csv'); |
|
427 | - $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name,$new_final_arr_key,$check_header); |
|
428 | - //echo "<pre>";print_r($csv_tmp_data);exit; |
|
426 | + $originationrate_file_name = $this->session->userdata('import_package_code_csv'); |
|
427 | + $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name,$new_final_arr_key,$check_header); |
|
428 | + //echo "<pre>";print_r($csv_tmp_data);exit; |
|
429 | 429 | $i=0; |
430 | - $pattern_arr=array(); |
|
431 | - foreach ($csv_tmp_data as $key => $csv_data) { |
|
430 | + $pattern_arr=array(); |
|
431 | + foreach ($csv_tmp_data as $key => $csv_data) { |
|
432 | 432 | if(isset($csv_data['patterns']) && $csv_data['patterns']!= '' && $i != 0){ |
433 | - $str=null; |
|
434 | - $pattern=$csv_data['patterns']; |
|
435 | - if(!in_array($csv_data['patterns'],$pattern_arr)){ |
|
433 | + $str=null; |
|
434 | + $pattern=$csv_data['patterns']; |
|
435 | + if(!in_array($csv_data['patterns'],$pattern_arr)){ |
|
436 | 436 | $this->db->select('count(id) as count'); |
437 | 437 | $this->db->where('patterns',"^".$csv_data['patterns'].".*"); |
438 | 438 | $this->db->where('package_id',$edit_id); |
@@ -443,97 +443,97 @@ discard block |
||
443 | 443 | if($str != ""){ |
444 | 444 | $invalid_array[$i]=$csv_data; |
445 | 445 | $invalid_array[$i]['error'] = $str; |
446 | - } |
|
447 | - else{ |
|
448 | - $csv_data['patterns'] = "^" . $csv_data['patterns'] . ".*"; |
|
449 | - $csv_data['package_id'] = $edit_id; |
|
450 | - $new_final_arr[$i]=$csv_data; |
|
451 | - $pattern_arr[$csv_data['patterns']]=$csv_data['patterns']; |
|
452 | - } |
|
453 | - }else{ |
|
446 | + } |
|
447 | + else{ |
|
448 | + $csv_data['patterns'] = "^" . $csv_data['patterns'] . ".*"; |
|
449 | + $csv_data['package_id'] = $edit_id; |
|
450 | + $new_final_arr[$i]=$csv_data; |
|
451 | + $pattern_arr[$csv_data['patterns']]=$csv_data['patterns']; |
|
452 | + } |
|
453 | + }else{ |
|
454 | 454 | $invalid_array[$i]=$csv_data; |
455 | 455 | $invalid_array[$i]['error'] = "Duplicate pattern found from database."; |
456 | - } |
|
456 | + } |
|
457 | 457 | }else{ |
458 | 458 | $invalid_array[$i]=$csv_data; |
459 | - $invalid_array[$i]['error'] = "Duplicate pattern found from import file"; |
|
459 | + $invalid_array[$i]['error'] = "Duplicate pattern found from import file"; |
|
460 | 460 | } |
461 | 461 | $pattern_arr[$csv_data['patterns']]=$pattern; |
462 | 462 | } |
463 | 463 | |
464 | - $i++; |
|
465 | - } |
|
466 | - if(!empty($new_final_arr)){ |
|
467 | - $result = $this->package_model->bulk_insert_package_pattern($new_final_arr); |
|
468 | - } |
|
469 | - //unlink($full_path.$originationrate_file_name); |
|
464 | + $i++; |
|
465 | + } |
|
466 | + if(!empty($new_final_arr)){ |
|
467 | + $result = $this->package_model->bulk_insert_package_pattern($new_final_arr); |
|
468 | + } |
|
469 | + //unlink($full_path.$originationrate_file_name); |
|
470 | 470 | $count=count($invalid_array); |
471 | 471 | //echo "<pre>";print_r($count);exit; |
472 | - if($count >0){ |
|
473 | - $session_id = "-1"; |
|
474 | - $fp = fopen($full_path.$session_id.'.csv', 'w'); |
|
475 | - foreach($new_final_arr_key as $key=>$value){ |
|
476 | - $custom_array[0][$key]=ucfirst($key); |
|
477 | - } |
|
478 | - $custom_array[0]['error']= "Error"; |
|
479 | - $invalid_array =array_merge($custom_array,$invalid_array); |
|
480 | - foreach($invalid_array as $err_data){ |
|
481 | - fputcsv($fp,$err_data); |
|
482 | - } |
|
483 | - fclose($fp); |
|
484 | - $this->session->set_userdata('import_package_code_csv_error', $session_id.".csv"); |
|
485 | - $data["error"] = $invalid_array; |
|
486 | - $data['packageid'] = $edit_id; |
|
487 | - $data['impoted_count'] = count($new_final_arr); |
|
488 | - $data['failure_count'] = count($invalid_array)-1; |
|
489 | - $data['page_title'] = 'Package Patterns Import Error'; |
|
490 | - //print_r($data) ;exit; |
|
491 | - $this->load->view('view_import_error',$data); |
|
492 | - } else{ |
|
472 | + if($count >0){ |
|
473 | + $session_id = "-1"; |
|
474 | + $fp = fopen($full_path.$session_id.'.csv', 'w'); |
|
475 | + foreach($new_final_arr_key as $key=>$value){ |
|
476 | + $custom_array[0][$key]=ucfirst($key); |
|
477 | + } |
|
478 | + $custom_array[0]['error']= "Error"; |
|
479 | + $invalid_array =array_merge($custom_array,$invalid_array); |
|
480 | + foreach($invalid_array as $err_data){ |
|
481 | + fputcsv($fp,$err_data); |
|
482 | + } |
|
483 | + fclose($fp); |
|
484 | + $this->session->set_userdata('import_package_code_csv_error', $session_id.".csv"); |
|
485 | + $data["error"] = $invalid_array; |
|
486 | + $data['packageid'] = $edit_id; |
|
487 | + $data['impoted_count'] = count($new_final_arr); |
|
488 | + $data['failure_count'] = count($invalid_array)-1; |
|
489 | + $data['page_title'] = 'Package Patterns Import Error'; |
|
490 | + //print_r($data) ;exit; |
|
491 | + $this->load->view('view_import_error',$data); |
|
492 | + } else{ |
|
493 | 493 | $this->session->set_flashdata('astpp_errormsg', 'Package patterns imported successfully!'); |
494 | 494 | //echo base_url()."package/package_pattern_list/" . $edit_id . "/";exit; |
495 | - redirect(base_url()."package/package_pattern_list/" . $edit_id . "/"); |
|
496 | - } |
|
497 | - } |
|
495 | + redirect(base_url()."package/package_pattern_list/" . $edit_id . "/"); |
|
496 | + } |
|
497 | + } |
|
498 | 498 | |
499 | 499 | function data_validate($csvdata){ |
500 | - $str=null; |
|
500 | + $str=null; |
|
501 | 501 | $alpha_regex = "/^[a-z ,.'-]+$/i"; |
502 | 502 | $alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i"; |
503 | 503 | $email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/"; |
504 | 504 | $str.= $csvdata['patterns']!= '' ? null : 'Code,'; |
505 | 505 | $str=rtrim($str,','); |
506 | 506 | if(!$str){ |
507 | - $str.= is_numeric($csvdata['patterns']) ? null : 'Code,'; |
|
507 | + $str.= is_numeric($csvdata['patterns']) ? null : 'Code,'; |
|
508 | 508 | |
509 | 509 | $str.= preg_match( $alpha_numeric_regex, $csvdata['destination'] ) ? null :'Destination,'; |
510 | 510 | |
511 | - if($str){ |
|
511 | + if($str){ |
|
512 | 512 | $str=rtrim($str,','); |
513 | 513 | $error_field=explode(',',$str); |
514 | 514 | $count = count($error_field); |
515 | 515 | $str.= $count > 1 ? ' are not valid' : ' is not Valid'; |
516 | 516 | return $str; |
517 | - } |
|
518 | - else{ |
|
519 | - return false; |
|
520 | - } |
|
517 | + } |
|
518 | + else{ |
|
519 | + return false; |
|
520 | + } |
|
521 | 521 | } |
522 | 522 | else{ |
523 | 523 | $str=rtrim($str,','); |
524 | - $error_field=explode(',',$str); |
|
525 | - $count = count($error_field); |
|
526 | - $str.= $count > 1 ? ' are required' : ' is Required'; |
|
527 | - return $str; |
|
528 | - } |
|
524 | + $error_field=explode(',',$str); |
|
525 | + $count = count($error_field); |
|
526 | + $str.= $count > 1 ? ' are required' : ' is Required'; |
|
527 | + return $str; |
|
528 | + } |
|
529 | 529 | } |
530 | 530 | |
531 | - function package_patterns_error_download(){ |
|
532 | - $this->load->helper('download'); |
|
533 | - $error_data = $this->session->userdata('import_package_code_csv_error'); |
|
534 | - $full_path = $this->config->item('rates-file-path'); |
|
535 | - $data = file_get_contents($full_path.$error_data); |
|
536 | - force_download("Package_Code_error.csv", $data); |
|
531 | + function package_patterns_error_download(){ |
|
532 | + $this->load->helper('download'); |
|
533 | + $error_data = $this->session->userdata('import_package_code_csv_error'); |
|
534 | + $full_path = $this->config->item('rates-file-path'); |
|
535 | + $data = file_get_contents($full_path.$error_data); |
|
536 | + force_download("Package_Code_error.csv", $data); |
|
537 | 537 | |
538 | 538 | } |
539 | 539 |
@@ -23,142 +23,142 @@ |
||
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 | class Package_form { |
29 | 29 | |
30 | - function get_package_form_fields($id='') { |
|
31 | - $form['forms'] = array(base_url() . 'package/package_save/'.$id."/",array('id'=>'packeage_form','method'=>'POST','name'=>'packeage_form')); |
|
32 | - $form['Package Information'] = array( |
|
33 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
34 | - array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
|
35 | - array('Name', 'INPUT', array('name' => 'package_name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | - array('Rate Group', 'pricelist_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")), |
|
37 | - array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|required|xss_clean', 'tOOL TIP', ''), |
|
30 | + function get_package_form_fields($id='') { |
|
31 | + $form['forms'] = array(base_url() . 'package/package_save/'.$id."/",array('id'=>'packeage_form','method'=>'POST','name'=>'packeage_form')); |
|
32 | + $form['Package Information'] = array( |
|
33 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
34 | + array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
|
35 | + array('Name', 'INPUT', array('name' => 'package_name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | + array('Rate Group', 'pricelist_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")), |
|
37 | + array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|required|xss_clean', 'tOOL TIP', ''), |
|
38 | 38 | /** |
39 | 39 | ASTPP 3.0 |
40 | 40 | Add For Package Inbound or Outbound or both? |
41 | 41 | **/ |
42 | - array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', ''), |
|
42 | + array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', ''), |
|
43 | 43 | /*********************************************/ |
44 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status') |
|
45 | - ); |
|
46 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/package/package_list/\')'); |
|
47 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
48 | - |
|
49 | - return $form; |
|
50 | - } |
|
51 | - |
|
52 | - function get_package_search_form() { |
|
53 | - $form['forms'] = array("", array('id' => "package_search")); |
|
54 | - $form['Search'] = array( |
|
55 | - array('Name', 'INPUT', array('name' => 'package_name[package_name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'package_name[package_name-string]', '', '', '', 'search_string_type', ''), |
|
56 | - array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")), |
|
57 | - array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''), |
|
44 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status') |
|
45 | + ); |
|
46 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/package/package_list/\')'); |
|
47 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
48 | + |
|
49 | + return $form; |
|
50 | + } |
|
51 | + |
|
52 | + function get_package_search_form() { |
|
53 | + $form['forms'] = array("", array('id' => "package_search")); |
|
54 | + $form['Search'] = array( |
|
55 | + array('Name', 'INPUT', array('name' => 'package_name[package_name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'package_name[package_name-string]', '', '', '', 'search_string_type', ''), |
|
56 | + array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")), |
|
57 | + array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''), |
|
58 | 58 | /** |
59 | 59 | ASTPP 3.0 |
60 | 60 | Add For Package Inbound or Outbound or both? |
61 | 61 | **/ |
62 | - array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', '',''), |
|
62 | + array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', '',''), |
|
63 | 63 | /*********************************************/ |
64 | 64 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), |
65 | 65 | |
66 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
67 | - array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
66 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
67 | + array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
68 | 68 | |
69 | - ); |
|
70 | - $form['button_search'] = array('name' => 'action', 'id' => "package_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
71 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
69 | + ); |
|
70 | + $form['button_search'] = array('name' => 'action', 'id' => "package_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
71 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
72 | 72 | |
73 | - return $form; |
|
74 | - } |
|
73 | + return $form; |
|
74 | + } |
|
75 | 75 | |
76 | - function build_package_list_for_admin() { |
|
77 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
78 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
76 | + function build_package_list_for_admin() { |
|
77 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
78 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
79 | 79 | /** |
80 | 80 | ASTPP 3.0 |
81 | 81 | For Package edit on Name |
82 | 82 | **/ |
83 | - array("Name", "170", "package_name", "", "", "","EDITABLE","true","center"), |
|
83 | + array("Name", "170", "package_name", "", "", "","EDITABLE","true","center"), |
|
84 | 84 | /***********************************/ |
85 | - array("Rate Group", "150", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
86 | - array("Included Seconds", "160", "includedseconds", "", "", "","","true","center"), |
|
85 | + array("Rate Group", "150", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
86 | + array("Included Seconds", "160", "includedseconds", "", "", "","","true","center"), |
|
87 | 87 | /** |
88 | 88 | ASTPP 3.0 |
89 | 89 | Add For Package Inbound or Outbound or both? |
90 | 90 | **/ |
91 | - array("Applicable For?", "200", "applicable_for", "applicable_for", "applicable_for", "get_package_type","","true","center"), |
|
91 | + array("Applicable For?", "200", "applicable_for", "applicable_for", "applicable_for", "get_package_type","","true","center"), |
|
92 | 92 | /****************************************************/ |
93 | - /* |
|
93 | + /* |
|
94 | 94 | ASTPP 3.0 |
95 | 95 | Creation date,last modified date show in grid |
96 | 96 | */ |
97 | - array("Status", "140", "status", "status", "packages", "get_status","","true","center"), |
|
98 | - array("Created Date", "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
99 | - array("Modified Date", "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
100 | - /***************************************************************/ |
|
101 | - /* |
|
97 | + array("Status", "140", "status", "status", "packages", "get_status","","true","center"), |
|
98 | + array("Created Date", "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
99 | + array("Modified Date", "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
100 | + /***************************************************************/ |
|
101 | + /* |
|
102 | 102 | ASTPP 3.0 |
103 | 103 | status show active or inactive |
104 | 104 | */ |
105 | 105 | |
106 | - /********************************************/ |
|
107 | - array("Action", "160", "", "", "", array("EDIT" => array("url" => "package/package_edit/", "mode" => "single"), |
|
108 | - "DELETE" => array("url" => "package/package_delete/", "mode" => "single"))) |
|
109 | - )); |
|
110 | - return $grid_field_arr; |
|
111 | - } |
|
112 | - |
|
113 | - function build_grid_buttons() { |
|
114 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/package_add/"), |
|
115 | - array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/package/package_delete_multiple/") |
|
116 | - )); |
|
117 | - return $buttons_json; |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - |
|
122 | - function build_package_counter_list_for_admin() { |
|
123 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
124 | - $grid_field_arr = json_encode(array(array("Package Name", "430", "package_id", "package_name", "packages", "get_field_name","","true","center"), |
|
125 | - array("Account", "420", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
|
126 | - array("Used Seconds", "420", "seconds", "", "", "","","true","center"), |
|
127 | - )); |
|
128 | - return $grid_field_arr; |
|
129 | - } |
|
130 | - function build_pattern_list_for_customer($packageid) { |
|
131 | - $grid_field_arr = json_encode(array( |
|
132 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
133 | - array("Code", "450", "patterns", "patterns", "", "get_only_numeric_val"), |
|
134 | - array("Destination", "450", "destination", "", "", ""), |
|
135 | - array("Action", "100", "", "", "", array("DELETE" => array("url" => "package/package_patterns_delete/$packageid/", "mode" => "single"))) |
|
136 | - )); |
|
137 | - return $grid_field_arr; |
|
138 | - } |
|
139 | - function set_pattern_grid_buttons($packageid) { |
|
140 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/customer_add_patterns/$packageid", "popup"))); |
|
141 | - return $buttons_json; |
|
142 | - } |
|
106 | + /********************************************/ |
|
107 | + array("Action", "160", "", "", "", array("EDIT" => array("url" => "package/package_edit/", "mode" => "single"), |
|
108 | + "DELETE" => array("url" => "package/package_delete/", "mode" => "single"))) |
|
109 | + )); |
|
110 | + return $grid_field_arr; |
|
111 | + } |
|
112 | + |
|
113 | + function build_grid_buttons() { |
|
114 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/package_add/"), |
|
115 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/package/package_delete_multiple/") |
|
116 | + )); |
|
117 | + return $buttons_json; |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + |
|
122 | + function build_package_counter_list_for_admin() { |
|
123 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
124 | + $grid_field_arr = json_encode(array(array("Package Name", "430", "package_id", "package_name", "packages", "get_field_name","","true","center"), |
|
125 | + array("Account", "420", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
|
126 | + array("Used Seconds", "420", "seconds", "", "", "","","true","center"), |
|
127 | + )); |
|
128 | + return $grid_field_arr; |
|
129 | + } |
|
130 | + function build_pattern_list_for_customer($packageid) { |
|
131 | + $grid_field_arr = json_encode(array( |
|
132 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
133 | + array("Code", "450", "patterns", "patterns", "", "get_only_numeric_val"), |
|
134 | + array("Destination", "450", "destination", "", "", ""), |
|
135 | + array("Action", "100", "", "", "", array("DELETE" => array("url" => "package/package_patterns_delete/$packageid/", "mode" => "single"))) |
|
136 | + )); |
|
137 | + return $grid_field_arr; |
|
138 | + } |
|
139 | + function set_pattern_grid_buttons($packageid) { |
|
140 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/customer_add_patterns/$packageid", "popup"))); |
|
141 | + return $buttons_json; |
|
142 | + } |
|
143 | 143 | |
144 | 144 | |
145 | 145 | |
146 | 146 | function build_package_counter_report() { |
147 | - $buttons_json = json_encode(array( |
|
148 | - array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/package/package_counter_report_export/", 'single') |
|
147 | + $buttons_json = json_encode(array( |
|
148 | + array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/package/package_counter_report_export/", 'single') |
|
149 | 149 | |
150 | - )); |
|
151 | - return $buttons_json; |
|
152 | - } |
|
153 | - function build_package_list_for_reseller(){ |
|
154 | - $grid_field_arr = json_encode(array( |
|
155 | - array("Name", "310", "package_name", "", "", "","","true","center"), |
|
156 | - array("Rate Group", "250", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
157 | - array("Included Seconds", "260", "includedseconds", "", "", "","","true","center"), |
|
158 | - array("Status", "160", "status", "status", "status", "get_status","","true","center"), |
|
159 | - )); |
|
160 | - return $grid_field_arr; |
|
161 | - } |
|
150 | + )); |
|
151 | + return $buttons_json; |
|
152 | + } |
|
153 | + function build_package_list_for_reseller(){ |
|
154 | + $grid_field_arr = json_encode(array( |
|
155 | + array("Name", "310", "package_name", "", "", "","","true","center"), |
|
156 | + array("Rate Group", "250", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
157 | + array("Included Seconds", "260", "includedseconds", "", "", "","","true","center"), |
|
158 | + array("Status", "160", "status", "status", "status", "get_status","","true","center"), |
|
159 | + )); |
|
160 | + return $grid_field_arr; |
|
161 | + } |
|
162 | 162 | |
163 | 163 | |
164 | 164 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | <div class="w-section inverse no-padding"> |
13 | 13 | <?php echo $form; ?> |
14 | 14 | <?php |
15 | - if(isset($validation_errors) && $validation_errors != ''){ ?> |
|
15 | + if(isset($validation_errors) && $validation_errors != ''){ ?> |
|
16 | 16 | <script> |
17 | 17 | var ERR_STR = '<?php echo $validation_errors; ?>'; |
18 | 18 | print_error(ERR_STR); |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | <div class="w-box"> |
17 | 17 | <span style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;"> |
18 | 18 | <? if(isset($error) && !empty($error)) { |
19 | - echo $error; |
|
20 | - }?> |
|
19 | + echo $error; |
|
20 | + }?> |
|
21 | 21 | </span> |
22 | 22 | <h3 class="padding-t-10 padding-l-16">File must be in the following format(.csv):</h3> |
23 | 23 | <p>Code,Destination.</p> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | </div> |
37 | 37 | <? |
38 | 38 | $logintype=$this->session->userdata('userlevel_logintype'); |
39 | - // $trunk=null; |
|
39 | + // $trunk=null; |
|
40 | 40 | if($logintype !=1) { ?> |
41 | 41 | <div class="col-md-12 no-padding"> |
42 | 42 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | <?}?> |
99 | 99 | |
100 | 100 | <?php |
101 | - if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?> |
|
101 | + if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?> |
|
102 | 102 | |
103 | 103 | <section class="slice color-three"> |
104 | 104 | <div class="w-section inverse no-padding"> |
@@ -108,24 +108,24 @@ discard block |
||
108 | 108 | <form id="import_form" name="import_form" action="<?=base_url()?>package/package_patterns_import_file/<?=$edit_id?>/<?=$check_header?>/" method="POST"> |
109 | 109 | <table width="100%" border="1" class="details_table table"> |
110 | 110 | <? $cnt =7; |
111 | - foreach($csv_tmp_data as $csv_key => $csv_value){ |
|
112 | - if($csv_key < 15){ |
|
113 | - echo "<tr>"; |
|
114 | - foreach($csv_value as $field_name => $field_val){ |
|
115 | - if($csv_key == 0){ |
|
116 | - echo "<th>".ucfirst($field_name)."</th>"; |
|
117 | - }else{ |
|
118 | - echo "<td class='portlet-content'>".$field_val."</td>"; |
|
119 | - } |
|
120 | - } |
|
121 | - echo "</tr>"; |
|
122 | - } |
|
123 | - } |
|
111 | + foreach($csv_tmp_data as $csv_key => $csv_value){ |
|
112 | + if($csv_key < 15){ |
|
113 | + echo "<tr>"; |
|
114 | + foreach($csv_value as $field_name => $field_val){ |
|
115 | + if($csv_key == 0){ |
|
116 | + echo "<th>".ucfirst($field_name)."</th>"; |
|
117 | + }else{ |
|
118 | + echo "<td class='portlet-content'>".$field_val."</td>"; |
|
119 | + } |
|
120 | + } |
|
121 | + echo "</tr>"; |
|
122 | + } |
|
123 | + } |
|
124 | 124 | |
125 | - echo "<tr><td colspan='".$cnt."'> |
|
125 | + echo "<tr><td colspan='".$cnt."'> |
|
126 | 126 | <a href='".base_url()."package/package_patterns_import/$edit_id'><input type='button' class='btn btn-line-sky pull-right margin-x-10' value='Back'/></a> |
127 | 127 | <input type='submit' class='btn btn-line-parrot pull-right' id='Process' value='Process'/></td></tr>"; |
128 | - ?> </table></form> |
|
128 | + ?> </table></form> |
|
129 | 129 | </div> |
130 | 130 | </div></div></div> |
131 | 131 | </section> |
@@ -22,88 +22,88 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | class Package_model extends CI_Model { |
24 | 24 | |
25 | - function Package_model() { |
|
26 | - parent::__construct(); |
|
27 | - } |
|
25 | + function Package_model() { |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | - function getpackage_list($flag, $start = 0, $limit = 0) { |
|
30 | - $this->db_model->build_search('package_list_search'); |
|
31 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
32 | - $account_data = $this->session->userdata("accountinfo"); |
|
33 | - $where = array("reseller_id" => $account_data['id']); |
|
34 | - } else { |
|
35 | - $where = array("reseller_id"=>"0"); |
|
36 | - } |
|
37 | - if ($flag) { |
|
38 | - $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
|
39 | - } else { |
|
40 | - $query = $this->db_model->countQuery("*", "packages", $where); |
|
41 | - } |
|
42 | - return $query; |
|
43 | - } |
|
44 | - function get_reseller_package_list($flag,$accountid,$accounttype,$start = 0, $limit = 0){ |
|
45 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_packages'); |
|
46 | - $instant_search_currency = $this->common_model->add_calculate_currency($instant_search, "", '', true, false); |
|
47 | - $like_str=!empty($instant_search) ? "(package_name like '%$instant_search%' |
|
29 | + function getpackage_list($flag, $start = 0, $limit = 0) { |
|
30 | + $this->db_model->build_search('package_list_search'); |
|
31 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
32 | + $account_data = $this->session->userdata("accountinfo"); |
|
33 | + $where = array("reseller_id" => $account_data['id']); |
|
34 | + } else { |
|
35 | + $where = array("reseller_id"=>"0"); |
|
36 | + } |
|
37 | + if ($flag) { |
|
38 | + $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
|
39 | + } else { |
|
40 | + $query = $this->db_model->countQuery("*", "packages", $where); |
|
41 | + } |
|
42 | + return $query; |
|
43 | + } |
|
44 | + function get_reseller_package_list($flag,$accountid,$accounttype,$start = 0, $limit = 0){ |
|
45 | + $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_packages'); |
|
46 | + $instant_search_currency = $this->common_model->add_calculate_currency($instant_search, "", '', true, false); |
|
47 | + $like_str=!empty($instant_search) ? "(package_name like '%$instant_search%' |
|
48 | 48 | OR includedseconds like '%$instant_search%')":null; |
49 | - $this->db->where('id',$accountid); |
|
50 | - $this->db->select('pricelist_id'); |
|
51 | - $account_info=(array)$this->db->get('accounts')->first_row(); |
|
52 | - $where=array('pricelist_id'=>$account_info['pricelist_id']); |
|
53 | - if(!empty($like_str)) |
|
54 | - $this->db->where($like_str); |
|
55 | - if ($flag) { |
|
56 | - $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
|
57 | - }else { |
|
58 | - $query = $this->db_model->countQuery("*", "packages", $where); |
|
59 | - } |
|
60 | - return $query; |
|
61 | - } |
|
62 | - function add_package($add_array) { |
|
63 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
64 | - $account_data = $this->session->userdata("accountinfo"); |
|
65 | - $add_array["reseller_id"] = $account_data['id']; |
|
66 | - } |
|
67 | - unset($add_array["action"]); |
|
68 | - /* |
|
49 | + $this->db->where('id',$accountid); |
|
50 | + $this->db->select('pricelist_id'); |
|
51 | + $account_info=(array)$this->db->get('accounts')->first_row(); |
|
52 | + $where=array('pricelist_id'=>$account_info['pricelist_id']); |
|
53 | + if(!empty($like_str)) |
|
54 | + $this->db->where($like_str); |
|
55 | + if ($flag) { |
|
56 | + $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
|
57 | + }else { |
|
58 | + $query = $this->db_model->countQuery("*", "packages", $where); |
|
59 | + } |
|
60 | + return $query; |
|
61 | + } |
|
62 | + function add_package($add_array) { |
|
63 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
64 | + $account_data = $this->session->userdata("accountinfo"); |
|
65 | + $add_array["reseller_id"] = $account_data['id']; |
|
66 | + } |
|
67 | + unset($add_array["action"]); |
|
68 | + /* |
|
69 | 69 | ASTPP 3.0 Add creation date |
70 | 70 | */ |
71 | - $add_array['creation_date']=gmdate('Y-m-d H:i:s'); |
|
72 | - /*******************************************/ |
|
73 | - $this->db->insert("packages", $add_array); |
|
74 | - return true; |
|
75 | - } |
|
71 | + $add_array['creation_date']=gmdate('Y-m-d H:i:s'); |
|
72 | + /*******************************************/ |
|
73 | + $this->db->insert("packages", $add_array); |
|
74 | + return true; |
|
75 | + } |
|
76 | 76 | |
77 | - function edit_package($data, $id) { |
|
78 | - unset($data["action"]); |
|
79 | - /* |
|
77 | + function edit_package($data, $id) { |
|
78 | + unset($data["action"]); |
|
79 | + /* |
|
80 | 80 | ASTPP 3.0 add last modified field. |
81 | 81 | */ |
82 | - $data['last_modified_date']=gmdate('Y-m-d H:i:s'); |
|
83 | - /********************************************/ |
|
84 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
85 | - $account_data = $this->session->userdata("accountinfo"); |
|
86 | - $add_array["reseller_id"] = $account_data['id']; |
|
87 | - } |
|
88 | - $this->db->where("id", $id); |
|
89 | - $this->db->update("packages", $data); |
|
90 | - return true; |
|
91 | - } |
|
82 | + $data['last_modified_date']=gmdate('Y-m-d H:i:s'); |
|
83 | + /********************************************/ |
|
84 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
85 | + $account_data = $this->session->userdata("accountinfo"); |
|
86 | + $add_array["reseller_id"] = $account_data['id']; |
|
87 | + } |
|
88 | + $this->db->where("id", $id); |
|
89 | + $this->db->update("packages", $data); |
|
90 | + return true; |
|
91 | + } |
|
92 | 92 | |
93 | - function remove_package($id) { |
|
94 | - /* ASTPP 3.0 |
|
93 | + function remove_package($id) { |
|
94 | + /* ASTPP 3.0 |
|
95 | 95 | * Remove Package information from table package_patterns as well. |
96 | 96 | */ |
97 | - $this->db->where('package_id',$id); |
|
98 | - $this->db->delete('package_patterns'); |
|
99 | - /***************************************/ |
|
100 | - $this->db->where("id", $id); |
|
101 | - $this->db->delete("packages"); |
|
102 | - return true; |
|
103 | - } |
|
97 | + $this->db->where('package_id',$id); |
|
98 | + $this->db->delete('package_patterns'); |
|
99 | + /***************************************/ |
|
100 | + $this->db->where("id", $id); |
|
101 | + $this->db->delete("packages"); |
|
102 | + return true; |
|
103 | + } |
|
104 | 104 | |
105 | - function getpackage_counter_list($flag, $start = 0, $limit = 0) { |
|
106 | - $where = array(); |
|
105 | + function getpackage_counter_list($flag, $start = 0, $limit = 0) { |
|
106 | + $where = array(); |
|
107 | 107 | $accountinfo = $this->session->userdata('accountinfo'); |
108 | 108 | $reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id']; |
109 | 109 | $this->db->where('reseller_id',$reseller_id); |
@@ -114,109 +114,109 @@ discard block |
||
114 | 114 | if($result->num_rows() >0){ |
115 | 115 | $acc_arr=array(); |
116 | 116 | $result=$result->result_array(); |
117 | - foreach($result as $data){ |
|
118 | - $acc_arr[]=$data['id']; |
|
119 | - } |
|
120 | - $this->db->where_in('accountid',$acc_arr); |
|
121 | - if($flag){ |
|
122 | - $this->db->select('*'); |
|
123 | - } |
|
124 | - else{ |
|
125 | - $this->db->select('count(id) as count'); |
|
126 | - } |
|
127 | - if($flag){ |
|
128 | - $this->db->limit($limit, $start); |
|
129 | - } |
|
130 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
131 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
132 | - }else{ |
|
133 | - $this->db->order_by('seconds','desc'); |
|
134 | - } |
|
135 | - $result=$this->db->get('counters'); |
|
117 | + foreach($result as $data){ |
|
118 | + $acc_arr[]=$data['id']; |
|
119 | + } |
|
120 | + $this->db->where_in('accountid',$acc_arr); |
|
121 | + if($flag){ |
|
122 | + $this->db->select('*'); |
|
123 | + } |
|
124 | + else{ |
|
125 | + $this->db->select('count(id) as count'); |
|
126 | + } |
|
127 | + if($flag){ |
|
128 | + $this->db->limit($limit, $start); |
|
129 | + } |
|
130 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
131 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
132 | + }else{ |
|
133 | + $this->db->order_by('seconds','desc'); |
|
134 | + } |
|
135 | + $result=$this->db->get('counters'); |
|
136 | 136 | // echo $this->db->last_query();exit; |
137 | - if($flag){ |
|
138 | - return $result; |
|
139 | - }else{ |
|
140 | - $result=$result->result_array(); |
|
141 | - return $result[0]['count']; |
|
142 | - } |
|
137 | + if($flag){ |
|
138 | + return $result; |
|
139 | + }else{ |
|
140 | + $result=$result->result_array(); |
|
141 | + return $result[0]['count']; |
|
142 | + } |
|
143 | 143 | }else{ |
144 | - if($flag){ |
|
145 | - $query=(object)array('num_rows'=>0); |
|
146 | - } |
|
147 | - else{ |
|
148 | - $query=0; |
|
149 | - } |
|
144 | + if($flag){ |
|
145 | + $query=(object)array('num_rows'=>0); |
|
146 | + } |
|
147 | + else{ |
|
148 | + $query=0; |
|
149 | + } |
|
150 | 150 | return $query; |
151 | - } |
|
152 | - }else{ |
|
151 | + } |
|
152 | + }else{ |
|
153 | 153 | |
154 | - if($result->num_rows() >0){ |
|
155 | - $acc_arr=array(); |
|
156 | - $result=$result->result_array(); |
|
157 | - foreach($result as $data){ |
|
158 | - $acc_arr[]=$data['id']; |
|
159 | - } |
|
160 | - $this->db->where_in('accountid',$acc_arr); |
|
154 | + if($result->num_rows() >0){ |
|
155 | + $acc_arr=array(); |
|
156 | + $result=$result->result_array(); |
|
157 | + foreach($result as $data){ |
|
158 | + $acc_arr[]=$data['id']; |
|
159 | + } |
|
160 | + $this->db->where_in('accountid',$acc_arr); |
|
161 | 161 | } |
162 | 162 | |
163 | - if($flag){ |
|
163 | + if($flag){ |
|
164 | 164 | $this->db->select('*'); |
165 | - } |
|
166 | - else{ |
|
167 | - $this->db->select('count(id) as count'); |
|
168 | - } |
|
169 | - if($flag){ |
|
165 | + } |
|
166 | + else{ |
|
167 | + $this->db->select('count(id) as count'); |
|
168 | + } |
|
169 | + if($flag){ |
|
170 | 170 | $this->db->order_by('seconds','desc'); |
171 | 171 | $this->db->limit($limit, $start); |
172 | - } |
|
173 | - $result=$this->db->get('counters'); |
|
172 | + } |
|
173 | + $result=$this->db->get('counters'); |
|
174 | 174 | // echo $this->db->last_query();exit; |
175 | - if($result->num_rows() > 0){ |
|
176 | - if($flag){ |
|
175 | + if($result->num_rows() > 0){ |
|
176 | + if($flag){ |
|
177 | 177 | |
178 | 178 | return $result; |
179 | - }else{ |
|
179 | + }else{ |
|
180 | 180 | $result=$result->result_array(); |
181 | 181 | |
182 | 182 | return $result[0]['count']; |
183 | - } |
|
184 | - }else{ |
|
185 | - if($flag){ |
|
183 | + } |
|
184 | + }else{ |
|
185 | + if($flag){ |
|
186 | 186 | |
187 | 187 | $query=(object)array('num_rows'=>0); |
188 | - } |
|
189 | - else{ |
|
188 | + } |
|
189 | + else{ |
|
190 | 190 | $query=0; |
191 | - } |
|
191 | + } |
|
192 | 192 | // echo $this->db->last_query();exit; |
193 | 193 | return $query; |
194 | 194 | } |
195 | - } |
|
196 | - } |
|
197 | - function insert_package_pattern($data, $packageid) { |
|
195 | + } |
|
196 | + } |
|
197 | + function insert_package_pattern($data, $packageid) { |
|
198 | 198 | |
199 | 199 | //echo "<pre>"; prit_r($data); exit; |
200 | - $this->db->select("pattern,comment"); |
|
201 | - $this->db->where("id IN (".$data.")"); |
|
202 | - $result=$this->db->get("routes")->result_array(); |
|
200 | + $this->db->select("pattern,comment"); |
|
201 | + $this->db->where("id IN (".$data.")"); |
|
202 | + $result=$this->db->get("routes")->result_array(); |
|
203 | 203 | |
204 | - $tmp = array(); |
|
205 | - foreach ($result as $key => $data_value) { |
|
206 | - $tmp[$key]["package_id"] = $packageid; |
|
207 | - $tmp[$key]["patterns"] = $data_value['pattern']; |
|
208 | - $tmp[$key]["destination"] = $data_value['comment']; |
|
209 | - } |
|
210 | - return $this->db->insert_batch("package_patterns", $tmp); |
|
211 | - } |
|
204 | + $tmp = array(); |
|
205 | + foreach ($result as $key => $data_value) { |
|
206 | + $tmp[$key]["package_id"] = $packageid; |
|
207 | + $tmp[$key]["patterns"] = $data_value['pattern']; |
|
208 | + $tmp[$key]["destination"] = $data_value['comment']; |
|
209 | + } |
|
210 | + return $this->db->insert_batch("package_patterns", $tmp); |
|
211 | + } |
|
212 | 212 | |
213 | 213 | |
214 | - function bulk_insert_package_pattern($inserted_array) { |
|
214 | + function bulk_insert_package_pattern($inserted_array) { |
|
215 | 215 | //echo "<pre>";print_r($inserted_array);exit; |
216 | - $this->db->insert_batch('package_patterns', $inserted_array); |
|
217 | - $affected_row = $this->db->affected_rows(); |
|
218 | - return $affected_row; |
|
219 | - } |
|
216 | + $this->db->insert_batch('package_patterns', $inserted_array); |
|
217 | + $affected_row = $this->db->affected_rows(); |
|
218 | + return $affected_row; |
|
219 | + } |
|
220 | 220 | |
221 | 221 | |
222 | 222 |
@@ -24,163 +24,163 @@ |
||
24 | 24 | |
25 | 25 | class Refill_coupon extends MX_Controller { |
26 | 26 | |
27 | - function Refill_coupon(){ |
|
28 | - parent::__construct(); |
|
29 | - $this->load->helper('template_inheritance'); |
|
30 | - $this->load->helper('form'); |
|
31 | - $this->load->model('refill_coupon_model'); |
|
32 | - $this->load->library("refill_coupon_form"); |
|
33 | - $this->load->library("astpp/form"); |
|
34 | - $this->load->library("session"); |
|
35 | - if ($this->session->userdata('user_login') == FALSE) |
|
36 | - redirect(base_url() . 'login/login'); |
|
37 | - } |
|
38 | - function refill_coupon_list(){ |
|
27 | + function Refill_coupon(){ |
|
28 | + parent::__construct(); |
|
29 | + $this->load->helper('template_inheritance'); |
|
30 | + $this->load->helper('form'); |
|
31 | + $this->load->model('refill_coupon_model'); |
|
32 | + $this->load->library("refill_coupon_form"); |
|
33 | + $this->load->library("astpp/form"); |
|
34 | + $this->load->library("session"); |
|
35 | + if ($this->session->userdata('user_login') == FALSE) |
|
36 | + redirect(base_url() . 'login/login'); |
|
37 | + } |
|
38 | + function refill_coupon_list(){ |
|
39 | 39 | if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
40 | - redirect(base_url() . 'user/user/'); |
|
40 | + redirect(base_url() . 'user/user/'); |
|
41 | 41 | } |
42 | 42 | $data['username'] = $this->session->userdata('user_name'); |
43 | - $data['page_title'] = gettext('Refill Coupon'); |
|
44 | - $data['search_flag'] = true; |
|
45 | - $this->session->set_userdata('advance_search', 0); |
|
46 | - $this->session->set_userdata('refill_coupon_list_search', 0); |
|
47 | - $data['grid_fields'] = $this->refill_coupon_form->build_refill_coupon_grid(); |
|
48 | - $data["grid_buttons"] = $this->refill_coupon_form->build_grid_buttons_refill_coupon(); |
|
49 | - $data['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form()); |
|
50 | - $this->load->view('view_refill_coupon_list', $data); |
|
51 | - } |
|
52 | - function refill_coupon_list_json(){ |
|
43 | + $data['page_title'] = gettext('Refill Coupon'); |
|
44 | + $data['search_flag'] = true; |
|
45 | + $this->session->set_userdata('advance_search', 0); |
|
46 | + $this->session->set_userdata('refill_coupon_list_search', 0); |
|
47 | + $data['grid_fields'] = $this->refill_coupon_form->build_refill_coupon_grid(); |
|
48 | + $data["grid_buttons"] = $this->refill_coupon_form->build_grid_buttons_refill_coupon(); |
|
49 | + $data['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form()); |
|
50 | + $this->load->view('view_refill_coupon_list', $data); |
|
51 | + } |
|
52 | + function refill_coupon_list_json(){ |
|
53 | 53 | $json_data = array(); |
54 | - $count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", ""); |
|
55 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
56 | - $json_data = $paging_data["json_paging"]; |
|
57 | - $query = $this->refill_coupon_model->get_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
58 | - $grid_fields = json_decode($this->refill_coupon_form->build_refill_coupon_grid()); |
|
59 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
60 | - echo json_encode($json_data); |
|
61 | - } |
|
62 | - function refill_coupon_list_search(){ |
|
63 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
64 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
65 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
66 | - $action = $this->input->post(); |
|
67 | - unset($action['action']); |
|
68 | - unset($action['advance_search']); |
|
69 | - if (isset($action['amount']['amount']) && $action['amount']['amount'] != '') { |
|
70 | - $action['amount']['amount'] = $this->common_model->add_calculate_currency($action['amount']['amount'], "", '', true, false); |
|
71 | - } |
|
72 | - $this->session->set_userdata('refill_coupon_list_search', $action); |
|
73 | - } |
|
74 | - if (@$ajax_search != 1) { |
|
75 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
76 | - } |
|
77 | - } |
|
78 | - function refill_coupon_clearsearchfilter(){ |
|
54 | + $count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", ""); |
|
55 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
56 | + $json_data = $paging_data["json_paging"]; |
|
57 | + $query = $this->refill_coupon_model->get_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
58 | + $grid_fields = json_decode($this->refill_coupon_form->build_refill_coupon_grid()); |
|
59 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
60 | + echo json_encode($json_data); |
|
61 | + } |
|
62 | + function refill_coupon_list_search(){ |
|
63 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
64 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
65 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
66 | + $action = $this->input->post(); |
|
67 | + unset($action['action']); |
|
68 | + unset($action['advance_search']); |
|
69 | + if (isset($action['amount']['amount']) && $action['amount']['amount'] != '') { |
|
70 | + $action['amount']['amount'] = $this->common_model->add_calculate_currency($action['amount']['amount'], "", '', true, false); |
|
71 | + } |
|
72 | + $this->session->set_userdata('refill_coupon_list_search', $action); |
|
73 | + } |
|
74 | + if (@$ajax_search != 1) { |
|
75 | + redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
76 | + } |
|
77 | + } |
|
78 | + function refill_coupon_clearsearchfilter(){ |
|
79 | 79 | $this->session->set_userdata('advance_search', 0); |
80 | - $this->session->set_userdata('refill_coupon_list_search', ""); |
|
81 | - } |
|
82 | - function refill_coupon_list_view($id){ |
|
83 | - $data['username'] = $this->session->userdata('user_name'); |
|
84 | - $data['page_title'] = 'View Refill Coupon'; |
|
85 | - if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) { |
|
86 | - $refill_coupon_details=$cc->result_array(); |
|
87 | - $data['refill_coupon_details']=$refill_coupon_details[0]; |
|
88 | - $data['refill_coupon_details']['callingcard']= $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | - $data['refill_coupon_details']['currency']= $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
90 | - } else { |
|
91 | - echo "This card is not available."; |
|
92 | - return; |
|
93 | - } |
|
94 | - $this->load->view('view_refill_coupon_details', $data); |
|
80 | + $this->session->set_userdata('refill_coupon_list_search', ""); |
|
81 | + } |
|
82 | + function refill_coupon_list_view($id){ |
|
83 | + $data['username'] = $this->session->userdata('user_name'); |
|
84 | + $data['page_title'] = 'View Refill Coupon'; |
|
85 | + if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) { |
|
86 | + $refill_coupon_details=$cc->result_array(); |
|
87 | + $data['refill_coupon_details']=$refill_coupon_details[0]; |
|
88 | + $data['refill_coupon_details']['callingcard']= $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | + $data['refill_coupon_details']['currency']= $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
90 | + } else { |
|
91 | + echo "This card is not available."; |
|
92 | + return; |
|
93 | + } |
|
94 | + $this->load->view('view_refill_coupon_details', $data); |
|
95 | 95 | |
96 | - } |
|
97 | - function refill_coupon_add() { |
|
96 | + } |
|
97 | + function refill_coupon_add() { |
|
98 | 98 | if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
99 | - redirect(base_url() . 'user/user/'); |
|
99 | + redirect(base_url() . 'user/user/'); |
|
100 | 100 | } |
101 | - $data['username'] = $this->session->userdata('user_name'); |
|
102 | - $data['flag'] = 'create'; |
|
103 | - $data['page_title'] = 'Create Refill Coupon'; |
|
104 | - $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), ''); |
|
105 | - $this->load->view('view_refill_coupon_add', $data); |
|
106 | - } |
|
107 | - function refill_coupon_save() { |
|
108 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
109 | - $add_array = $this->input->post(); |
|
110 | - $add_array['status']=0; |
|
111 | - $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array); |
|
101 | + $data['username'] = $this->session->userdata('user_name'); |
|
102 | + $data['flag'] = 'create'; |
|
103 | + $data['page_title'] = 'Create Refill Coupon'; |
|
104 | + $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), ''); |
|
105 | + $this->load->view('view_refill_coupon_add', $data); |
|
106 | + } |
|
107 | + function refill_coupon_save() { |
|
108 | + $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
109 | + $add_array = $this->input->post(); |
|
110 | + $add_array['status']=0; |
|
111 | + $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array); |
|
112 | 112 | $result=$this->refill_coupon_model->refill_coupon_count($add_array); |
113 | - $count=$result[0]['count']; |
|
114 | - $remaining_length =0; |
|
115 | - $remaining_length=$account_length - strlen($add_array['prefix']); |
|
116 | - $currentlength =pow(5,$remaining_length); |
|
117 | - $currentlength=$currentlength-$count; |
|
118 | - $data['page_title'] = 'Add Refill Coupon'; |
|
119 | - if ($this->form_validation->run() == FALSE) { |
|
120 | - $data['validation_errors'] = validation_errors(); |
|
121 | - echo $data['validation_errors']; |
|
122 | - exit; |
|
123 | - } |
|
124 | - else { |
|
125 | - if($account_length<=strlen($add_array['prefix'])){ |
|
126 | - echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
|
127 | - exit; |
|
128 | - } |
|
129 | - if($currentlength <= 0){ |
|
130 | - echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix")); |
|
131 | - exit; |
|
132 | - } |
|
133 | - if($currentlength > 0 && $add_array['count'] > $currentlength){ |
|
134 | - echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
|
135 | - exit; |
|
136 | - }else{ |
|
137 | - $this->refill_coupon_model->add_refill_coupon($add_array); |
|
138 | - echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
|
139 | - exit; |
|
140 | - } |
|
141 | - } |
|
142 | - } |
|
143 | - function refill_coupon_list_delete($id) { |
|
144 | - $this->refill_coupon_model->remove_refill_coupon($id); |
|
145 | - $this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!'); |
|
146 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
147 | - } |
|
148 | - function refill_coupon_export(){ |
|
113 | + $count=$result[0]['count']; |
|
114 | + $remaining_length =0; |
|
115 | + $remaining_length=$account_length - strlen($add_array['prefix']); |
|
116 | + $currentlength =pow(5,$remaining_length); |
|
117 | + $currentlength=$currentlength-$count; |
|
118 | + $data['page_title'] = 'Add Refill Coupon'; |
|
119 | + if ($this->form_validation->run() == FALSE) { |
|
120 | + $data['validation_errors'] = validation_errors(); |
|
121 | + echo $data['validation_errors']; |
|
122 | + exit; |
|
123 | + } |
|
124 | + else { |
|
125 | + if($account_length<=strlen($add_array['prefix'])){ |
|
126 | + echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
|
127 | + exit; |
|
128 | + } |
|
129 | + if($currentlength <= 0){ |
|
130 | + echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix")); |
|
131 | + exit; |
|
132 | + } |
|
133 | + if($currentlength > 0 && $add_array['count'] > $currentlength){ |
|
134 | + echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
|
135 | + exit; |
|
136 | + }else{ |
|
137 | + $this->refill_coupon_model->add_refill_coupon($add_array); |
|
138 | + echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
|
139 | + exit; |
|
140 | + } |
|
141 | + } |
|
142 | + } |
|
143 | + function refill_coupon_list_delete($id) { |
|
144 | + $this->refill_coupon_model->remove_refill_coupon($id); |
|
145 | + $this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!'); |
|
146 | + redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
147 | + } |
|
148 | + function refill_coupon_export(){ |
|
149 | 149 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
150 | 150 | $currency_id=$account_info['currency_id']; |
151 | 151 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
152 | 152 | $query = $this->refill_coupon_model->get_refill_coupon_list(true,'','',true); |
153 | - $cc_array = array(); |
|
154 | - ob_clean(); |
|
155 | - $cc_array[] = array('Coupon No.','Description', 'Account','Amount('.$currency.')','Created Date',"Used?",'Used Date'); |
|
156 | - if ($query->num_rows() > 0) { |
|
157 | - foreach ($query->result_array() as $row) { |
|
158 | - $row['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row['currency_id']); |
|
159 | - $row['acc_name'] = $row['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row['account_id']) : ""; |
|
160 | - $row['status']=$this->common->get_refill_coupon_status('','',$row['status']); |
|
161 | - $cc_array[] = array( |
|
162 | - $row['number'], |
|
163 | - $row['description'], |
|
164 | - $row['acc_name'], |
|
165 | - $this->common->convert_to_currency('','',$row['amount']), |
|
166 | - $row['creation_date'], |
|
167 | - $row['status'], |
|
168 | - $row['firstused'] |
|
169 | - ); |
|
170 | - } |
|
171 | - } |
|
172 | - $this->load->helper('csv'); |
|
173 | - array_to_csv($cc_array, 'refill_coupon_' . date("Y-m-d") . '.csv'); |
|
174 | - } |
|
175 | - function refill_coupon_customer_json($accountid){ |
|
153 | + $cc_array = array(); |
|
154 | + ob_clean(); |
|
155 | + $cc_array[] = array('Coupon No.','Description', 'Account','Amount('.$currency.')','Created Date',"Used?",'Used Date'); |
|
156 | + if ($query->num_rows() > 0) { |
|
157 | + foreach ($query->result_array() as $row) { |
|
158 | + $row['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row['currency_id']); |
|
159 | + $row['acc_name'] = $row['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row['account_id']) : ""; |
|
160 | + $row['status']=$this->common->get_refill_coupon_status('','',$row['status']); |
|
161 | + $cc_array[] = array( |
|
162 | + $row['number'], |
|
163 | + $row['description'], |
|
164 | + $row['acc_name'], |
|
165 | + $this->common->convert_to_currency('','',$row['amount']), |
|
166 | + $row['creation_date'], |
|
167 | + $row['status'], |
|
168 | + $row['firstused'] |
|
169 | + ); |
|
170 | + } |
|
171 | + } |
|
172 | + $this->load->helper('csv'); |
|
173 | + array_to_csv($cc_array, 'refill_coupon_' . date("Y-m-d") . '.csv'); |
|
174 | + } |
|
175 | + function refill_coupon_customer_json($accountid){ |
|
176 | 176 | $json_data = array(); |
177 | - $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "",$accountid); |
|
178 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
179 | - $json_data = $paging_data["json_paging"]; |
|
180 | - $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"],$accountid); |
|
181 | - $grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid()); |
|
182 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
183 | - echo json_encode($json_data); |
|
184 | - } |
|
177 | + $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "",$accountid); |
|
178 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
179 | + $json_data = $paging_data["json_paging"]; |
|
180 | + $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"],$accountid); |
|
181 | + $grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid()); |
|
182 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
183 | + echo json_encode($json_data); |
|
184 | + } |
|
185 | 185 | } |
186 | 186 | ?> |
@@ -21,103 +21,103 @@ |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | if (!defined('BASEPATH')) |
24 | - exit('No direct script access allowed'); |
|
24 | + exit('No direct script access allowed'); |
|
25 | 25 | |
26 | 26 | class Refill_coupon_form { |
27 | - function __construct($library_name = '') { |
|
28 | - $this->CI = & get_instance(); |
|
29 | - } |
|
30 | - function get_refill_coupon_form_fields(){ |
|
31 | - $form['forms'] = array(base_url() . 'refill_coupon/refill_coupon_save/',array("id" => "refill_coupon_form", "name" => "refill_coupon_form")); |
|
32 | - $form['Coupon Information'] = array( |
|
33 | - array('Description', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
34 | - array('Start prefix', 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
35 | - array('Quantity', 'INPUT', array('name' => 'count', 'size' => '20', 'maxlength' => '5', 'class' => "text field medium"), 'trim|required|is_numeric|greater_than[0]|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
36 | - array('Amount', 'INPUT', array('name' => 'amount', 'size' => '20', 'class' => "text field medium"), 'trim|required|is_numeric|greater_than[0]|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
37 | - ); |
|
38 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
39 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
27 | + function __construct($library_name = '') { |
|
28 | + $this->CI = & get_instance(); |
|
29 | + } |
|
30 | + function get_refill_coupon_form_fields(){ |
|
31 | + $form['forms'] = array(base_url() . 'refill_coupon/refill_coupon_save/',array("id" => "refill_coupon_form", "name" => "refill_coupon_form")); |
|
32 | + $form['Coupon Information'] = array( |
|
33 | + array('Description', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
34 | + array('Start prefix', 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''), |
|
35 | + array('Quantity', 'INPUT', array('name' => 'count', 'size' => '20', 'maxlength' => '5', 'class' => "text field medium"), 'trim|required|is_numeric|greater_than[0]|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
36 | + array('Amount', 'INPUT', array('name' => 'amount', 'size' => '20', 'class' => "text field medium"), 'trim|required|is_numeric|greater_than[0]|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
|
37 | + ); |
|
38 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
39 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
40 | 40 | |
41 | - return $form; |
|
42 | - } |
|
43 | - function build_grid_buttons_refill_coupon() { |
|
44 | - $buttons_json = json_encode(array( |
|
45 | - array(gettext("Create"),"btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/refill_coupon/refill_coupon_add/","popup"), |
|
46 | - array(gettext("Export"),"btn btn-xing" ," fa fa-download fa-lg", "button_action", "/refill_coupon/refill_coupon_export/", 'single'), |
|
47 | - )); |
|
48 | - return $buttons_json; |
|
49 | - } |
|
50 | - function build_user_grid_buttons_refill_coupon() { |
|
51 | - $buttons_json = json_encode(array( |
|
52 | - array("Refresh", "reload", "/refill_coupon/refill_coupon_clearsearchfilter/"))); |
|
53 | - return $buttons_json; |
|
54 | - } |
|
55 | - function get_refill_coupon_search_form() { |
|
56 | - $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
57 | - $reseller_id=$accountinfo['type']== 1 ?$accountinfo['id'] : 0 ; |
|
58 | - $form['forms'] = array("", array('id' => "refill_coupon_list_search")); |
|
59 | - $form['Search'] = array( |
|
60 | - array('Coupon Number', 'INPUT', array('name' => 'number[number]', '', 'id' => 'number', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
61 | - array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15','class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
|
62 | - array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"GLOBAL")), |
|
63 | - array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''), |
|
64 | - array('Used?', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_refill_coupon_status', '', ''), |
|
41 | + return $form; |
|
42 | + } |
|
43 | + function build_grid_buttons_refill_coupon() { |
|
44 | + $buttons_json = json_encode(array( |
|
45 | + array(gettext("Create"),"btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/refill_coupon/refill_coupon_add/","popup"), |
|
46 | + array(gettext("Export"),"btn btn-xing" ," fa fa-download fa-lg", "button_action", "/refill_coupon/refill_coupon_export/", 'single'), |
|
47 | + )); |
|
48 | + return $buttons_json; |
|
49 | + } |
|
50 | + function build_user_grid_buttons_refill_coupon() { |
|
51 | + $buttons_json = json_encode(array( |
|
52 | + array("Refresh", "reload", "/refill_coupon/refill_coupon_clearsearchfilter/"))); |
|
53 | + return $buttons_json; |
|
54 | + } |
|
55 | + function get_refill_coupon_search_form() { |
|
56 | + $accountinfo=$this->CI->session->userdata('accountinfo'); |
|
57 | + $reseller_id=$accountinfo['type']== 1 ?$accountinfo['id'] : 0 ; |
|
58 | + $form['forms'] = array("", array('id' => "refill_coupon_list_search")); |
|
59 | + $form['Search'] = array( |
|
60 | + array('Coupon Number', 'INPUT', array('name' => 'number[number]', '', 'id' => 'number', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
61 | + array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15','class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
|
62 | + array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"GLOBAL")), |
|
63 | + array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''), |
|
64 | + array('Used?', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_refill_coupon_status', '', ''), |
|
65 | 65 | |
66 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
67 | - array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
68 | - ); |
|
69 | - $form['button_search'] = array('name' => 'action', 'id' => "refill_coupon_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
70 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
66 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
67 | + array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
68 | + ); |
|
69 | + $form['button_search'] = array('name' => 'action', 'id' => "refill_coupon_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
70 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
71 | 71 | |
72 | - return $form; |
|
73 | - } |
|
74 | - function get_user_refill_coupon_search_form() { |
|
72 | + return $form; |
|
73 | + } |
|
74 | + function get_user_refill_coupon_search_form() { |
|
75 | 75 | |
76 | - $form['forms'] = array("", array('id' => "user_refill_coupon_list_search")); |
|
77 | - $form['Search Refill Coupon'] = array( |
|
78 | - array('Coupon Number', 'INPUT', array('name' => 'number[number]', '', 'id' => 'number', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
79 | - array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
|
80 | - array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''), |
|
81 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_refill_coupon_status', '', ''), |
|
82 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
83 | - array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
84 | - ); |
|
85 | - $form['button_search'] = array('name' => 'action', 'id' => "user_refill_coupon_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'ui-state-default float-right ui-corner-all ui-button'); |
|
86 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear Search Filter', 'value' => 'cancel', 'type' => 'reset', 'class' => 'ui-state-default float-right ui-corner-all ui-button'); |
|
87 | - return $form; |
|
88 | - } |
|
89 | - function build_refill_coupon_grid() { |
|
76 | + $form['forms'] = array("", array('id' => "user_refill_coupon_list_search")); |
|
77 | + $form['Search Refill Coupon'] = array( |
|
78 | + array('Coupon Number', 'INPUT', array('name' => 'number[number]', '', 'id' => 'number', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''), |
|
79 | + array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
|
80 | + array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''), |
|
81 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_refill_coupon_status', '', ''), |
|
82 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
83 | + array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
84 | + ); |
|
85 | + $form['button_search'] = array('name' => 'action', 'id' => "user_refill_coupon_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'ui-state-default float-right ui-corner-all ui-button'); |
|
86 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear Search Filter', 'value' => 'cancel', 'type' => 'reset', 'class' => 'ui-state-default float-right ui-corner-all ui-button'); |
|
87 | + return $form; |
|
88 | + } |
|
89 | + function build_refill_coupon_grid() { |
|
90 | 90 | |
91 | 91 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
92 | 92 | $currency_id=$account_info['currency_id']; |
93 | 93 | $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
94 | 94 | |
95 | - $grid_field_arr = json_encode(array( |
|
96 | - array(gettext("Coupon Number"), "150", "number", "", "", "","","true","center"), |
|
97 | - array(gettext("Description"), "165", "description", "", "", "","","true","center"), |
|
98 | - array(gettext("Account"), "165", "account_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"), |
|
99 | - array("Amount($currency)", "150", "amount", "amount", "amount", "convert_to_currency","","true","right"), |
|
100 | - array(gettext("Created Date"), "200", "creation_date", "", "", "","","true","center"), |
|
101 | - array(gettext("Used?"),"135","status",'status','status','get_refill_coupon_used',"","true","center"), |
|
102 | - array(gettext("Used Date"), "180", "firstused", "firstused", "firstused", "firstused_check","","true","center"), |
|
103 | - array("Action", "120", "", "", "", array( |
|
104 | - "DELETE" => array("url" => "refill_coupon/refill_coupon_list_delete/", "mode" => "single") |
|
105 | - )) |
|
106 | - )); |
|
107 | - return $grid_field_arr; |
|
108 | - } |
|
109 | - function build_user_refill_coupon_grid() { |
|
95 | + $grid_field_arr = json_encode(array( |
|
96 | + array(gettext("Coupon Number"), "150", "number", "", "", "","","true","center"), |
|
97 | + array(gettext("Description"), "165", "description", "", "", "","","true","center"), |
|
98 | + array(gettext("Account"), "165", "account_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"), |
|
99 | + array("Amount($currency)", "150", "amount", "amount", "amount", "convert_to_currency","","true","right"), |
|
100 | + array(gettext("Created Date"), "200", "creation_date", "", "", "","","true","center"), |
|
101 | + array(gettext("Used?"),"135","status",'status','status','get_refill_coupon_used',"","true","center"), |
|
102 | + array(gettext("Used Date"), "180", "firstused", "firstused", "firstused", "firstused_check","","true","center"), |
|
103 | + array("Action", "120", "", "", "", array( |
|
104 | + "DELETE" => array("url" => "refill_coupon/refill_coupon_list_delete/", "mode" => "single") |
|
105 | + )) |
|
106 | + )); |
|
107 | + return $grid_field_arr; |
|
108 | + } |
|
109 | + function build_user_refill_coupon_grid() { |
|
110 | 110 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
111 | - $currency_id=$account_info['currency_id']; |
|
112 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
111 | + $currency_id=$account_info['currency_id']; |
|
112 | + $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
113 | 113 | $grid_field_arr = json_encode(array( |
114 | - array("Coupon Number", "230", "number", "", "", "","","true","center"), |
|
115 | - array("Description", "210", "description", "", "", "","","true","center"), |
|
116 | - array("Amount($currency)", "190", "amount", "amount", "amount", "convert_to_currency","","true","right"), |
|
117 | - array("Created Date", "250", "creation_date", "", "", "","","true","center"), |
|
118 | - array("Used Date", "250", "firstused", "firstused", "firstused", "firstused_check","","true","center"), |
|
119 | - )); |
|
120 | - return $grid_field_arr; |
|
121 | - } |
|
114 | + array("Coupon Number", "230", "number", "", "", "","","true","center"), |
|
115 | + array("Description", "210", "description", "", "", "","","true","center"), |
|
116 | + array("Amount($currency)", "190", "amount", "amount", "amount", "convert_to_currency","","true","right"), |
|
117 | + array("Created Date", "250", "creation_date", "", "", "","","true","center"), |
|
118 | + array("Used Date", "250", "firstused", "firstused", "firstused", "firstused_check","","true","center"), |
|
119 | + )); |
|
120 | + return $grid_field_arr; |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | ?> |
@@ -49,10 +49,10 @@ |
||
49 | 49 | <th>Cost(CAD)</th> |
50 | 50 | </tr> |
51 | 51 | <?php foreach($cdrs as $cdr){ |
52 | - $debit= ''; |
|
53 | - $debit =($cdr['debit']/10000); |
|
54 | - $debit=$debit+0; |
|
55 | - ?> |
|
52 | + $debit= ''; |
|
53 | + $debit =($cdr['debit']/10000); |
|
54 | + $debit=$debit+0; |
|
55 | + ?> |
|
56 | 56 | <tr> |
57 | 57 | <td><?=$cdr['destination']?></td> |
58 | 58 | <td><?=$cdr['disposition']?></td> |