Completed
Push — v3.0 ( 300813...495b61 )
by Samir
13:52
created
web_interface/astpp/application/modules/login/controllers/login.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -301,34 +301,34 @@
 block discarded – undo
301 301
 				'invoiceid'=>$invoice_id,
302 302
 				'description'=>"Your account has been credited due to your customer account recharge done by paypal",
303 303
 				'item_type'=>'PAYMENT',
304
-		  	        'before_balance'=>$account_data['balance'],
304
+		  			'before_balance'=>$account_data['balance'],
305 305
 				'after_balance'=>$account_data['balance']+$balance_amt,
306 306
 			   );
307
-		          $this->db->insert("invoice_details", $details_insert); 
308
-	          	  $this->db_model->update_balance($balance_amt,$account_data["id"],"credit");  			         
307
+				  $this->db->insert("invoice_details", $details_insert); 
308
+			  	  $this->db_model->update_balance($balance_amt,$account_data["id"],"credit");  			         
309 309
 			}
310
-		      }
310
+			  }
311 311
 		}
312 312
 		redirect(base_url() . 'user/user/');
313
-        }
314
-      }         
313
+		}
314
+	  }         
315 315
 	redirect(base_url() . 'user/user/');
316
-    }
316
+	}
317 317
 
318
-    /**
319
-     * @param integer $last_invoice_ID
320
-     * @param string $due_date
321
-     */
322
-    function generate_receipt($accountid,$amount,$accountinfo,$last_invoice_ID,$invoice_prefix,$due_date){
318
+	/**
319
+	 * @param integer $last_invoice_ID
320
+	 * @param string $due_date
321
+	 */
322
+	function generate_receipt($accountid,$amount,$accountinfo,$last_invoice_ID,$invoice_prefix,$due_date){
323 323
 		$invoice_data = array("accountid"=>$accountid,"invoice_prefix" =>$invoice_prefix,"invoiceid"=>'0000'.$last_invoice_ID,"reseller_id"=>$accountinfo['reseller_id'],"invoice_date"=>gmdate("Y-m-d H:i:s"),"from_date"=>  gmdate("Y-m-d H:i:s"),"to_date"=>gmdate("Y-m-d H:i:s"),"due_date"=>$due_date,"status"=>1,"balance"=>$accountinfo['balance'],"amount"=>$amount,"type"=>'R',"confirm"=>'1');            
324
-        $this->db->insert("invoices",$invoice_data);
325
-        $invoiceid = $this->db->insert_id();    
326
-        return  $invoiceid;  
327
-    }
324
+		$this->db->insert("invoices",$invoice_data);
325
+		$invoiceid = $this->db->insert_id();    
326
+		return  $invoiceid;  
327
+	}
328 328
     
329
-    function get_language_text(){
329
+	function get_language_text(){
330 330
    // echo '<pre>'; print_r($_POST); exit;
331
-      echo gettext($_POST['display']); 
331
+	  echo gettext($_POST['display']); 
332 332
  	}  
333 333
     
334 334
 }
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
 		$this->load->model('db_model');
32 32
 	}
33 33
     
