@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $this->db_model->build_search('taxes_list_search'); |
31 | 31 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
32 | 32 | $where = array("reseller_id"=>$this->session->userdata["accountinfo"]['id']); |
33 | - }else{ |
|
34 | - $where =array("reseller_id"=>0); |
|
33 | + } else { |
|
34 | + $where = array("reseller_id"=>0); |
|
35 | 35 | } |
36 | 36 | if ($flag) { |
37 | 37 | $query = $this->db_model->select("*", "taxes", $where, "id", "ASC", $limit, $start); |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $data["creation_date"] = date("Y-m-d H:i:s"); |
47 | 47 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
48 | 48 | $data['reseller_id'] = $this->session->userdata["accountinfo"]['id']; |
49 | - }else{ |
|
50 | - $data['reseller_id'] =0; |
|
49 | + } else { |
|
50 | + $data['reseller_id'] = 0; |
|
51 | 51 | } |
52 | 52 | $this->db->insert("taxes", $data); |
53 | 53 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | function remove_taxes($id) { |
63 | - $this->db->delete('taxes_to_accounts',array('taxes_id'=>$id)); |
|
64 | - return $this->db->delete("taxes",array('id'=>$id)); |
|
63 | + $this->db->delete('taxes_to_accounts', array('taxes_id'=>$id)); |
|
64 | + return $this->db->delete("taxes", array('id'=>$id)); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $this->load->library('csvreader'); |
37 | 37 | $this->load->library('astpp/email_lib'); |
38 | 38 | if ($this->session->userdata('user_login') == FALSE) |
39 | - redirect(base_url() . '/astpp/login'); |
|
39 | + redirect(base_url().'/astpp/login'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | function email_edit($edit_id = '') { |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | $data['form'] = $this->form->build_form($this->email_form->get_form_fields_email(), $edit_data); |
57 | 57 | $this->load->view('view_email_add_edit', $data); |
58 | 58 | } else { |
59 | - redirect(base_url() . 'email/email_history_list/'); |
|
59 | + redirect(base_url().'email/email_history_list/'); |
|
60 | 60 | } |
61 | - redirect(base_url() . 'email/email_history_list/'); |
|
61 | + redirect(base_url().'email/email_history_list/'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | function email_resend() { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | foreach ($account->result_array() as $key => $value) { |
79 | 79 | $edit_data = $value; |
80 | 80 | } |
81 | - $add_array=array('accountid'=>$edit_data['accountid'], |
|
81 | + $add_array = array('accountid'=>$edit_data['accountid'], |
|
82 | 82 | 'subject'=>$add_array['subject'], |
83 | 83 | 'body'=>$add_array['body'], |
84 | 84 | 'from'=>$edit_data['from'], |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $this->email_re_send($add_array); |
92 | 92 | |
93 | 93 | $this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!'); |
94 | - redirect(base_url() . 'email/email_history_list/'); |
|
94 | + redirect(base_url().'email/email_history_list/'); |
|
95 | 95 | } |
96 | 96 | function email_resend_edit($edit_id = '') { |
97 | 97 | $data['page_title'] = 'Resend Email'; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $this->load->view('view_email_add_edit', $data); |
108 | 108 | } else { |
109 | - redirect(base_url() . 'email/email_history_list/'); |
|
109 | + redirect(base_url().'email/email_history_list/'); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $this->load->view('view_email_add_edit', $data); |
125 | 125 | } else { |
126 | - redirect(base_url() . 'email/email_history_list/'); |
|
126 | + redirect(base_url().'email/email_history_list/'); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | foreach ($account->result_array() as $key => $value) { |
137 | 137 | $edit_data = $value; |
138 | 138 | } |
139 | - $add_array=array('accountid'=>$edit_data['accountid'], |
|
139 | + $add_array = array('accountid'=>$edit_data['accountid'], |
|
140 | 140 | 'subject'=>$add_array['subject'], |
141 | 141 | 'body'=>$add_array['body'], |
142 | 142 | 'from'=>$edit_data['from'], |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | 'attachment'=>$edit_data['attachment'], |
147 | 147 | ); |
148 | 148 | $this->email_model->add_email($add_array); |
149 | - $this->email_lib->send_email('',$add_array,'','',1); |
|
149 | + $this->email_lib->send_email('', $add_array, '', '', 1); |
|
150 | 150 | |
151 | 151 | $this->load->module('accounts/accounts'); |
152 | 152 | $this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!'); |
153 | - redirect(base_url() . 'accounts/customer_edit/'.$value["accountid"]); |
|
153 | + redirect(base_url().'accounts/customer_edit/'.$value["accountid"]); |
|
154 | 154 | } |
155 | 155 | function email_add($type = "") { |
156 | 156 | |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | function email_re_send($edit_data) { |
192 | - $this->email_lib->send_email('',$edit_data,'',$edit_data['attachment'],1); |
|
192 | + $this->email_lib->send_email('', $edit_data, '', $edit_data['attachment'], 1); |
|
193 | 193 | $this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!'); |
194 | - redirect(base_url() . '/email/email_history_list/'); |
|
194 | + redirect(base_url().'/email/email_history_list/'); |
|
195 | 195 | } |
196 | 196 | function email_view($edit_id = '') { |
197 | 197 | $data['page_title'] = 'View Email'; |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | foreach ($account->result_array() as $key => $value) { |
202 | 202 | $edit_data = $value; |
203 | 203 | } |
204 | - if($edit_data['status'] == 1){ |
|
205 | - $edit_data['status']='Not Sent'; |
|
206 | - }else{ |
|
207 | - $edit_data['status']='Sent'; |
|
204 | + if ($edit_data['status'] == 1) { |
|
205 | + $edit_data['status'] = 'Not Sent'; |
|
206 | + } else { |
|
207 | + $edit_data['status'] = 'Sent'; |
|
208 | 208 | } |
209 | 209 | $data['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view(), $edit_data); |
210 | 210 | |
211 | 211 | $this->load->view('view_email_add_edit', $data); |
212 | 212 | } else { |
213 | - redirect(base_url() . 'email/email_history_list/'); |
|
213 | + redirect(base_url().'email/email_history_list/'); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | function email_view_customer($edit_id = '') { |
@@ -224,141 +224,141 @@ discard block |
||
224 | 224 | $data['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view_cus(), $edit_data); |
225 | 225 | $this->load->view('view_email_add_edit', $data); |
226 | 226 | } else { |
227 | - redirect(base_url() . 'email/email_history_list/'.$edit_id); |
|
227 | + redirect(base_url().'email/email_history_list/'.$edit_id); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | function email_delete($id) { |
231 | 231 | $this->email_model->remove_email($id); |
232 | 232 | $this->session->set_flashdata('astpp_notification', 'Email removed successfully!'); |
233 | - redirect(base_url() . '/email/email_history_list/'); |
|
233 | + redirect(base_url().'/email/email_history_list/'); |
|
234 | 234 | } |
235 | - function email_delete_customer($accounttype,$accountid,$id) { |
|
235 | + function email_delete_customer($accounttype, $accountid, $id) { |
|
236 | 236 | $this->email_model->remove_email($id); |
237 | 237 | $where = array('id' => $id); |
238 | 238 | $account = $this->db_model->getSelect("*", "mail_details", $where); |
239 | 239 | foreach ($account->result_array() as $key => $value) { |
240 | 240 | $edit_data = $value; |
241 | 241 | } |
242 | - $url ="accounts/".$accounttype."_emailhistory/$accountid/"; |
|
242 | + $url = "accounts/".$accounttype."_emailhistory/$accountid/"; |
|
243 | 243 | $this->session->set_flashdata('astpp_notification', 'Email removed successfully!'); |
244 | 244 | $this->load->module('accounts/accounts'); |
245 | - redirect(base_url() . $url); |
|
245 | + redirect(base_url().$url); |
|
246 | 246 | } |
247 | 247 | function email_mass() { |
248 | 248 | $account_data = $this->session->userdata("accountinfo"); |
249 | - if ($account_data['type'] == '1' || $account_data['type']== 0 || $account_data['type']==3) |
|
250 | - redirect(base_url() . '/astpp/dashboard/'); |
|
249 | + if ($account_data['type'] == '1' || $account_data['type'] == 0 || $account_data['type'] == 3) |
|
250 | + redirect(base_url().'/astpp/dashboard/'); |
|
251 | 251 | $data['username'] = $this->session->userdata('user_name'); |
252 | 252 | $data['page_title'] = 'Email Mass'; |
253 | 253 | $data['form'] = $this->form->build_form($this->email_form->build_list_for_email_client_area(), ''); |
254 | - $this->load->view('view_email_client_area',$data); |
|
254 | + $this->load->view('view_email_client_area', $data); |
|
255 | 255 | } |
256 | 256 | /*Mass Email*/ |
257 | - function attachment_icons($select = "", $table = "", $attachement="") { |
|
258 | - if($attachement!="") |
|
257 | + function attachment_icons($select = "", $table = "", $attachement = "") { |
|
258 | + if ($attachement != "") |
|
259 | 259 | { |
260 | - $array=explode(",", $attachement); |
|
261 | - $str=''; |
|
262 | - foreach($array as $key =>$val){ |
|
263 | - $link = base_url() . "email/email_history_list_attachment/".$val; |
|
264 | - $str.="<a href='".$link."' title='".$val."' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a> "; |
|
260 | + $array = explode(",", $attachement); |
|
261 | + $str = ''; |
|
262 | + foreach ($array as $key =>$val) { |
|
263 | + $link = base_url()."email/email_history_list_attachment/".$val; |
|
264 | + $str .= "<a href='".$link."' title='".$val."' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a> "; |
|
265 | 265 | } |
266 | 266 | return $str; |
267 | 267 | } |
268 | - else{ |
|
268 | + else { |
|
269 | 269 | return ""; |
270 | 270 | } |
271 | 271 | } |
272 | 272 | function email_client_get() |
273 | 273 | { |
274 | - $files=$_FILES; |
|
274 | + $files = $_FILES; |
|
275 | 275 | $add_array = $this->input->post(); |
276 | 276 | $add_array['page_title'] = 'Compose email'; |
277 | - $nooffile= $files['file']['name']; |
|
278 | - $count=count($nooffile); |
|
279 | - $add_array['attachment']=''; |
|
280 | - $add_array['file']=''; |
|
281 | - for($i=0;$i<$count;$i++){ |
|
282 | - $tmp_name[]= $files['file']['tmp_name'][$i]; |
|
283 | - if($files['file']['error'][$i]==0){ |
|
277 | + $nooffile = $files['file']['name']; |
|
278 | + $count = count($nooffile); |
|
279 | + $add_array['attachment'] = ''; |
|
280 | + $add_array['file'] = ''; |
|
281 | + for ($i = 0; $i < $count; $i++) { |
|
282 | + $tmp_name[] = $files['file']['tmp_name'][$i]; |
|
283 | + if ($files['file']['error'][$i] == 0) { |
|
284 | 284 | $cur_name = $files['file']['name'][$i]; |
285 | 285 | $parts = explode(".", $cur_name); |
286 | - $add_array['attachment'].=date('ymdhis').$i.'.'.$parts[1].','; |
|
287 | - $add_array['file'].=date('ymdhis').$i.'.'.$parts[1].','; |
|
286 | + $add_array['attachment'] .= date('ymdhis').$i.'.'.$parts[1].','; |
|
287 | + $add_array['file'] .= date('ymdhis').$i.'.'.$parts[1].','; |
|
288 | 288 | $uploadedFile1 = $files['file']['tmp_name'][$i]; |
289 | - $user_name='inextrix'; |
|
290 | - $actual_file_name=date('ymdhis').$i.'.'.$parts[1]; |
|
291 | - $dir_path= getcwd()."/attachments/"; |
|
292 | - $path =$dir_path.$actual_file_name; |
|
293 | - if (move_uploaded_file($uploadedFile1,$path)) { |
|
289 | + $user_name = 'inextrix'; |
|
290 | + $actual_file_name = date('ymdhis').$i.'.'.$parts[1]; |
|
291 | + $dir_path = getcwd()."/attachments/"; |
|
292 | + $path = $dir_path.$actual_file_name; |
|
293 | + if (move_uploaded_file($uploadedFile1, $path)) { |
|
294 | 294 | $this->session->set_flashdata('astpp_errormsg', 'files added successfully!'); |
295 | 295 | } |
296 | - else{ |
|
296 | + else { |
|
297 | 297 | $this->session->set_flashdata('astpp_errormsg', 'Please try again !'); |
298 | 298 | } |
299 | 299 | } |
300 | 300 | } |
301 | - $add_array['attachment']=trim($add_array['attachment'],','); |
|
302 | - $add_array['file']=trim($add_array['file'],','); |
|
303 | - $add_array['email']= explode(",",$add_array['to']); |
|
301 | + $add_array['attachment'] = trim($add_array['attachment'], ','); |
|
302 | + $add_array['file'] = trim($add_array['file'], ','); |
|
303 | + $add_array['email'] = explode(",", $add_array['to']); |
|
304 | 304 | $this->email_model->multipal_email($add_array); |
305 | 305 | $screen_path = getcwd()."/cron"; |
306 | 306 | $screen_filename = "Email_Broadcast_".strtotime('now'); |
307 | 307 | $command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
308 | 308 | exec($command); |
309 | 309 | $this->session->set_flashdata('astpp_errormsg', 'Email broad cast successfully!'); |
310 | - redirect(base_url() . 'email/email_history_list/'); |
|
310 | + redirect(base_url().'email/email_history_list/'); |
|
311 | 311 | exit; |
312 | 312 | } |
313 | 313 | |
314 | 314 | function email_client_area() { |
315 | 315 | $add_array = $this->input->post(); |
316 | - if($add_array['temp'] == ''){ |
|
316 | + if ($add_array['temp'] == '') { |
|
317 | 317 | $subject = ''; |
318 | - $body =''; |
|
318 | + $body = ''; |
|
319 | 319 | } |
320 | - else{ |
|
320 | + else { |
|
321 | 321 | $where = array('id' => $add_array['temp']); |
322 | 322 | $account = $this->db_model->getSelect("subject,template", "default_templates", $where); |
323 | - $account_data =$account->result_array(); |
|
324 | - $subject = isset($account_data[0]['subject'])?$account_data[0]['subject']:''; |
|
325 | - $body = isset($account_data[0]['template'])?$account_data[0]['template']:''; |
|
323 | + $account_data = $account->result_array(); |
|
324 | + $subject = isset($account_data[0]['subject']) ? $account_data[0]['subject'] : ''; |
|
325 | + $body = isset($account_data[0]['template']) ? $account_data[0]['template'] : ''; |
|
326 | 326 | |
327 | 327 | |
328 | 328 | } |
329 | 329 | $count_all = $this->email_model->get_email_client_data($add_array); |
330 | 330 | $email_arr = array(); |
331 | 331 | $id_arr = array(); |
332 | - foreach($count_all as $key=>$value){ |
|
332 | + foreach ($count_all as $key=>$value) { |
|
333 | 333 | $value = $value; |
334 | - if($value['email']!=''){ |
|
335 | - $email_arr[$value['email']]= $value['email']; |
|
336 | - $id_arr[]= $value['id'];} |
|
334 | + if ($value['email'] != '') { |
|
335 | + $email_arr[$value['email']] = $value['email']; |
|
336 | + $id_arr[] = $value['id']; } |
|
337 | 337 | } |
338 | 338 | if (empty($email_arr)) |
339 | 339 | { |
340 | 340 | $this->session->set_flashdata('astpp_notification', 'No record found! '); |
341 | - redirect(base_url() . 'email/email_mass/'); |
|
341 | + redirect(base_url().'email/email_mass/'); |
|
342 | 342 | } |
343 | 343 | $to_email = $email_arr; |
344 | 344 | |
345 | 345 | $to_id = $id_arr; |
346 | - $to_send_mail = implode(",",$to_email); |
|
347 | - if($to_send_mail != ''){ |
|
348 | - $add_arr['email']= $email_arr; |
|
346 | + $to_send_mail = implode(",", $to_email); |
|
347 | + if ($to_send_mail != '') { |
|
348 | + $add_arr['email'] = $email_arr; |
|
349 | 349 | } |
350 | 350 | $data['username'] = $this->session->userdata('user_name'); |
351 | 351 | $data['page_title'] = 'Compose Email'; |
352 | 352 | $send_id = $this->db_model->getSelect("emailaddress", "invoice_conf", array()); |
353 | - $send_id =$send_id->result_array(); |
|
354 | - $send_id =$send_id[0]['emailaddress']; |
|
353 | + $send_id = $send_id->result_array(); |
|
354 | + $send_id = $send_id[0]['emailaddress']; |
|
355 | 355 | $add_arr['template'] = $body; |
356 | 356 | $add_arr['subject'] = $subject; |
357 | 357 | $add_arr['accountid'] = $id_arr; |
358 | 358 | $add_arr['from'] = $send_id; |
359 | 359 | $add_arr['temp'] = $add_array['temp']; |
360 | - $add_arr['to']=$to_send_mail; |
|
361 | - $add_arr['temp']=$add_array['temp']; |
|
360 | + $add_arr['to'] = $to_send_mail; |
|
361 | + $add_arr['temp'] = $add_array['temp']; |
|
362 | 362 | $this->load->view('view_email_brod', $add_arr); |
363 | 363 | } |
364 | 364 | |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | $edit_data = $value; |
372 | 372 | } |
373 | 373 | $this->load->module('accounts/accounts'); |
374 | - redirect(base_url() . 'accounts/customer_edit/'.$value['accountid']); |
|
374 | + redirect(base_url().'accounts/customer_edit/'.$value['accountid']); |
|
375 | 375 | } |
376 | 376 | function email_history_list() { |
377 | - $data['logintype']=$this->session->userdata('logintype'); |
|
377 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
378 | 378 | $data['username'] = $this->session->userdata('user_name'); |
379 | 379 | $data['search_flag'] = true; |
380 | 380 | $this->session->set_userdata('advance_search', 0); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $this->load->view('view_email_list', $data); |
386 | 386 | } |
387 | 387 | function email_history_list_json() { |
388 | - $data['logintype']=$this->session->userdata('logintype'); |
|
388 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
389 | 389 | $json_data = array(); |
390 | 390 | $count_all = $this->email_model->get_email_list(false); |
391 | 391 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | echo json_encode($json_data); |
397 | 397 | } |
398 | 398 | |
399 | - function customer_mail_record($accountid,$accounttype){ |
|
399 | + function customer_mail_record($accountid, $accounttype) { |
|
400 | 400 | $json_data = array(); |
401 | - $count_all = $this->email_model->customer_get_email_list(false,$accountid,"",""); |
|
401 | + $count_all = $this->email_model->customer_get_email_list(false, $accountid, "", ""); |
|
402 | 402 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
403 | 403 | $json_data = $paging_data["json_paging"]; |
404 | - $query = $this->email_model->customer_get_email_list(true,$accountid,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
405 | - $grid_fields = json_decode($this->email_form->build_list_for_email_customer($accountid,$accounttype)); |
|
404 | + $query = $this->email_model->customer_get_email_list(true, $accountid, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
405 | + $grid_fields = json_decode($this->email_form->build_list_for_email_customer($accountid, $accounttype)); |
|
406 | 406 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
407 | 407 | echo json_encode($json_data); |
408 | 408 | } |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | echo $this->db->delete("email"); |
414 | 414 | } |
415 | 415 | |
416 | - function email_send_multipal(){ |
|
416 | + function email_send_multipal() { |
|
417 | 417 | $add_array = $this->input->post(); |
418 | - if($add_array['email'] == '' || $add_array['subject'] == '' || $add_array['template'] == ''){ |
|
418 | + if ($add_array['email'] == '' || $add_array['subject'] == '' || $add_array['template'] == '') { |
|
419 | 419 | $this->session->set_flashdata('astpp_notification', 'Email address not found!'); |
420 | - redirect(base_url() . '/email/email_client_area/'); |
|
420 | + redirect(base_url().'/email/email_client_area/'); |
|
421 | 421 | } |
422 | 422 | $this->email_model->multipal_email($add_array); |
423 | 423 | $screen_path = "/var/www/html/ITPLATP/cron"; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | $command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
426 | 426 | exec($command); |
427 | 427 | $this->session->set_flashdata('astpp_errormsg', 'Email broad cast successfully!'); |
428 | - redirect(base_url() . 'email/email_history_list/'); |
|
428 | + redirect(base_url().'email/email_history_list/'); |
|
429 | 429 | |
430 | 430 | } |
431 | 431 | function email_history_list_search() { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $this->session->set_userdata('email_search_list', $action); |
440 | 440 | } |
441 | 441 | if (@$ajax_search != 1) { |
442 | - redirect(base_url() . 'email/email_history_list/'); |
|
442 | + redirect(base_url().'email/email_history_list/'); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * Version 2.1 |
453 | 453 | */ |
454 | 454 | function email_history_list_attachment($file_name) { |
455 | - if(file_exists(getcwd().'/attachments/'.$file_name)){ |
|
455 | + if (file_exists(getcwd().'/attachments/'.$file_name)) { |
|
456 | 456 | header('Content-Type: application/octet-stream'); |
457 | 457 | header('Content-Disposition: attachment; filename='.$file_name); |
458 | 458 | ob_clean(); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
25 | +if ( ! defined('BASEPATH')) |
|
26 | 26 | exit('No direct script access allowed'); |
27 | 27 | |
28 | 28 | class Email_form { |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | function get_form_fields_email() { |
34 | - $form['forms'] = array(base_url() . 'email/email_re_send/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
34 | + $form['forms'] = array(base_url().'email/email_re_send/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
35 | 35 | $form['Resend Email'] = array( |
36 | 36 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
37 | - array('To', 'INPUT', array('name' => 'to', 'size' => '20', 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
38 | - array('From', 'INPUT', array('name' => 'from', 'size' => '20', 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
39 | - array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
40 | - array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
37 | + array('To', 'INPUT', array('name' => 'to', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
38 | + array('From', 'INPUT', array('name' => 'from', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
39 | + array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
40 | + array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
41 | 41 | |
42 | 42 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'email_search_status', '', ''), |
43 | 43 | |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | function get_form_fields_email_edit() { |
52 | - $readable='disabled'; |
|
53 | - $form['forms'] = array(base_url() . 'email/email_resend/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
52 | + $readable = 'disabled'; |
|
53 | + $form['forms'] = array(base_url().'email/email_resend/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
54 | 54 | $form['Resent Email'] = array( |
55 | 55 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
56 | 56 | array('', 'HIDDEN', array('name' => 'status'), '', '', '', ''), |
57 | - array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
58 | - array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "margin-t-10 text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
59 | - array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20','cols'=>50,'rows'=>1, 'class' => "margin-t-10 text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
60 | - array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20','cols'=>50,'rows'=>15, 'class' => "margin-t-10 text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
57 | + array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
58 | + array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "margin-t-10 text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
59 | + array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20', 'cols'=>50, 'rows'=>1, 'class' => "margin-t-10 text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
60 | + array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'cols'=>50, 'rows'=>15, 'class' => "margin-t-10 text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
61 | 61 | |
62 | 62 | ); |
63 | 63 | $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\')'); |
@@ -66,48 +66,48 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | function get_form_fields_email_view() { |
69 | - $readable='disabled'; |
|
70 | - $form['forms'] = array(base_url() . 'email/email_history_list/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
69 | + $readable = 'disabled'; |
|
70 | + $form['forms'] = array(base_url().'email/email_history_list/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
71 | 71 | $form['View Email'] = array( |
72 | 72 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
73 | 73 | array('', 'HIDDEN', array('name' => 'status'), '', '', '', ''), |
74 | - array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium col-md-5"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
75 | - array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true,'style'=>'margin-top: 3px;' ,'class' => "text field medium col-md-5"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
76 | - array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
77 | - array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20','cols'=>50,'rows'=>15, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
78 | - array('Status', 'INPUT', array('name' => 'status', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'style'=>'width: 18% !important;margin-top: 3px;' , 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
74 | + array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium col-md-5"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
75 | + array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
76 | + array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
77 | + array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'cols'=>50, 'rows'=>15, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
78 | + array('Status', 'INPUT', array('name' => 'status', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'style'=>'width: 18% !important;margin-top: 3px;', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
79 | 79 | |
80 | 80 | ); |
81 | 81 | $form['button_save'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
82 | 82 | return $form; |
83 | 83 | } |
84 | 84 | function get_form_fields_email_view_cus() { |
85 | - $readable='disabled'; |
|
86 | - $form['forms'] = array(base_url() . 'email/email_history_list_customer/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
85 | + $readable = 'disabled'; |
|
86 | + $form['forms'] = array(base_url().'email/email_history_list_customer/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
87 | 87 | $form['View Email'] = array( |
88 | 88 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
89 | 89 | array('', 'HIDDEN', array('name' => 'status'), '', '', '', ''), |
90 | - array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
91 | - array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
92 | - array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
93 | - array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20','cols'=>50,'rows'=>15, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
90 | + array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
91 | + array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
92 | + array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
93 | + array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'cols'=>50, 'rows'=>15, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
94 | 94 | |
95 | - array('Status', array('name' => 'status', 'disabled' => $readable, 'style' => 'width:20% !important;','class' => "text field medium"), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'email_search_status', '', ''), |
|
95 | + array('Status', array('name' => 'status', 'disabled' => $readable, 'style' => 'width:20% !important;', 'class' => "text field medium"), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'email_search_status', '', ''), |
|
96 | 96 | |
97 | 97 | ); |
98 | 98 | $form['button_save'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
99 | 99 | return $form; |
100 | 100 | } |
101 | 101 | function get_form_fields_email_view_cus_edit() { |
102 | - $readable='disabled'; |
|
103 | - $form['forms'] = array(base_url() . 'email/email_resend_customer/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
102 | + $readable = 'disabled'; |
|
103 | + $form['forms'] = array(base_url().'email/email_resend_customer/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
104 | 104 | $form['Resent Email'] = array( |
105 | 105 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
106 | 106 | array('', 'HIDDEN', array('name' => 'status'), '', '', '', ''), |
107 | - array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
108 | - array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
109 | - array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20','cols'=>50,'rows'=>1, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
110 | - array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20','cols'=>50,'rows'=>15, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
107 | + array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
108 | + array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
109 | + array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20', 'cols'=>50, 'rows'=>1, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
110 | + array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'cols'=>50, 'rows'=>15, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
111 | 111 | ); |
112 | 112 | $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\')'); |
113 | 113 | $form['button_save'] = array('name' => 'action', 'content' => 'Sent', 'value' => 'save', 'id' => 'button', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
@@ -117,49 +117,49 @@ discard block |
||
117 | 117 | function build_list_for_email() { |
118 | 118 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
119 | 119 | $grid_field_arr = json_encode(array( |
120 | - array("Date", "100", "date", "", "", "","","true","center"), |
|
121 | - array("Account", "99", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
|
122 | - array("From", "145", "from", "", "", "","","true","center"), |
|
123 | - array("To", "140", "to", "", "", "","","true","center"), |
|
124 | - array("Subject", "180", "subject", "", "", "","","true","center"), |
|
125 | - array("Body", "320", "body", "", "", "","","true","center"), |
|
126 | - array("Attachement", "120", "attachment", "attachment", "attachment", "attachment_icons","","true","center"), |
|
127 | - array("Status", "70", "status", "status", "status", "email_status","","true","center"), |
|
120 | + array("Date", "100", "date", "", "", "", "", "true", "center"), |
|
121 | + array("Account", "99", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new", "", "true", "center"), |
|
122 | + array("From", "145", "from", "", "", "", "", "true", "center"), |
|
123 | + array("To", "140", "to", "", "", "", "", "true", "center"), |
|
124 | + array("Subject", "180", "subject", "", "", "", "", "true", "center"), |
|
125 | + array("Body", "320", "body", "", "", "", "", "true", "center"), |
|
126 | + array("Attachement", "120", "attachment", "attachment", "attachment", "attachment_icons", "", "true", "center"), |
|
127 | + array("Status", "70", "status", "status", "status", "email_status", "", "true", "center"), |
|
128 | 128 | array("Action", "100", "", "", "", array("RESEND" => array("url" => "email/email_resend_edit/", "mode" => "popup"), |
129 | - "VIEW" => array("url" => "email/email_view/", "mode" => "popup","layout"=>"medium"), |
|
129 | + "VIEW" => array("url" => "email/email_view/", "mode" => "popup", "layout"=>"medium"), |
|
130 | 130 | "DELETE" => array("url" => "/email/email_delete/", "mode" => "single"))) |
131 | 131 | )); |
132 | 132 | return $grid_field_arr; |
133 | 133 | } |
134 | 134 | |
135 | - function build_list_for_email_customer($accountid,$accounttype) { |
|
135 | + function build_list_for_email_customer($accountid, $accounttype) { |
|
136 | 136 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
137 | 137 | $grid_field_arr = json_encode(array( |
138 | - array("Date", "140", "date", "", "", "","","true","center"), |
|
139 | - array("Subject", "230", "subject", "", "", "","","true","center"), |
|
140 | - array("Body", "350", "body", "", "", "","","true","center"), |
|
141 | - array("Attachement", "120", "attachment", "attachment", "attachment", "attachment_icons","","true","center"), |
|
142 | - array("Status", "100", "status", "status", "status", "email_status","","true","center"), |
|
138 | + array("Date", "140", "date", "", "", "", "", "true", "center"), |
|
139 | + array("Subject", "230", "subject", "", "", "", "", "true", "center"), |
|
140 | + array("Body", "350", "body", "", "", "", "", "true", "center"), |
|
141 | + array("Attachement", "120", "attachment", "attachment", "attachment", "attachment_icons", "", "true", "center"), |
|
142 | + array("Status", "100", "status", "status", "status", "email_status", "", "true", "center"), |
|
143 | 143 | array("Action", "100", "", "", "", array("RESEND" => array("url" => "email/email_resend_edit_customer/", "mode" => "popup"), |
144 | - "VIEW" => array("url" => "email/email_view_customer/", "mode" => "popup","layout"=>"medium"), |
|
144 | + "VIEW" => array("url" => "email/email_view_customer/", "mode" => "popup", "layout"=>"medium"), |
|
145 | 145 | "DELETE" => array("url" => "email/email_delete_customer/".$accounttype."/".$accountid."/", "mode" => "single"))) |
146 | 146 | )); |
147 | 147 | return $grid_field_arr; |
148 | 148 | } |
149 | 149 | |
150 | - function build_list_for_email_client_area(){ |
|
150 | + function build_list_for_email_client_area() { |
|
151 | 151 | $logintype = $this->CI->session->userdata('logintype'); |
152 | 152 | if ($logintype == 1 || $logintype == 5) { |
153 | 153 | $account_data = $this->CI->session->userdata("accountinfo"); |
154 | 154 | $loginid = $account_data['id']; |
155 | 155 | |
156 | - }else{ |
|
156 | + } else { |
|
157 | 157 | $loginid = "0"; |
158 | 158 | } |
159 | - $form['forms'] = array(base_url() . 'email/email_client_area/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
159 | + $form['forms'] = array(base_url().'email/email_client_area/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
160 | 160 | $form['Filter'] = array( |
161 | - array('Rate Group', 'pricelist_id', 'SELECT', '',array("name"=>"pricelist_id","rules"=>"required"), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => $loginid)), |
|
162 | - array('Account Type',array('name' => 'posttoexternal','class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
161 | + array('Rate Group', 'pricelist_id', 'SELECT', '', array("name"=>"pricelist_id", "rules"=>"required"), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => $loginid)), |
|
162 | + array('Account Type', array('name' => 'posttoexternal', 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'), |
|
163 | 163 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'), |
164 | 164 | array('Entity Type', 'type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_entity_type_email_mass'), |
165 | 165 | ); |
@@ -174,27 +174,27 @@ discard block |
||
174 | 174 | return $form; |
175 | 175 | } |
176 | 176 | function get_form_fields_email_view_client($add_arr) { |
177 | - if($add_arr['type'] == ''){ |
|
178 | - $email_add = array('To','email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter receipent Email', 'email', 'email', 'accounts', 'build_dropdown', 'where_arr',array('status'=>$add_arr['status'],'posttoexternal'=>$add_arr['posttoexternal'],'pricelist_id'=>$add_arr['pricelist_id']), 'multi'); |
|
177 | + if ($add_arr['type'] == '') { |
|
178 | + $email_add = array('To', 'email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter receipent Email', 'email', 'email', 'accounts', 'build_dropdown', 'where_arr', array('status'=>$add_arr['status'], 'posttoexternal'=>$add_arr['posttoexternal'], 'pricelist_id'=>$add_arr['pricelist_id']), 'multi'); |
|
179 | 179 | } |
180 | - else{ |
|
181 | - $email_add = array('To','email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter receipent Email', 'email', 'email', 'accounts', 'build_dropdown', 'where_arr',array('status'=>$add_arr['status'],'posttoexternal'=>$add_arr['posttoexternal'],'pricelist_id'=>$add_arr['pricelist_id'],'type'=>$add_arr['type']), 'multi'); |
|
180 | + else { |
|
181 | + $email_add = array('To', 'email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter receipent Email', 'email', 'email', 'accounts', 'build_dropdown', 'where_arr', array('status'=>$add_arr['status'], 'posttoexternal'=>$add_arr['posttoexternal'], 'pricelist_id'=>$add_arr['pricelist_id'], 'type'=>$add_arr['type']), 'multi'); |
|
182 | 182 | } |
183 | 183 | |
184 | - $form['forms'] = array(base_url() . 'email/email_send_multipal/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
184 | + $form['forms'] = array(base_url().'email/email_send_multipal/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form')); |
|
185 | 185 | $form['Compose Email'] = array( |
186 | 186 | array('', 'HIDDEN', array('name' => 'accountid'), '', '', '', ''), |
187 | 187 | array('', 'HIDDEN', array('name' => 'temp'), '', '', '', ''), |
188 | - array('From', 'INPUT', array('name' => 'from', 'size' => '20','readonly'=>true,'value'=>'', 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''), |
|
188 | + array('From', 'INPUT', array('name' => 'from', 'size' => '20', 'readonly'=>true, 'value'=>'', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
189 | 189 | $email_add, |
190 | 190 | array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''), |
191 | 191 | array('Body', 'TEXTAREA', array('name' => 'template', 'id' => 'template', 'size' => '20', 'class' => "textarea medium"), 'trim|required', 'tOOL TIP', ''), |
192 | 192 | ); |
193 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/email/email_mass/\')'); |
|
193 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/email/email_mass/\')'); |
|
194 | 194 | $form['button_save'] = array('name' => 'action', 'content' => 'Send', 'value' => 'save', 'id' => 'submit', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
195 | 195 | return $form; |
196 | 196 | } |
197 | - function build_grid_buttons_email(){ |
|
197 | + function build_grid_buttons_email() { |
|
198 | 198 | $buttons_json = json_encode(array( |
199 | 199 | )); |
200 | 200 | return $buttons_json; |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | 'class' => "text field "), '', 'tOOL TIP', '', 'date[date-date]'), |
207 | 207 | array('To Date', 'INPUT', array('name' => 'date[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'date[date-date]'), |
208 | 208 | array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "deleted" => "0")), |
209 | - array('From', 'INPUT', array('name' => 'from[from]', '','id'=>'from', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'from[from-string]', '', '', '', 'search_string_type', ''), |
|
210 | - array('To', 'INPUT', array('name' => 'to[to]', '','id'=>'to', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'to[to-string]', '', '', '', 'search_string_type', ''), |
|
211 | - array('Subject', 'INPUT', array('name' => 'subject[subject]', '','id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''), |
|
212 | - array('Body', 'INPUT', array('name' => 'body[body]', '','id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'body[body-string]', '', '', '', 'search_string_type', ''), |
|
209 | + array('From', 'INPUT', array('name' => 'from[from]', '', 'id'=>'from', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'from[from-string]', '', '', '', 'search_string_type', ''), |
|
210 | + array('To', 'INPUT', array('name' => 'to[to]', '', 'id'=>'to', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'to[to-string]', '', '', '', 'search_string_type', ''), |
|
211 | + array('Subject', 'INPUT', array('name' => 'subject[subject]', '', 'id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''), |
|
212 | + array('Body', 'INPUT', array('name' => 'body[body]', '', 'id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'body[body-string]', '', '', '', 'search_string_type', ''), |
|
213 | 213 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
214 | 214 | array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
215 | 215 | ); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | <!--***************************************************************--> |
47 | 47 | |
48 | 48 | |
49 | - <script type="text/javascript" src="<?php echo base_url();?>assets/markup/markitup/sets/default/set.js"></script> |
|
49 | + <script type="text/javascript" src="<?php echo base_url(); ?>assets/markup/markitup/sets/default/set.js"></script> |
|
50 | 50 | <script type="text/javascript"> |
51 | 51 | $(function() { |
52 | 52 | $('#template').markItUp(mySettings); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | <div class="container"> |
237 | 237 | <form method="post" action="<?= base_url()?>email/email_client_get/" enctype="multipart/form-data" name="myform" id="myform" onsubmit="return(regvalidate())"> |
238 | 238 | <span style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;"> |
239 | - <? if(isset($error) && !empty($error)) { |
|
239 | + <? if (isset($error) && ! empty($error)) { |
|
240 | 240 | echo $error; |
241 | 241 | }?> |
242 | 242 | </span> |
@@ -26,10 +26,10 @@ |
||
26 | 26 | </div> |
27 | 27 | <?php echo $form; ?> |
28 | 28 | </div> |
29 | - <?php if(isset($maildata) && $maildata != ''){ |
|
29 | + <?php if (isset($maildata) && $maildata != '') { |
|
30 | 30 | echo "<div class='col-md-12 no-padding'>Attachments :</div>"; |
31 | - $imgArr = explode(",",$maildata); |
|
32 | - foreach($imgArr as $key => $imgname){ |
|
31 | + $imgArr = explode(",", $maildata); |
|
32 | + foreach ($imgArr as $key => $imgname) { |
|
33 | 33 | $imgpath = base_url()."email/email_history_list_attachment/".$imgname; |
34 | 34 | echo "<div class='col-md-4 no-padding'> |
35 | 35 | <a href='".$imgpath."'>".$imgname."</a> |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | $(".country_id").val(<?=$country_id?>); |
7 | 7 | $(".timezone_id").val(<?=$timezone_id?>); |
8 | 8 | $(".currency_id").val(<?=$currency_id?>); |
9 | - <?php if($entity_name != 'admin' && $entity_name !='subadmin'){ ?> |
|
9 | + <?php if ($entity_name != 'admin' && $entity_name != 'subadmin') { ?> |
|
10 | 10 | document.getElementsByName("sweep_id")[0].selectedIndex = <?=1?>; |
11 | 11 | |
12 | 12 | $(".sweep_id").change(function(e){ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | <div class="w-section inverse no-padding"> |
43 | 43 | <?php echo $form; ?> |
44 | 44 | <?php |
45 | - if(isset($validation_errors) && $validation_errors != ''){ ?> |
|
45 | + if (isset($validation_errors) && $validation_errors != '') { ?> |
|
46 | 46 | <script> |
47 | 47 | var ERR_STR = '<?php echo $validation_errors; ?>'; |
48 | 48 | print_error(ERR_STR); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <? extend('master.php') ?> |
2 | -<?php error_reporting(E_ERROR);?> |
|
2 | +<?php error_reporting(E_ERROR); ?> |
|
3 | 3 | <? startblock('extra_head') ?> |
4 | 4 | |
5 | 5 | <!-- |
@@ -38,27 +38,27 @@ discard block |
||
38 | 38 | $account_email = $account_data['email']; |
39 | 39 | $account_type = $account_data['type']; |
40 | 40 | |
41 | - if($account_type == 0){ |
|
42 | - $this->db->where('accountid',$account_id); |
|
41 | + if ($account_type == 0) { |
|
42 | + $this->db->where('accountid', $account_id); |
|
43 | 43 | } |
44 | - if($account_type == 1){ |
|
44 | + if ($account_type == 1) { |
|
45 | 45 | $this->db->where_in('reseller_id'); |
46 | 46 | $this->db->select('id'); |
47 | - $email_address=$this->db->get('accounts'); |
|
47 | + $email_address = $this->db->get('accounts'); |
|
48 | 48 | |
49 | - $email_address=$email_address->result_array(); |
|
49 | + $email_address = $email_address->result_array(); |
|
50 | 50 | |
51 | - if(empty($email_address)){ |
|
52 | - $this->db->or_where('accountid',0); |
|
53 | - }else{ |
|
54 | - $this->db->where('reseller_id',$account_id); |
|
51 | + if (empty($email_address)) { |
|
52 | + $this->db->or_where('accountid', 0); |
|
53 | + } else { |
|
54 | + $this->db->where('reseller_id', $account_id); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | $this->db_model->build_search('email_search_list'); |
58 | 58 | if ($flag) { |
59 | 59 | $query = $this->db_model->select("*", "mail_details", '', "id", "DESC", $limit, $start); |
60 | 60 | } else { |
61 | - $query = $this->db_model->countQuery("*", "mail_details",''); |
|
61 | + $query = $this->db_model->countQuery("*", "mail_details", ''); |
|
62 | 62 | } |
63 | 63 | return $query; |
64 | 64 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | $this->db->where("id", $id); |
79 | 79 | $this->db->update("mail_details", $data); |
80 | 80 | } |
81 | - function customer_get_email_list($flag,$accountid, $start = 0, $limit = 0) { |
|
81 | + function customer_get_email_list($flag, $accountid, $start = 0, $limit = 0) { |
|
82 | 82 | |
83 | - $this->db->where('accountid',$accountid); |
|
83 | + $this->db->where('accountid', $accountid); |
|
84 | 84 | if ($flag) { |
85 | 85 | $query = $this->db_model->select("*", "mail_details", '', "id", "desc", $limit, $start); |
86 | 86 | } else { |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | |
91 | 91 | return $query; |
92 | 92 | } |
93 | - function get_email_client_data($data, $start = 0, $limit = 0){ |
|
94 | - if($data['type'] == ''){ |
|
95 | - $where = array('pricelist_id'=>$data['pricelist_id'],'posttoexternal'=>$data['posttoexternal'],'status'=>$data['status'],'deleted'=>'0'); |
|
93 | + function get_email_client_data($data, $start = 0, $limit = 0) { |
|
94 | + if ($data['type'] == '') { |
|
95 | + $where = array('pricelist_id'=>$data['pricelist_id'], 'posttoexternal'=>$data['posttoexternal'], 'status'=>$data['status'], 'deleted'=>'0'); |
|
96 | 96 | } |
97 | - else{ |
|
98 | - $where = array('pricelist_id'=>$data['pricelist_id'],'posttoexternal'=>$data['posttoexternal'],'status'=>$data['status'],'type'=>$data['type'],'deleted'=>'0'); |
|
97 | + else { |
|
98 | + $where = array('pricelist_id'=>$data['pricelist_id'], 'posttoexternal'=>$data['posttoexternal'], 'status'=>$data['status'], 'type'=>$data['type'], 'deleted'=>'0'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $query = $this->db_model->getSelect("email,id", "accounts", $where); |
@@ -103,29 +103,29 @@ discard block |
||
103 | 103 | return $query; |
104 | 104 | } |
105 | 105 | /*Mass mail*/ |
106 | - function multipal_email($data){ |
|
107 | - $mail_ids=explode(',',$data['to']); |
|
108 | - foreach($mail_ids as $key=>$val) |
|
106 | + function multipal_email($data) { |
|
107 | + $mail_ids = explode(',', $data['to']); |
|
108 | + foreach ($mail_ids as $key=>$val) |
|
109 | 109 | { |
110 | - if($val!='') |
|
110 | + if ($val != '') |
|
111 | 111 | { |
112 | - $template_type['message']=$data['template']; |
|
113 | - $template_type['subject']=$data['subject']; |
|
114 | - $act_details = $this->db_model->getSelect("*", "accounts", array('email'=>$val,"deleted"=>0)); |
|
115 | - $count=$act_details->num_rows(); |
|
116 | - $account_info=array(); |
|
117 | - if($count<=0) |
|
112 | + $template_type['message'] = $data['template']; |
|
113 | + $template_type['subject'] = $data['subject']; |
|
114 | + $act_details = $this->db_model->getSelect("*", "accounts", array('email'=>$val, "deleted"=>0)); |
|
115 | + $count = $act_details->num_rows(); |
|
116 | + $account_info = array(); |
|
117 | + if ($count <= 0) |
|
118 | 118 | { |
119 | - $account_info['email']=$val; |
|
120 | - $account_info['accountid']='0'; |
|
119 | + $account_info['email'] = $val; |
|
120 | + $account_info['accountid'] = '0'; |
|
121 | 121 | } |
122 | - else{ |
|
122 | + else { |
|
123 | 123 | $res_data = $act_details->result_array(); |
124 | - $account_info=$res_data[0]; |
|
125 | - $account_info['accountid']=$account_info['id']; |
|
124 | + $account_info = $res_data[0]; |
|
125 | + $account_info['accountid'] = $account_info['id']; |
|
126 | 126 | } |
127 | 127 | $account_info['password'] = $this->common->decode($account_info['password']); |
128 | - $this->email_lib->send_email($template_type,$account_info,'',$data['file'],0,1); |
|
128 | + $this->email_lib->send_email($template_type, $account_info, '', $data['file'], 0, 1); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | return true; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->fpdf->initialize('P', 'mm', 'A4'); |
40 | 40 | |
41 | 41 | if ($this->session->userdata('user_login') == FALSE) |
42 | - redirect(base_url() . '/astpp/login'); |
|
42 | + redirect(base_url().'/astpp/login'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | function customerReport() { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | function customerReport_json() { |
61 | 61 | $count_res = $this->reports_model->getcustomer_cdrs(false, "", ""); |
62 | - $count_all = (array) $count_res->first_row(); |
|
62 | + $count_all = (array)$count_res->first_row(); |
|
63 | 63 | $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
64 | 64 | $json_data = $paging_data["json_paging"]; |
65 | 65 | $query = $this->reports_model->getcustomer_cdrs(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | $trunk_arr = array(); |
70 | 70 | // Get search information from session. |
71 | 71 | $search_arr = $this->session->userdata('customer_cdr_list_search'); |
72 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
72 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
73 | 73 | $query = $query->result_array(); |
74 | 74 | |
75 | - $where = "id IN (" . $count_all['pricelist_ids'] . ")"; |
|
75 | + $where = "id IN (".$count_all['pricelist_ids'].")"; |
|
76 | 76 | $this->db->where($where); |
77 | 77 | $this->db->select('id,name'); |
78 | 78 | $pricelist_res = $this->db->get('pricelists'); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | foreach ($pricelist_res as $value) { |
81 | 81 | $pricelist_arr[$value['id']] = $value['name']; |
82 | 82 | } |
83 | - $where = "id IN (" . $count_all['trunk_ids'] . ")"; |
|
83 | + $where = "id IN (".$count_all['trunk_ids'].")"; |
|
84 | 84 | $this->db->where($where); |
85 | 85 | $this->db->select('id,name'); |
86 | 86 | $trunk_res = $this->db->get('trunks'); |
@@ -88,22 +88,22 @@ discard block |
||
88 | 88 | foreach ($trunk_res as $value) { |
89 | 89 | $trunk_arr[$value['id']] = $value['name']; |
90 | 90 | } |
91 | - $where = "id IN (" . $count_all['accounts_ids'] . ")"; |
|
91 | + $where = "id IN (".$count_all['accounts_ids'].")"; |
|
92 | 92 | $this->db->where($where); |
93 | 93 | $this->db->select('id,number,first_name,last_name'); |
94 | 94 | $account_res = $this->db->get('accounts'); |
95 | 95 | foreach ($account_res->result_array() as $value) { |
96 | - $account_arr[$value['id']] =$value['first_name'] . " " . $value['last_name'] . ' (' . $value['number'] . ')'; |
|
96 | + $account_arr[$value['id']] = $value['first_name']." ".$value['last_name'].' ('.$value['number'].')'; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | //Get Decimal points,system currency and user currency. |
100 | 100 | $currency_info = $this->common->get_currency_info(); |
101 | 101 | foreach ($query as $value) { |
102 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
103 | - sprintf('%02d',$value['billseconds'] / 60) . ":" . sprintf('%02d', $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
104 | - $account=isset($account_arr[$value['accountid']]) ? $account_arr[$value['accountid']] : 'Anonymous'; |
|
102 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ? |
|
103 | + sprintf('%02d', $value['billseconds'] / 60).":".sprintf('%02d', $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
104 | + $account = isset($account_arr[$value['accountid']]) ? $account_arr[$value['accountid']] : 'Anonymous'; |
|
105 | 105 | $uid = $value['uniqueid']; |
106 | - $recording = ($value['is_recording'] == 0) ? '<a title="Recording file" href="../customerReport_recording_download/demo.wav"><img src="' . base_url() . 'assets/images/play_file.png" height="20px" width="20px"/></a>' : '<img src="' . base_url() . 'assets/images/false.png" height="20px" alt="file not found" width="20px"/>'; |
|
106 | + $recording = ($value['is_recording'] == 0) ? '<a title="Recording file" href="../customerReport_recording_download/demo.wav"><img src="'.base_url().'assets/images/play_file.png" height="20px" width="20px"/></a>' : '<img src="'.base_url().'assets/images/false.png" height="20px" alt="file not found" width="20px"/>'; |
|
107 | 107 | $json_data['rows'][] = array('cell' => array( |
108 | 108 | $this->common->convert_GMT_to('', '', $value['callstart']), |
109 | 109 | $value['callerid'], |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
112 | 112 | $value['notes'], |
113 | 113 | $duration, |
114 | - $this->common->calculate_currency_manually($currency_info, $value['debit'],false), |
|
115 | - $this->common->calculate_currency_manually($currency_info, $value['cost'],false), |
|
114 | + $this->common->calculate_currency_manually($currency_info, $value['debit'], false), |
|
115 | + $this->common->calculate_currency_manually($currency_info, $value['cost'], false), |
|
116 | 116 | $value['disposition'], |
117 | 117 | $account, |
118 | 118 | isset($trunk_arr[$value['trunk_id']]) ? $trunk_arr[$value['trunk_id']] : '', |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $recording, |
122 | 122 | )); |
123 | 123 | } |
124 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
125 | - floor($count_all['billseconds'] / 60) . ":" . sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
124 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
125 | + floor($count_all['billseconds'] / 60).":".sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
126 | 126 | $json_data['rows'][] = array("cell" => array( |
127 | 127 | "<b>Grand Total</b>", |
128 | 128 | "", |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | "", |
132 | 132 | "<b>$duration</b>", |
133 | 133 | //$count_all['total_debit'], |
134 | - "<b>".$this->common->calculate_currency_manually($currency_info, $count_all['total_debit'],false)."</b>", |
|
135 | - "<b>".$this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false)."</b>", |
|
134 | + "<b>".$this->common->calculate_currency_manually($currency_info, $count_all['total_debit'], false)."</b>", |
|
135 | + "<b>".$this->common->calculate_currency_manually($currency_info, $count_all['total_cost'], false)."</b>", |
|
136 | 136 | "", |
137 | 137 | "", |
138 | 138 | "", |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | * **** */ |
153 | 153 | |
154 | 154 | function customerReport_recording_download($file_name) { |
155 | - $file_name = getcwd() . "/recording/" . $file_name; |
|
155 | + $file_name = getcwd()."/recording/".$file_name; |
|
156 | 156 | header('Content-Description: File Transfer'); |
157 | 157 | header('Content-Type: application/octet-stream'); |
158 | - header('Content-Disposition: attachment; filename=' . basename($file_name)); |
|
158 | + header('Content-Disposition: attachment; filename='.basename($file_name)); |
|
159 | 159 | header('Content-Transfer-Encoding: binary'); |
160 | 160 | header('Expires: 0'); |
161 | 161 | header('Cache-Control: must-revalidate'); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $this->session->set_userdata('customer_cdr_list_search', $action); |
177 | 177 | } |
178 | 178 | if (@$ajax_search != 1) { |
179 | - redirect(base_url() . 'reports/customerReport/'); |
|
179 | + redirect(base_url().'reports/customerReport/'); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -191,23 +191,23 @@ discard block |
||
191 | 191 | * */ |
192 | 192 | function customerReport_export() { |
193 | 193 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
194 | - $currency_id=$account_info['currency_id']; |
|
195 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
194 | + $currency_id = $account_info['currency_id']; |
|
195 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
196 | 196 | $count_res = $this->reports_model->getcustomer_cdrs(false, "", ""); |
197 | - $count_all = (array) $count_res->first_row(); |
|
197 | + $count_all = (array)$count_res->first_row(); |
|
198 | 198 | ob_clean(); |
199 | 199 | if ($count_all['count'] > 0) { |
200 | 200 | //Initialization of Rategroup and Trunk Array |
201 | 201 | $pricelist_arr = array(); |
202 | 202 | $trunk_arr = array(); |
203 | - $account_arr=array(); |
|
203 | + $account_arr = array(); |
|
204 | 204 | $query = $this->reports_model->getcustomer_cdrs(true, '', '', true); |
205 | 205 | //Get Decimal points,system currency and user currency. |
206 | 206 | $currency_info = $this->common->get_currency_info(); |
207 | 207 | //Get search information from session. |
208 | 208 | $search_arr = $this->session->userdata('customer_cdr_list_search'); |
209 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
210 | - $where = "id IN (" . $count_all['pricelist_ids'] . ")"; |
|
209 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
210 | + $where = "id IN (".$count_all['pricelist_ids'].")"; |
|
211 | 211 | $this->db->where($where); |
212 | 212 | $this->db->select('id,name'); |
213 | 213 | $pricelist_res = $this->db->get('pricelists'); |
@@ -215,17 +215,17 @@ discard block |
||
215 | 215 | foreach ($pricelist_res as $value) { |
216 | 216 | $pricelist_arr[$value['id']] = $value['name']; |
217 | 217 | } |
218 | - $where = "id IN (" . $count_all['accounts_ids'] . ")"; |
|
218 | + $where = "id IN (".$count_all['accounts_ids'].")"; |
|
219 | 219 | $this->db->where($where); |
220 | 220 | $this->db->select('id,number,first_name,last_name'); |
221 | 221 | $account_res = $this->db->get('accounts'); |
222 | 222 | foreach ($account_res->result_array() as $value) { |
223 | - $account_arr[$value['id']] =$value['first_name'] . " " . $value['last_name'] . ' (' . $value['number'] . ')'; |
|
223 | + $account_arr[$value['id']] = $value['first_name']." ".$value['last_name'].' ('.$value['number'].')'; |
|
224 | 224 | } |
225 | 225 | |
226 | - if($accountinfo['type'] !=1){ |
|
226 | + if ($accountinfo['type'] != 1) { |
|
227 | 227 | $customer_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Cost($currency)", "Disposition", "Account", "Trunk", "Rate Group", "Call Type"); |
228 | - $where = "id IN (" . $count_all['trunk_ids'] . ")"; |
|
228 | + $where = "id IN (".$count_all['trunk_ids'].")"; |
|
229 | 229 | $this->db->where($where); |
230 | 230 | $this->db->select('id,name'); |
231 | 231 | $trunk_res = $this->db->get('trunks'); |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | $trunk_arr[$value['id']] = $value['name']; |
235 | 235 | } |
236 | 236 | foreach ($query->result_array() as $value) { |
237 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
238 | - floor($value['billseconds'] / 60) . ":" . sprintf('%02d', $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
239 | - $account=isset($account_arr[$value['accountid']]) ? $account_arr[$value['accountid']] : 'Anonymous'; |
|
237 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ? |
|
238 | + floor($value['billseconds'] / 60).":".sprintf('%02d', $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
239 | + $account = isset($account_arr[$value['accountid']]) ? $account_arr[$value['accountid']] : 'Anonymous'; |
|
240 | 240 | $customer_array[] = array( |
241 | 241 | $this->common->convert_GMT_to('', '', $value['callstart']), |
242 | 242 | $value['callerid'], |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
245 | 245 | $value['notes'], |
246 | 246 | $duration, |
247 | - $this->common->calculate_currency_manually($currency_info, $value['debit'],false,false), |
|
248 | - $this->common->calculate_currency_manually($currency_info, $value['cost'],false,false), |
|
247 | + $this->common->calculate_currency_manually($currency_info, $value['debit'], false, false), |
|
248 | + $this->common->calculate_currency_manually($currency_info, $value['cost'], false, false), |
|
249 | 249 | $value['disposition'], |
250 | 250 | $account, |
251 | 251 | isset($trunk_arr[$value['trunk_id']]) ? $trunk_arr[$value['trunk_id']] : '', |
@@ -253,16 +253,16 @@ discard block |
||
253 | 253 | $value['calltype'], |
254 | 254 | ); |
255 | 255 | } |
256 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
257 | - floor($count_all['billseconds'] / 60) . ":" . sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
256 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
257 | + floor($count_all['billseconds'] / 60).":".sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
258 | 258 | $customer_array[] = array("Grand Total", |
259 | 259 | "", |
260 | 260 | "", |
261 | 261 | "", |
262 | 262 | "", |
263 | 263 | $duration, |
264 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_debit'],false,false), |
|
265 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,false), |
|
264 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_debit'], false, false), |
|
265 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'], false, false), |
|
266 | 266 | "", |
267 | 267 | "", |
268 | 268 | "", |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | "", |
273 | 273 | "", |
274 | 274 | ); |
275 | - }else{ |
|
276 | - $customer_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Cost($currency)", "Disposition", "Account","Rate Group", "Call Type"); |
|
275 | + } else { |
|
276 | + $customer_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Cost($currency)", "Disposition", "Account", "Rate Group", "Call Type"); |
|
277 | 277 | foreach ($query->result_array() as $value) { |
278 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
279 | - floor($value['billseconds'] / 60) . ":" . sprintf('%02d', $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
280 | - $account=isset($account_arr[$value['accountid']]) ? $account_arr[$value['accountid']] : 'Anonymous'; |
|
278 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ? |
|
279 | + floor($value['billseconds'] / 60).":".sprintf('%02d', $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
280 | + $account = isset($account_arr[$value['accountid']]) ? $account_arr[$value['accountid']] : 'Anonymous'; |
|
281 | 281 | $customer_array[] = array( |
282 | 282 | $this->common->convert_GMT_to('', '', $value['callstart']), |
283 | 283 | $value['callerid'], |
@@ -285,24 +285,24 @@ discard block |
||
285 | 285 | filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
286 | 286 | $value['notes'], |
287 | 287 | $duration, |
288 | - $this->common->calculate_currency_manually($currency_info, $value['debit'],false,false), |
|
289 | - $this->common->calculate_currency_manually($currency_info, $value['cost'],false,false), |
|
288 | + $this->common->calculate_currency_manually($currency_info, $value['debit'], false, false), |
|
289 | + $this->common->calculate_currency_manually($currency_info, $value['cost'], false, false), |
|
290 | 290 | $value['disposition'], |
291 | 291 | $account, |
292 | 292 | isset($pricelist_arr[$value['pricelist_id']]) ? $pricelist_arr[$value['pricelist_id']] : '', |
293 | 293 | $value['calltype'], |
294 | 294 | ); |
295 | 295 | } |
296 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
297 | - floor($count_all['billseconds'] / 60) . ":" . sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
296 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
297 | + floor($count_all['billseconds'] / 60).":".sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
298 | 298 | $customer_array[] = array("Grand Total", |
299 | 299 | "", |
300 | 300 | "", |
301 | 301 | "", |
302 | 302 | "", |
303 | 303 | $duration, |
304 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_debit'],false,false), |
|
305 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,false), |
|
304 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_debit'], false, false), |
|
305 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'], false, false), |
|
306 | 306 | "", |
307 | 307 | "", |
308 | 308 | "", |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | } |
315 | 315 | } |
316 | 316 | $this->load->helper('csv'); |
317 | - if(isset($customer_array)){ |
|
318 | - array_to_csv($customer_array, 'Customer_CDR_' . date("Y-m-d") . '.csv'); |
|
319 | - }else{ |
|
320 | - $customer_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Cost($currency)", "Disposition", "Account","Rate Group", "Call Type"); |
|
321 | - array_to_csv($customer_array, 'Customer_CDR_' . date("Y-m-d") . '.csv'); |
|
317 | + if (isset($customer_array)) { |
|
318 | + array_to_csv($customer_array, 'Customer_CDR_'.date("Y-m-d").'.csv'); |
|
319 | + } else { |
|
320 | + $customer_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Cost($currency)", "Disposition", "Account", "Rate Group", "Call Type"); |
|
321 | + array_to_csv($customer_array, 'Customer_CDR_'.date("Y-m-d").'.csv'); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | //Get Total Count,Total debit,Total cost information |
344 | 344 | $count_res = $this->reports_model->getreseller_cdrs(false, "", ""); |
345 | - $count_all = (array) $count_res->first_row(); |
|
345 | + $count_all = (array)$count_res->first_row(); |
|
346 | 346 | $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
347 | 347 | $json_data = $paging_data["json_paging"]; |
348 | 348 | $query = $this->reports_model->getreseller_cdrs(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
351 | 351 | if ($count_all['count'] > 0) { |
352 | 352 | $search_arr = $this->session->userdata('reseller_cdr_list_search'); |
353 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
354 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
355 | - sprintf('%02d', $count_all['billseconds'] / 60) . ":" . sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : sprintf('%02d', $count_all['billseconds'] ); |
|
353 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
354 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
355 | + sprintf('%02d', $count_all['billseconds'] / 60).":".sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : sprintf('%02d', $count_all['billseconds']); |
|
356 | 356 | $json_data['rows'][] = array("cell" => array( |
357 | 357 | "<b>Grand Total</b>", |
358 | 358 | "", |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | "", |
361 | 361 | "", |
362 | 362 | "<b>$duration</b>", |
363 | - "<b>".$this->common_model->calculate_currency($count_all['total_debit'],'','',true,false)."</b>", |
|
364 | - "<b>".$this->common_model->calculate_currency($count_all['total_cost'],'','',true,false)."</b>", |
|
363 | + "<b>".$this->common_model->calculate_currency($count_all['total_debit'], '', '', true, false)."</b>", |
|
364 | + "<b>".$this->common_model->calculate_currency($count_all['total_cost'], '', '', true, false)."</b>", |
|
365 | 365 | "", |
366 | 366 | "", |
367 | 367 | "", |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $this->session->set_userdata('reseller_cdr_list_search', $action); |
386 | 386 | } |
387 | 387 | if (@$ajax_search != 1) { |
388 | - redirect(base_url() . 'reports/resellerReport/'); |
|
388 | + redirect(base_url().'reports/resellerReport/'); |
|
389 | 389 | } |
390 | 390 | } |
391 | 391 | |
@@ -397,10 +397,10 @@ discard block |
||
397 | 397 | function resellerReport_export() { |
398 | 398 | //Get All count related information. |
399 | 399 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
400 | - $currency_id=$account_info['currency_id']; |
|
401 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
400 | + $currency_id = $account_info['currency_id']; |
|
401 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
402 | 402 | $count_res = $this->reports_model->getreseller_cdrs(false, "", ""); |
403 | - $count_all = (array) $count_res->first_row(); |
|
403 | + $count_all = (array)$count_res->first_row(); |
|
404 | 404 | ob_clean(); |
405 | 405 | $reseller_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Cost($currency)", "Disposition", "Account", "Rate Group", "Call Type"); |
406 | 406 | if ($count_all['count'] > 0) { |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | $currency_info = $this->common->get_currency_info(); |
412 | 412 | // Get search information from session. |
413 | 413 | $search_arr = $this->session->userdata('reseller_cdr_list_search'); |
414 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
415 | - $where = "id IN (" . $count_all['pricelist_ids'] . ")"; |
|
414 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
415 | + $where = "id IN (".$count_all['pricelist_ids'].")"; |
|
416 | 416 | $this->db->where($where); |
417 | 417 | $this->db->select('id,name'); |
418 | 418 | $pricelist_res = $this->db->get('pricelists'); |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | $pricelist_arr[$value['id']] = $value['name']; |
422 | 422 | } |
423 | 423 | foreach ($query->result_array() as $value) { |
424 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
425 | - sprintf('%02d',$value['billseconds'] / 60) . ":" . sprintf('%02d', $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
424 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ? |
|
425 | + sprintf('%02d', $value['billseconds'] / 60).":".sprintf('%02d', $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
426 | 426 | $reseller_array[] = array( |
427 | 427 | $this->common->convert_GMT_to('', '', $value['callstart']), |
428 | 428 | $value['callerid'], |
@@ -430,24 +430,24 @@ discard block |
||
430 | 430 | filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
431 | 431 | $value['notes'], |
432 | 432 | $duration, |
433 | - $this->common->calculate_currency_manually($currency_info, $value['debit'],false,false), |
|
434 | - $this->common->calculate_currency_manually($currency_info, $value['cost'],false,false), |
|
433 | + $this->common->calculate_currency_manually($currency_info, $value['debit'], false, false), |
|
434 | + $this->common->calculate_currency_manually($currency_info, $value['cost'], false, false), |
|
435 | 435 | $value['disposition'], |
436 | 436 | $this->common->build_concat_string("first_name,last_name,number", "accounts", $value['accountid']), |
437 | 437 | isset($pricelist_arr[$value['pricelist_id']]) ? $pricelist_arr[$value['pricelist_id']] : '', |
438 | 438 | $value['calltype'], |
439 | 439 | ); |
440 | 440 | } |
441 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
442 | - floor($count_all['billseconds'] / 60) . ":" . sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
441 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
442 | + floor($count_all['billseconds'] / 60).":".sprintf('%02d', $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
443 | 443 | $reseller_array[] = array("Grand Total", |
444 | 444 | "", |
445 | 445 | "", |
446 | 446 | "", |
447 | 447 | "", |
448 | 448 | $duration, |
449 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_debit'],false,false), |
|
450 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,false), |
|
449 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_debit'], false, false), |
|
450 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'], false, false), |
|
451 | 451 | "", |
452 | 452 | "", |
453 | 453 | "", |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | ); |
460 | 460 | } |
461 | 461 | $this->load->helper('csv'); |
462 | - array_to_csv($reseller_array, 'Reseller_CDR_' . date("Y-m-d") . '.csv'); |
|
462 | + array_to_csv($reseller_array, 'Reseller_CDR_'.date("Y-m-d").'.csv'); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | function providerReport() { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | function providerReport_json() { |
476 | 476 | //Get All count related information. |
477 | 477 | $count_res = $this->reports_model->getprovider_cdrs(false, "", ""); |
478 | - $count_all = (array) $count_res->first_row(); |
|
478 | + $count_all = (array)$count_res->first_row(); |
|
479 | 479 | $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
480 | 480 | $json_data = $paging_data["json_paging"]; |
481 | 481 | |
@@ -484,9 +484,9 @@ discard block |
||
484 | 484 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
485 | 485 | if ($count_all['count'] > 0) { |
486 | 486 | $search_arr = $this->session->userdata('provider_cdr_list_search'); |
487 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
488 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
489 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
487 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
488 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
489 | + floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
490 | 490 | $json_data['rows'][] = array("cell" => array( |
491 | 491 | "<b>Grand Total</b>", |
492 | 492 | "", |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | "", |
495 | 495 | "", |
496 | 496 | "<b>$duration</b>", |
497 | - "<b>".$this->common_model->calculate_currency($count_all['total_cost'],'','',true,false)."</b>", |
|
497 | + "<b>".$this->common_model->calculate_currency($count_all['total_cost'], '', '', true, false)."</b>", |
|
498 | 498 | "", |
499 | 499 | "", |
500 | 500 | )); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $this->session->set_userdata('provider_cdr_list_search', $action); |
513 | 513 | } |
514 | 514 | if (@$ajax_search != 1) { |
515 | - redirect(base_url() . 'reports/providerReport/'); |
|
515 | + redirect(base_url().'reports/providerReport/'); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
@@ -526,10 +526,10 @@ discard block |
||
526 | 526 | Get All count information as well All total information |
527 | 527 | */ |
528 | 528 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
529 | - $currency_id=$account_info['currency_id']; |
|
530 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
529 | + $currency_id = $account_info['currency_id']; |
|
530 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
531 | 531 | $count_res = $this->reports_model->getprovider_cdrs(false, "", ""); |
532 | - $count_all = (array) $count_res->first_row(); |
|
532 | + $count_all = (array)$count_res->first_row(); |
|
533 | 533 | ob_clean(); |
534 | 534 | $provider_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Cost($currency)", "Disposition", "Account"); |
535 | 535 | if ($count_all['count'] > 0) { |
@@ -538,15 +538,15 @@ discard block |
||
538 | 538 | $currency_info = $this->common->get_currency_info(); |
539 | 539 | // Get search information from session. |
540 | 540 | $search_arr = $this->session->userdata('provider_cdr_list_search'); |
541 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
541 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
542 | 542 | foreach ($query->result_array() as $value) { |
543 | 543 | // echo"<pre>";print_r($value);exit; |
544 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
545 | - floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
544 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ? |
|
545 | + floor($value['billseconds'] / 60).":".sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
546 | 546 | $account_arr = $this->db_model->getSelect('*', 'accounts', array('id' => $value['provider_id'])); |
547 | 547 | if ($account_arr->num_rows() > 0) { |
548 | 548 | $account_array = $account_arr->result_array(); |
549 | - $account = $account_array[0]['first_name'] . " " . $account_array[0]['last_name'] . ' (' . $account_array[0]['number'] . ')'; |
|
549 | + $account = $account_array[0]['first_name']." ".$account_array[0]['last_name'].' ('.$account_array[0]['number'].')'; |
|
550 | 550 | } else { |
551 | 551 | $account = "Anonymous"; |
552 | 552 | } |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
558 | 558 | $value['notes'], |
559 | 559 | $duration, |
560 | - $this->common->calculate_currency_manually($currency_info, $value['cost'],false,false), |
|
560 | + $this->common->calculate_currency_manually($currency_info, $value['cost'], false, false), |
|
561 | 561 | $value['disposition'], |
562 | 562 | $account, |
563 | 563 | ); |
564 | 564 | } |
565 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
566 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
565 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
566 | + floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
567 | 567 | $provider_array[] = array("Grand Total", |
568 | 568 | "", |
569 | 569 | "", |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | "", |
572 | 572 | $duration, |
573 | 573 | //$this->common->calculate_currency_manually($currency_info, $count_all['total_debit']), |
574 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,false), |
|
574 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'], false, false), |
|
575 | 575 | "", |
576 | 576 | "", |
577 | 577 | "", |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | } |
585 | 585 | //echo "<pre>";print_r($provider_array);exit; |
586 | 586 | $this->load->helper('csv'); |
587 | - array_to_csv($provider_array, 'Provider_CDR_' . date("Y-m-d") . '.csv'); |
|
587 | + array_to_csv($provider_array, 'Provider_CDR_'.date("Y-m-d").'.csv'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $this->session->set_userdata('cdr_refill_search', $action); |
617 | 617 | } |
618 | 618 | if (@$ajax_search != 1) { |
619 | - redirect(base_url() . 'user/user_cdrs_report/'); |
|
619 | + redirect(base_url().'user/user_cdrs_report/'); |
|
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | /* * ************************** */ |
629 | 629 | |
630 | 630 | function customer_cdrreport($accountid, $accounttype) { |
631 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_cdrs'); |
|
631 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_cdrs'); |
|
632 | 632 | $instant_search_currency = $this->common_model->add_calculate_currency($instant_search, "", '', true, false); |
633 | - $like_str=!empty($instant_search) ? "(callstart like '%$instant_search%' |
|
633 | + $like_str = ! empty($instant_search) ? "(callstart like '%$instant_search%' |
|
634 | 634 | OR callerid like '%$instant_search%' |
635 | 635 | OR callednum like '%$instant_search%' |
636 | 636 | OR notes like '%$instant_search%' |
@@ -642,12 +642,12 @@ discard block |
||
642 | 642 | :null; |
643 | 643 | |
644 | 644 | $json_data = array(); |
645 | - if(!empty($like_str)) |
|
645 | + if ( ! empty($like_str)) |
|
646 | 646 | $this->db->where($like_str); |
647 | 647 | $count_all = $this->reports_model->users_cdrs_list(false, $accountid, $accounttype, "", ""); |
648 | 648 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
649 | 649 | $json_data = $paging_data["json_paging"]; |
650 | - if(!empty($like_str)) |
|
650 | + if ( ! empty($like_str)) |
|
651 | 651 | $this->db->where($like_str); |
652 | 652 | $query = $this->reports_model->users_cdrs_list(true, $accountid, $accounttype, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
653 | 653 | $grid_fields = json_decode($this->reports_form->build_report_list_for_user($accounttype)); |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | $data['page_title'] = 'Refill Report'; |
665 | 665 | $data['search_flag'] = true; |
666 | 666 | $this->session->set_userdata('advance_search', 0); |
667 | - $data['grid_buttons']=$this->reports_form->build_refillreport_buttons(); |
|
667 | + $data['grid_buttons'] = $this->reports_form->build_refillreport_buttons(); |
|
668 | 668 | $data['grid_fields'] = $this->reports_form->build_refill_report_for_admin(); |
669 | 669 | $data['form_search'] = $this->form->build_serach_form($this->reports_form->build_search_refill_report_for_admin()); |
670 | 670 | $this->load->view('view_refill_report', $data); |
@@ -683,22 +683,22 @@ discard block |
||
683 | 683 | |
684 | 684 | function refillreport_export() { |
685 | 685 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
686 | - $currency_id=$account_info['currency_id']; |
|
687 | - $reseller_id=$accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : 0; |
|
688 | - $account_arr=array(); |
|
686 | + $currency_id = $account_info['currency_id']; |
|
687 | + $reseller_id = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : 0; |
|
688 | + $account_arr = array(); |
|
689 | 689 | $currency_info = $this->common->get_currency_info(); |
690 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
690 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
691 | 691 | ob_clean(); |
692 | 692 | $customer_array[] = array("Date", "Account", "Amount($currency)", "Refill By", "Note"); |
693 | - $query = $this->reports_model->get_refill_list(true,"","",true); |
|
694 | - $this->db->select("concat(first_name,' ',last_name,' ','(',number,')') as first_name,id",false); |
|
695 | - $this->db->where('reseller_id',$reseller_id); |
|
696 | - $this->db->where_not_in('type',array("-1,2,4")); |
|
697 | - $account_res=$this->db->get('accounts'); |
|
698 | - if($account_res->num_rows() > 0){ |
|
699 | - $account_res=$account_res->result_array(); |
|
700 | - foreach($account_res as $key=>$value){ |
|
701 | - $account_arr[$value['id']]=$value['first_name']; |
|
693 | + $query = $this->reports_model->get_refill_list(true, "", "", true); |
|
694 | + $this->db->select("concat(first_name,' ',last_name,' ','(',number,')') as first_name,id", false); |
|
695 | + $this->db->where('reseller_id', $reseller_id); |
|
696 | + $this->db->where_not_in('type', array("-1,2,4")); |
|
697 | + $account_res = $this->db->get('accounts'); |
|
698 | + if ($account_res->num_rows() > 0) { |
|
699 | + $account_res = $account_res->result_array(); |
|
700 | + foreach ($account_res as $key=>$value) { |
|
701 | + $account_arr[$value['id']] = $value['first_name']; |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | if ($query->num_rows() > 0) { |
@@ -706,14 +706,14 @@ discard block |
||
706 | 706 | $customer_array[] = array( |
707 | 707 | $row['payment_date'], |
708 | 708 | isset($account_arr[$row['accountid']]) ? $account_arr[$row['accountid']] : 'Anonymous', |
709 | - number_format((float) (($row['credit'] * $currency_info['user_currency']['currencyrate']) / $currency_info['base_currency']['currencyrate']), $currency_info['decimalpoints'],".",""), |
|
710 | - $this->common->get_refill_by("","",$row['payment_by']), |
|
709 | + number_format((float)(($row['credit'] * $currency_info['user_currency']['currencyrate']) / $currency_info['base_currency']['currencyrate']), $currency_info['decimalpoints'], ".", ""), |
|
710 | + $this->common->get_refill_by("", "", $row['payment_by']), |
|
711 | 711 | $row['notes'] |
712 | 712 | ); |
713 | 713 | } |
714 | 714 | } |
715 | 715 | $this->load->helper('csv'); |
716 | - array_to_csv($customer_array, 'Refill_Report_' . date("Y-m-d") . '.csv'); |
|
716 | + array_to_csv($customer_array, 'Refill_Report_'.date("Y-m-d").'.csv'); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | function customer_refillreport_search() { |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | $this->session->set_userdata('cdr_refill_search', $action); |
727 | 727 | } |
728 | 728 | if (@$ajax_search != 1) { |
729 | - redirect(base_url() . 'user/user_cdrs_report/'); |
|
729 | + redirect(base_url().'user/user_cdrs_report/'); |
|
730 | 730 | } |
731 | 731 | } |
732 | 732 | |
@@ -755,43 +755,43 @@ discard block |
||
755 | 755 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
756 | 756 | $json_data = $paging_data["json_paging"]; |
757 | 757 | $query = $this->reports_model->getcharges_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
758 | - $result= $query->result_array(); |
|
759 | - $query1 = $this->reports_model->getcharges_list(true,'',''); |
|
760 | - $res= $query1->result_array(); |
|
761 | - $debit=0; |
|
762 | - $credit=0; |
|
763 | - $before_balance=0; |
|
764 | - $after_balance=0; |
|
765 | - $i=0; |
|
758 | + $result = $query->result_array(); |
|
759 | + $query1 = $this->reports_model->getcharges_list(true, '', ''); |
|
760 | + $res = $query1->result_array(); |
|
761 | + $debit = 0; |
|
762 | + $credit = 0; |
|
763 | + $before_balance = 0; |
|
764 | + $after_balance = 0; |
|
765 | + $i = 0; |
|
766 | 766 | foreach ($result as $key => $value) { |
767 | - $date=$this->common->convert_GMT_to('','',$value['created_date']); |
|
767 | + $date = $this->common->convert_GMT_to('', '', $value['created_date']); |
|
768 | 768 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
769 | - $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$value['invoiceid'])); |
|
770 | - $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$value['invoiceid'])); |
|
771 | - $invoice_num=$invoice_prefix.$invoiceid; |
|
772 | - $account=$this->common->get_field_name_coma_new('first_name,last_name,number','accounts',$value['accountid']); |
|
773 | - $reseller=$this->common->reseller_select_value('first_name,last_name,number','accounts',$value['reseller_id']); |
|
774 | - $item_type=$value['item_type']; |
|
775 | - if($value['before_balance'] == '-'){ |
|
776 | - $before_balance='-'; |
|
777 | - }else{ |
|
778 | - $before_balance=$this->common->convert_to_currency('','',$value['before_balance']); |
|
769 | + $invoice_prefix = $entity_type = $this->common->get_field_name('invoice_prefix', 'invoices', array('id'=>$value['invoiceid'])); |
|
770 | + $invoiceid = $entity_type = $this->common->get_field_name('invoiceid', 'invoices', array('id'=>$value['invoiceid'])); |
|
771 | + $invoice_num = $invoice_prefix.$invoiceid; |
|
772 | + $account = $this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', $value['accountid']); |
|
773 | + $reseller = $this->common->reseller_select_value('first_name,last_name,number', 'accounts', $value['reseller_id']); |
|
774 | + $item_type = $value['item_type']; |
|
775 | + if ($value['before_balance'] == '-') { |
|
776 | + $before_balance = '-'; |
|
777 | + } else { |
|
778 | + $before_balance = $this->common->convert_to_currency('', '', $value['before_balance']); |
|
779 | 779 | } |
780 | - if($value['debit'] == '-'){ |
|
781 | - $debit='-'; |
|
782 | - }else{ |
|
783 | - $debit=$this->common->convert_to_currency('','',$value['debit']); |
|
780 | + if ($value['debit'] == '-') { |
|
781 | + $debit = '-'; |
|
782 | + } else { |
|
783 | + $debit = $this->common->convert_to_currency('', '', $value['debit']); |
|
784 | 784 | } |
785 | - $credit=$this->common->convert_to_currency('','',$value['credit']); |
|
786 | - if($cust_type == 0 && $value['item_type'] == 'INVPAY'){ |
|
785 | + $credit = $this->common->convert_to_currency('', '', $value['credit']); |
|
786 | + if ($cust_type == 0 && $value['item_type'] == 'INVPAY') { |
|
787 | 787 | $credit = '(-) '.$credit; |
788 | 788 | } |
789 | - if($value['after_balance'] == '-'){ |
|
790 | - $after_balance='-'; |
|
791 | - }else{ |
|
792 | - $after_balance=$this->common->convert_to_currency('','',$value['after_balance']); |
|
789 | + if ($value['after_balance'] == '-') { |
|
790 | + $after_balance = '-'; |
|
791 | + } else { |
|
792 | + $after_balance = $this->common->convert_to_currency('', '', $value['after_balance']); |
|
793 | 793 | } |
794 | - $description=$value['description']; |
|
794 | + $description = $value['description']; |
|
795 | 795 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
796 | 796 | if ($this->session->userdata('logintype') == 1) { |
797 | 797 | $json_data['rows'][] = array('cell' => array( |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | $after_balance, |
807 | 807 | $description, |
808 | 808 | )); |
809 | - }else{ |
|
809 | + } else { |
|
810 | 810 | $json_data['rows'][] = array('cell' => array( |
811 | 811 | $date, |
812 | 812 | $invoice_num, |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | } |
824 | 824 | $debit_sum = 0; |
825 | 825 | $credit_sum = 0; |
826 | - foreach($res as $value){ |
|
826 | + foreach ($res as $value) { |
|
827 | 827 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
828 | 828 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
829 | 829 | $debit_sum += $value['debit']; |
@@ -832,9 +832,9 @@ discard block |
||
832 | 832 | $after_balance += $value['after_balance']; |
833 | 833 | } |
834 | 834 | if ($this->session->userdata('logintype') == 1) { |
835 | - $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
836 | - }else{ |
|
837 | - $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
835 | + $json_data['rows'][$count_all]['cell'] = array('<b>Total</b>', '-', '-', '-', '-', '<b>'.$this->common->convert_to_currency('', '', $debit_sum).'</b>', '<b>'.$this->common->convert_to_currency('', '', $credit_sum).'</b>', '-', '-'); |
|
836 | + } else { |
|
837 | + $json_data['rows'][$count_all]['cell'] = array('<b>Total</b>', '-', '-', '-', '-', '<b>'.$this->common->convert_to_currency('', '', $debit_sum).'</b>', '<b>'.$this->common->convert_to_currency('', '', $credit_sum).'</b>', '-', '-'); |
|
838 | 838 | |
839 | 839 | } |
840 | 840 | echo json_encode($json_data); |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $this->session->set_userdata('charges_list_search', $action); |
850 | 850 | } |
851 | 851 | if (@$ajax_search != 1) { |
852 | - redirect(base_url() . 'accounts/admin_list/'); |
|
852 | + redirect(base_url().'accounts/admin_list/'); |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -861,62 +861,62 @@ discard block |
||
861 | 861 | /* ASTPP 3.0 |
862 | 862 | * This function using for customer edit |
863 | 863 | */ |
864 | - function customer_charge_history($accountid,$accounttype){ |
|
864 | + function customer_charge_history($accountid, $accounttype) { |
|
865 | 865 | $json_data = array(); |
866 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_charges'); |
|
867 | - $like_str=!empty($instant_search) ? "(created_date like '%$instant_search%' |
|
866 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_charges'); |
|
867 | + $like_str = ! empty($instant_search) ? "(created_date like '%$instant_search%' |
|
868 | 868 | OR item_type like '%$instant_search%' |
869 | 869 | OR 'debit' like '%$instant_search%' |
870 | 870 | OR 'credit' like '%$instant_search%' |
871 | 871 | OR 'description' like '%$instant_search%')" |
872 | 872 | :null; |
873 | - if(!empty($like_str)) |
|
873 | + if ( ! empty($like_str)) |
|
874 | 874 | $this->db->where($like_str); |
875 | - $count_all = $this->reports_model->get_customer_charge_list(false,$accountid); |
|
875 | + $count_all = $this->reports_model->get_customer_charge_list(false, $accountid); |
|
876 | 876 | |
877 | 877 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
878 | 878 | $json_data = $paging_data["json_paging"]; |
879 | - if(!empty($like_str)) |
|
879 | + if ( ! empty($like_str)) |
|
880 | 880 | $this->db->where($like_str); |
881 | - $query = $this->reports_model->get_customer_charge_list(true,$accountid,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
882 | - $result= $query->result_array(); |
|
883 | - $query1 = $this->reports_model->get_customer_charge_list(true,$accountid,'',''); |
|
884 | - $res= $query1->result_array(); |
|
885 | - |
|
886 | - $debit=0; |
|
887 | - $credit=0; |
|
888 | - $before_balance=0; |
|
889 | - $after_balance=0; |
|
890 | - $i=0; |
|
881 | + $query = $this->reports_model->get_customer_charge_list(true, $accountid, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
882 | + $result = $query->result_array(); |
|
883 | + $query1 = $this->reports_model->get_customer_charge_list(true, $accountid, '', ''); |
|
884 | + $res = $query1->result_array(); |
|
885 | + |
|
886 | + $debit = 0; |
|
887 | + $credit = 0; |
|
888 | + $before_balance = 0; |
|
889 | + $after_balance = 0; |
|
890 | + $i = 0; |
|
891 | 891 | foreach ($result as $key => $value) { |
892 | - $date=$this->common->convert_GMT_to('','',$value['created_date']); |
|
892 | + $date = $this->common->convert_GMT_to('', '', $value['created_date']); |
|
893 | 893 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
894 | - $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$value['invoiceid'])); |
|
895 | - $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$value['invoiceid'])); |
|
896 | - $invoice_num=$invoice_prefix.$invoiceid; |
|
897 | - $account=$this->common->get_field_name_coma_new('first_name,last_name,number','accounts',$value['accountid']); |
|
898 | - $reseller=$this->common->reseller_select_value('first_name,last_name,number','accounts',$value['reseller_id']); |
|
899 | - $item_type=$value['item_type']; |
|
900 | - if($value['before_balance'] == '-'){ |
|
901 | - $before_balance='-'; |
|
902 | - }else{ |
|
903 | - $before_balance=$this->common->convert_to_currency('','',$value['before_balance']); |
|
894 | + $invoice_prefix = $entity_type = $this->common->get_field_name('invoice_prefix', 'invoices', array('id'=>$value['invoiceid'])); |
|
895 | + $invoiceid = $entity_type = $this->common->get_field_name('invoiceid', 'invoices', array('id'=>$value['invoiceid'])); |
|
896 | + $invoice_num = $invoice_prefix.$invoiceid; |
|
897 | + $account = $this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', $value['accountid']); |
|
898 | + $reseller = $this->common->reseller_select_value('first_name,last_name,number', 'accounts', $value['reseller_id']); |
|
899 | + $item_type = $value['item_type']; |
|
900 | + if ($value['before_balance'] == '-') { |
|
901 | + $before_balance = '-'; |
|
902 | + } else { |
|
903 | + $before_balance = $this->common->convert_to_currency('', '', $value['before_balance']); |
|
904 | 904 | } |
905 | - if($value['debit'] == '-'){ |
|
906 | - $debit='-'; |
|
907 | - }else{ |
|
908 | - $debit=$this->common->convert_to_currency('','',$value['debit']); |
|
905 | + if ($value['debit'] == '-') { |
|
906 | + $debit = '-'; |
|
907 | + } else { |
|
908 | + $debit = $this->common->convert_to_currency('', '', $value['debit']); |
|
909 | 909 | } |
910 | - $credit=$this->common->convert_to_currency('','',$value['credit']); |
|
911 | - if($cust_type == 0 && $value['item_type'] == 'INVPAY'){ |
|
910 | + $credit = $this->common->convert_to_currency('', '', $value['credit']); |
|
911 | + if ($cust_type == 0 && $value['item_type'] == 'INVPAY') { |
|
912 | 912 | $credit = '(-) '.$credit; |
913 | 913 | } |
914 | - if($value['after_balance'] == '-'){ |
|
915 | - $after_balance='-'; |
|
916 | - }else{ |
|
917 | - $after_balance=$this->common->convert_to_currency('','',$value['after_balance']); |
|
914 | + if ($value['after_balance'] == '-') { |
|
915 | + $after_balance = '-'; |
|
916 | + } else { |
|
917 | + $after_balance = $this->common->convert_to_currency('', '', $value['after_balance']); |
|
918 | 918 | } |
919 | - $description=$value['description']; |
|
919 | + $description = $value['description']; |
|
920 | 920 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
921 | 921 | if ($this->session->userdata('logintype') == 1) { |
922 | 922 | $json_data['rows'][] = array('cell' => array( |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | $after_balance, |
930 | 930 | $description, |
931 | 931 | )); |
932 | - }else{ |
|
932 | + } else { |
|
933 | 933 | $json_data['rows'][] = array('cell' => array( |
934 | 934 | $date, |
935 | 935 | $invoice_num, |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | } |
946 | 946 | $debit_sum = 0; |
947 | 947 | $credit_sum = 0; |
948 | - foreach($res as $value){ |
|
948 | + foreach ($res as $value) { |
|
949 | 949 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
950 | 950 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
951 | 951 | $debit_sum += $value['debit']; |
@@ -954,31 +954,31 @@ discard block |
||
954 | 954 | $after_balance += $value['after_balance']; |
955 | 955 | } |
956 | 956 | if ($this->session->userdata('logintype') == 1) { |
957 | - $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
958 | - }else{ |
|
959 | - $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
957 | + $json_data['rows'][$count_all]['cell'] = array('<b>Total</b>', '-', '-', '-', '<b>'.$this->common->convert_to_currency('', '', $debit_sum).'</b>', '<b>'.$this->common->convert_to_currency('', '', $credit_sum).'</b>', '-', '-'); |
|
958 | + } else { |
|
959 | + $json_data['rows'][$count_all]['cell'] = array('<b>Total</b>', '-', '-', '-', '<b>'.$this->common->convert_to_currency('', '', $debit_sum).'</b>', '<b>'.$this->common->convert_to_currency('', '', $credit_sum).'</b>', '-', '-'); |
|
960 | 960 | |
961 | 961 | } |
962 | 962 | echo json_encode($json_data); |
963 | 963 | } |
964 | 964 | |
965 | - function customer_refillreport($accountid,$accounttype){ |
|
965 | + function customer_refillreport($accountid, $accounttype) { |
|
966 | 966 | $json_data = array(); |
967 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_refill'); |
|
968 | - $like_str=!empty($instant_search) ? "(payment_date like '%$instant_search%' |
|
967 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_refill'); |
|
968 | + $like_str = ! empty($instant_search) ? "(payment_date like '%$instant_search%' |
|
969 | 969 | OR credit like '%$instant_search%' |
970 | 970 | OR payment_by like '%$instant_search%' |
971 | 971 | OR notes like '%$instant_search%' |
972 | 972 | )" |
973 | 973 | :null; |
974 | - if(!empty($like_str)) |
|
974 | + if ( ! empty($like_str)) |
|
975 | 975 | $this->db->where($like_str); |
976 | - $count_all = $this->reports_model->get_customer_refillreport(false,$accountid); |
|
976 | + $count_all = $this->reports_model->get_customer_refillreport(false, $accountid); |
|
977 | 977 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
978 | 978 | $json_data = $paging_data["json_paging"]; |
979 | - if(!empty($like_str)) |
|
979 | + if ( ! empty($like_str)) |
|
980 | 980 | $this->db->where($like_str); |
981 | - $query = $this->reports_model->get_customer_refillreport(true,$accountid,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
981 | + $query = $this->reports_model->get_customer_refillreport(true, $accountid, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
982 | 982 | $grid_fields = json_decode($this->reports_form->build_refillreport_for_customer()); |
983 | 983 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
984 | 984 | echo json_encode($json_data); |