34
-	function set_lang_global($post=false){ 
35
-	if(!is_array($post)){
36
-		$str=trim($post);
37
-		$new_arr[$str]=$str;
38
-		$post=$new_arr;
34
+	function set_lang_global($post = false) { 
35
+	if ( ! is_array($post)) {
36
+		$str = trim($post);
37
+		$new_arr[$str] = $str;
38
+		$post = $new_arr;
39 39
 	}
40
-	if(isset($post['fr_FR'])){
41
-	 $language=$post['fr_FR'];
40
+	if (isset($post['fr_FR'])) {
41
+	 $language = $post['fr_FR'];
42 42
 	 $this->session->set_userdata('user_language', $language);
43 43
 	}
44
-	if(isset($post['es_ES'])){
45
-	 $language=$post['es_ES'];
44
+	if (isset($post['es_ES'])) {
45
+	 $language = $post['es_ES'];
46 46
 	 $this->session->set_userdata('user_language', $language);         
47 47
 	}       
48
-	if(isset($post['en_EN'])){
49
-	 $language=$post['en_EN'];
50
-	 $this->session->unset_userdata('user_language',$language);
48
+	if (isset($post['en_EN'])) {
49
+	 $language = $post['en_EN'];
50
+	 $this->session->unset_userdata('user_language', $language);
51 51
 	} 
52 52
 	$this->locale->set_lang();
53 53
 	return true;
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 
56 56
 	function index() {
57 57
 		if ($this->session->userdata('user_login') == FALSE) {
58
-			if (!empty($_POST) && trim($_POST['username']) != '' && trim($_POST['password']) != '') {
59
-			$_POST['password']=$this->common->encode($_POST['password']);
58
+			if ( ! empty($_POST) && trim($_POST['username']) != '' && trim($_POST['password']) != '') {
59
+			$_POST['password'] = $this->common->encode($_POST['password']);
60 60
 				$user_valid = $this->Auth_model->verify_login($_POST['username'], $_POST['password']);
61 61
                 
62 62
 				if ($user_valid == 1) {
63 63
 					$this->session->set_userdata('user_login', TRUE);
64 64
 			$where = "number = '".$this->db->escape_str($_POST['username'])."' OR email = '".$this->db->escape_str($_POST['username'])."'";
65
-					$result = $this->db_model->getSelect("*", "accounts",$where);
65
+					$result = $this->db_model->getSelect("*", "accounts", $where);
66 66
 					$result = $result->result_array();
67 67
 					$result = $result[0];
68
-					 $logintype=$result['type']== -1 ? 2: $result['type'];
68
+					 $logintype = $result['type'] == -1 ? 2 : $result['type'];
69 69
 					$this->session->set_userdata('logintype', $logintype);
70 70
 					$this->session->set_userdata('userlevel_logintype', $result['type']);
71 71
 					$this->session->set_userdata('username', $_POST['username']);
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 					if ($result['type'] == 0 || $result['type'] == 1) {
119 119
 						$menu_list = $this->permission->get_module_access($result['type']);
120 120
 						$this->session->set_userdata('mode_cur', 'user');
121
-						if($result['type'] == 1){
122
-							redirect(base_url() . 'dashboard/');
123
-						}else{
124
-							redirect(base_url() . 'user/user/');
121
+						if ($result['type'] == 1) {
122
+							redirect(base_url().'dashboard/');
123
+						} else {
124
+							redirect(base_url().'user/user/');
125 125
 						}
126 126
 					} else {
127 127
 						$menu_list = $this->permission->get_module_access($result['type']);
128 128
 						$this->session->set_userdata('mode_cur', 'admin');
129
-						redirect(base_url() . 'dashboard/');
129
+						redirect(base_url().'dashboard/');
130 130
 					}
131 131
 				} else {
132 132
 		   
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			$this->session->set_userdata('user_login', FALSE);
152 152
 			$data['app_name'] = 'ASTPP - Open Source Billing Solution';
153 153
 			$this->load->view('view_login', $data);
154
-		}else {
154
+		} else {
155 155
 	/*
156 156
 	*
157 157
 	* Purpose : Display logo based on domain name
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	//              echo $data['user_logo'];exit;
174 174
 /***************************************************************************************/
175 175
 		if ($this->session->userdata('logintype') == '2') {
176
-		redirect(base_url() . 'dashboard/');
176
+		redirect(base_url().'dashboard/');
177 177
 		} else {
178 178
 		redirect(base_url().'user/user/');
179 179
 		}
@@ -184,25 +184,25 @@  discard block
 block discarded – undo
184 184
 		$this->session->sess_destroy();
185 185
 		redirect(base_url());
186 186
 	}
187
-  function paypal_response(){
188
-	  if(count($_POST)>0)
187
+  function paypal_response() {
188
+	  if (count($_POST) > 0)
189 189
 	  {
190
-		$response_arr=$_POST;
191
-		$fp=fopen("/var/log/astpp/astpp_payment.log","w+");
190
+		$response_arr = $_POST;
191
+		$fp = fopen("/var/log/astpp/astpp_payment.log", "w+");
192 192
 		$date = date("Y-m-d H:i:s");
193
-		fwrite($fp,"====================".$date."===============================\n");
194
-		foreach($response_arr as $key => $value){	  
195
-			fwrite($fp,$key.":::>".$value."\n");
193
+		fwrite($fp, "====================".$date."===============================\n");
194
+		foreach ($response_arr as $key => $value) {	  
195
+			fwrite($fp, $key.":::>".$value."\n");
196 196
 		}
197 197
 		$payment_check = $this->db_model->countQuery("txn_id", "payments", array("txn_id" => $response_arr['txn_id']));
198
-		if( ($response_arr["payment_status"] == "Pending" || $response_arr["payment_status"] == "Complete" || $response_arr["payment_status"] == "Completed" ) && $payment_check == 0){
198
+		if (($response_arr["payment_status"] == "Pending" || $response_arr["payment_status"] == "Complete" || $response_arr["payment_status"] == "Completed") && $payment_check == 0) {
199 199
 
200
-			$paypal_tax = (array)$this->db->get_where("system", array("name" => "paypal_tax","group_title"=>"paypal"))->first_row();
201
-			$paypal_tax =$paypal_tax['value'];
200
+			$paypal_tax = (array)$this->db->get_where("system", array("name" => "paypal_tax", "group_title"=>"paypal"))->first_row();
201
+			$paypal_tax = $paypal_tax['value'];
202 202
 			$balance_amt = $actual_amount = $response_arr["custom"];
203
-			$paypal_fee = (array)$this->db->get_where("system", array("name" => "paypal_fee","group_title"=>"paypal"))->first_row();
203
+			$paypal_fee = (array)$this->db->get_where("system", array("name" => "paypal_fee", "group_title"=>"paypal"))->first_row();
204 204
 			$paypal_fee = $paypal_fee['value'];
205
-			$paypalfee = ($paypal_fee == 0)?'0':$response_arr["mc_gross"];
205
+			$paypalfee = ($paypal_fee == 0) ? '0' : $response_arr["mc_gross"];
206 206
 			$account_data = (array)$this->db->get_where("accounts", array("id" => $response_arr["item_number"]))->first_row();
207 207
 			$currency = (array)$this->db->get_where('currency', array("id"=>$account_data["currency_id"]))->first_row();
208 208
 			$date = date('Y-m-d H:i:s');
@@ -216,35 +216,35 @@  discard block
 block discarded – undo
216 216
 							"currency_rate"=>$currency["currencyrate"],
217 217
 							"transaction_details"=>json_encode($response_arr),
218 218
 							"date"=>$date);
219
-			 $paymentid=$this->db->insert('payment_transaction',$payment_trans_array);
220
-			 $parent_id =$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : '-1';
219
+			 $paymentid = $this->db->insert('payment_transaction', $payment_trans_array);
220
+			 $parent_id = $account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : '-1';
221 221
 		 $payment_arr = array("accountid"=> $response_arr["item_number"],
222
-		 		"payment_mode"=>"1","credit"=>$balance_amt,
222
+		 		"payment_mode"=>"1", "credit"=>$balance_amt,
223 223
 				"type"=>"PAYPAL",
224 224
 				"payment_by"=>$parent_id,
225 225
 				"notes"=>"Payment Made by Paypal on date:-".$date,
226 226
 				"paypalid"=>$paymentid,
227 227
 				"txn_id"=>$response_arr["txn_id"],
228
-				'payment_date'=>gmdate('Y-m-d H:i:s',strtotime($response_arr['payment_date'])));
228
+				'payment_date'=>gmdate('Y-m-d H:i:s', strtotime($response_arr['payment_date'])));
229 229
 		 $this->db->insert('payments', $payment_arr);
230 230
 		 $this->db->select('invoiceid');
231
-		 $this->db->order_by('id','desc');
231
+		 $this->db->order_by('id', 'desc');
232 232
 		 $this->db->limit(1);
233
- 		 $last_invoice_result=(array)$this->db->get('invoices')->first_row();
234
- 		 $last_invoice_ID=isset($last_invoice_result['invoiceid'] ) && $last_invoice_result['invoiceid'] > 0 ?$last_invoice_result['invoiceid'] : 1;
235
- 		 $reseller_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
236
-		 $where="accountid IN ('".$reseller_id."','1')";
233
+ 		 $last_invoice_result = (array)$this->db->get('invoices')->first_row();
234
+ 		 $last_invoice_ID = isset($last_invoice_result['invoiceid']) && $last_invoice_result['invoiceid'] > 0 ? $last_invoice_result['invoiceid'] : 1;
235
+ 		 $reseller_id = $account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
236
+		 $where = "accountid IN ('".$reseller_id."','1')";
237 237
 		 $this->db->where($where);
238 238
 		 $this->db->select('*');
239 239
 		 $this->db->order_by('accountid', 'desc');
240 240
 		 $this->db->limit(1);
241 241
 			 $invoiceconf = $this->db->get('invoice_conf');
242 242
 			 $invoiceconf = (array)$invoiceconf->first_row();
243
-		 $invoice_prefix=$invoiceconf['invoice_prefix'];
243
+		 $invoice_prefix = $invoiceconf['invoice_prefix'];
244 244
 
245
-		 $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));  
246
-		 $invoice_id=$this->generate_receipt($account_data['id'],$balance_amt,$account_data,$last_invoice_ID+1,$invoice_prefix,$due_date);
247
-		 $details_insert=array(
245
+		 $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));  
246
+		 $invoice_id = $this->generate_receipt($account_data['id'], $balance_amt, $account_data, $last_invoice_ID + 1, $invoice_prefix, $due_date);
247
+		 $details_insert = array(
248 248
 			'created_date'=>$date,
249 249
 			'credit'=>$balance_amt,
250 250
 			'debit'=>'-',
@@ -254,34 +254,34 @@  discard block
 block discarded – undo
254 254
 			'description'=>"Payment Made by Paypal on date:-".$date,
255 255
 			'item_type'=>'PAYMENT',
256 256
 	  			'before_balance'=>$account_data['balance'],
257
-			'after_balance'=>$account_data['balance']+$balance_amt,
257
+			'after_balance'=>$account_data['balance'] + $balance_amt,
258 258
 			);
259 259
 		$this->db->insert("invoice_details", $details_insert); 
260
-		$this->db_model->update_balance($balance_amt,$account_data["id"],"credit");            
261
-		if($parent_id > 0){
262
-			  $reseller_ids=$this->common->get_parent_info($parent_id,0);
263
-			  $reseller_ids=rtrim($reseller_ids,",");
264
-			  $reseller_arr=explode(",",$reseller_ids);
265
-			  if(!empty($reseller_arr)){
266
-			foreach($reseller_arr as $key=>$reseller_id){
260
+		$this->db_model->update_balance($balance_amt, $account_data["id"], "credit");            
261
+		if ($parent_id > 0) {
262
+			  $reseller_ids = $this->common->get_parent_info($parent_id, 0);
263
+			  $reseller_ids = rtrim($reseller_ids, ",");
264
+			  $reseller_arr = explode(",", $reseller_ids);
265
+			  if ( ! empty($reseller_arr)) {
266
+			foreach ($reseller_arr as $key=>$reseller_id) {
267 267
 			  $account_data = (array)$this->db->get_where("accounts", array("id" => $reseller_id))->first_row();
268 268
 			  $this->db->select('invoiceid');
269
-				  $this->db->order_by('id','desc');
269
+				  $this->db->order_by('id', 'desc');
270 270
 				  $this->db->limit(1);
271
- 					  $last_invoice_result=(array)$this->db->get('invoices')->first_row();
272
- 					  $last_invoice_ID=$last_invoice_result['invoiceid'];
273
- 		 		  $reseller_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
274
-					  $where="accountid IN ('".$reseller_id."','1')";
271
+ 					  $last_invoice_result = (array)$this->db->get('invoices')->first_row();
272
+ 					  $last_invoice_ID = $last_invoice_result['invoiceid'];
273
+ 		 		  $reseller_id = $account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
274
+					  $where = "accountid IN ('".$reseller_id."','1')";
275 275
 					  $this->db->where($where);
276 276
 				  $this->db->select('*');
277 277
 				  $this->db->order_by('accountid', 'desc');
278 278
 				  $this->db->limit(1);
279 279
 				  $invoiceconf = $this->db->get('invoice_conf');
280 280
 				  $invoiceconf = (array)$invoiceconf->first_row();
281
-					  $invoice_prefix=$invoiceconf['invoice_prefix'];
282
-		 		  $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));
283
-		 		  $invoice_id=$this->generate_receipt($account_data['id'],$balance_amt,$account_data,$last_invoice_ID+1,$invoice_prefix,$due_date);
284
-			  $parent_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : -1;
281
+					  $invoice_prefix = $invoiceconf['invoice_prefix'];
282
+		 		  $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));
283
+		 		  $invoice_id = $this->generate_receipt($account_data['id'], $balance_amt, $account_data, $last_invoice_ID + 1, $invoice_prefix, $due_date);
284
+			  $parent_id = $account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : -1;
285 285
 			  $payment_arr = array("accountid"=> $account_data["id"],
286 286
 		 					"payment_mode"=>"1",
287 287
 		 					"credit"=>$balance_amt,
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
 							"notes"=>"Your account has been credited due to your customer account recharge done by paypal",
291 291
 							"paypalid"=>$paymentid,
292 292
 							"txn_id"=>$response_arr["txn_id"],
293
-							'payment_date'=>gmdate('Y-m-d H:i:s',strtotime($response_arr['payment_date'])));
293
+							'payment_date'=>gmdate('Y-m-d H:i:s', strtotime($response_arr['payment_date'])));
294 294
 	 			  $this->db->insert('payments', $payment_arr);
295
-			  $details_insert=array(
295
+			  $details_insert = array(
296 296
 				'created_date'=>$date,
297 297
 				'credit'=>$balance_amt,
298 298
 				'debit'=>'-',
@@ -302,31 +302,31 @@  discard block
 block discarded – undo
302 302
 				'description'=>"Your account has been credited due to your customer account recharge done by paypal",
303 303
 				'item_type'=>'PAYMENT',
304 304
 		  	        'before_balance'=>$account_data['balance'],
305
-				'after_balance'=>$account_data['balance']+$balance_amt,
305
+				'after_balance'=>$account_data['balance'] + $balance_amt,
306 306
 			   );
307 307
 		          $this->db->insert("invoice_details", $details_insert); 
308
-	          	  $this->db_model->update_balance($balance_amt,$account_data["id"],"credit");  			         
308
+	          	  $this->db_model->update_balance($balance_amt, $account_data["id"], "credit");  			         
309 309
 			}
310 310
 		      }
311 311
 		}
312
-		redirect(base_url() . 'user/user/');
312
+		redirect(base_url().'user/user/');
313 313
         }
314 314
       }         
315
-	redirect(base_url() . 'user/user/');
315
+	redirect(base_url().'user/user/');
316 316
     }
317 317
 
318 318
     /**
319 319
      * @param integer $last_invoice_ID
320 320
      * @param string $due_date
321 321
      */
322
-    function generate_receipt($accountid,$amount,$accountinfo,$last_invoice_ID,$invoice_prefix,$due_date){
323
-		$invoice_data = array("accountid"=>$accountid,"invoice_prefix" =>$invoice_prefix,"invoiceid"=>'0000'.$last_invoice_ID,"reseller_id"=>$accountinfo['reseller_id'],"invoice_date"=>gmdate("Y-m-d H:i:s"),"from_date"=>  gmdate("Y-m-d H:i:s"),"to_date"=>gmdate("Y-m-d H:i:s"),"due_date"=>$due_date,"status"=>1,"balance"=>$accountinfo['balance'],"amount"=>$amount,"type"=>'R',"confirm"=>'1');            
324
-        $this->db->insert("invoices",$invoice_data);
322
+    function generate_receipt($accountid, $amount, $accountinfo, $last_invoice_ID, $invoice_prefix, $due_date) {
323
+		$invoice_data = array("accountid"=>$accountid, "invoice_prefix" =>$invoice_prefix, "invoiceid"=>'0000'.$last_invoice_ID, "reseller_id"=>$accountinfo['reseller_id'], "invoice_date"=>gmdate("Y-m-d H:i:s"), "from_date"=>  gmdate("Y-m-d H:i:s"), "to_date"=>gmdate("Y-m-d H:i:s"), "due_date"=>$due_date, "status"=>1, "balance"=>$accountinfo['balance'], "amount"=>$amount, "type"=>'R', "confirm"=>'1');            
324
+        $this->db->insert("invoices", $invoice_data);
325 325
         $invoiceid = $this->db->insert_id();    
326 326
         return  $invoiceid;  
327 327
     }
328 328
     
329
-    function get_language_text(){
329
+    function get_language_text() {
330 330
    // echo '<pre>'; print_r($_POST); exit;
331 331
       echo gettext($_POST['display']); 
332 332
  	}  
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 						$this->session->set_userdata('mode_cur', 'user');
121 121
 						if($result['type'] == 1){
122 122
 							redirect(base_url() . 'dashboard/');
123
-						}else{
123
+						} else{
124 124
 							redirect(base_url() . 'user/user/');
125 125
 						}
126 126
 					} else {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			$this->session->set_userdata('user_login', FALSE);
152 152
 			$data['app_name'] = 'ASTPP - Open Source Billing Solution';
153 153
 			$this->load->view('view_login', $data);
154
-		}else {
154
+		} else {
155 155
 	/*
156 156
 	*
157 157
 	* Purpose : Display logo based on domain name
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/did/models/did_model.php 2 patches
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 
31 31
 	function add_did($add_array) {
32
-	if($add_array['accountid'] > 0 ){
33
-	  $add_array['assign_date']=gmdate('Y-m-d H:i:s');
32
+	if ($add_array['accountid'] > 0) {
33
+	  $add_array['assign_date'] = gmdate('Y-m-d H:i:s');
34 34
 	}
35 35
 	unset($add_array["action"]);
36 36
 	$this->db->insert("dids", $add_array);
37
-		if($add_array['accountid'] > 0 ){
38
-	  $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$add_array['accountid']))->first_row();
39
-	  $currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$accountinfo['currency_id']));
40
-	  $available_bal = $this->db_model->update_balance( $add_array["setup"], $add_array['accountid'], "debit");
41
-	  $this->common->add_invoice_details($accountinfo, "DIDCHRG",  $add_array["setup"], $add_array['number']);
37
+		if ($add_array['accountid'] > 0) {
38
+	  $accountinfo = (array)$this->db->get_where('accounts', array("id"=>$add_array['accountid']))->first_row();
39
+	  $currency_name = $this->common->get_field_name('currency', "currency", array('id'=>$accountinfo['currency_id']));
40
+	  $available_bal = $this->db_model->update_balance($add_array["setup"], $add_array['accountid'], "debit");
41
+	  $this->common->add_invoice_details($accountinfo, "DIDCHRG", $add_array["setup"], $add_array['number']);
42 42
 	  $accountinfo['did_number'] = $add_array['number'];
43 43
 	  $country_id = $this->common->get_field_name('country', 'countrycode', $add_array['country_id']);
44 44
 	  $accountinfo['did_country_id'] = $country_id;
45
-	  $accountinfo['did_setup'] = $this->common_model->calculate_currency($add_array['setup'],'',$currency_name,true,true);
46
-	  $accountinfo['did_monthlycost'] =$this->common_model->calculate_currency($add_array['monthlycost'],'',$currency_name,true,true);
45
+	  $accountinfo['did_setup'] = $this->common_model->calculate_currency($add_array['setup'], '', $currency_name, true, true);
46
+	  $accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($add_array['monthlycost'], '', $currency_name, true, true);
47 47
 	  $accountinfo['did_maxchannels'] = $add_array['maxchannels'];
48 48
 	  $this->common->mail_to_users('email_add_did', $accountinfo);
49 49
 	   }
@@ -54,67 +54,67 @@  discard block
 block discarded – undo
54 54
 		return $this->db->insert_id();
55 55
 	}
56 56
 
57
-	function edit_did($data, $id,$number) {
57
+	function edit_did($data, $id, $number) {
58 58
 		unset($data["action"]);
59
-		$this->db->where('number',$number);
59
+		$this->db->where('number', $number);
60 60
 		$this->db->select('parent_id,accountid');
61
-		$did_result=$this->db->get('dids');
62
-		$did_result=(array)$did_result->first_row();
63
-		if($did_result['accountid'] > 0 || $did_result['parent_id'] > 0){
64
-		 $data['accountid']=$did_result['accountid'];
65
-		 $data['parent_id']=$did_result['parent_id'];
61
+		$did_result = $this->db->get('dids');
62
+		$did_result = (array)$did_result->first_row();
63
+		if ($did_result['accountid'] > 0 || $did_result['parent_id'] > 0) {
64
+		 $data['accountid'] = $did_result['accountid'];
65
+		 $data['parent_id'] = $did_result['parent_id'];
66 66
 		}
67 67
 	/**
68 68
 	  ASTPP  3.0 
69 69
 	  In did edit last modified date and assign date update
70 70
 	 **/
71
-		$data['last_modified_date']=gmdate("Y-m-d H:i:s");
72
-		if($did_result['accountid'] ==0 && $data['accountid'] > 0 ){
73
-		$data['assign_date']=gmdate("Y-m-d H:i:s");
71
+		$data['last_modified_date'] = gmdate("Y-m-d H:i:s");
72
+		if ($did_result['accountid'] == 0 && $data['accountid'] > 0) {
73
+		$data['assign_date'] = gmdate("Y-m-d H:i:s");
74 74
 	} 
75 75
 	$this->db->where("number", $number);
76 76
 	$this->db->where("id", $id);
77 77
 	$this->db->update("dids", $data);
78 78
 		/**************************************/
79
-		if($did_result['parent_id'] > 0 ){
80
-			$update_array['call_type']=$data['call_type'];
81
-			$update_array['extensions']=$data['extensions'];
79
+		if ($did_result['parent_id'] > 0) {
80
+			$update_array['call_type'] = $data['call_type'];
81
+			$update_array['extensions'] = $data['extensions'];
82 82
 			$this->db->where("note", $number);
83 83
 			$this->db->update("reseller_pricing", $update_array);
84 84
 		}
85
-		if($did_result['accountid'] ==0 && $data['accountid'] > 0 ){
86
-		$accountinfo=(array)$this->db->get_where('accounts',array("id"=>$data['accountid']))->first_row();
87
-		$currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$accountinfo['currency_id']));
88
-		$available_bal = $this->db_model->update_balance( $data["setup"], $data['accountid'], "debit");
85
+		if ($did_result['accountid'] == 0 && $data['accountid'] > 0) {
86
+		$accountinfo = (array)$this->db->get_where('accounts', array("id"=>$data['accountid']))->first_row();
87
+		$currency_name = $this->common->get_field_name('currency', "currency", array('id'=>$accountinfo['currency_id']));
88
+		$available_bal = $this->db_model->update_balance($data["setup"], $data['accountid'], "debit");
89 89
 		$this->common->add_invoice_details($accountinfo, "DIDCHRG", $data["setup"], $number);
90 90
 		$accountinfo['did_number'] = $number;
91 91
 		$country_id = $this->common->get_field_name('country', 'countrycode', $data['country_id']);
92 92
 		$accountinfo['did_country_id'] = $country_id;
93
-		$accountinfo['did_setup'] = $this->common_model->calculate_currency($data['setup'],'',$currency_name,true,true);
94
-		$accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($data['monthlycost'],'',$currency_name,true,true);
93
+		$accountinfo['did_setup'] = $this->common_model->calculate_currency($data['setup'], '', $currency_name, true, true);
94
+		$accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($data['monthlycost'], '', $currency_name, true, true);
95 95
 		$accountinfo['did_maxchannels'] = $data['maxchannels'];
96 96
 		$this->common->mail_to_users('email_add_did', $accountinfo);
97 97
 		}        
98 98
 	}
99 99
 
100 100
 	function getdid_list($flag, $start = 0, $limit = 0) {
101
-			$accountinfo=$this->session->userdata('accountinfo');
102
-			$parent_id= $accountinfo['type']==1 ? $accountinfo['reseller_id'] : 0 ;
101
+			$accountinfo = $this->session->userdata('accountinfo');
102
+			$parent_id = $accountinfo['type'] == 1 ? $accountinfo['reseller_id'] : 0;
103 103
 	    
104
-		if($accountinfo['type']==1)
104
+		if ($accountinfo['type'] == 1)
105 105
 		{
106
-		  $where = array('reseller_id' => $accountinfo['id'],"parent_id"=>$parent_id);
106
+		  $where = array('reseller_id' => $accountinfo['id'], "parent_id"=>$parent_id);
107 107
 		if ($flag) {
108
-		  if($accountinfo['reseller_id'] > 0 ){
109
-			 $search_string=$this->db_model->build_search_string('did_list_search');
110
-			 $search_string= !empty($search_string) ? " AND ".$search_string : null;
111
-			  if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
112
-			$this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
108
+		  if ($accountinfo['reseller_id'] > 0) {
109
+			 $search_string = $this->db_model->build_search_string('did_list_search');
110
+			 $search_string = ! empty($search_string) ? " AND ".$search_string : null;
111
+			  if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
112
+			$this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
113 113
 			  }
114 114
 			  $this->db->limit($limit, $start);
115
-			  $query=$this->db->query("SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=".$accountinfo['id']." AND a.parent_id =".$accountinfo['reseller_id'].$search_string);
115
+			  $query = $this->db->query("SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=".$accountinfo['id']." AND a.parent_id =".$accountinfo['reseller_id'].$search_string);
116 116
 		  }
117
-		  else{
117
+		  else {
118 118
 			$this->db_model->build_search('did_list_search');
119 119
 			$query = $this->db_model->select("*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start);
120 120
 		  }
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	      ASTPP  3.0  last_modified_date,assign_date put in query.
133 133
 	      */
134 134
 		$this->db->select('dids.id,dids.connectcost,dids.includedseconds,dids.last_modified_date,dids.assign_date,dids.number,dids.extensions,dids.call_type,dids.country_id,dids.init_inc,dids.inc,dids.cost,dids.setup,dids.monthlycost,dids.status,(CASE when parent_id > 0 THEN (SELECT reseller_id as accountid from reseller_pricing where dids.number=reseller_pricing.note AND reseller_pricing.parent_id=0) ELSE dids.accountid END ) as accountid');
135
-				if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
136
-					$this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
135
+				if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
136
+					$this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
137 137
 				}
138 138
 		/*********************************************************88*/
139 139
 		$this->db->limit($limit, $start);
140
-		$query=$this->db->get('dids');
140
+		$query = $this->db->get('dids');
141 141
 		  } else {
142 142
 		$query = $this->db_model->countQuery("*", "dids");
143 143
 		  }
@@ -152,19 +152,19 @@  discard block
 block discarded – undo
152 152
 	$where = array('id' => $id);
153 153
 	$this->db->where($where);
154 154
 	$this->db->select('accountid,number,parent_id');
155
-	$did_info=(array)$this->db->get('dids')->first_row();
155
+	$did_info = (array)$this->db->get('dids')->first_row();
156 156
 	$this->db->where("id", $id);
157 157
 		$this->db->delete("dids");
158 158
 		$this->db->where("note", $did_info['number']);
159 159
 		$this->db->delete("reseller_pricing");
160
-		if($did_info['accountid'] == 0 && $did_info['parent_id'] > 0){
161
-	  $accountinfo=$this->session->userdata('accountinfo');
162
-	  $did_info['accountid']=$accouninfo['id'];
163
-	  $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$did_info['parent_id']))->first_row();
160
+		if ($did_info['accountid'] == 0 && $did_info['parent_id'] > 0) {
161
+	  $accountinfo = $this->session->userdata('accountinfo');
162
+	  $did_info['accountid'] = $accouninfo['id'];
163
+	  $accountinfo = (array)$this->db->get_where('accounts', array("id"=>$did_info['parent_id']))->first_row();
164 164
 	  $accountinfo['did_number'] = $accountinfo['number'];
165 165
 	  $this->common->mail_to_users('email_remove_did', $accountinfo);
166
-	} elseif($did_info['accountid'] > 0 ){
167
-	  $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$did_info['accountid']))->first_row();
166
+	} elseif ($did_info['accountid'] > 0) {
167
+	  $accountinfo = (array)$this->db->get_where('accounts', array("id"=>$did_info['accountid']))->first_row();
168 168
 	  $accountinfo['did_number'] = $did_info['number'];
169 169
 	  $this->common->mail_to_users('email_remove_did', $accountinfo);
170 170
 	}
@@ -188,21 +188,21 @@  discard block
 block discarded – undo
188 188
 	}
189 189
 
190 190
 	function get_account($accountdata) {
191
-		$q = "SELECT * FROM accounts WHERE number = '" . $this->db->escape_str($accountdata) . "' AND status = 0";
191
+		$q = "SELECT * FROM accounts WHERE number = '".$this->db->escape_str($accountdata)."' AND status = 0";
192 192
 		$query = $this->db->query($q);
193 193
 		if ($query->num_rows() > 0) {
194 194
 			$row = $query->row_array();
195 195
 			return $row;
196 196
 		}
197 197
 
198
-		$q = "SELECT * FROM accounts WHERE cc = '" . $this->db->escape_str($accountdata) . "' AND status = 0";
198
+		$q = "SELECT * FROM accounts WHERE cc = '".$this->db->escape_str($accountdata)."' AND status = 0";
199 199
 		$query = $this->db->query($q);
200 200
 		if ($query->num_rows() > 0) {
201 201
 			$row = $query->row_array();
202 202
 			return $row;
203 203
 		}
204 204
 
205
-		$q = "SELECT * FROM accounts WHERE accountid = '" . $this->db->escape_str($accountdata) . "' AND status = 0";
205
+		$q = "SELECT * FROM accounts WHERE accountid = '".$this->db->escape_str($accountdata)."' AND status = 0";
206 206
 		$query = $this->db->query($q);
207 207
 		if ($query->num_rows() > 0) {
208 208
 			$row = $query->row_array();
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 				. "dids.dial_as AS dial_as, "
238 238
 				. "dids.status AS status "
239 239
 				. "FROM dids, reseller_pricing "
240
-				. "WHERE dids.id = " . $did
240
+				. "WHERE dids.id = ".$did
241 241
 				. " AND reseller_pricing.type = '1' AND reseller_pricing.reseller_id = "
242 242
 				. $reseller_id;
243 243
 		$query = $this->db->query($sql);
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
 		else
256 256
 			return false;
257 257
 	}
258
-   function edit_did_reseller($did_id,$post) {
258
+   function edit_did_reseller($did_id, $post) {
259 259
 		$accountinfo = $this->session->userdata('accountinfo');
260 260
 
261
-		$where_array=array('reseller_id' => $accountinfo['id'], 'note' => $post['number'], 'type' => '1');
261
+		$where_array = array('reseller_id' => $accountinfo['id'], 'note' => $post['number'], 'type' => '1');
262 262
 	$this->db->where($where_array);
263
-	$flag='0';
263
+	$flag = '0';
264 264
 		$query = $this->db->get('reseller_pricing');
265
-		if($query->num_rows() > 0){
266
-	  $flag='1';
265
+		if ($query->num_rows() > 0) {
266
+	  $flag = '1';
267 267
 		}
268 268
         
269 269
 		$this->insert_reseller_pricing($accountinfo, $post);
@@ -305,21 +305,21 @@  discard block
 block discarded – undo
305 305
 	}
306 306
 
307 307
 	function delete_routes($id, $number, $pricelist_id) {
308
-		$number = "^" . $number . ".*";
308
+		$number = "^".$number.".*";
309 309
 		$where = array('pricelist_id' => $pricelist_id, 'pattern' => $number);
310 310
 		$this->db->where($where);
311 311
 		$this->db->delete('routes');
312 312
 	}
313 313
 
314 314
 	function insert_routes($post, $pricelist_id) {
315
-		$commment = "DID:" . $post['country'] . "," . $post['province'] . "," . $post['city'];
316
-		$insert_array = array('pattern' => "^" . $post['number'] . ".*", 'comment' => $commment, 'pricelist_id' => $pricelist_id,
315
+		$commment = "DID:".$post['country'].",".$post['province'].",".$post['city'];
316
+		$insert_array = array('pattern' => "^".$post['number'].".*", 'comment' => $commment, 'pricelist_id' => $pricelist_id,
317 317
 			'connectcost' => $post['connectcost'], 'includedseconds' => $post['included'], 'cost' => $post['cost'], 'inc' => $post['inc']);
318 318
 		$this->db->insert('routes', $insert_array);
319 319
 		return true;
320 320
 	}
321 321
 
322
-	function add_invoice_data($accountid,$charge_type,$description,$credit)
322
+	function add_invoice_data($accountid, $charge_type, $description, $credit)
323 323
 	{
324 324
 	$insert_array = array('accountid' => $accountid, 
325 325
 				  'charge_type' => $charge_type, 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	function check_unique_did($number)
336 336
 	{
337 337
 
338
-	  $where=array('number'=>$number);
338
+	  $where = array('number'=>$number);
339 339
 	  $query = $this->db_model->countQuery("*", "dids", $where);
340 340
 	  return $query;
341 341
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -113,8 +113,7 @@  discard block
 block discarded – undo
113 113
 			  }
114 114
 			  $this->db->limit($limit, $start);
115 115
 			  $query=$this->db->query("SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=".$accountinfo['id']." AND a.parent_id =".$accountinfo['reseller_id'].$search_string);
116
-		  }
117
-		  else{
116
+		  } else{
118 117
 			$this->db_model->build_search('did_list_search');
119 118
 			$query = $this->db_model->select("*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start);
120 119
 		  }
@@ -123,8 +122,7 @@  discard block
 block discarded – undo
123 122
 		  $query = $this->db_model->countQuery("*", "reseller_pricing", $where);
124 123
 		}
125 124
 
126
-		}
127
-		else
125
+		} else
128 126
 		{	
129 127
 		  $this->db_model->build_search('did_list_search');
130 128
 		  if ($flag) {
@@ -175,10 +173,11 @@  discard block
 block discarded – undo
175 173
 		$this->db->where("country", ucfirst($field_value));
176 174
 		$query = $this->db->get('countrycode');
177 175
 		$data = $query->result();
178
-		if ($query->num_rows > 0)
179
-			return $data[0]->id;
180
-		else
181
-			return '';
176
+		if ($query->num_rows > 0) {
177
+					return $data[0]->id;
178
+		} else {
179
+					return '';
180
+		}
182 181
 	}
183 182
 
184 183
 	function bulk_insert_dids($field_value) {
@@ -250,10 +249,11 @@  discard block
 block discarded – undo
250 249
 		$this->db->where("id", $number);
251 250
 		$this->db->or_where("number", $number);
252 251
 		$query = $this->db->get("dids");
253
-		if ($query->num_rows() > 0)
254
-			return $query->row_array();
255
-		else
256
-			return false;
252
+		if ($query->num_rows() > 0) {
253
+					return $query->row_array();
254
+		} else {
255
+					return false;
256
+		}
257 257
 	}
258 258
    function edit_did_reseller($did_id,$post) {
259 259
 		$accountinfo = $this->session->userdata('accountinfo');
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/did/controllers/did.php 2 patches
Spacing   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 		$this->load->library('csvreader');
36 36
 
37 37
 		if ($this->session->userdata('user_login') == FALSE)
38
-			redirect(base_url() . '/astpp/login');
38
+			redirect(base_url().'/astpp/login');
39 39
 	}
40 40
 
41 41
 	function did_add() {
42 42
 		$data['page_title'] = 'Create DID';
43 43
 		$data['form'] = $this->form->build_form($this->did_form->get_dids_form_fields(), '');
44 44
 		$data['country_id'] = $this->common->get_field_name('id', 'countrycode', array('country' => Common_model::$global_config['system_config']['country']));
45
-		if (!$data['country_id']) {
45
+		if ( ! $data['country_id']) {
46 46
 			$data['country_id'] = 1;
47 47
 		}
48 48
 		$this->load->view('view_did_add_edit', $data);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			$data['country_id'] = Common_model::$global_config['system_config']['country'];
65 65
 		}
66 66
 		/*         * ************************************************* */
67
-		if (!$data['country_id']) {
67
+		if ( ! $data['country_id']) {
68 68
 			$data['country_id'] = 1;
69 69
 		}
70 70
 		$edit_data['setup'] = $this->common_model->to_calculate_currency($edit_data['setup'], '', '', false, false);
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
 	function did_save() {
85 85
 		$add_array = $this->input->post();
86
-		$parent_id =isset($add_array['parent_id']) && $add_array['parent_id'] >0 ? $add_array['parent_id'] : '';
87
-		$accountid =isset($add_array['accountid']) && $add_array['accountid'] > 0 ? $add_array['accountid'] : '';
88
-		$data['form'] = $this->form->build_form($this->did_form->get_dids_form_fields($add_array['id'],$parent_id,$accountid), $add_array);
86
+		$parent_id = isset($add_array['parent_id']) && $add_array['parent_id'] > 0 ? $add_array['parent_id'] : '';
87
+		$accountid = isset($add_array['accountid']) && $add_array['accountid'] > 0 ? $add_array['accountid'] : '';
88
+		$data['form'] = $this->form->build_form($this->did_form->get_dids_form_fields($add_array['id'], $parent_id, $accountid), $add_array);
89 89
 		if ($add_array['id'] != '') {
90 90
 			$data['page_title'] = 'Edit DID';
91 91
 			if ($this->form_validation->run() == FALSE) {
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 			} else {
96 96
 				$number = $add_array['number'];
97 97
 				unset($add_array['number']);
98
-				$add_array['accountid']=isset($add_array['accountid']) ?$add_array['accountid'] : 0;
98
+				$add_array['accountid'] = isset($add_array['accountid']) ? $add_array['accountid'] : 0;
99 99
 				$add_array['setup'] = $this->common_model->add_calculate_currency($add_array['setup'], '', '', false, false);
100 100
 				$add_array['monthlycost'] = $this->common_model->add_calculate_currency($add_array['monthlycost'], '', '', false, false);
101 101
 				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
102 102
 				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
103 103
 				$this->did_model->edit_did($add_array, $add_array['id'], $number);
104
-				echo json_encode(array("SUCCESS" => $number . " DID Updated Successfully!"));
104
+				echo json_encode(array("SUCCESS" => $number." DID Updated Successfully!"));
105 105
 				exit;
106 106
 			}
107 107
 		} else {
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 				$add_array['monthlycost'] = $this->common_model->add_calculate_currency($add_array['monthlycost'], '', '', false, false);
121 121
 				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
122 122
 				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
123
-				$add_array['accountid']=isset($add_array['accountid'])?$add_array['accountid'] : 0;
123
+				$add_array['accountid'] = isset($add_array['accountid']) ? $add_array['accountid'] : 0;
124 124
 				$this->did_model->add_did($add_array);
125
-				echo json_encode(array("SUCCESS" => $add_array["number"] . " DID Added Successfully!"));
125
+				echo json_encode(array("SUCCESS" => $add_array["number"]." DID Added Successfully!"));
126 126
 				exit;
127 127
 				exit;
128 128
 			}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	function did_remove($id) {
133 133
 		$this->did_model->remove_did($id);
134 134
 		$this->session->set_flashdata('astpp_notification', 'DID Removed Successfully!');
135
-		redirect(base_url() . 'did/did_list/');
135
+		redirect(base_url().'did/did_list/');
136 136
 	}
137 137
 
138 138
 	/*
@@ -141,54 +141,54 @@  discard block
 block discarded – undo
141 141
      */
142 142
 
143 143
 	function did_list_release($id) {
144
-	 $accountinfo=$this->session->userdata('accountinfo'); 
145
-	 $this->db->where('id',$id);
144
+	 $accountinfo = $this->session->userdata('accountinfo'); 
145
+	 $this->db->where('id', $id);
146 146
 	 $this->db->select('parent_id,accountid,number');
147
-	 $did_info=(array)$this->db->get('dids')->first_row();
148
-	 if($did_info['parent_id'] > 0){
149
-	$str=$this->common->get_parent_info($did_info['parent_id'],$accountinfo['id']);
150
-	$str=rtrim($str,",");
151
-	$account_result=(array)$this->db->get_where('accounts',"id IN (".$str.")")->result_array();
152
-	foreach($account_result as $key=>$acc_row){
153
-	   $acc_row['did_number']=$did_info['number'];
147
+	 $did_info = (array)$this->db->get('dids')->first_row();
148
+	 if ($did_info['parent_id'] > 0) {
149
+	$str = $this->common->get_parent_info($did_info['parent_id'], $accountinfo['id']);
150
+	$str = rtrim($str, ",");
151
+	$account_result = (array)$this->db->get_where('accounts', "id IN (".$str.")")->result_array();
152
+	foreach ($account_result as $key=>$acc_row) {
153
+	   $acc_row['did_number'] = $did_info['number'];
154 154
 	   $this->common->mail_to_users('email_remove_did', $acc_row);
155 155
 	}
156 156
 	 }
157
-	 if($accountinfo['type'] == -1){
158
-	  $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s"));
157
+	 if ($accountinfo['type'] == -1) {
158
+	  $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00", "last_modified_date"=>gmdate("Y-m-d H:i:s"));
159 159
 	  $where = array('id' => $id);
160 160
 	  $this->db->where($where);
161 161
 	  $this->db->update('dids', $update_array);
162
-	  if($did_info['parent_id'] > 0){
163
-		$this->db->where('note',$did_info['number']);
162
+	  if ($did_info['parent_id'] > 0) {
163
+		$this->db->where('note', $did_info['number']);
164 164
 		$this->db->delete("reseller_pricing");
165 165
 	  }
166
-	  }else{
167
-	  $reseller_ids=$this->common->get_subreseller_info($accountinfo['id']);
168
-	  $reseller_ids=rtrim($reseller_ids,",");
169
-	  $where="parent_id IN ($reseller_ids)";
170
-	  $this->db->where('note',$did_info['number']);
171
-	  $this->db->delete('reseller_pricing',$where);  
166
+	  } else {
167
+	  $reseller_ids = $this->common->get_subreseller_info($accountinfo['id']);
168
+	  $reseller_ids = rtrim($reseller_ids, ",");
169
+	  $where = "parent_id IN ($reseller_ids)";
170
+	  $this->db->where('note', $did_info['number']);
171
+	  $this->db->delete('reseller_pricing', $where);  
172 172
 	  }
173
-	  if($accountinfo['type']==1){
174
-		  $update_array = array('parent_id' => $accountinfo['id'], 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s"));
175
-	  }else{
176
-	  $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s"));
173
+	  if ($accountinfo['type'] == 1) {
174
+		  $update_array = array('parent_id' => $accountinfo['id'], 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00", "last_modified_date"=>gmdate("Y-m-d H:i:s"));
175
+	  } else {
176
+	  $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00", "last_modified_date"=>gmdate("Y-m-d H:i:s"));
177 177
 	  }
178 178
 	  $where = array('id' => $id);
179 179
 	  $this->db->where($where);
180 180
 	  $this->db->update('dids', $update_array);
181
-	  $accountid=$did_info['accountid'] > 0 ? $did_info['accountid']:0;
182
-	  if($did_info['accountid'] > 0 ){
183
-	   $email_user_id=$did_info['accountid'];
184
-	  }elseif($did_info['parent_id'] > 0){
185
-	$email_user_id=$did_info['parent_id'];
181
+	  $accountid = $did_info['accountid'] > 0 ? $did_info['accountid'] : 0;
182
+	  if ($did_info['accountid'] > 0) {
183
+	   $email_user_id = $did_info['accountid'];
184
+	  }elseif ($did_info['parent_id'] > 0) {
185
+	$email_user_id = $did_info['parent_id'];
186 186
 	  }
187
-	  $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$email_user_id))->first_row();
187
+	  $accountinfo = (array)$this->db->get_where('accounts', array("id"=>$email_user_id))->first_row();
188 188
 	  $accountinfo['did_number'] = $did_info['number'];
189 189
 	  $this->common->mail_to_users('email_remove_did', $accountinfo);
190 190
 	  $this->session->set_flashdata('astpp_errormsg', 'DID Released Successfully!');
191
-	  redirect(base_url() . 'did/did_list/');
191
+	  redirect(base_url().'did/did_list/');
192 192
 	}
193 193
 
194 194
 	function did_list() {
@@ -204,33 +204,33 @@  discard block
 block discarded – undo
204 204
 		}
205 205
          
206 206
 		if ($this->session->userdata['userlevel_logintype'] == '1') {
207
-		$drp_list=array();
207
+		$drp_list = array();
208 208
 		$accountinfo = $this->session->userdata('accountinfo');
209
-		if($accountinfo['reseller_id'] > 0){
210
-		  $dids_array=$this->db->query("SELECT a.id AS id,a.number as number, b.monthlycost, b.setup FROM dids AS a, reseller_pricing AS b WHERE a.number = b.note AND b.reseller_id = ".$accountinfo['reseller_id']." AND a.parent_id =".$accountinfo['reseller_id'])->result_array();
211
-			}else{
209
+		if ($accountinfo['reseller_id'] > 0) {
210
+		  $dids_array = $this->db->query("SELECT a.id AS id,a.number as number, b.monthlycost, b.setup FROM dids AS a, reseller_pricing AS b WHERE a.number = b.note AND b.reseller_id = ".$accountinfo['reseller_id']." AND a.parent_id =".$accountinfo['reseller_id'])->result_array();
211
+			} else {
212 212
 			  $this->db->select('id,monthlycost,setup,number');
213
-			  $this->db->where('accountid',0);
214
-			  $this->db->where('parent_id',0);
215
-			  $dids_array=$this->db->get('dids')->result_array();
213
+			  $this->db->where('accountid', 0);
214
+			  $this->db->where('parent_id', 0);
215
+			  $dids_array = $this->db->get('dids')->result_array();
216 216
 			}
217
-			if(!empty($dids_array)){
217
+			if ( ! empty($dids_array)) {
218 218
 		foreach ($dids_array as $drp_value) {
219
-			if (!empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) {
219
+			if ( ! empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) {
220 220
 			$did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'], '', '', true, false);
221 221
 			} else {
222 222
 			$did_cost = 0;
223 223
 			}
224
-			if (!empty($drp_value['setup']) && $drp_value['setup'] != 0) {
224
+			if ( ! empty($drp_value['setup']) && $drp_value['setup'] != 0) {
225 225
 			$did_setup = $this->common_model->to_calculate_currency($drp_value['setup'], '', '', true, false);
226 226
 			} else {
227 227
 			$did_setup = 0;
228 228
 			}
229
-			$drp_list[$drp_value['id']] = $drp_value['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )';
229
+			$drp_list[$drp_value['id']] = $drp_value['number'].' ( Setup : '.$did_setup.')'.'( Monthly : '.$did_cost.' )';
230 230
 			/*                 * ********************************************************************************************* */
231 231
 		}
232 232
 		}
233
-	  $data['didlist'] = form_dropdown_all(array("name"=>"free_did_list","id"=>"free_did_list","class"=>"did_dropdown"), $drp_list, '');
233
+	  $data['didlist'] = form_dropdown_all(array("name"=>"free_did_list", "id"=>"free_did_list", "class"=>"did_dropdown"), $drp_list, '');
234 234
 		}
235 235
 		if ($this->session->userdata['userlevel_logintype'] == '1') {
236 236
 			$data['grid_fields'] = $this->did_form->build_did_list_for_reseller_login();
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			$this->session->set_userdata('did_list_search', $action);
271 271
 		}
272 272
 		if (@$ajax_search != 1) {
273
-			redirect(base_url() . 'did/did_list/');
273
+			redirect(base_url().'did/did_list/');
274 274
 		}
275 275
 	}
276 276
 
@@ -318,10 +318,10 @@  discard block
 block discarded – undo
318 318
  */
319 319
 	function customer_did($accountid, $accounttype) {
320 320
 		$json_data = array();
321
-		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_did'); 
322
-		$account_arr=(array)$this->db->get_where('accounts',array("id"=>$accountid))->first_row();
321
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_did'); 
322
+		$account_arr = (array)$this->db->get_where('accounts', array("id"=>$accountid))->first_row();
323 323
 		$field_name = $accounttype == "reseller" ? "parent_id" : 'accountid';
324
-	$like_str=!empty($instant_search) ? 
324
+	$like_str = ! empty($instant_search) ? 
325 325
 					"(a.note like '%$instant_search%'
326 326
 					OR  a.init_inc like '%$instant_search%'
327 327
 					OR  a.inc like '%$instant_search%'
@@ -330,32 +330,32 @@  discard block
 block discarded – undo
330 330
 					OR  a.setup like '%$instant_search%'
331 331
 					OR  a.monthlycost like '%$instant_search%'
332 332
 					OR  a.connectcost like '%$instant_search%'
333
-					    )" :null;
333
+					    )" : null;
334 334
 		if ($account_arr['reseller_id'] != 0) {
335
-		if(!empty($like_str))
335
+		if ( ! empty($like_str))
336 336
 			$this->db->where($like_str);
337
-			if($accounttype=='reseller'){
338
-		  $this->db->where('a.note','b.number',false);
339
-		  $this->db->where('a.reseller_id',$account_arr['id']);
340
-		  $this->db->where('a.parent_id',$account_arr['reseller_id']);
337
+			if ($accounttype == 'reseller') {
338
+		  $this->db->where('a.note', 'b.number', false);
339
+		  $this->db->where('a.reseller_id', $account_arr['id']);
340
+		  $this->db->where('a.parent_id', $account_arr['reseller_id']);
341 341
 		  $this->db->select('count(a.id) as count');
342
-		  $count_result=(array)$this->db->get('reseller_pricing as a,dids as b')->first_row();
342
+		  $count_result = (array)$this->db->get('reseller_pricing as a,dids as b')->first_row();
343 343
 		  $paging_data = $this->form->load_grid_config($count_result['count'], $_GET['rp'], $_GET['page']);
344 344
 		  $json_data = $paging_data["json_paging"];
345
-		  $this->db->where('a.note','b.number',false);
346
-		  $this->db->where('a.reseller_id',$account_arr['id']);
347
-		  $this->db->where('a.parent_id',$account_arr['reseller_id']);
345
+		  $this->db->where('a.note', 'b.number', false);
346
+		  $this->db->where('a.reseller_id', $account_arr['id']);
347
+		  $this->db->where('a.parent_id', $account_arr['reseller_id']);
348 348
 		  $this->db->select('a . * , b.id, a.reseller_id AS accountid,a.note as number,b.country_id as country_id');
349
-		  $this->db->limit($paging_data["paging"]["page_no"],$paging_data["paging"]["start"]);
350
-		  $query=$this->db->get('reseller_pricing as a,dids as b');
351
-		  }else{
352
-		  $count_result=(array)$this->db->query('select count(id) as count from dids where accountid='.$accountid." AND parent_id =".$account_arr['reseller_id'])->first_row();
349
+		  $this->db->limit($paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
350
+		  $query = $this->db->get('reseller_pricing as a,dids as b');
351
+		  } else {
352
+		  $count_result = (array)$this->db->query('select count(id) as count from dids where accountid='.$accountid." AND parent_id =".$account_arr['reseller_id'])->first_row();
353 353
 			  $paging_data = $this->form->load_grid_config($count_result['count'], $_GET['rp'], $_GET['page']);
354 354
 		  $json_data = $paging_data["json_paging"];
355
-			  $query=$this->db->query("SELECT a . * ,a.note as number,b.country_id as country_id,b.id FROM reseller_pricing AS a, dids AS b WHERE b.accountid =".$account_arr['id']." AND a.note = b.number AND a.reseller_id =".$account_arr['reseller_id']);
355
+			  $query = $this->db->query("SELECT a . * ,a.note as number,b.country_id as country_id,b.id FROM reseller_pricing AS a, dids AS b WHERE b.accountid =".$account_arr['id']." AND a.note = b.number AND a.reseller_id =".$account_arr['reseller_id']);
356 356
 		  }
357
-		}else{
358
-						$like_str=!empty($instant_search) ? 
357
+		} else {
358
+						$like_str = ! empty($instant_search) ? 
359 359
 												"(dids.number like '%$instant_search%'
360 360
                                                     OR dids.inc like '%$instant_search%'
361 361
                                                     OR dids.cost like '%$instant_search%'
@@ -363,14 +363,14 @@  discard block
 block discarded – undo
363 363
                                                     OR dids.setup like '%$instant_search%'
364 364
                                                     OR dids.monthlycost like '%$instant_search%'
365 365
                                                     OR dids.connectcost like '%$instant_search%'
366
-                                                        )" :null;
367
-			if(!empty($like_str))
366
+                                                        )" : null;
367
+			if ( ! empty($like_str))
368 368
 			$this->db->where($like_str);
369 369
 			$where = array($field_name => $accountid);
370 370
 			$count_all = $this->db_model->countQuery("*", "dids", $where);
371 371
 			$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
372 372
 			$json_data = $paging_data["json_paging"];
373
-			if(!empty($like_str))
373
+			if ( ! empty($like_str))
374 374
 			$this->db->where($like_str);
375 375
 			$query = $this->db_model->select("*", "dids", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
376 376
 		}
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 		$ids = $this->input->post("selected_ids", true);
383 383
 		$where = "id IN ($ids)";
384 384
 		$this->db->where($where);
385
-		$this->db->select("group_concat(concat('''',number,'''')) as number",false);
386
-		$dids_result=(array)$this->db->get('dids')->first_row();
387
-		$notes_where="note IN (".$dids_result['number'].")";
385
+		$this->db->select("group_concat(concat('''',number,'''')) as number", false);
386
+		$dids_result = (array)$this->db->get('dids')->first_row();
387
+		$notes_where = "note IN (".$dids_result['number'].")";
388 388
 		$this->db->where($notes_where);
389 389
 		$this->db->delete('reseller_pricing');
390 390
 		$this->db->where($where);
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	function did_reseller_edit($action = false, $id = false) {
400 400
 		$data['page_title'] = 'Edit DID ';
401
-		$accountinfo=$this->session->userdata('accountinfo');
401
+		$accountinfo = $this->session->userdata('accountinfo');
402 402
 		if ($action == 'edit') {
403 403
 			if (($this->input->post())) {
404 404
 				$post = $this->input->post();
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 					$accountinfo = $this->did_model->get_account($accountinfo['number']);
428 428
 					$reseller_did = $this->db_model->getSelect("*", "reseller_pricing", array('id' => $id));
429 429
 					$reseller_didinfo = (array)$reseller_did->first_row();
430
-					if (!empty($reseller_didinfo)) {
430
+					if ( ! empty($reseller_didinfo)) {
431 431
 						$reseller_didinfo['setup'] = $this->common_model->to_calculate_currency($reseller_didinfo['setup'], '', '', true, false);
432 432
 						$reseller_didinfo['monthlycost'] = $this->common_model->to_calculate_currency($reseller_didinfo['monthlycost'], '', '', true, false);
433 433
 						$reseller_didinfo['connectcost'] = $this->common_model->to_calculate_currency($reseller_didinfo['connectcost'], '', '', true, false);
@@ -441,43 +441,43 @@  discard block
 block discarded – undo
441 441
 			}
442 442
 		}
443 443
 		if ($action == 'delete') {
444
-				$this->db->where('id',$id);
444
+				$this->db->where('id', $id);
445 445
 		$this->db->select('note');
446
-			$reseller_pricing=(array)$this->db->get('reseller_pricing')->first_row();
447
-			$did_number=$reseller_pricing['note'];
448
-			$did_info=(array)$this->db->get_where('dids',array('number'=>$did_number))->first_row();
449
-			$query="select count(id) as count from reseller_pricing where id >= (select id from reseller_pricing where note =$did_number AND parent_id =".$accountinfo['reseller_id']." AND reseller_id =".$accountinfo['id'].") AND note= $did_number order by id desc";
450
-		$result=(array)$this->db->query($query)->first_row();
451
-		if($result['count'] > 0){
452
-		$str=$this->common->get_parent_info($did_info['parent_id'],$accountinfo['id']);
453
-		$str=rtrim($str,",");
454
-		$account_result=(array)$this->db->get_where('accounts',"id IN (".$str.")")->result_array();
455
-		foreach($account_result as $key=>$acc_row){
456
-		  $acc_row['did_number']=$did_info['number'];
446
+			$reseller_pricing = (array)$this->db->get('reseller_pricing')->first_row();
447
+			$did_number = $reseller_pricing['note'];
448
+			$did_info = (array)$this->db->get_where('dids', array('number'=>$did_number))->first_row();
449
+			$query = "select count(id) as count from reseller_pricing where id >= (select id from reseller_pricing where note =$did_number AND parent_id =".$accountinfo['reseller_id']." AND reseller_id =".$accountinfo['id'].") AND note= $did_number order by id desc";
450
+		$result = (array)$this->db->query($query)->first_row();
451
+		if ($result['count'] > 0) {
452
+		$str = $this->common->get_parent_info($did_info['parent_id'], $accountinfo['id']);
453
+		$str = rtrim($str, ",");
454
+		$account_result = (array)$this->db->get_where('accounts', "id IN (".$str.")")->result_array();
455
+		foreach ($account_result as $key=>$acc_row) {
456
+		  $acc_row['did_number'] = $did_info['number'];
457 457
 		  $this->common->mail_to_users('email_remove_did', $acc_row);
458 458
 		}
459
-			$reseller_ids=$this->common->get_subreseller_info($accountinfo['id']);
460
-		$reseller_ids=rtrim($reseller_ids,",");
461
-		$where="parent_id IN ($reseller_ids)";
462
-		$this->db->where('note',$did_info['number']);
463
-		$this->db->delete('reseller_pricing',$where);  
464
-		$this->db->where('reseller_id',$accountinfo['id']);
465
-		$this->db->where('note',$did_info['number']);
459
+			$reseller_ids = $this->common->get_subreseller_info($accountinfo['id']);
460
+		$reseller_ids = rtrim($reseller_ids, ",");
461
+		$where = "parent_id IN ($reseller_ids)";
462
+		$this->db->where('note', $did_info['number']);
463
+		$this->db->delete('reseller_pricing', $where);  
464
+		$this->db->where('reseller_id', $accountinfo['id']);
465
+		$this->db->where('note', $did_info['number']);
466 466
 		$this->db->delete('reseller_pricing');  
467 467
 		}
468
-		$this->db->where('number',$did_number);
468
+		$this->db->where('number', $did_number);
469 469
 		$this->db->select('accountid');
470
-		$did_array=(array)$this->db->get('dids')->first_row();
471
-		if($did_array['accountid'] > 0){
472
-		 $customer_info=(array)$this->db->get_where('accounts',array('id'=>$did_array['accountid']))->first_row();
473
-		 $customer_info['did_number']=$did_number;
470
+		$did_array = (array)$this->db->get('dids')->first_row();
471
+		if ($did_array['accountid'] > 0) {
472
+		 $customer_info = (array)$this->db->get_where('accounts', array('id'=>$did_array['accountid']))->first_row();
473
+		 $customer_info['did_number'] = $did_number;
474 474
 		 $this->common->mail_to_users('email_remove_did', $customer_info);
475 475
 		}
476
-		$did_array=array("accountid"=>0,"parent_id"=>$accountinfo['reseller_id'], "assign_date" => "0000-00-00 00:00:00", "charge_upto" => "0000-00-00 00:00:00");
477
-		$this->db->where('number',$did_number);
478
-		$this->db->update('dids',$did_array);
476
+		$did_array = array("accountid"=>0, "parent_id"=>$accountinfo['reseller_id'], "assign_date" => "0000-00-00 00:00:00", "charge_upto" => "0000-00-00 00:00:00");
477
+		$this->db->where('number', $did_number);
478
+		$this->db->update('dids', $did_array);
479 479
 			$this->session->set_flashdata('astpp_notification', 'DID Removed Successfully!');
480
-			redirect(base_url() . 'did/did_list/');
480
+			redirect(base_url().'did/did_list/');
481 481
 		}
482 482
 	}
483 483
 
@@ -486,37 +486,37 @@  discard block
 block discarded – undo
486 486
 		$accountinfo = $this->session->userdata('accountinfo');
487 487
 		$where = array('id' => $accountinfo['id']);
488 488
 		$account = $this->db_model->getSelect("*", "accounts", $where);
489
-		$currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$accountinfo['currency_id']));
490
-		$accountinfo= (array)$account->first_row();
489
+		$currency_name = $this->common->get_field_name('currency', "currency", array('id'=>$accountinfo['currency_id']));
490
+		$accountinfo = (array)$account->first_row();
491 491
 		if (($this->input->post())) {
492 492
 			$post = $this->input->post();
493 493
 			if (isset($post['free_did_list']) && $post['free_did_list'] != '') {
494 494
 				// For deduction of admin price to reseller
495 495
 				$didinfo = $this->did_model->get_did_by_number($post['free_did_list']);
496
-				if($accountinfo['reseller_id'] > 0 ){
497
-				$reseller_pricing_query = $this->db_model->getSelect("call_type,setup,extensions,monthlycost,connectcost,includedseconds,cost,inc", "reseller_pricing", array("note" => $didinfo['number'],'reseller_id'=>$accountinfo['reseller_id']));
496
+				if ($accountinfo['reseller_id'] > 0) {
497
+				$reseller_pricing_query = $this->db_model->getSelect("call_type,setup,extensions,monthlycost,connectcost,includedseconds,cost,inc", "reseller_pricing", array("note" => $didinfo['number'], 'reseller_id'=>$accountinfo['reseller_id']));
498 498
 				   $reseller_pricing_result = (array)$reseller_pricing_query->first_row();
499
-				   $didinfo['call_type']=$reseller_pricing_result['call_type'];
500
-				   $didinfo['extensions']=$reseller_pricing_result['extensions'];
501
-				   $didinfo['setup']=$reseller_pricing_result['setup'];
502
-				   $didinfo['monthlycost']=$reseller_pricing_result['monthlycost'];
503
-				   $didinfo['connectcost']=$reseller_pricing_result['connectcost'];
504
-				   $didinfo['includedseconds']=$reseller_pricing_result['includedseconds'];
505
-				   $didinfo['cost']=$reseller_pricing_result['cost'];
506
-				   $didinfo['inc']=$reseller_pricing_result['inc'];
499
+				   $didinfo['call_type'] = $reseller_pricing_result['call_type'];
500
+				   $didinfo['extensions'] = $reseller_pricing_result['extensions'];
501
+				   $didinfo['setup'] = $reseller_pricing_result['setup'];
502
+				   $didinfo['monthlycost'] = $reseller_pricing_result['monthlycost'];
503
+				   $didinfo['connectcost'] = $reseller_pricing_result['connectcost'];
504
+				   $didinfo['includedseconds'] = $reseller_pricing_result['includedseconds'];
505
+				   $didinfo['cost'] = $reseller_pricing_result['cost'];
506
+				   $didinfo['inc'] = $reseller_pricing_result['inc'];
507 507
 				}
508 508
 				$available_bal = $this->db_model->get_available_bal($accountinfo);
509 509
 				 $accountinfo['did_number'] = $didinfo['number'];
510 510
 		 $accountinfo['did_country_id'] = $didinfo['country_id'];
511
-		 $accountinfo['did_setup'] = $this->common_model->calculate_currency($didinfo['setup'],'',$currency_name,true,true);
512
-		 $accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($didinfo['monthlycost'],'',$currency_name,true,true);
511
+		 $accountinfo['did_setup'] = $this->common_model->calculate_currency($didinfo['setup'], '', $currency_name, true, true);
512
+		 $accountinfo['did_monthlycost'] = $this->common_model->calculate_currency($didinfo['monthlycost'], '', $currency_name, true, true);
513 513
 		 $accountinfo['did_maxchannels'] = $didinfo['maxchannels'];
514 514
 				if ($available_bal >= $didinfo["setup"]) {
515 515
 					$available_bal = $this->db_model->update_balance($didinfo['setup'], $accountinfo['id'], "debit");
516
-					$this->db_model->update("dids", array('parent_id' => $accountinfo['id'],"assign_date"=>gmdate("Y-m-d H:i:s")), array("id" => $didinfo['id']));
516
+					$this->db_model->update("dids", array('parent_id' => $accountinfo['id'], "assign_date"=>gmdate("Y-m-d H:i:s")), array("id" => $didinfo['id']));
517 517
 					$this->did_model->insert_reseller_pricing($accountinfo, $didinfo);
518
-					$this->common->add_invoice_details($accountinfo,"DIDCHRG",$didinfo['setup'],$didinfo['number']);
519
-					$this->common->mail_to_users('email_add_did', $accountinfo,"",$didinfo['number']);
518
+					$this->common->add_invoice_details($accountinfo, "DIDCHRG", $didinfo['setup'], $didinfo['number']);
519
+					$this->common->mail_to_users('email_add_did', $accountinfo, "", $didinfo['number']);
520 520
 					$this->session->set_flashdata('astpp_errormsg', 'DID Purchased Successfully.');
521 521
 				} else {
522 522
 					$this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did');
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 				$this->session->set_flashdata('astpp_notification', 'Please Select DID.');
526 526
 			}
527 527
 		}
528
-		redirect(base_url() . 'did/did_list/');
528
+		redirect(base_url().'did/did_list/');
529 529
 		exit;
530 530
 	}
531 531
 
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
 
548 548
 	function did_download_sample_file($file_name) {
549 549
 		$this->load->helper('download');
550
-		$full_path = base_url() . "assets/Rates_File/" . $file_name . ".csv";
551
-		$arrContextOptions=array(
550
+		$full_path = base_url()."assets/Rates_File/".$file_name.".csv";
551
+		$arrContextOptions = array(
552 552
 			"ssl"=>array(
553 553
 			"verify_peer"=>false,
554 554
 			"verify_peer_name"=>false,
@@ -567,28 +567,28 @@  discard block
 block discarded – undo
567 567
 		$this->session->set_userdata('import_did_rate_csv', "");
568 568
 		$error_data = $this->session->userdata('import_did_csv_error');
569 569
 		$full_path = $this->config->item('rates-file-path');
570
-		if (file_exists($full_path . $error_data) && $error_data != "") {
571
-			unlink($full_path . $error_data);
570
+		if (file_exists($full_path.$error_data) && $error_data != "") {
571
+			unlink($full_path.$error_data);
572 572
 			$this->session->set_userdata('import_did_csv_error', "");
573 573
 		}
574
-		$accountinfo=$this->session->userdata('accountinfo');
575
-		$this->db->where('id',$accountinfo['currency_id']);
574
+		$accountinfo = $this->session->userdata('accountinfo');
575
+		$this->db->where('id', $accountinfo['currency_id']);
576 576
 		$this->db->select('currency');
577
-		$currency_info=(array)$this->db->get('currency')->first_row();
578
-		$data['fields']="DID,Country,Account,Per Minute Cost(".$currency_info['currency']."),Initial Increment,Increment,Setup Fee(".$currency_info['currency']."),Monthly Fee(".$currency_info['currency']."),Call Type,Destination,Status";
577
+		$currency_info = (array)$this->db->get('currency')->first_row();
578
+		$data['fields'] = "DID,Country,Account,Per Minute Cost(".$currency_info['currency']."),Initial Increment,Increment,Setup Fee(".$currency_info['currency']."),Monthly Fee(".$currency_info['currency']."),Call Type,Destination,Status";
579 579
 		$this->load->view('view_import_did', $data);
580 580
 	}
581 581
 
582 582
 	function did_preview_file() {
583 583
 		$data['page_title'] = 'Import DIDs';
584 584
 		$config_did_array = $this->config->item('DID-rates-field');
585
-		$accountinfo=$this->session->userdata('accountinfo');
586
-		$this->db->where('id',$accountinfo['currency_id']);
585
+		$accountinfo = $this->session->userdata('accountinfo');
586
+		$this->db->where('id', $accountinfo['currency_id']);
587 587
 		$this->db->select('currency');
588
-		$currency_info=(array)$this->db->get('currency')->first_row();
589
-		foreach($config_did_array as $key=>$value){
588
+		$currency_info = (array)$this->db->get('currency')->first_row();
589
+		foreach ($config_did_array as $key=>$value) {
590 590
 		 $key = str_replace('CURRENCY', $currency_info['currency'], $key);
591
-		 $did_fields_array[$key]=$value;
591
+		 $did_fields_array[$key] = $value;
592 592
 		}
593 593
 		$check_header = $this->input->post('check_header', true);
594 594
 		$invalid_flag = false;
@@ -599,10 +599,10 @@  discard block
 block discarded – undo
599 599
 				if ($error == 0) {
600 600
 					$uploadedFile = $_FILES["didimport"]["tmp_name"];
601 601
 					$full_path = $this->config->item('rates-file-path');
602
-					$actual_file_name = "ASTPP-DIDs-" . date("Y-m-d H:i:s") . "." . $ext;
603
-					if (move_uploaded_file($uploadedFile, $full_path . $actual_file_name)) {
602
+					$actual_file_name = "ASTPP-DIDs-".date("Y-m-d H:i:s").".".$ext;
603
+					if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) {
604 604
 						$data['page_title'] = 'Import DIDs Preview';
605
-						$data['csv_tmp_data'] = $this->csvreader->parse_file($full_path . $actual_file_name, $did_fields_array, $check_header);
605
+						$data['csv_tmp_data'] = $this->csvreader->parse_file($full_path.$actual_file_name, $did_fields_array, $check_header);
606 606
 						$data['provider_id'] = $_POST['provider_id'];
607 607
 						$data['check_header'] = $check_header;
608 608
 						$this->session->set_userdata('import_did_rate_csv', $actual_file_name);
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		if ($invalid_flag) {
620 620
 			$str = '';
621 621
 			if (empty($_FILES['didimport']['name'])) {
622
-				$str.= '<br/>Please Select  File.';
622
+				$str .= '<br/>Please Select  File.';
623 623
 			}
624 624
 			$data['error'] = $str;
625 625
 		}
@@ -630,32 +630,32 @@  discard block
 block discarded – undo
630 630
 		$new_final_arr = array();
631 631
 		$invalid_array = array();
632 632
 		$new_final_arr_key = $this->config->item('DID-rates-field');
633
-		$accountinfo=$this->session->userdata('accountinfo');
634
-		$reseller_id = $accountinfo['type']==1 ? $accountinfo['id']: 0;
633
+		$accountinfo = $this->session->userdata('accountinfo');
634
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
635 635
 	
636 636
 		$full_path = $this->config->item('rates-file-path');
637 637
 		$did_file_name = $this->session->userdata('import_did_rate_csv');
638
-		$csv_tmp_data = $this->csvreader->parse_file($full_path . $did_file_name, $new_final_arr_key, $check_header);
638
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$did_file_name, $new_final_arr_key, $check_header);
639 639
 		$flag = false;
640 640
 		$i = 0;
641 641
 		$number_arr = array();
642
-		$reseller_array=array();
643
-		$final_reseller_array=array();
642
+		$reseller_array = array();
643
+		$final_reseller_array = array();
644 644
 		foreach ($csv_tmp_data as $key => $csv_data) {
645 645
         
646 646
 			if (isset($csv_data['number']) && $csv_data['number'] != '' && $i != 0) {
647 647
 				$str = null;
648
-				if(isset($csv_data['call_type'])){
649
-					if(strtolower($csv_data['call_type']) == 'sip-did'){
648
+				if (isset($csv_data['call_type'])) {
649
+					if (strtolower($csv_data['call_type']) == 'sip-did') {
650 650
 						$call_type = '3';
651
-					} else if(strtolower($csv_data['call_type']) == 'did-local'){
651
+					} else if (strtolower($csv_data['call_type']) == 'did-local') {
652 652
 						$call_type = '1';
653
-					} else if(strtolower($csv_data['call_type']) == 'other'){
653
+					} else if (strtolower($csv_data['call_type']) == 'other') {
654 654
 						$call_type = '2';
655 655
 					} else {
656 656
 						$call_type = '0';
657 657
 					}
658
-				} else{
658
+				} else {
659 659
 					$call_type = '0';
660 660
 				}
661 661
 				$csv_data['accountid'] = isset($csv_data['accountid']) ? $csv_data['accountid'] : 0;
@@ -664,77 +664,77 @@  discard block
 block discarded – undo
664 664
 				$csv_data['call_type'] = $call_type;
665 665
 				$csv_data['extensions'] = isset($csv_data['extensions']) ? $csv_data['extensions'] : '';
666 666
 				$csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0;
667
-				$csv_data['cost'] = !empty($csv_data['cost']) && is_numeric($csv_data['cost']) && $csv_data['cost'] ? $csv_data['cost'] : 0;
668
-				$csv_data['setup'] = !empty($csv_data['setup']) && is_numeric($csv_data['setup']) && $csv_data['setup'] > 0 ? $csv_data['setup'] : 0;
669
-				$csv_data['monthlycost'] = !empty($csv_data['monthlycost']) && is_numeric($csv_data['monthlycost']) && $csv_data['monthlycost'] > 0 ? $csv_data['monthlycost'] : 0;
670
-				$csv_data['connectcost'] = !empty($csv_data['connectcost']) && is_numeric($csv_data['connectcost']) && $csv_data['connectcost'] > 0 ? $csv_data['connectcost'] : 0;
667
+				$csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) && $csv_data['cost'] ? $csv_data['cost'] : 0;
668
+				$csv_data['setup'] = ! empty($csv_data['setup']) && is_numeric($csv_data['setup']) && $csv_data['setup'] > 0 ? $csv_data['setup'] : 0;
669
+				$csv_data['monthlycost'] = ! empty($csv_data['monthlycost']) && is_numeric($csv_data['monthlycost']) && $csv_data['monthlycost'] > 0 ? $csv_data['monthlycost'] : 0;
670
+				$csv_data['connectcost'] = ! empty($csv_data['connectcost']) && is_numeric($csv_data['connectcost']) && $csv_data['connectcost'] > 0 ? $csv_data['connectcost'] : 0;
671 671
 				$csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0;
672 672
 				$str = $this->data_validate($csv_data);
673 673
 				if ($str != "") {
674 674
 					$invalid_array[$i] = $csv_data;
675 675
 					$invalid_array[$i]['error'] = $str;
676 676
 				} else {
677
-					if (!in_array($csv_data['number'], $number_arr)) {
677
+					if ( ! in_array($csv_data['number'], $number_arr)) {
678 678
 						$number_count = $this->db_model->countQuery('id', 'dids', array('number' => $csv_data['number']));
679 679
 						if ($number_count > 0) {
680 680
 							$invalid_array[$i] = $csv_data;
681 681
 							$invalid_array[$i]['error'] = 'Duplicate DID found from database';
682 682
 						} else {
683
-							if($csv_data['accountid'] > 0 && $csv_data['setup'] > 0){
683
+							if ($csv_data['accountid'] > 0 && $csv_data['setup'] > 0) {
684 684
 						  $this->db->where('type IN(0,1,3)');
685
-						  $this->db->where('reseller_id',0);
686
-						  $this->db->where('deleted',0);
687
-						  $this->db->where('status',0);
688
-				  $account_info=(array)$this->db->get_where('accounts',array("number"=>$csv_data['accountid']))->first_row();
689
-				  if($account_info){
690
-					  $account_balance=$this->db_model->get_available_bal($account_info);
685
+						  $this->db->where('reseller_id', 0);
686
+						  $this->db->where('deleted', 0);
687
+						  $this->db->where('status', 0);
688
+				  $account_info = (array)$this->db->get_where('accounts', array("number"=>$csv_data['accountid']))->first_row();
689
+				  if ($account_info) {
690
+					  $account_balance = $this->db_model->get_available_bal($account_info);
691 691
 					  $setup = $this->common_model->add_calculate_currency($csv_data['setup'], '', '', false, false);
692
-					  if($account_balance >= $setup){
693
-						$field_name=$account_info['type']==1 ? 'parent_id':'accountid';
694
-						$currency_name=$this->common->get_field_name('currency',"currency",array('id'=>$account_info['currency_id']));
692
+					  if ($account_balance >= $setup) {
693
+						$field_name = $account_info['type'] == 1 ? 'parent_id' : 'accountid';
694
+						$currency_name = $this->common->get_field_name('currency', "currency", array('id'=>$account_info['currency_id']));
695 695
 					$csv_data['monthlycost'] = $this->common_model->add_calculate_currency($csv_data['monthlycost'], '', '', false, false);
696 696
 					$csv_data['cost'] = $this->common_model->add_calculate_currency($csv_data['cost'], '', '', false, false);
697 697
 					$csv_data['connectcost'] = $this->common_model->add_calculate_currency($csv_data['connectcost'], '', '', false, false);
698
-					$csv_data['setup']=$setup;
699
-					$csv_data[$field_name]=$account_info['id'];
700
-					$csv_data['status']=$this->common->get_import_status($csv_data['status']);
701
-					$available_bal = $this->db_model->update_balance($csv_data["setup"],$account_info['id'], "debit");
698
+					$csv_data['setup'] = $setup;
699
+					$csv_data[$field_name] = $account_info['id'];
700
+					$csv_data['status'] = $this->common->get_import_status($csv_data['status']);
701
+					$available_bal = $this->db_model->update_balance($csv_data["setup"], $account_info['id'], "debit");
702 702
 					$account_info['did_number'] = $csv_data['number'];
703 703
 					$account_info['did_country_id'] = $csv_data['country_id'];
704
-					$account_info['did_setup'] = $this->common_model->calculate_currency($csv_data['setup'],'',$currency_name,true,true);
705
-					$account_info['did_monthlycost'] = $this->common_model->calculate_currency($csv_data['monthlycost'],'',$currency_name,true,true);
704
+					$account_info['did_setup'] = $this->common_model->calculate_currency($csv_data['setup'], '', $currency_name, true, true);
705
+					$account_info['did_monthlycost'] = $this->common_model->calculate_currency($csv_data['monthlycost'], '', $currency_name, true, true);
706 706
 					$account_info['did_maxchannels'] = "0";
707
-					$csv_data['country_id']=$this->common->get_field_name('id','countrycode',array("country"=>$csv_data['country_id']));
708
-					if($account_info['type']==1){
709
-					 $reseller_array=$csv_data;
710
-					 $reseller_array['note']=$csv_data['number'];
711
-					 $reseller_array['reseller_id']=$account_info['id'];
712
-					 $reseller_array['parent_id']=$account_info['reseller_id'];
713
-					 $reseller_array['assign_date']=gmdate("Y-m-d H:i:s");
714
-					 unset($reseller_array['number'],$csv_data['accountid'],$reseller_array['accountid'],$reseller_array['country_id'],$reseller_array['init_inc']);
715
-					 $csv_data['accountid']=0;
716
-					 $final_reseller_array[$i]=$reseller_array;
717
-					}else{
718
-					  $csv_data['parent_id']=0;
707
+					$csv_data['country_id'] = $this->common->get_field_name('id', 'countrycode', array("country"=>$csv_data['country_id']));
708
+					if ($account_info['type'] == 1) {
709
+					 $reseller_array = $csv_data;
710
+					 $reseller_array['note'] = $csv_data['number'];
711
+					 $reseller_array['reseller_id'] = $account_info['id'];
712
+					 $reseller_array['parent_id'] = $account_info['reseller_id'];
713
+					 $reseller_array['assign_date'] = gmdate("Y-m-d H:i:s");
714
+					 unset($reseller_array['number'], $csv_data['accountid'], $reseller_array['accountid'], $reseller_array['country_id'], $reseller_array['init_inc']);
715
+					 $csv_data['accountid'] = 0;
716
+					 $final_reseller_array[$i] = $reseller_array;
717
+					} else {
718
+					  $csv_data['parent_id'] = 0;
719 719
 					}
720
-					$csv_data['assign_date']=gmdate("Y-m-d H:i:s");
720
+					$csv_data['assign_date'] = gmdate("Y-m-d H:i:s");
721 721
 					$new_final_arr[$i] = $csv_data;
722 722
 					$this->common->mail_to_users('email_add_did', $account_info);
723
-					  }else{
723
+					  } else {
724 724
 					$invalid_array[$i] = $csv_data;
725 725
 					$invalid_array[$i]['error'] = 'Account have not sufficient amount to purchase this DID.';
726 726
 					  }
727
-				  }else{
727
+				  } else {
728 728
 				$invalid_array[$i] = $csv_data;
729 729
 				$invalid_array[$i]['error'] = 'Account not found or assign to invalid account';
730 730
 				  }
731
-							}else{
731
+							} else {
732 732
 				  $csv_data['setup'] = $this->common_model->add_calculate_currency($csv_data['setup'], '', '', false, false);
733 733
 				  $csv_data['monthlycost'] = $this->common_model->add_calculate_currency($csv_data['monthlycost'], '', '', false, false);
734 734
 				  $csv_data['cost'] = $this->common_model->add_calculate_currency($csv_data['cost'], '', '', false, false);
735 735
 				  $csv_data['connectcost'] = $this->common_model->add_calculate_currency($csv_data['connectcost'], '', '', false, false);
736
-				  $csv_data['accountid']=0;
737
-				  $csv_data['country_id']=$this->common->get_field_name('id','countrycode',array("country"=>$csv_data['country_id']));
736
+				  $csv_data['accountid'] = 0;
737
+				  $csv_data['country_id'] = $this->common->get_field_name('id', 'countrycode', array("country"=>$csv_data['country_id']));
738 738
 				  $new_final_arr[$i] = $csv_data;
739 739
 							}
740 740
 						}
@@ -747,17 +747,17 @@  discard block
 block discarded – undo
747 747
 			}
748 748
 			$i++;
749 749
 		}
750
-		if (!empty($new_final_arr)) {
750
+		if ( ! empty($new_final_arr)) {
751 751
 		   $result = $this->did_model->bulk_insert_dids($new_final_arr);
752 752
 		}
753
-		if(!empty($final_reseller_array)){
753
+		if ( ! empty($final_reseller_array)) {
754 754
 			$this->db->insert_batch('reseller_pricing', $final_reseller_array);
755 755
 		}
756 756
 	unlink($full_path.$did_file_name);
757 757
 		$count = count($invalid_array);
758 758
 		if ($count > 0) {
759 759
 			$session_id = "-1";
760
-			$fp = fopen($full_path . $session_id . '.csv', 'w');
760
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
761 761
 			foreach ($new_final_arr_key as $key => $value) {
762 762
 				$custom_array[0][$key] = ucfirst($key);
763 763
 			}
@@ -767,16 +767,16 @@  discard block
 block discarded – undo
767 767
 				fputcsv($fp, $err_data);
768 768
 			}
769 769
 			fclose($fp);
770
-			$this->session->set_userdata('import_did_csv_error', $session_id . ".csv");
770
+			$this->session->set_userdata('import_did_csv_error', $session_id.".csv");
771 771
 			$data["error"] = $invalid_array;
772 772
 			$data['provider_id'] = $provider_id;
773
-			$data['import_record_count'] = count($new_final_arr)+count($reseller_array);
773
+			$data['import_record_count'] = count($new_final_arr) + count($reseller_array);
774 774
 			$data['failure_count'] = count($invalid_array) - 1;
775 775
 			$data['page_title'] = 'DID Import Error';
776 776
 			$this->load->view('view_import_error', $data);
777 777
 		} else {
778
-			$this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' DIDs Imported Successfully!');
779
-			redirect(base_url() . "did/did_list/");
778
+			$this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' DIDs Imported Successfully!');
779
+			redirect(base_url()."did/did_list/");
780 780
 		}
781 781
 	}
782 782
 
@@ -785,17 +785,17 @@  discard block
 block discarded – undo
785 785
 		$alpha_regex = "/^[a-z ,.'-]+$/i";
786 786
 		$alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i";
787 787
 		$email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/";
788
-		$str.= $csvdata['number'] != '' ? null : 'Number,';
788
+		$str .= $csvdata['number'] != '' ? null : 'Number,';
789 789
 		$str = rtrim($str, ',');
790
-		if (!$str) {
791
-			$str.= is_numeric($csvdata['number']) ? null : 'Number,';
792
-			$str.=!empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : ( empty($csvdata['connectcost']) ? null : 'Connect Cost,');
793
-			$str.=!empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : ( empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
790
+		if ( ! $str) {
791
+			$str .= is_numeric($csvdata['number']) ? null : 'Number,';
792
+			$str .= ! empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : (empty($csvdata['connectcost']) ? null : 'Connect Cost,');
793
+			$str .= ! empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : (empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
794 794
 			if ($str) {
795 795
 				$str = rtrim($str, ',');
796 796
 				$error_field = explode(',', $str);
797 797
 				$count = count($error_field);
798
-				$str.= $count > 1 ? ' are not valid' : ' is not Valid';
798
+				$str .= $count > 1 ? ' are not valid' : ' is not Valid';
799 799
 				return $str;
800 800
 			} else {
801 801
 				return false;
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 			$str = rtrim($str, ',');
805 805
 			$error_field = explode(',', $str);
806 806
 			$count = count($error_field);
807
-			$str.= $count > 1 ? ' are required' : ' is Required';
807
+			$str .= $count > 1 ? ' are required' : ' is Required';
808 808
 			return $str;
809 809
 		}
810 810
 	}
@@ -813,38 +813,38 @@  discard block
 block discarded – undo
813 813
 		$this->load->helper('download');
814 814
 		$error_data = $this->session->userdata('import_did_csv_error');
815 815
 		$full_path = $this->config->item('rates-file-path');
816
-		$data = file_get_contents($full_path . $error_data);
816
+		$data = file_get_contents($full_path.$error_data);
817 817
 		force_download("error_did_rates.csv", $data);
818 818
 	}
819 819
 
820 820
 	function did_export_data_xls() {
821 821
 	$account_info = $accountinfo = $this->session->userdata('accountinfo');
822
-	$currency_id=$account_info['currency_id'];
823
-	$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
822
+	$currency_id = $account_info['currency_id'];
823
+	$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
824 824
 	$query = $this->did_model->getdid_list(true, '0', '10000000');
825 825
 	ob_clean();
826
-	$outbound_array[] = array("DID", "Country", "Account","Per Minute Cost($currency)","Initial Increment","Increment","Setup Fee($currency)","Monthly Fee($currency)","Call Type","Destination","Status","Modified Date","Is Purchased");
826
+	$outbound_array[] = array("DID", "Country", "Account", "Per Minute Cost($currency)", "Initial Increment", "Increment", "Setup Fee($currency)", "Monthly Fee($currency)", "Call Type", "Destination", "Status", "Modified Date", "Is Purchased");
827 827
 	if ($query->num_rows() > 0) {
828 828
 	  foreach ($query->result_array() as $row) {
829 829
 		$outbound_array[] = array(
830 830
 		$row['number'],
831 831
 		$this->common->get_field_name("country", "countrycode", $row['country_id']),
832 832
 		$this->common->get_field_name("number", "accounts", $row['accountid']),
833
-		$this->common_model->calculate_currency($row['cost'], '', '',true, false),
833
+		$this->common_model->calculate_currency($row['cost'], '', '', true, false),
834 834
 		$row['init_inc'],
835 835
 		$row['inc'],
836
-		$this->common_model->calculate_currency($row['setup'], '', '',true, false),
837
-		$this->common_model->calculate_currency($row['monthlycost'], '', '',true, false),
838
-		$this->common->get_call_type("","",$row['call_type']),
836
+		$this->common_model->calculate_currency($row['setup'], '', '', true, false),
837
+		$this->common_model->calculate_currency($row['monthlycost'], '', '', true, false),
838
+		$this->common->get_call_type("", "", $row['call_type']),
839 839
 		$row['extensions'],
840
-		$this->common->get_status('export','',$row['status']),
840
+		$this->common->get_status('export', '', $row['status']),
841 841
 		$row['last_modified_date'],
842 842
 		$this->common->check_did_avl_export($row['number'])
843 843
 		);
844 844
 	  }
845 845
 	}
846 846
 		$this->load->helper('csv');
847
-		array_to_csv($outbound_array, 'DIDs_' . date("Y-m-d") . '.csv');
847
+		array_to_csv($outbound_array, 'DIDs_'.date("Y-m-d").'.csv');
848 848
 	}
849 849
 
850 850
 }
Please login to merge, or discard this patch.
Braces   +22 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 		$this->load->model('did_model');
35 35
 		$this->load->library('csvreader');
36 36
 
37
-		if ($this->session->userdata('user_login') == FALSE)
38
-			redirect(base_url() . '/astpp/login');
37
+		if ($this->session->userdata('user_login') == FALSE) {
38
+					redirect(base_url() . '/astpp/login');
39
+		}
39 40
 	}
40 41
 
41 42
 	function did_add() {
@@ -163,7 +164,7 @@  discard block
 block discarded – undo
163 164
 		$this->db->where('note',$did_info['number']);
164 165
 		$this->db->delete("reseller_pricing");
165 166
 	  }
166
-	  }else{
167
+	  } else{
167 168
 	  $reseller_ids=$this->common->get_subreseller_info($accountinfo['id']);
168 169
 	  $reseller_ids=rtrim($reseller_ids,",");
169 170
 	  $where="parent_id IN ($reseller_ids)";
@@ -172,7 +173,7 @@  discard block
 block discarded – undo
172 173
 	  }
173 174
 	  if($accountinfo['type']==1){
174 175
 		  $update_array = array('parent_id' => $accountinfo['id'], 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s"));
175
-	  }else{
176
+	  } else{
176 177
 	  $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s"));
177 178
 	  }
178 179
 	  $where = array('id' => $id);
@@ -181,7 +182,7 @@  discard block
 block discarded – undo
181 182
 	  $accountid=$did_info['accountid'] > 0 ? $did_info['accountid']:0;
182 183
 	  if($did_info['accountid'] > 0 ){
183 184
 	   $email_user_id=$did_info['accountid'];
184
-	  }elseif($did_info['parent_id'] > 0){
185
+	  } elseif($did_info['parent_id'] > 0){
185 186
 	$email_user_id=$did_info['parent_id'];
186 187
 	  }
187 188
 	  $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$email_user_id))->first_row();
@@ -208,7 +209,7 @@  discard block
 block discarded – undo
208 209
 		$accountinfo = $this->session->userdata('accountinfo');
209 210
 		if($accountinfo['reseller_id'] > 0){
210 211
 		  $dids_array=$this->db->query("SELECT a.id AS id,a.number as number, b.monthlycost, b.setup FROM dids AS a, reseller_pricing AS b WHERE a.number = b.note AND b.reseller_id = ".$accountinfo['reseller_id']." AND a.parent_id =".$accountinfo['reseller_id'])->result_array();
211
-			}else{
212
+			} else{
212 213
 			  $this->db->select('id,monthlycost,setup,number');
213 214
 			  $this->db->where('accountid',0);
214 215
 			  $this->db->where('parent_id',0);
@@ -332,8 +333,9 @@  discard block
 block discarded – undo
332 333
 					OR  a.connectcost like '%$instant_search%'
333 334
 					    )" :null;
334 335
 		if ($account_arr['reseller_id'] != 0) {
335
-		if(!empty($like_str))
336
-			$this->db->where($like_str);
336
+		if(!empty($like_str)) {
337
+					$this->db->where($like_str);
338
+		}
337 339
 			if($accounttype=='reseller'){
338 340
 		  $this->db->where('a.note','b.number',false);
339 341
 		  $this->db->where('a.reseller_id',$account_arr['id']);
@@ -348,13 +350,13 @@  discard block
 block discarded – undo
348 350
 		  $this->db->select('a . * , b.id, a.reseller_id AS accountid,a.note as number,b.country_id as country_id');
349 351
 		  $this->db->limit($paging_data["paging"]["page_no"],$paging_data["paging"]["start"]);
350 352
 		  $query=$this->db->get('reseller_pricing as a,dids as b');
351
-		  }else{
353
+		  } else{
352 354
 		  $count_result=(array)$this->db->query('select count(id) as count from dids where accountid='.$accountid." AND parent_id =".$account_arr['reseller_id'])->first_row();
353 355
 			  $paging_data = $this->form->load_grid_config($count_result['count'], $_GET['rp'], $_GET['page']);
354 356
 		  $json_data = $paging_data["json_paging"];
355 357
 			  $query=$this->db->query("SELECT a . * ,a.note as number,b.country_id as country_id,b.id FROM reseller_pricing AS a, dids AS b WHERE b.accountid =".$account_arr['id']." AND a.note = b.number AND a.reseller_id =".$account_arr['reseller_id']);
356 358
 		  }
357
-		}else{
359
+		} else{
358 360
 						$like_str=!empty($instant_search) ? 
359 361
 												"(dids.number like '%$instant_search%'
360 362
                                                     OR dids.inc like '%$instant_search%'
@@ -364,14 +366,16 @@  discard block
 block discarded – undo
364 366
                                                     OR dids.monthlycost like '%$instant_search%'
365 367
                                                     OR dids.connectcost like '%$instant_search%'
366 368
                                                         )" :null;
367
-			if(!empty($like_str))
368
-			$this->db->where($like_str);
369
+			if(!empty($like_str)) {
370
+						$this->db->where($like_str);
371
+			}
369 372
 			$where = array($field_name => $accountid);
370 373
 			$count_all = $this->db_model->countQuery("*", "dids", $where);
371 374
 			$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
372 375
 			$json_data = $paging_data["json_paging"];
373
-			if(!empty($like_str))
374
-			$this->db->where($like_str);
376
+			if(!empty($like_str)) {
377
+						$this->db->where($like_str);
378
+			}
375 379
 			$query = $this->db_model->select("*", "dids", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
376 380
 		}
377 381
 		$did_grid_fields = json_decode($this->did_form->build_did_list_for_customer($accountid, $accounttype));
@@ -714,21 +718,21 @@  discard block
 block discarded – undo
714 718
 					 unset($reseller_array['number'],$csv_data['accountid'],$reseller_array['accountid'],$reseller_array['country_id'],$reseller_array['init_inc']);
715 719
 					 $csv_data['accountid']=0;
716 720
 					 $final_reseller_array[$i]=$reseller_array;
717
-					}else{
721
+					} else{
718 722
 					  $csv_data['parent_id']=0;
719 723
 					}
720 724
 					$csv_data['assign_date']=gmdate("Y-m-d H:i:s");
721 725
 					$new_final_arr[$i] = $csv_data;
722 726
 					$this->common->mail_to_users('email_add_did', $account_info);
723
-					  }else{
727
+					  } else{
724 728
 					$invalid_array[$i] = $csv_data;
725 729
 					$invalid_array[$i]['error'] = 'Account have not sufficient amount to purchase this DID.';
726 730
 					  }
727
-				  }else{
731
+				  } else{
728 732
 				$invalid_array[$i] = $csv_data;
729 733
 				$invalid_array[$i]['error'] = 'Account not found or assign to invalid account';
730 734
 				  }
731
-							}else{
735
+							} else{
732 736
 				  $csv_data['setup'] = $this->common_model->add_calculate_currency($csv_data['setup'], '', '', false, false);
733 737
 				  $csv_data['monthlycost'] = $this->common_model->add_calculate_currency($csv_data['monthlycost'], '', '', false, false);
734 738
 				  $csv_data['cost'] = $this->common_model->add_calculate_currency($csv_data['cost'], '', '', false, false);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/did/libraries/did_form.php 2 patches
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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 did_form {
@@ -31,48 +31,48 @@  discard block
 block discarded – undo
31 31
 		$this->CI = & get_instance();
32 32
 	}
33 33
 
34
-	function get_dids_form_fields($id=false,$parent_id='0',$account_id='0') {
35
-	if ($id != 0){
36
-	  if($parent_id > 0){
37
-	  $account_dropdown =  array('Reseller',  array('name' => 'parent_id', 'disabled' => 'disabled','class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"1", "deleted" => "0","status" => "0"));                
38
-	  }else{
39
-	  if($account_id > 0){
40
-		$account_dropdown =  array('Account ',  array('name' => 'accountid', 'disabled' => 'disabled','class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0,3", "deleted" => "0","status" => "0"));
34
+	function get_dids_form_fields($id = false, $parent_id = '0', $account_id = '0') {
35
+	if ($id != 0) {
36
+	  if ($parent_id > 0) {
37
+	  $account_dropdown = array('Reseller', array('name' => 'parent_id', 'disabled' => 'disabled', 'class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type"=>"1", "deleted" => "0", "status" => "0"));                
38
+	  } else {
39
+	  if ($account_id > 0) {
40
+		$account_dropdown = array('Account ', array('name' => 'accountid', 'disabled' => 'disabled', 'class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type"=>"0,3", "deleted" => "0", "status" => "0"));
41 41
 	  }
42
-	  else{
43
-		$account_dropdown = array('Account', 'accountid', 'SELECT', '',array("name"=>"accountid","rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id',  'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3","deleted" => "0","status" => "0" ));
42
+	  else {
43
+		$account_dropdown = array('Account', 'accountid', 'SELECT', '', array("name"=>"accountid", "rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0", "status" => "0"));
44 44
 	  }
45 45
 	  }
46
-   } else{
47
-	$account_dropdown = array('Account', 'accountid', 'SELECT','' , array("name"=>"accountid","rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id',  'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0","status" => "0" ));
46
+   } else {
47
+	$account_dropdown = array('Account', 'accountid', 'SELECT', '', array("name"=>"accountid", "rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0", "status" => "0"));
48 48
    }
49 49
 
50
-	$val= $id > 0 ? 'dids.number.'.$id : 'dids.number';
51
-		$form['forms'] = array(base_url() . '/did/did_save/', array('id' => 'did_form', 'method' => 'POST', 'name' => 'did_form'));
50
+	$val = $id > 0 ? 'dids.number.'.$id : 'dids.number';
51
+		$form['forms'] = array(base_url().'/did/did_save/', array('id' => 'did_form', 'method' => 'POST', 'name' => 'did_form'));
52 52
 		$form['DID Information'] = array(
53 53
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
54 54
 			array('DID', 'INPUT', array('name' => 'number', 'size' => '20', 'class' => "text field medium"), 'trim|required|is_numeric|xss_clean|integer', 'tOOL TIP', 'Please Enter account number'),
55
-			  array('Country',array('name'=>'country_id','class'=>'country_id'), 'SELECT', '',array("name"=>"country_id","rules"=>"required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
55
+			  array('Country', array('name'=>'country_id', 'class'=>'country_id'), 'SELECT', '', array("name"=>"country_id", "rules"=>"required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
56 56
 			array('City', 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
57 57
 			array('Province', 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
58
-			array('Provider', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type" => "3", "deleted" => "0","status" => "0")),
58
+			array('Provider', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type" => "3", "deleted" => "0", "status" => "0")),
59 59
 		);
60 60
 
61 61
 		$form['Billing Information'] = array(
62 62
 			$account_dropdown,    
63
-			array('Connection Cost', 'INPUT', array('name' => 'connectcost', 'size' => '15',  'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'),       
64
-			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '50',  'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'),
65
-			array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '15',  'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'),
66
-			array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20',  'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Initial Increment'),
67
-			array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Increment'),
68
-			array('Setup Fee', 'INPUT', array('name' => 'setup',  'size' => '15', 'class' => 'text field medium'), 'trim|is_numeric|xss_clean', 'tOOL TIP', ''),
69
-			array('Monthly<br>Fee', 'INPUT', array('name' => 'monthlycost', 'size' => '15',  'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'),
63
+			array('Connection Cost', 'INPUT', array('name' => 'connectcost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'),       
64
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '50', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'),
65
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'),
66
+			array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Initial Increment'),
67
+			array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Increment'),
68
+			array('Setup Fee', 'INPUT', array('name' => 'setup', 'size' => '15', 'class' => 'text field medium'), 'trim|is_numeric|xss_clean', 'tOOL TIP', ''),
69
+			array('Monthly<br>Fee', 'INPUT', array('name' => 'monthlycost', 'size' => '15', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter Password'),
70 70
 		);
71 71
 
72 72
 		$form['DID Setting'] = array(
73 73
 			array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type', ''),
74 74
 			array('Destination', 'INPUT', array('name' => 'extensions', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
75
-			array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20',  'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter account number'),
75
+			array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|xss_clean', 'tOOL TIP', 'Please Enter account number'),
76 76
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
77 77
 
78 78
 		);
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 		$form['Search'] = array(
92 92
 			array('DID', 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''),
93 93
 			array('Country', 'country_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
94
-			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","type"=>"0", "deleted" => "0")),
94
+			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", "type"=>"0", "deleted" => "0")),
95 95
 			array('Initial Increment', 'INPUT', array('name' => 'init_inc[init_inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'init_inc[init_inc-integer]', '', '', '', 'search_int_type', ''),
96
-			array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '',''),
96
+			array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '', ''),
97 97
 			array('Destination', 'INPUT', array('name' => 'extensions[extensions]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'extensions[extensions-string]', '', '', '', 'search_string_type', ''),
98 98
 		array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
99 99
             
100
-		array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '')
100
+		array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', '')
101 101
 		  );
102 102
 
103 103
 		$form['button_search'] = array('name' => 'action', 'id' => "did_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 		$form['forms'] = array("", array('id' => "did_search"));
113 113
 		$form['Search'] = array(
114 114
 			array('DID', 'INPUT', array('name' => 'note[note]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'note[note-string]', '', '', '', 'search_string_type', ''),
115
- 	  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","type"=>"0", "deleted" => "0")),
116
-	   array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '',''),
115
+ 	  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", "type"=>"0", "deleted" => "0")),
116
+	   array('Call Type', 'call_type', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_call_type_search', '', ''),
117 117
 	  array('Destination', 'INPUT', array('name' => 'extensions[extensions]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'extensions[extensions-string]', '', '', '', 'search_string_type', ''),
118 118
 	  array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
119
-	  array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '')
119
+	  array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', '')
120 120
 		  );
121 121
 
122 122
 		$form['button_search'] = array('name' => 'action', 'id' => "did_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
@@ -131,31 +131,31 @@  discard block
 block discarded – undo
131 131
     */
132 132
 	function build_did_list_for_admin() {
133 133
 		  $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
134
-	$currency_id=$account_info['currency_id'];
135
-	 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
134
+	$currency_id = $account_info['currency_id'];
135
+	 $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
136 136
 		
137 137
 		
138 138
 	   // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
139
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
139
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
140 140
 
141 141
 /**
142 142
 ASTPP  3.0 
143 143
 For DID edit on DID number
144 144
 **/
145
-			array(gettext("DID"), "80", "number", "", "", "","EDITABLE","true","center"),
146
-			array(gettext("Country"), "60", "country_id", "country", "countrycode", "get_field_name","","true","center"),
145
+			array(gettext("DID"), "80", "number", "", "", "", "EDITABLE", "true", "center"),
146
+			array(gettext("Country"), "60", "country_id", "country", "countrycode", "get_field_name", "", "true", "center"),
147 147
 			array(gettext("Account"), "95", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new"),
148
-			array("Per Minute <br>Cost($currency)", "85", "cost", "cost", "cost", "convert_to_currency","","true","right"),
149
-			array(gettext("Initial <br>Increment"), "80", "init_inc", "", "", "","","true","center"),
150
-			array(gettext("Increment"), "90", "inc", "", "", "","","true","center"),
151
-			array("Setup <br>Fee($currency)", "70", "setup", "setup", "setup", "convert_to_currency","","true","right"),
152
-			array("Monthly<br>Fee($currency)", "90", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency","","true","right"),
153
-			array(gettext("Call Type"), "90", "call_type", "call_type", "call_type", "get_call_type","","true","center"),
154
-			array(gettext("Destination"), "80", "extensions", "", "", "","","true","center"),       
155
-			array(gettext("Status"), "90", "status", "status", "dids", "get_status","","true","center"),
156
-			array(gettext("Modified <br/>Date"), "90", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
157
-			array(gettext("Is Purchased?"), "110", "number", "number", "number", "check_did_avl","","true","center"),
158
-			array("Action", "100", "", "", "", array("EDIT" => array("url" => "did/did_edit/", "mode" => "popup","layout"=>"medium"),
148
+			array("Per Minute <br>Cost($currency)", "85", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
149
+			array(gettext("Initial <br>Increment"), "80", "init_inc", "", "", "", "", "true", "center"),
150
+			array(gettext("Increment"), "90", "inc", "", "", "", "", "true", "center"),
151
+			array("Setup <br>Fee($currency)", "70", "setup", "setup", "setup", "convert_to_currency", "", "true", "right"),
152
+			array("Monthly<br>Fee($currency)", "90", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency", "", "true", "right"),
153
+			array(gettext("Call Type"), "90", "call_type", "call_type", "call_type", "get_call_type", "", "true", "center"),
154
+			array(gettext("Destination"), "80", "extensions", "", "", "", "", "true", "center"),       
155
+			array(gettext("Status"), "90", "status", "status", "dids", "get_status", "", "true", "center"),
156
+			array(gettext("Modified <br/>Date"), "90", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
157
+			array(gettext("Is Purchased?"), "110", "number", "number", "number", "check_did_avl", "", "true", "center"),
158
+			array("Action", "100", "", "", "", array("EDIT" => array("url" => "did/did_edit/", "mode" => "popup", "layout"=>"medium"),
159 159
 					"DELETE" => array("url" => "did/did_remove/", "mode" => "single")))
160 160
 			));
161 161
 		return $grid_field_arr;
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
      */
168 168
 		function build_did_list_for_reseller_login() {
169 169
 	 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
170
-		$currency_id=$account_info['currency_id'];
171
-	 	$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);	
170
+		$currency_id = $account_info['currency_id'];
171
+	 	$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);	
172 172
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
173 173
 		$grid_field_arr = json_encode(array(
174
-			array("DID", "90", "number", "", "", "","EDITABLE","","true","center"),
175
-			array("Account", "100", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"),
176
-			array("Per Minute<br>Cost($currency)", "80", "cost", "cost", "cost", "convert_to_currency","","true","right"),
177
-			array("Initial <br>Increment", "100", "init_inc", "", "", "","","true","center"),
178
-			array("Increment", "95", "inc", "", "", "","","true","center"),
179
-			array("Setup <br> Fee($currency)", "90", "setup", "setup", "setup", "convert_to_currency","","true","right"),
180
-			array("Monthly<br> fee($currency)", "90", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency","","true","right"),
181
-			array("Call Type", "80", "call_type", "call_type", "call_type", "get_call_type","","true","center"),
182
-			array("Destination", "95", "extensions", "", "", "","","true","center"),
183
-			array("Status", "90", "status", "status", "reseller_pricing", "get_status","","true","center"),
184
-			array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
185
-			array("Is purchased?", "100", "number", "number", "number", "check_did_avl_reseller","","true","center"),
174
+			array("DID", "90", "number", "", "", "", "EDITABLE", "", "true", "center"),
175
+			array("Account", "100", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new", "", "true", "center"),
176
+			array("Per Minute<br>Cost($currency)", "80", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
177
+			array("Initial <br>Increment", "100", "init_inc", "", "", "", "", "true", "center"),
178
+			array("Increment", "95", "inc", "", "", "", "", "true", "center"),
179
+			array("Setup <br> Fee($currency)", "90", "setup", "setup", "setup", "convert_to_currency", "", "true", "right"),
180
+			array("Monthly<br> fee($currency)", "90", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency", "", "true", "right"),
181
+			array("Call Type", "80", "call_type", "call_type", "call_type", "get_call_type", "", "true", "center"),
182
+			array("Destination", "95", "extensions", "", "", "", "", "true", "center"),
183
+			array("Status", "90", "status", "status", "reseller_pricing", "get_status", "", "true", "center"),
184
+			array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
185
+			array("Is purchased?", "100", "number", "number", "number", "check_did_avl_reseller", "", "true", "center"),
186 186
 		array("Action", "90", "", "", "", array("EDIT" => array("url" => "did/did_reseller_edit/edit/", "mode" => "popup"),
187 187
 					"DELETE" => array("url" => "did/did_reseller_edit/delete/", "mode" => "single")))
188 188
 				));
@@ -191,27 +191,27 @@  discard block
 block discarded – undo
191 191
 	/************************************************************************/
192 192
 	function build_grid_buttons() {
193 193
 		$buttons_json = json_encode(array(
194
-			array(gettext("Create"),"btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/did/did_add/", "popup","medium"),
195
-			array(gettext("Delete"), "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/did/did_delete_multiple/"),
196
-			array(gettext("Import"), "btn btn-line-blue","fa fa-upload fa-lg", "button_action", "/did/did_import/", '',"small"),            
197
-			array(gettext("Export"),"btn btn-xing" ,"fa fa-download fa-lg", "button_action", "/did/did_export_data_xls", 'single')
194
+			array(gettext("Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/did/did_add/", "popup", "medium"),
195
+			array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/did/did_delete_multiple/"),
196
+			array(gettext("Import"), "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "/did/did_import/", '', "small"),            
197
+			array(gettext("Export"), "btn btn-xing", "fa fa-download fa-lg", "button_action", "/did/did_export_data_xls", 'single')
198 198
 			));
199 199
 		return $buttons_json;
200 200
 	}
201 201
 
202 202
 	function build_did_list_for_customer($accountid, $accounttype) {
203 203
 	$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
204
-	$currency_id=$account_info['currency_id'];
205
-	$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
204
+	$currency_id = $account_info['currency_id'];
205
+	$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
206 206
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
207 207
 		$grid_field_arr = json_encode(array(
208
-	array("DID", "110", "number", "", "", "","","true","center"),
209
-	array("Country", "110", "country_id", "country", "countrycode", "get_field_name","","true","center"),
210
-	array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency","","true","right"),
211
-	array("Initial Increment", "140", "init_inc", "", "", "","","true","center"),
212
-	array("Increment", "120", "inc", "", "", "","","true","center"),
213
-	array("Setup Fee($currency)", "140", "setup", "setup", "setup", "convert_to_currency","","true","right"),
214
-	array("Monthly Fee($currency)", "140", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency","","true","right"),
208
+	array("DID", "110", "number", "", "", "", "", "true", "center"),
209
+	array("Country", "110", "country_id", "country", "countrycode", "get_field_name", "", "true", "center"),
210
+	array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
211
+	array("Initial Increment", "140", "init_inc", "", "", "", "", "true", "center"),
212
+	array("Increment", "120", "inc", "", "", "", "", "true", "center"),
213
+	array("Setup Fee($currency)", "140", "setup", "setup", "setup", "convert_to_currency", "", "true", "right"),
214
+	array("Monthly Fee($currency)", "140", "monthlycost", "monthlycost", "monthlycost", "convert_to_currency", "", "true", "right"),
215 215
 	array("Action", "110", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_dids_action/delete/$accountid/$accounttype/", "mode" => "single")))
216 216
 		));
217 217
 		return $grid_field_arr;
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
26
-	exit('No direct script access allowed');
25
+if (!defined('BASEPATH')) {
26
+	exit('No direct script access allowed');
27
+}
27 28
 
28 29
 class did_form {
29 30
 
@@ -35,11 +36,10 @@  discard block
 block discarded – undo
35 36
 	if ($id != 0){
36 37
 	  if($parent_id > 0){
37 38
 	  $account_dropdown =  array('Reseller',  array('name' => 'parent_id', 'disabled' => 'disabled','class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"1", "deleted" => "0","status" => "0"));                
38
-	  }else{
39
+	  } else{
39 40
 	  if($account_id > 0){
40 41
 		$account_dropdown =  array('Account ',  array('name' => 'accountid', 'disabled' => 'disabled','class' => 'accountid', 'id' => 'accountid'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0,3", "deleted" => "0","status" => "0"));
41
-	  }
42
-	  else{
42
+	  } else{
43 43
 		$account_dropdown = array('Account', 'accountid', 'SELECT', '',array("name"=>"accountid","rules"=>"did_account_checking"), 'tOOL TIP', 'Please Enter account number', 'id',  'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3","deleted" => "0","status" => "0" ));
44 44
 	  }
45 45
 	  }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/did/views/view_import_did.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
               <div class="col-md-12">
16 16
             	<div class="w-box">
17 17
             	 <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
18
-                    <? if(isset($error) && !empty($error)) {
18
+                    <? if (isset($error) && ! empty($error)) {
19 19
 						echo $error;
20 20
 					}?>
21 21
                  </span>
22 22
                    <h3 class="padding-t-10 padding-l-16">File must be in the following format(.csv):</h3>
23
-            <p><?= $fields;?></p>
23
+            <p><?= $fields; ?></p>
24 24
                  </div>
25 25
                </div>
26 26
                <div class="col-md-12  no-padding">
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
                            <div class="col-md-12 no-padding">
31 31
                                <label class="col-md-3">Provider:</label>
32 32
                                <div>
33
-                               <? $provider_id = form_dropdown('provider_id', $this->db_model->build_concat_select_dropdown("id,first_name,number", " accounts", "where_arr", array("type" => "3","status"=>"0","deleted" => "0")), '');
33
+                               <? $provider_id = form_dropdown('provider_id', $this->db_model->build_concat_select_dropdown("id,first_name,number", " accounts", "where_arr", array("type" => "3", "status"=>"0", "deleted" => "0")), '');
34 34
 							echo $provider_id;
35 35
 							  ?> </div>
36 36
                            </div>
@@ -84,24 +84,24 @@  discard block
 block discarded – undo
84 84
 <?php }?>    
85 85
         
86 86
 <?php
87
-	if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?>
87
+	if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?>
88 88
  <section class="slice color-three">
89 89
 	<div class="w-section inverse no-padding">
90 90
            <div class="container">
91 91
 	<div class="row">
92 92
              
93 93
         <div class="col-md-12 margin-t-10">        
94
-            <form id="import_form" name="import_form" action="<?=base_url()?>did/did_import_file/<?= $provider_id?>/<?=$check_header;?>/" method="POST">
94
+            <form id="import_form" name="import_form" action="<?=base_url()?>did/did_import_file/<?= $provider_id?>/<?=$check_header; ?>/" method="POST">
95 95
             <table width="100%" border="1"  class="details_table table">
96
-                <?php  $cnt =0;
97
-					foreach($csv_tmp_data as $csv_key => $csv_value){
98
-						if($csv_key <  15){
96
+                <?php  $cnt = 0;
97
+					foreach ($csv_tmp_data as $csv_key => $csv_value) {
98
+						if ($csv_key < 15) {
99 99
 							echo "<tr>";
100
-							foreach($csv_value as $field_name => $field_val){
101
-								if($csv_key == 0){
100
+							foreach ($csv_value as $field_name => $field_val) {
101
+								if ($csv_key == 0) {
102 102
 					$cnt++;
103 103
 									echo "<th>".ucfirst($field_name)."</th>";
104
-								}else{
104
+								} else {
105 105
 									echo "<td class='portlet-content'>".$field_val."</td>";   
106 106
 								}
107 107
 							}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
 								if($csv_key == 0){
102 102
 					$cnt++;
103 103
 									echo "<th>".ucfirst($field_name)."</th>";
104
-								}else{
104
+								} else{
105 105
 									echo "<td class='portlet-content'>".$field_val."</td>";   
106 106
 								}
107 107
 							}
Please login to merge, or discard this patch.
astpp/application/modules/did/views/view_did_manage_reseller_add.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@
 block discarded – undo
46 46
         	      <li class="col-md-12">
47 47
                         <label class="col-md-3 no-padding">Call Type</label>
48 48
                   		  <select name="call_type" class="col-md-5 form-control selectpicker" data-live-search='true'>
49
-                  		  <?php $calltype=$this->common->set_call_type();
50
-				  			 foreach($calltype as $key=>$value){
51
-				  			   $selected=$reseller_didinfo['call_type']==$key ? "selected='selected'" : '';
49
+                  		  <?php $calltype = $this->common->set_call_type();
50
+				  			 foreach ($calltype as $key=>$value) {
51
+				  			   $selected = $reseller_didinfo['call_type'] == $key ? "selected='selected'" : '';
52 52
 				  			   echo "<option value='$key'$selected>$value</option>";
53 53
 				  			 }
54 54
 				  			 ?>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/reports/models/reports_model.php 2 patches
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -29,31 +29,31 @@  discard block
 block discarded – undo
29 29
 ASTPP  3.0 
30 30
     For Detail Customer Report List,Export
31 31
 **/
32
-	function getcustomer_cdrs($flag, $start, $limit,$export =false) {
32
+	function getcustomer_cdrs($flag, $start, $limit, $export = false) {
33 33
 		$this->db_model->build_search('customer_cdr_list_search');
34 34
 		$account_data = $this->session->userdata("accountinfo");
35
-		$where['reseller_id']=$account_data['type']== 1 ? $account_data['id']:0;
35
+		$where['reseller_id'] = $account_data['type'] == 1 ? $account_data['id'] : 0;
36 36
 		//$where['type']=0;
37
-		if($this->session->userdata('advance_search') != 1){
38
-		$where['callstart >= ']=date("Y-m-d")." 00:00:00";
39
-			$where['callstart <=']=date("Y-m-d")." 23:59:59";
37
+		if ($this->session->userdata('advance_search') != 1) {
38
+		$where['callstart >= '] = date("Y-m-d")." 00:00:00";
39
+			$where['callstart <='] = date("Y-m-d")." 23:59:59";
40 40
 		}
41 41
 
42
-		$types = array('0','3');
42
+		$types = array('0', '3');
43 43
 		//$this->db->or_where_in('type', $types);    
44 44
 		$this->db->where_in('type', $types);  
45 45
 		
46 46
 		$this->db->where($where);
47
-		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
48
-		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
49
-		}else{
47
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
48
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
49
+		} else {
50 50
 		   $this->db->order_by("callstart desc");
51 51
 		}
52 52
 		if ($flag) {
53
-			if (!$export)
53
+			if ( ! $export)
54 54
 				$this->db->limit($limit, $start);
55 55
 			$this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid');
56
-		}else {
56
+		} else {
57 57
 			$this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids,group_concat(distinct(accountid)) as accounts_ids');
58 58
 		}
59 59
 		$result = $this->db->get('cdrs');
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
 /*
63 63
  * Below function using by Detail reseller report
64 64
  */
65
-	function getreseller_cdrs($flag, $start, $limit,$export=false) {
65
+	function getreseller_cdrs($flag, $start, $limit, $export = false) {
66 66
 		$this->db_model->build_search('reseller_cdr_list_search');
67 67
 		$account_data = $this->session->userdata("accountinfo");
68
-		$where['reseller_id']=$account_data['type']== 1 ? $account_data['id']:0;
69
-		$where["accountid <>"]=$account_data['type']== 1 ? $account_data['id']:0;
70
-	if($this->session->userdata('advance_search') != 1){
71
-		$where['callstart >= ']=date("Y-m-d")." 00:00:00";
72
-			$where['callstart <=']=date("Y-m-d")." 23:59:59";
68
+		$where['reseller_id'] = $account_data['type'] == 1 ? $account_data['id'] : 0;
69
+		$where["accountid <>"] = $account_data['type'] == 1 ? $account_data['id'] : 0;
70
+	if ($this->session->userdata('advance_search') != 1) {
71
+		$where['callstart >= '] = date("Y-m-d")." 00:00:00";
72
+			$where['callstart <='] = date("Y-m-d")." 23:59:59";
73 73
 		}
74 74
 		$this->db->where($where);
75
-		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
76
-		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
77
-		}else{
75
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
76
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
77
+		} else {
78 78
 		   $this->db->order_by("callstart desc");
79 79
 		}
80 80
 		if ($flag) {
81
-			if (!$export)
81
+			if ( ! $export)
82 82
 				$this->db->limit($limit, $start);
83 83
 				$this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype');
84 84
 		} else {
@@ -89,48 +89,48 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 		/*Below function using by Detail provider report
91 91
   */
92
-	function getprovider_cdrs($flag, $start, $limit,$export=false) {
92
+	function getprovider_cdrs($flag, $start, $limit, $export = false) {
93 93
 		$this->db_model->build_search('provider_cdr_list_search');
94 94
 		$account_data = $this->session->userdata("accountinfo");
95
-		$where=array();
96
-		if($account_data['type']== 3 ){ 
97
-			$where['provider_id']= $account_data['id'];
95
+		$where = array();
96
+		if ($account_data['type'] == 3) { 
97
+			$where['provider_id'] = $account_data['id'];
98 98
 		}
99 99
         
100
-		if($this->session->userdata('advance_search') != 1){
101
-		$where['callstart >= ']=date("Y-m-d")." 00:00:00";
102
-			$where['callstart <=']=date("Y-m-d")." 23:59:59";
100
+		if ($this->session->userdata('advance_search') != 1) {
101
+		$where['callstart >= '] = date("Y-m-d")." 00:00:00";
102
+			$where['callstart <='] = date("Y-m-d")." 23:59:59";
103 103
 		}
104 104
 		$this->db->where('trunk_id !=', '');
105 105
 		$this->db->where($where);
106
-		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
107
-		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
108
-		}else{
106
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
107
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
108
+		} else {
109 109
 		   $this->db->order_by("callstart desc");
110 110
 		}
111 111
 		if ($flag) {
112
-			if (!$export)
112
+			if ( ! $export)
113 113
 				$this->db->limit($limit, $start);
114 114
 			$this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,provider_call_cost,disposition,provider_id,cost');
115
-		}else {
115
+		} else {
116 116
 			$this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost');
117 117
 		}
118 118
 		$result = $this->db->get('cdrs');
119 119
 	  //  echo $this->db->last_query();
120 120
 		return $result;
121 121
 	}
122
-	 function users_cdrs_list($flag,$accountid,$entity_type,$start,$limit) {
122
+	 function users_cdrs_list($flag, $accountid, $entity_type, $start, $limit) {
123 123
 		$where = "callstart >= '".date('Y-m-d 00:00:00')."' AND callstart <='".date('Y-m-d 23:59:59')."' AND ";
124
-		$account_type= $entity_type =='provider' ? 'provider_id' :'accountid';
125
-		$where.="accountid = '".$accountid."' ";
124
+		$account_type = $entity_type == 'provider' ? 'provider_id' : 'accountid';
125
+		$where .= "accountid = '".$accountid."' ";
126 126
 		//~ if($entity_type == 'provider'){
127 127
 		 //~ $where.="OR provider_id = '".$accountid."'";
128 128
 		//~ }
129
-		$table=$entity_type=='reseller'?'reseller_cdrs' : 'cdrs';
129
+		$table = $entity_type == 'reseller' ? 'reseller_cdrs' : 'cdrs';
130 130
 		if ($flag) {
131 131
 			$query = $this->db_model->select("*", $table, $where, "callstart", "DESC", $limit, $start);
132 132
 		} else {
133
-			$query = $this->db_model->countQuery("*",$table, $where);
133
+			$query = $this->db_model->countQuery("*", $table, $where);
134 134
 		}
135 135
 		return $query;
136 136
 
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		return $query;
155 155
 	}
156 156
 
157
-	function get_refill_list($flag, $start, $limit,$export=false) {
157
+	function get_refill_list($flag, $start, $limit, $export = false) {
158 158
 		$this->db_model->build_search('cdr_refill_search');
159 159
 		$accountinfo = $this->session->userdata('accountinfo');
160
-		$where['payment_by']=$accountinfo['type']==1 ? $accountinfo['id']:-1;
160
+		$where['payment_by'] = $accountinfo['type'] == 1 ? $accountinfo['id'] : -1;
161 161
 		if ($flag) {
162
-			if($export)
163
-		  $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC","","");
162
+			if ($export)
163
+		  $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", "", "");
164 164
 			else
165 165
 		   $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start);
166 166
 		} else {
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 			$reseller_id = "0";
180 180
 		}
181 181
 		if ($flag) {
182
-			$query = $this->db_model->select_by_in("*", "commission","" , "date", "DESC", $limit, $start,"","reseller_id",$reseller_id);
182
+			$query = $this->db_model->select_by_in("*", "commission", "", "date", "DESC", $limit, $start, "", "reseller_id", $reseller_id);
183 183
 
184 184
 		} else {
185
-			$query = $this->db_model->countQuery_by_in("*", "commission", "","reseller_id",$reseller_id);
185
+			$query = $this->db_model->countQuery_by_in("*", "commission", "", "reseller_id", $reseller_id);
186 186
 		}
187 187
 
188 188
 		return $query;
@@ -192,22 +192,22 @@  discard block
 block discarded – undo
192 192
 Charge History
193 193
 ***********/
194 194
 	function getcharges_list($flag, $start = 0, $limit = 0) {
195
-	$accountinfo=$this->session->userdata('accountinfo');
196
-	$reseller_id=$accountinfo['id'];
197
-	if($accountinfo['type'] == 1){
198
-		$where['reseller_id']=$reseller_id;
199
-	} else{
200
-		$where['reseller_id']=0;
195
+	$accountinfo = $this->session->userdata('accountinfo');
196
+	$reseller_id = $accountinfo['id'];
197
+	if ($accountinfo['type'] == 1) {
198
+		$where['reseller_id'] = $reseller_id;
199
+	} else {
200
+		$where['reseller_id'] = 0;
201 201
 	}
202
-	if($this->session->userdata('advance_search') != 1){
203
-		$where['created_date >=']=gmdate("Y-m-01 00:00:01");
204
-		$where['created_date <=']=gmdate("Y-m-d 23:59:59");
202
+	if ($this->session->userdata('advance_search') != 1) {
203
+		$where['created_date >='] = gmdate("Y-m-01 00:00:01");
204
+		$where['created_date <='] = gmdate("Y-m-d 23:59:59");
205 205
 	}
206 206
 	$this->db_model->build_search('charges_list_search');
207 207
 	$this->db->where($where);
208
-	$whr= "( invoiceid =0 OR invoiceid in (  select id  from invoices where confirm = 1) )";
208
+	$whr = "( invoiceid =0 OR invoiceid in (  select id  from invoices where confirm = 1) )";
209 209
 	$this->db->where($whr);
210
-	$this->db->where('item_type <>','STANDARD');
210
+	$this->db->where('item_type <>', 'STANDARD');
211 211
 	if ($flag) {
212 212
 		$query = $this->db_model->select('*', "invoice_details", "", "id", "DESC", $limit, $start);
213 213
 	} else {
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
 	/* ASTPP  3.0 
221 221
      * This function using for customer edit
222 222
      */
223
-   function get_customer_charge_list($flag,$accountid,$start = 0, $limit = 0){
223
+   function get_customer_charge_list($flag, $accountid, $start = 0, $limit = 0) {
224 224
 		$this->db_model->build_search('charges_list_search');
225
-		$accountinfo=$this->session->userdata('accountinfo');
226
-		$reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
227
-		$where['reseller_id']=$reseller_id;
228
-		$where['accountid']=$accountid;
229
-		if($this->session->userdata('advance_search') != 1){
230
-			 $where['created_date >=']=gmdate("Y-m-1 00:00:00");
231
-			 $where['created_date <=']=gmdate("Y-m-d 23:59:59");
225
+		$accountinfo = $this->session->userdata('accountinfo');
226
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
227
+		$where['reseller_id'] = $reseller_id;
228
+		$where['accountid'] = $accountid;
229
+		if ($this->session->userdata('advance_search') != 1) {
230
+			 $where['created_date >='] = gmdate("Y-m-1 00:00:00");
231
+			 $where['created_date <='] = gmdate("Y-m-d 23:59:59");
232 232
 		}
233 233
 		if ($flag) {
234 234
 			$query = $this->db_model->select("*", "invoice_details", $where, "id", "DESC", $limit, $start);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		}
238 238
 		return $query;        
239 239
 	}
240
-	function get_customer_refillreport($flag,$accountid,$start = 0, $limit = 0){
240
+	function get_customer_refillreport($flag, $accountid, $start = 0, $limit = 0) {
241 241
 		$where = array("accountid"=>$accountid);
242 242
 		if ($flag) {
243 243
 			$query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start);
Please login to merge, or discard this patch.
Braces   +19 added lines, -15 removed lines patch added patch discarded remove patch
@@ -46,14 +46,15 @@  discard block
 block discarded – undo
46 46
 		$this->db->where($where);
47 47
 		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
48 48
 		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
49
-		}else{
49
+		} else{
50 50
 		   $this->db->order_by("callstart desc");
51 51
 		}
52 52
 		if ($flag) {
53
-			if (!$export)
54
-				$this->db->limit($limit, $start);
53
+			if (!$export) {
54
+							$this->db->limit($limit, $start);
55
+			}
55 56
 			$this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid');
56
-		}else {
57
+		} else {
57 58
 			$this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids,group_concat(distinct(accountid)) as accounts_ids');
58 59
 		}
59 60
 		$result = $this->db->get('cdrs');
@@ -74,12 +75,13 @@  discard block
 block discarded – undo
74 75
 		$this->db->where($where);
75 76
 		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
76 77
 		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
77
-		}else{
78
+		} else{
78 79
 		   $this->db->order_by("callstart desc");
79 80
 		}
80 81
 		if ($flag) {
81
-			if (!$export)
82
-				$this->db->limit($limit, $start);
82
+			if (!$export) {
83
+							$this->db->limit($limit, $start);
84
+			}
83 85
 				$this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype');
84 86
 		} else {
85 87
 		   $this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids');
@@ -105,14 +107,15 @@  discard block
 block discarded – undo
105 107
 		$this->db->where($where);
106 108
 		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
107 109
 		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
108
-		}else{
110
+		} else{
109 111
 		   $this->db->order_by("callstart desc");
110 112
 		}
111 113
 		if ($flag) {
112
-			if (!$export)
113
-				$this->db->limit($limit, $start);
114
+			if (!$export) {
115
+							$this->db->limit($limit, $start);
116
+			}
114 117
 			$this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,provider_call_cost,disposition,provider_id,cost');
115
-		}else {
118
+		} else {
116 119
 			$this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost');
117 120
 		}
118 121
 		$result = $this->db->get('cdrs');
@@ -159,10 +162,11 @@  discard block
 block discarded – undo
159 162
 		$accountinfo = $this->session->userdata('accountinfo');
160 163
 		$where['payment_by']=$accountinfo['type']==1 ? $accountinfo['id']:-1;
161 164
 		if ($flag) {
162
-			if($export)
163
-		  $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC","","");
164
-			else
165
-		   $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start);
165
+			if($export) {
166
+					  $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC","","");
167
+			} else {
168
+					   $query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start);
169
+			}
166 170
 		} else {
167 171
 			$query = $this->db_model->countQuery("*", "payments", $where);
168 172
 		}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/reports/controllers/reports.php 2 patches
Spacing   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +26 added lines, -19 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@  discard block
 block discarded – undo
38 38
 		$this->fpdf = new PDF('P', 'pt');
39 39
 		$this->fpdf->initialize('P', 'mm', 'A4');
40 40
 
41
-		if ($this->session->userdata('user_login') == FALSE)
42
-			redirect(base_url() . '/astpp/login');
41
+		if ($this->session->userdata('user_login') == FALSE) {
42
+					redirect(base_url() . '/astpp/login');
43
+		}
43 44
 	}
44 45
 
45 46
 	function customerReport() {
@@ -272,7 +273,7 @@  discard block
 block discarded – undo
272 273
 				"",
273 274
 				"",
274 275
 			);
275
-			}else{
276
+			} else{
276 277
 							$customer_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Cost($currency)", "Disposition", "Account","Rate Group", "Call Type");
277 278
 			   foreach ($query->result_array() as $value) {
278 279
 				   $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ?
@@ -642,13 +643,15 @@  discard block
 block discarded – undo
642 643
 										   :null;
643 644
         
644 645
 		$json_data = array();
645
-		if(!empty($like_str))
646
-		$this->db->where($like_str);
646
+		if(!empty($like_str)) {
647
+				$this->db->where($like_str);
648
+		}
647 649
 		$count_all = $this->reports_model->users_cdrs_list(false, $accountid, $accounttype, "", "");
648 650
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
649 651
 		$json_data = $paging_data["json_paging"];
650
-		if(!empty($like_str))
651
-		$this->db->where($like_str);
652
+		if(!empty($like_str)) {
653
+				$this->db->where($like_str);
654
+		}
652 655
 		$query = $this->reports_model->users_cdrs_list(true, $accountid, $accounttype, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
653 656
 		$grid_fields = json_decode($this->reports_form->build_report_list_for_user($accounttype));
654 657
 		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
@@ -806,7 +809,7 @@  discard block
 block discarded – undo
806 809
 							$after_balance,
807 810
 							$description,
808 811
 									));
809
-	}else{
812
+	} else{
810 813
 			$json_data['rows'][] = array('cell' => array(
811 814
 							$date,
812 815
 							$invoice_num,
@@ -833,7 +836,7 @@  discard block
 block discarded – undo
833 836
 	}
834 837
 		if ($this->session->userdata('logintype') == 1) {
835 838
 			$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{
839
+	} else{
837 840
 			$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 841
 
839 842
 	}
@@ -870,14 +873,16 @@  discard block
 block discarded – undo
870 873
                                             OR 'credit' like '%$instant_search%'
871 874
                                             OR  'description' like '%$instant_search%')"
872 875
 											:null;
873
-		if(!empty($like_str))
874
-		$this->db->where($like_str);
876
+		if(!empty($like_str)) {
877
+				$this->db->where($like_str);
878
+		}
875 879
 		$count_all = $this->reports_model->get_customer_charge_list(false,$accountid);
876 880
 
877 881
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
878 882
 		$json_data = $paging_data["json_paging"];
879
-		if(!empty($like_str))
880
-		$this->db->where($like_str);
883
+		if(!empty($like_str)) {
884
+				$this->db->where($like_str);
885
+		}
881 886
 		$query = $this->reports_model->get_customer_charge_list(true,$accountid,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
882 887
 	$result= $query->result_array();
883 888
 		$query1 = $this->reports_model->get_customer_charge_list(true,$accountid,'','');
@@ -929,7 +934,7 @@  discard block
 block discarded – undo
929 934
 							$after_balance,
930 935
 							$description,
931 936
 									));
932
-	}else{
937
+	} else{
933 938
 			$json_data['rows'][] = array('cell' => array(
934 939
 							$date,
935 940
 							$invoice_num,
@@ -955,7 +960,7 @@  discard block
 block discarded – undo
955 960
 	}
956 961
 		if ($this->session->userdata('logintype') == 1) {
957 962
 			$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{
963
+	} else{
959 964
 			$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 965
 
961 966
 	}
@@ -971,13 +976,15 @@  discard block
 block discarded – undo
971 976
                                             OR  notes like '%$instant_search%'
972 977
                                                 )"
973 978
 										   :null;
974
-		if(!empty($like_str))
975
-		$this->db->where($like_str);
979
+		if(!empty($like_str)) {
980
+				$this->db->where($like_str);
981
+		}
976 982
 		$count_all = $this->reports_model->get_customer_refillreport(false,$accountid);
977 983
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
978 984
 		$json_data = $paging_data["json_paging"];
979
-		if(!empty($like_str))
980
-		$this->db->where($like_str);
985
+		if(!empty($like_str)) {
986
+				$this->db->where($like_str);
987
+		}
981 988
 		$query = $this->reports_model->get_customer_refillreport(true,$accountid,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
982 989
 		$grid_fields = json_decode($this->reports_form->build_refillreport_for_customer());
983 990
 		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/reports/libraries/reports_form.php 2 patches
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 # You should have received a copy of the GNU Affero General Public License
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23
-if (!defined('BASEPATH'))
23
+if ( ! defined('BASEPATH'))
24 24
 	exit('No direct script access allowed');
25 25
 
26 26
 class Reports_form {
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 	function get_customer_cdr_form() {
31 31
 		$logintype = $this->CI->session->userdata('userlevel_logintype');
32
-		 if($logintype != 1){
32
+		 if ($logintype != 1) {
33 33
 		if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) {
34 34
 			$accountinfo = $this->CI->session->userdata['accountinfo'];
35 35
 			$reseller_id = $accountinfo["id"];
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		array('Debit ', 'INPUT', array('name' => 'debit[debit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'debit[debit-integer]', '', '', '', 'search_int_type', ''),
49 49
 			array('Cost ', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
50 50
 		array('Disposition', 'disposition', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_despostion'),
51
-			array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"GLOBAL")),
51
+			array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"GLOBAL")),
52 52
  
53 53
 	  array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`status`=2, concat(name,"","^"),name) as name', 'trunks', 'build_dropdown_deleted', '', array("status" => "1")),
54 54
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		array('Debit ', 'INPUT', array('name' => 'debit[debit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'debit[debit-integer]', '', '', '', 'search_int_type', ''),
72 72
 			array('Cost ', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
73 73
 		array('Disposition', 'disposition', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_despostion'),
74
-			array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"GLOBAL")),
74
+			array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"GLOBAL")),
75 75
  
76 76
 	  //array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`status`=2, concat(name,"","^"),name) as name', 'trunks', 'build_dropdown_deleted', '', array("status" => "1")),
77 77
 
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
 			array('Cost ', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
110 110
             
111 111
 			array('Disposition', 'disposition', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_despostion'),
112
-		array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"1")),
112
+		array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"1")),
113 113
 		 array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`status`=2, concat(name,"","^"),name) as name', 'pricelists', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0")),
114 114
 			array('Call Type', 'calltype', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_calltype'),
115 115
         
116 116
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
117 117
 			array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
118 118
 		if ($this->CI->session->userdata('logintype') != 1 && $this->CI->session->userdata('logintype') != 5) {
119
-	  $new_Array=array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "1"));     
119
+	  $new_Array = array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "1"));     
120 120
 	}
121 121
 	
122
-	$form['display_in']=array('name' => 'search_in',"id"=>"search_in","function"=>"search_report_in", "content"=>"Display records in &nbsp;&nbsp;",'label_class' => "search_label col-md-3 no-padding","dropdown_class"=>"form-control","label_style"=>"font-size:13px;text-align:right;","dropdown_style"=>"background: #ddd; width: 23% !important;");
122
+	$form['display_in'] = array('name' => 'search_in', "id"=>"search_in", "function"=>"search_report_in", "content"=>"Display records in &nbsp;&nbsp;", 'label_class' => "search_label col-md-3 no-padding", "dropdown_class"=>"form-control", "label_style"=>"font-size:13px;text-align:right;", "dropdown_style"=>"background: #ddd; width: 23% !important;");
123 123
 	
124 124
 	/****************************************/
125 125
 		$form['button_search'] = array('name' => 'action', 'id' => "reseller_cdr_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 		array('Cost ', 'INPUT', array('name' => 'provider_call_cost[provider_call_cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'provider_call_cost[provider_call_cost-integer]', '', '', '', 'search_int_type', ''),
142 142
 //	  array('Cost ', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
143 143
 		  array('Disposition', 'disposition', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_despostion'),
144
- array('Account', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"3")),
145
-			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '')
144
+ array('Account', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"3")),
145
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', '')
146 146
 
147 147
 //	  array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', '', ''),
148 148
             
149 149
             
150 150
 		);
151
-	$form['display_in']=array('name' => 'search_in',"id"=>"search_in","function"=>"search_report_in", "content"=>"Display records in",'label_class' => "search_label col-md-3 no-padding","dropdown_class"=>"form-control","label_style"=>"font-size:13px;","dropdown_style"=>"background: #ddd; width: 21% !important;");
151
+	$form['display_in'] = array('name' => 'search_in', "id"=>"search_in", "function"=>"search_report_in", "content"=>"Display records in", 'label_class' => "search_label col-md-3 no-padding", "dropdown_class"=>"form-control", "label_style"=>"font-size:13px;", "dropdown_style"=>"background: #ddd; width: 21% !important;");
152 152
 	
153 153
 	/****************************************/
154 154
 		$form['button_search'] = array('name' => 'action', 'id' => "provider_cdr_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
@@ -163,52 +163,52 @@  discard block
 block discarded – undo
163 163
 ******/
164 164
 	function build_report_list_for_customer() {
165 165
 		$logintype = $this->CI->session->userdata('userlevel_logintype');
166
-		 if($logintype != 1){
166
+		 if ($logintype != 1) {
167 167
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
168
-		$currency_id=$account_info['currency_id'];
169
-		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
168
+		$currency_id = $account_info['currency_id'];
169
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
170 170
              
171
-			 $recording=array();
171
+			 $recording = array();
172 172
 			 $account_data = $this->CI->session->userdata("accountinfo");
173
-		 if($account_data['type'] == 1){
174
-				$recording=array("Recording", "127", "recording", "", "", ""); 
173
+		 if ($account_data['type'] == 1) {
174
+				$recording = array("Recording", "127", "recording", "", "", ""); 
175 175
 			 }
176 176
 		$grid_field_arr = json_encode(array(
177
-		array(gettext("Date"), "100", "callstart","callstart", "callstart", "convert_GMT_to","","true","center"),
178
-		array("Caller ID", "120", "callerid", "", "", "","","true","center"),
179
-		array("Called Number", "103", "callednum", "", "", "","","true","center"),
180
-		array("Code", "71", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
181
-		array("Destination", "90", "notes", "", "", "","","true","center"),
182
-		array("Duration", "80", "billseconds", "customer_cdr_list_search", "billseconds", "convert_to_show_in","","true","center"),
183
-		array("Debit($currency)", "75", "debit", "debit", "debit", "convert_to_currency","","true","right"),
184
-		array("Cost($currency)", "75", "cost", "cost", "cost", "convert_to_currency","","true","right"),
185
-		array("Disposition", "150", "disposition", "", "", "","","true","center"),
186
-		array("Account", "110", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
187
-		array("Trunk", "90", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
188
-		array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
177
+		array(gettext("Date"), "100", "callstart", "callstart", "callstart", "convert_GMT_to", "", "true", "center"),
178
+		array("Caller ID", "120", "callerid", "", "", "", "", "true", "center"),
179
+		array("Called Number", "103", "callednum", "", "", "", "", "true", "center"),
180
+		array("Code", "71", "pattern", "pattern", "", "get_only_numeric_val", "", "true", "center"),
181
+		array("Destination", "90", "notes", "", "", "", "", "true", "center"),
182
+		array("Duration", "80", "billseconds", "customer_cdr_list_search", "billseconds", "convert_to_show_in", "", "true", "center"),
183
+		array("Debit($currency)", "75", "debit", "debit", "debit", "convert_to_currency", "", "true", "right"),
184
+		array("Cost($currency)", "75", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
185
+		array("Disposition", "150", "disposition", "", "", "", "", "true", "center"),
186
+		array("Account", "110", "accountid", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
187
+		array("Trunk", "90", "trunk_id", "name", "trunks", "get_field_name", "", "true", "center"),
188
+		array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
189 189
 		array("Call Type", "112", "calltype", "", "", ""),
190 190
 				$recording,
191 191
 				));
192 192
                 
193 193
 				}
194
-				else{
194
+				else {
195 195
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
196
-		$currency_id=$account_info['currency_id'];
197
-		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
198
-		$recording=array("Recording", "127", "recording", "", "", "");			
196
+		$currency_id = $account_info['currency_id'];
197
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
198
+		$recording = array("Recording", "127", "recording", "", "", "");			
199 199
 		$grid_field_arr = json_encode(array(
200
-		array("Date", "100", "callstart","callstart", "callstart", "convert_GMT_to","","true","center"),
201
-		array("Caller ID", "100", "callerid", "", "", "","","true","center"),
202
-		array("Called Number", "103", "callednum", "", "", "","","true","center"),
203
-		array("Code", "71", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
204
-		array("Destination", "90", "notes", "", "", "","","true","center"),
205
-		array("Duration", "80", "billseconds", "customer_cdr_list_search", "billseconds", "convert_to_show_in","","true","center"),
206
-		array("Debit($currency)", "75", "debit", "debit", "debit", "convert_to_currency","","true","right"),
207
-		array("Cost($currency)", "75", "cost", "cost", "cost", "convert_to_currency","","true","right"),
208
-		array("Disposition", "130", "disposition", "", "", "","","true","center"),
209
-		array("Account", "110", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
200
+		array("Date", "100", "callstart", "callstart", "callstart", "convert_GMT_to", "", "true", "center"),
201
+		array("Caller ID", "100", "callerid", "", "", "", "", "true", "center"),
202
+		array("Called Number", "103", "callednum", "", "", "", "", "true", "center"),
203
+		array("Code", "71", "pattern", "pattern", "", "get_only_numeric_val", "", "true", "center"),
204
+		array("Destination", "90", "notes", "", "", "", "", "true", "center"),
205
+		array("Duration", "80", "billseconds", "customer_cdr_list_search", "billseconds", "convert_to_show_in", "", "true", "center"),
206
+		array("Debit($currency)", "75", "debit", "debit", "debit", "convert_to_currency", "", "true", "right"),
207
+		array("Cost($currency)", "75", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
208
+		array("Disposition", "130", "disposition", "", "", "", "", "true", "center"),
209
+		array("Account", "110", "accountid", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
210 210
 		//array("Trunk", "90", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
211
-		array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
211
+		array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
212 212
 		array("Call Type", "112", "calltype", "", "", ""),
213 213
 				$recording,
214 214
 				));
@@ -222,23 +222,23 @@  discard block
 block discarded – undo
222 222
 	function build_report_list_for_reseller() {
223 223
 		
224 224
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
225
-$currency_id=$account_info['currency_id'];
226
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
225
+$currency_id = $account_info['currency_id'];
226
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
227 227
 		
228 228
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
229 229
 		$grid_field_arr = json_encode(array(
230
-			array("Date", "100", "callstart", "callstart", "callstart", "convert_GMT_to","","true","center"),
231
-			array("Caller ID", "100", "callerid", "", "", "","","true","center"),
232
-			array("Called Number", "120", "callednum", "", "", "","","true","center"),
233
-			array("Code", "80", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
234
-			array("Destination", "120", "notes", "", "", "","","true","center"),
235
-			array("Duration", "107", "billseconds", "reseller_cdr_list_search", "billseconds", "convert_to_show_in","","true","center"),
236
-			array("Debit($currency)", "105", "debit", "debit", "debit", "convert_to_currency","","true","right"),
237
-			array("Cost($currency)", "104", "cost", "cost", "cost", "convert_to_currency","","true","right"),
238
-			array("Disposition", "100", "disposition", "", "", "","","true","center"),
239
-			array("Account", "120", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
240
-			array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
241
- 			array("Call Type", "120", "calltype", "", "", "","","true","center"), 
230
+			array("Date", "100", "callstart", "callstart", "callstart", "convert_GMT_to", "", "true", "center"),
231
+			array("Caller ID", "100", "callerid", "", "", "", "", "true", "center"),
232
+			array("Called Number", "120", "callednum", "", "", "", "", "true", "center"),
233
+			array("Code", "80", "pattern", "pattern", "", "get_only_numeric_val", "", "true", "center"),
234
+			array("Destination", "120", "notes", "", "", "", "", "true", "center"),
235
+			array("Duration", "107", "billseconds", "reseller_cdr_list_search", "billseconds", "convert_to_show_in", "", "true", "center"),
236
+			array("Debit($currency)", "105", "debit", "debit", "debit", "convert_to_currency", "", "true", "right"),
237
+			array("Cost($currency)", "104", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
238
+			array("Disposition", "100", "disposition", "", "", "", "", "true", "center"),
239
+			array("Account", "120", "accountid", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
240
+			array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
241
+ 			array("Call Type", "120", "calltype", "", "", "", "", "true", "center"), 
242 242
 		    
243 243
 		   ));
244 244
 		return $grid_field_arr;
@@ -247,25 +247,25 @@  discard block
 block discarded – undo
247 247
 	function build_report_list_for_provider() {
248 248
 
249 249
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
250
-$currency_id=$account_info['currency_id'];
251
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
250
+$currency_id = $account_info['currency_id'];
251
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
252 252
 		
253 253
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
254
-		$grid_field_arr = json_encode(array(array("Date", "100", "callstart", "callstart", "callstart", "convert_GMT_to","","true","center"),
255
-		  array("Caller ID", "120", "callerid", "", "", "","","true","center"),
256
-		  array("Called Number", "160", "callednum", "", "", "","","true","center"),
257
-		  array("Code", "117", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
258
-		  array("Destination", "130", "notes", "", "", "","","true","center"),
259
-		  array("Duration", "110", "billseconds", "provider_cdr_list_search", "billseconds", "convert_to_show_in","","true","center"),
260
-		  array("Cost($currency)", "150", "provider_call_cost", "provider_cost", "provider_cost", "convert_to_currency","","true","right"),
261
-		  array("Disposition", "200", "disposition", "", "", "","","true","center"),
262
-		  array("Account", "181", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
254
+		$grid_field_arr = json_encode(array(array("Date", "100", "callstart", "callstart", "callstart", "convert_GMT_to", "", "true", "center"),
255
+		  array("Caller ID", "120", "callerid", "", "", "", "", "true", "center"),
256
+		  array("Called Number", "160", "callednum", "", "", "", "", "true", "center"),
257
+		  array("Code", "117", "pattern", "pattern", "", "get_only_numeric_val", "", "true", "center"),
258
+		  array("Destination", "130", "notes", "", "", "", "", "true", "center"),
259
+		  array("Duration", "110", "billseconds", "provider_cdr_list_search", "billseconds", "convert_to_show_in", "", "true", "center"),
260
+		  array("Cost($currency)", "150", "provider_call_cost", "provider_cost", "provider_cost", "convert_to_currency", "", "true", "right"),
261
+		  array("Disposition", "200", "disposition", "", "", "", "", "true", "center"),
262
+		  array("Account", "181", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
263 263
 		));
264 264
 		return $grid_field_arr;
265 265
 	}
266 266
 
267 267
 	function build_grid_customer() {
268
-		$buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/reports/customerReport_export/", 'single')));
268
+		$buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/reports/customerReport_export/", 'single')));
269 269
 		return $buttons_json;
270 270
 	}
271 271
 /**
@@ -274,43 +274,43 @@  discard block
 block discarded – undo
274 274
 **/
275 275
 
276 276
 	function build_grid_buttons_user() {
277
-		$buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/user/user_report_export/", 'single')));
277
+		$buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/user/user_report_export/", 'single')));
278 278
 		return $buttons_json;
279 279
 	}
280 280
 /*****************************************************************/
281 281
 	function build_grid_buttons_reseller() {
282
-		$buttons_json = json_encode(array( array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/reports/resellerReport_export/", 'single')));
282
+		$buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/reports/resellerReport_export/", 'single')));
283 283
 		return $buttons_json;
284 284
 	}
285 285
 	function build_grid_buttons_provider() {
286
-		$buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/reports/providerReport_export/", 'single')));
286
+		$buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/reports/providerReport_export/", 'single')));
287 287
 		return $buttons_json;
288 288
 	}
289 289
     
290 290
 	function build_report_list_for_user($accounttype = 'customer') {
291 291
 		
292 292
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
293
-		$currency_id=$account_info['currency_id'];
294
-		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);			
293
+		$currency_id = $account_info['currency_id'];
294
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);			
295 295
 		
296 296
 		
297
-		if($accounttype == 'customer' || $accounttype =='reseller'){
298
-			$cost_array=array("Debit($currency)", "100", "debit", "debit", "debit", "convert_to_currency","","true","right");
297
+		if ($accounttype == 'customer' || $accounttype == 'reseller') {
298
+			$cost_array = array("Debit($currency)", "100", "debit", "debit", "debit", "convert_to_currency", "", "true", "right");
299 299
 		}
300
-		if(strtolower($accounttype)=='provider'){
301
-			$cost_array=array("Debit($currency)", "140", "cost", "cost", "cost", "convert_to_currency");
300
+		if (strtolower($accounttype) == 'provider') {
301
+			$cost_array = array("Debit($currency)", "140", "cost", "cost", "cost", "convert_to_currency");
302 302
 		}
303 303
 	 // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
304 304
 		$grid_field_arr = json_encode(array(
305
-		array("Date", "130", "callstart", "callstart", "callstart", "convert_GMT_to","","true","center"),
306
-			array("Caller ID", "100", "callerid", "", "", "","","true","center"),
307
-			array("Called Number", "120", "callednum", "", "", "","","true","center"),
308
-			array("Destination", "135", "notes", "", "", "","","true","center"),
305
+		array("Date", "130", "callstart", "callstart", "callstart", "convert_GMT_to", "", "true", "center"),
306
+			array("Caller ID", "100", "callerid", "", "", "", "", "true", "center"),
307
+			array("Called Number", "120", "callednum", "", "", "", "", "true", "center"),
308
+			array("Destination", "135", "notes", "", "", "", "", "true", "center"),
309 309
 //            array("Account Number", "120", "accountid", "number", "accounts", "get_field_name"),
310
-			array("Duration", "120", "billseconds", "user_cdrs_report_search", "billseconds", "convert_to_show_in","","true","center"),
310
+			array("Duration", "120", "billseconds", "user_cdrs_report_search", "billseconds", "convert_to_show_in", "", "true", "center"),
311 311
 			$cost_array,
312
-			array("Disposition", "160", "disposition", "", "", "","","true","center"),
313
-			array("Call Type", "140", "calltype", "", "", "","","true","center"),
312
+			array("Disposition", "160", "disposition", "", "", "", "", "true", "center"),
313
+			array("Call Type", "140", "calltype", "", "", "", "", "true", "center"),
314 314
 				));
315 315
 		return $grid_field_arr;
316 316
 	}
@@ -322,37 +322,37 @@  discard block
 block discarded – undo
322 322
 	function build_refill_report_for_admin() {
323 323
 		
324 324
 		  $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
325
-	$currency_id=$account_info['currency_id'];
326
-	 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
325
+	$currency_id = $account_info['currency_id'];
326
+	 $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
327 327
 	  $grid_field_arr = json_encode(array(
328
-			array(gettext("Date"), "225", "payment_date", "", "", "","","true","center"),
329
-			array(gettext("Account"), "240", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
330
-			array("Amount($currency)", "250", "credit", "credit", "credit", "convert_to_currency","","true","right"),
331
-			array(gettext("Refill By"), "230", "payment_by", "payment_by", "payment_by", "get_refill_by","","true","center"),
332
-			array(gettext("Note"), "327", "notes", "", "", "","","true","center")
328
+			array(gettext("Date"), "225", "payment_date", "", "", "", "", "true", "center"),
329
+			array(gettext("Account"), "240", "accountid", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
330
+			array("Amount($currency)", "250", "credit", "credit", "credit", "convert_to_currency", "", "true", "right"),
331
+			array(gettext("Refill By"), "230", "payment_by", "payment_by", "payment_by", "get_refill_by", "", "true", "center"),
332
+			array(gettext("Note"), "327", "notes", "", "", "", "", "true", "center")
333 333
 				));
334 334
 		return $grid_field_arr;
335 335
 	}
336 336
 	function build_refillreport_buttons() {
337
-		$buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/reports/refillreport_export/", 'single')));
337
+		$buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/reports/refillreport_export/", 'single')));
338 338
 		return $buttons_json;
339 339
 	}
340 340
 	function build_search_refill_report_for_admin() {
341
-		 $accountinfo=$this->CI->session->userdata('accountinfo');
342
-		 $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0 ;
341
+		 $accountinfo = $this->CI->session->userdata('accountinfo');
342
+		 $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
343 343
 		 $form['forms'] = array("", array('id' => "cdr_refill_search"));
344 344
 			 $account_data = $this->CI->session->userdata("accountinfo");
345
-			 $acc_arr= array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"0,1,3"));
345
+			 $acc_arr = array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id, "type"=>"0,1,3"));
346 346
 			 $logintype = $this->CI->session->userdata('logintype');
347 347
 		if ($logintype == 1 || $logintype == 5) {
348 348
 			$account_data = $this->CI->session->userdata("accountinfo");
349 349
 			$loginid = $account_data['id'];
350 350
 
351
-		}else{
351
+		} else {
352 352
 			$loginid = "0";
353 353
 		}
354
-		if($logintype==0 || $logintype==3){
355
-		$acc_arr=null;
354
+		if ($logintype == 0 || $logintype == 3) {
355
+		$acc_arr = null;
356 356
 		}    
357 357
 		$form['Search'] = array(
358 358
 		array('From Date', 'INPUT', array('name' => 'payment_date[]', 'id' => 'refill_from_date', 'size' => '20',
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 //	    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","type"=>"0")), 
363 363
 			array('Amount ', 'INPUT', array('name' => 'credit[credit]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'credit[credit-integer]', '', '', '', 'search_int_type', ''),
364 364
 		   // array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
365
-			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
365
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
366 366
 
367 367
 		$form['button_search'] = array('name' => 'action', 'id' => "cusotmer_cdr_refill_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
368 368
 		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
393 393
 			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
394 394
 			array('From Date', 'INPUT', array('name' => 'date[]', 'id' => 'commission_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'),
395
-			array('To Date', 'INPUT', array('name' => 'date[]', 'id' => 'commission_to_date', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
396
-		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","type"=>"1", "deleted" => "0")),
397
-			array('Amount', 'INPUT', array('name' => 'amount[amount]', 'value' => '', 'size' => '20',  'class' => "text field"), '', 'Tool tips info', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''),
395
+			array('To Date', 'INPUT', array('name' => 'date[]', 'id' => 'commission_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
396
+		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", "type"=>"1", "deleted" => "0")),
397
+			array('Amount', 'INPUT', array('name' => 'amount[amount]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''),
398 398
 		);
399 399
 
400 400
 		$form['button_search'] = array('name' => 'action', 'id' => "commission_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'ui-state-default float-right ui-corner-all ui-button');
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 		$form['Search'] = array(
408 408
 	array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'),
409 409
 			array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
410
-		   array('Account', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"3")),
411
-		   array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
410
+		   array('Account', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"3")),
411
+		   array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
412 412
             
413 413
 			array('Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''), 
414 414
 		// array('Account Number', 'number', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type"=>"3", "deleted" => "0")),
@@ -419,99 +419,99 @@  discard block
 block discarded – undo
419 419
 
420 420
 		return $form;
421 421
 	}
422
-	function build_providersummary(){
422
+	function build_providersummary() {
423 423
 		$grid_field_arr = json_encode(array(
424 424
 			array("Provider", "220", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"),
425 425
 			array("Code", "120", "pattern", "pattern", "", "get_only_numeric_val"),
426 426
 			array("Destination", "150", "notes", "", "", ""),
427 427
 			array("Attempted Calls", "130", "attempted_calls", "", "", ""),
428 428
 			array("Completed Calls", "150", "description", "", "", ""),
429
-			array("ASR","95","asr",'','',''),
430
-			array("ACD","95","acd  ",'','',''),
431
-			array("MCD","95","mcd",'','',''),
432
-			array("Bilable","100","billable",'','',''),
433
-			array("Cost","115","cost",'','',''),
429
+			array("ASR", "95", "asr", '', '', ''),
430
+			array("ACD", "95", "acd  ", '', '', ''),
431
+			array("MCD", "95", "mcd", '', '', ''),
432
+			array("Bilable", "100", "billable", '', '', ''),
433
+			array("Cost", "115", "cost", '', '', ''),
434 434
 //            array("Profit", "95", "profit", "", "", ""),
435 435
 			));
436 436
 		return $grid_field_arr;
437 437
 	}
438 438
 	function build_grid_buttons_providersummary() {
439
-	   $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/reports/providersummary_export_cdr_xls", 'single')));
439
+	   $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/reports/providersummary_export_cdr_xls", 'single')));
440 440
 		return $buttons_json;
441 441
 	}
442 442
 	function get_resellersummary_search_form() {
443
-		$form['forms'] = array("",array('id' => "resellersummary_search"));
443
+		$form['forms'] = array("", array('id' => "resellersummary_search"));
444 444
 		$form['Search'] = array(
445 445
 			array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'),
446 446
 			array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
447
-		array('Account', 'reseller_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"1")),
448
-		   array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
447
+		array('Account', 'reseller_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"1")),
448
+		   array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
449 449
             
450 450
 			array('Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''), 
451 451
 		   // array('Account Number', 'number', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type"=>"1", "deleted" => "0")),
452
-array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
452
+array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
453 453
 		$form['button_search'] = array('name' => 'action', 'id' => "resellersummary_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
454 454
 		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
455 455
 
456 456
 		return $form;
457 457
 	}
458
-	function build_resellersummary(){
458
+	function build_resellersummary() {
459 459
 		$grid_field_arr = json_encode(array(
460 460
 			array("Account", "148", "accountid", "first_name,last_name,number", "accounts", "build_concat_string"),
461 461
 			array("Code", "120", "pattern", "pattern", "", "get_only_numeric_val"),
462 462
 			array("Destination", "150", "notes", "", "", ""),
463 463
 			array("Attempted Calls", "120", "attempted_calls", "", "", ""),
464 464
 			array("Completed Calls", "120", "description", "", "", ""),
465
-			array("ASR","80","asr",'','',''),
466
-			array("ACD","80","acd  ",'','',''),
467
-			array("MCD","80","mcd",'','',''),
468
-			array("Bilable","90","billable",'','',''),
469
-			array("Price","90","price",'','',''),
470
-			array("Cost","90","cost",'','',''),
465
+			array("ASR", "80", "asr", '', '', ''),
466
+			array("ACD", "80", "acd  ", '', '', ''),
467
+			array("MCD", "80", "mcd", '', '', ''),
468
+			array("Bilable", "90", "billable", '', '', ''),
469
+			array("Price", "90", "price", '', '', ''),
470
+			array("Cost", "90", "cost", '', '', ''),
471 471
 			array("Profit", "100", "profit", "", "", ""),
472 472
 			));
473 473
 		return $grid_field_arr;
474 474
 	}
475 475
 	function build_grid_buttons_resellersummary() {
476
-		 $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/reports/resellersummary_export_cdr_xls", 'single')));
476
+		 $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/reports/resellersummary_export_cdr_xls", 'single')));
477 477
 		return $buttons_json;
478 478
 	}
479 479
 	function get_customersummary_search_form() {
480
-		$form['forms'] = array("",array('id' => "customersummary_search"));
480
+		$form['forms'] = array("", array('id' => "customersummary_search"));
481 481
 		$form['Search'] = array(
482 482
 			array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'),
483 483
 			array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
484
-		array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"GLOBAL")),
484
+		array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"GLOBAL")),
485 485
 			array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
486 486
             
487 487
 			array('Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''),
488 488
 		   // array('Account Number', 'number', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("type"=>"0", "deleted" => "0")),
489
-	array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '')
489
+	array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', '')
490 490
 		);
491 491
 		$form['button_search'] = array('name' => 'action', 'id' => "customersummary_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
492 492
 		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
493 493
 
494 494
 		return $form;
495 495
 	}
496
-	function build_customersummary(){
496
+	function build_customersummary() {
497 497
 		$grid_field_arr = json_encode(array(
498 498
 			array("Account", "190", "accountid", "first_name,last_name,number", "accounts", "build_concat_string"),
499 499
 			array("Code", "80", "pattern", "pattern", "", "get_only_numeric_val"),
500 500
 			array("Destination", "110", "notes", "", "", ""),
501 501
 			array("Attempted Calls", "140", "attempted_calls", "", "", ""),
502 502
 			array("Completed Calls", "130", "description", "", "", ""),
503
-			array("ASR","70","asr",'','',''),
504
-			array("ACD","70","acd  ",'','',''),
505
-			array("MCD","80","mcd",'','',''),
506
-			array("Bilable","80","billable",'','',''),
507
-			array("Debit","85","cost",'','',''),
508
-			array("Cost","110","price",'','',''),            
503
+			array("ASR", "70", "asr", '', '', ''),
504
+			array("ACD", "70", "acd  ", '', '', ''),
505
+			array("MCD", "80", "mcd", '', '', ''),
506
+			array("Bilable", "80", "billable", '', '', ''),
507
+			array("Debit", "85", "cost", '', '', ''),
508
+			array("Cost", "110", "price", '', '', ''),            
509 509
 			array("Profit", "123", "profit", "", "", ""),
510 510
 			));
511 511
 		return $grid_field_arr;
512 512
 	}
513 513
 	function build_grid_buttons_customersummary() {
514
-		$buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/reports/customersummary_export_cdr_xls", 'single')));
514
+		$buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/reports/customersummary_export_cdr_xls", 'single')));
515 515
 		return $buttons_json;
516 516
 	}
517 517
 /*********
@@ -520,45 +520,45 @@  discard block
 block discarded – undo
520 520
 *********/
521 521
 	function build_charge_list_for_admin() {
522 522
 	$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
523
-	$currency_id=$account_info['currency_id'];
524
-	$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
523
+	$currency_id = $account_info['currency_id'];
524
+	$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
525 525
 	 if ($this->CI->session->userdata("logintype") == '1') {
526 526
 		$grid_field_arr = json_encode(array(
527
-			array(gettext("Created Date"), "120", "created_date", "", "", "","","true","center"),
528
-			array(gettext("Invoice Number"), "120", "created_date", "", "", "","","true","center"),
529
-			array(gettext("Account"), "120", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
527
+			array(gettext("Created Date"), "120", "created_date", "", "", "", "", "true", "center"),
528
+			array(gettext("Invoice Number"), "120", "created_date", "", "", "", "", "true", "center"),
529
+			array(gettext("Account"), "120", "accountid", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
530 530
 //            array("Reseller", "120", "reseller_id", "first_name,last_name,number", "accounts", "reseller_select_value"),
531
-			array(gettext("Charge Type"), "120", "item_type", "", "", "","","true","center"),
532
-			array("Before Balance<br/>($currency)", "120", "before_balance", "before_balance", "before_balance", "convert_to_currency","","true","right"),
533
-			array("Debit (-)<br/>($currency)", "110", "debit", "debit", "debit", "convert_to_currency","","true","right"),
534
-			array("Credit (+)<br/>($currency)", "110", "credit", "credit", "credit", "convert_to_currency","","true","right"),
535
-		array("After Balance<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency","","true","right"),	
536
-			array(gettext("Description"), "300", "description", "", "", "","","true","center"),
531
+			array(gettext("Charge Type"), "120", "item_type", "", "", "", "", "true", "center"),
532
+			array("Before Balance<br/>($currency)", "120", "before_balance", "before_balance", "before_balance", "convert_to_currency", "", "true", "right"),
533
+			array("Debit (-)<br/>($currency)", "110", "debit", "debit", "debit", "convert_to_currency", "", "true", "right"),
534
+			array("Credit (+)<br/>($currency)", "110", "credit", "credit", "credit", "convert_to_currency", "", "true", "right"),
535
+		array("After Balance<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency", "", "true", "right"),	
536
+			array(gettext("Description"), "300", "description", "", "", "", "", "true", "center"),
537 537
 				));
538
-	}else{
538
+	} else {
539 539
 		$grid_field_arr = json_encode(array(
540
-			array("Created Date", "120", "created_date", "", "", "","","true","center"),
541
-			array("Invoice Number", "120", "created_date", "", "", "","","true","center"),
542
-   		array("Account", "120", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
543
-			array("Charge Type", "120", "item_type", "", "", "","","true","center"),
544
-			array("Before Balance<br/>($currency)", "120", "before_balance", "before_balance", "before_balance", "convert_to_currency","","true","right"),
545
-			array("Debit (-)<br/>($currency)", "110", "debit", "debit", "debit", "convert_to_currency","","true","right"),
546
-			array("Credit (+)<br/>($currency)", "110", "credit", "credit", "credit", "convert_to_currency","","true","right"),
547
-		array("After Balance<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency","","true","right"),	
548
-			array("Description", "300", "description", "", "", "","","true","center"),
540
+			array("Created Date", "120", "created_date", "", "", "", "", "true", "center"),
541
+			array("Invoice Number", "120", "created_date", "", "", "", "", "true", "center"),
542
+   		array("Account", "120", "accountid", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
543
+			array("Charge Type", "120", "item_type", "", "", "", "", "true", "center"),
544
+			array("Before Balance<br/>($currency)", "120", "before_balance", "before_balance", "before_balance", "convert_to_currency", "", "true", "right"),
545
+			array("Debit (-)<br/>($currency)", "110", "debit", "debit", "debit", "convert_to_currency", "", "true", "right"),
546
+			array("Credit (+)<br/>($currency)", "110", "credit", "credit", "credit", "convert_to_currency", "", "true", "right"),
547
+		array("After Balance<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency", "", "true", "right"),	
548
+			array("Description", "300", "description", "", "", "", "", "true", "center"),
549 549
 				));
550 550
 
551 551
 	}
552 552
 		return $grid_field_arr;
553 553
 	}
554 554
 	function get_charges_search_form() {
555
-		$accountinfo=$this->CI->session->userdata('accountinfo');
556
-		$reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
555
+		$accountinfo = $this->CI->session->userdata('accountinfo');
556
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
557 557
 		$form['forms'] = array("", array('id' => "charges_search"));
558 558
 		$form['Search'] = array(
559 559
 			array('From Date', 'INPUT', array('name' => 'created_date[]', 'id' => 'charge_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'),
560 560
 			array('To Date', 'INPUT', array('name' => 'created_date[]', 'id' => 'charge_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'),
561
-		array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"GLOBAL")),
561
+		array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id, "type"=>"GLOBAL")),
562 562
 		array('Debit ', 'INPUT', array('name' => 'debit[debit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'debit[debit-integer]', '', '', '', 'search_int_type', ''),
563 563
 		array('Credit ', 'INPUT', array('name' => 'credit[credit]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'credit[credit-integer]', '', '', '', 'search_int_type', ''),
564 564
 
@@ -575,20 +575,20 @@  discard block
 block discarded – undo
575 575
         ASTPP  3.0
576 576
         Charges History
577 577
     *********/
578
-	function build_charge_list_for_customer(){
578
+	function build_charge_list_for_customer() {
579 579
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
580
-		$currency_id=$account_info['currency_id'];
581
-		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);	
580
+		$currency_id = $account_info['currency_id'];
581
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);	
582 582
 		
583 583
 		$grid_field_arr = json_encode(array(
584
-			array("Created Date", "100", "created_date", "", "", "","","true","center"),
585
-			array("Invoice Number", "110", "created_date", "", "", "","","true","center"),
586
-			array("Charge Type", "100", "item_type", "", "", "","","true","center"),
587
-			array("Before Balance<br/>($currency)", "120", "before_balance", "before_balance", "before_balance", "convert_to_currency","","true","right"),
588
-			array("Debit (-)<br/>($currency)", "110", "debit", "debit", "debit", "convert_to_currency","","true","right"),
589
-			array("Credit (+)<br/>($currency)", "110", "credit", "credit", "credit", "convert_to_currency","","true","right"),
590
-		array("After Balance<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency","","true","right"),
591
-			array("Description", "270", "description", "", "", "","","true","center"),
584
+			array("Created Date", "100", "created_date", "", "", "", "", "true", "center"),
585
+			array("Invoice Number", "110", "created_date", "", "", "", "", "true", "center"),
586
+			array("Charge Type", "100", "item_type", "", "", "", "", "true", "center"),
587
+			array("Before Balance<br/>($currency)", "120", "before_balance", "before_balance", "before_balance", "convert_to_currency", "", "true", "right"),
588
+			array("Debit (-)<br/>($currency)", "110", "debit", "debit", "debit", "convert_to_currency", "", "true", "right"),
589
+			array("Credit (+)<br/>($currency)", "110", "credit", "credit", "credit", "convert_to_currency", "", "true", "right"),
590
+		array("After Balance<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency", "", "true", "right"),
591
+			array("Description", "270", "description", "", "", "", "", "true", "center"),
592 592
 				));
593 593
 		return $grid_field_arr;
594 594
 	}
@@ -596,17 +596,17 @@  discard block
 block discarded – undo
596 596
         ASTPP  3.0
597 597
         Refill History
598 598
     *********/
599
-	function build_refillreport_for_customer(){
599
+	function build_refillreport_for_customer() {
600 600
 		
601 601
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
602
-		$currency_id=$account_info['currency_id'];
603
-		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);		
602
+		$currency_id = $account_info['currency_id'];
603
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);		
604 604
 		
605 605
 		 $grid_field_arr = json_encode(array(
606
-			array("Date", "225", "payment_date", "", "", "","","true","center"),
607
-			array("Amount($currency)", "250", "credit", "credit", "credit", "convert_to_currency","","true","right"),
608
-			array("Refill By", "230", "payment_by", "payment_by", "payment_by", "get_refill_by","","true","center"),
609
-			array("Note", "325", "notes", "", "", "","","true","center")
606
+			array("Date", "225", "payment_date", "", "", "", "", "true", "center"),
607
+			array("Amount($currency)", "250", "credit", "credit", "credit", "convert_to_currency", "", "true", "right"),
608
+			array("Refill By", "230", "payment_by", "payment_by", "payment_by", "get_refill_by", "", "true", "center"),
609
+			array("Note", "325", "notes", "", "", "", "", "true", "center")
610 610
 				));
611 611
 		return $grid_field_arr;
612 612
 	}
Please login to merge, or discard this patch.
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 # You should have received a copy of the GNU Affero General Public License
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23
-if (!defined('BASEPATH'))
24
-	exit('No direct script access allowed');
23
+if (!defined('BASEPATH')) {
24
+	exit('No direct script access allowed');
25
+}
25 26
 
26 27
 class Reports_form {
27 28
 	function __construct() {
@@ -56,8 +57,7 @@  discard block
 block discarded – undo
56 57
 			array('Call Type', 'calltype', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_calltype'),
57 58
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
58 59
 			array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
59
-			 }
60
-		else
60
+			 } else
61 61
 		{
62 62
 		$form['forms'] = array("", array('id' => "cdr_customer_search"));
63 63
 		$form['Search'] = array(
@@ -190,8 +190,7 @@  discard block
 block discarded – undo
190 190
 				$recording,
191 191
 				));
192 192
                 
193
-				}
194
-				else{
193
+				} else{
195 194
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
196 195
 		$currency_id=$account_info['currency_id'];
197 196
 		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
@@ -348,7 +347,7 @@  discard block
 block discarded – undo
348 347
 			$account_data = $this->CI->session->userdata("accountinfo");
349 348
 			$loginid = $account_data['id'];
350 349
 
351
-		}else{
350
+		} else{
352 351
 			$loginid = "0";
353 352
 		}
354 353
 		if($logintype==0 || $logintype==3){
@@ -535,7 +534,7 @@  discard block
 block discarded – undo
535 534
 		array("After Balance<br/>($currency)", "120", "after_balance", "after_balance", "after_balance", "convert_to_currency","","true","right"),	
536 535
 			array(gettext("Description"), "300", "description", "", "", "","","true","center"),
537 536
 				));
538
-	}else{
537
+	} else{
539 538
 		$grid_field_arr = json_encode(array(
540 539
 			array("Created Date", "120", "created_date", "", "", "","","true","center"),
541 540
 			array("Invoice Number", "120", "created_date", "", "", "","","true","center"),
Please login to merge, or discard this patch.