Completed
Push — v3.0 ( e28df5...5be1a9 )
by Samir
13:00
created
web_interface/astpp/application/modules/user/views/view_user_ipmap_list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,24 +21,24 @@
 block discarded – undo
21 21
             <div class="col-md-12 no-padding color-three border_box"> 
22 22
                 <div class="pull-left">
23 23
                     <ul class="breadcrumb">
24
-                         <?php $accountinfo=$this->session->userdata('accountinfo');
25
-						  if($accountinfo['type']==1){ ?>
26
-                          <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li>
27
-                          <?php } else{ ?>
24
+                         <?php $accountinfo = $this->session->userdata('accountinfo');
25
+						  if ($accountinfo['type'] == 1) { ?>
26
+                          <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li>
27
+                          <?php } else { ?>
28 28
 			    <li><a href="#">Configuration</a></li>
29 29
                           <?php }
30 30
 					?>
31 31
                         
32 32
                         <li class='active'>
33
-                            <a href="<?= base_url() . "user/user_ipmap/"; ?>">IP Settings</a>
33
+                            <a href="<?= base_url()."user/user_ipmap/"; ?>">IP Settings</a>
34 34
                         </li>
35 35
                     </ul>
36 36
                 </div>
37
-                <?php if($accountinfo['type']==1) { ?>
37
+                <?php if ($accountinfo['type'] == 1) { ?>
38 38
                    <div class="pull-right">
39 39
                     <ul class="breadcrumb">
40 40
 		      <li class="active pull-right">
41
-		      <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
41
+		      <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
42 42
                     </ul>
43 43
                    </div>
44 44
                 <?php }?>
Please login to merge, or discard this patch.
astpp/application/modules/user/views/view_user_invoices_config.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -198,13 +198,13 @@
 block discarded – undo
198 198
 				</div>
199 199
 		</div>	
200 200
 <?php
201
-	if($account_data['logo']  != ''){
202
-		 $logo=$account_data['file'];
203
-	}else{
204
-		 $logo=$account_data['logo'];
201
+	if ($account_data['logo'] != '') {
202
+		 $logo = $account_data['file'];
203
+	} else {
204
+		 $logo = $account_data['logo'];
205 205
 	}
206
-		  if($logo != ''){        
207
-			 $file_name= base_url()."upload/$logo";
206
+		  if ($logo != '') {        
207
+			 $file_name = base_url()."upload/$logo";
208 208
 ?>
209 209
 
210 210
 		<div class='col-md-12 no-padding'>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/user/views/view_user_animap.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,24 +43,24 @@
 block discarded – undo
43 43
             <div class="col-md-12 no-padding color-three border_box"> 
44 44
                 <div class="pull-left">
45 45
                     <ul class="breadcrumb">
46
-                         <?php $accountinfo=$this->session->userdata('accountinfo');
47
-						  if($accountinfo['type']==1){ ?>
48
-                          <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li>
49
-                          <?php } else{ ?>
46
+                         <?php $accountinfo = $this->session->userdata('accountinfo');
47
+						  if ($accountinfo['type'] == 1) { ?>
48
+                          <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li>
49
+                          <?php } else { ?>
50 50
 			    <li><a href="#">Configuration</a></li>
51 51
                           <?php }
52 52
 					?>
53 53
                         
54 54
                         <li class='active'>
55
-                           <a href="<?= base_url() . "user/user_animap_list/"; ?>">Caller ID</a>
55
+                           <a href="<?= base_url()."user/user_animap_list/"; ?>">Caller ID</a>
56 56
                         </li>
57 57
                     </ul>
58 58
                 </div>
59
-                <?php if($accountinfo['type']==1) { ?>
59
+                <?php if ($accountinfo['type'] == 1) { ?>
60 60
                    <div class="pull-right">
61 61
                     <ul class="breadcrumb">
62 62
 		      <li class="active pull-right">
63
-		      <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
63
+		      <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
64 64
                     </ul>
65 65
                    </div>
66 66
                 <?php }?>
Please login to merge, or discard this patch.
astpp/application/modules/user/views/view_user_invoices_list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,24 +52,24 @@
 block discarded – undo
52 52
             <div class="col-md-12 no-padding color-three border_box"> 
53 53
                 <div class="pull-left">
54 54
                     <ul class="breadcrumb">
55
-                    <?php $accountinfo=$this->session->userdata('accountinfo');
56
-						  if($accountinfo['type']==1){ ?>
57
-                          <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li>
58
-                          <?php } else{ ?>
55
+                    <?php $accountinfo = $this->session->userdata('accountinfo');
56
+						  if ($accountinfo['type'] == 1) { ?>
57
+                          <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li>
58
+                          <?php } else { ?>
59 59
 			    <li><a href="#">Billing</a></li>
60 60
                           <?php }
61 61
 					?>
62 62
                         
63 63
                         <li class='active'>
64
-                            <a href="<?= base_url() . "user/user_invoices_list/"; ?>">Invoices </a>
64
+                            <a href="<?= base_url()."user/user_invoices_list/"; ?>">Invoices </a>
65 65
                         </li>
66 66
                     </ul>
67 67
                 </div>
68
-                <?php if($accountinfo['type']==1) { ?>
68
+                <?php if ($accountinfo['type'] == 1) { ?>
69 69
                    <div class="pull-right">
70 70
                     <ul class="breadcrumb">
71 71
 		      <li class="active pull-right">
72
-		      <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
72
+		      <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
73 73
                     </ul>
74 74
                    </div>
75 75
                 <?php }?>
Please login to merge, or discard this patch.
astpp/application/modules/user/views/view_user_charges_list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,22 +42,22 @@
 block discarded – undo
42 42
             <div class="col-md-12 no-padding color-three border_box"> 
43 43
                 <div class="pull-left">
44 44
                     <ul class="breadcrumb">
45
-                    <?php $accountinfo=$this->session->userdata('accountinfo');
46
-						  if($accountinfo['type']==1){ ?>
47
-                          <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li>
48
-                          <?php } else{ ?>
45
+                    <?php $accountinfo = $this->session->userdata('accountinfo');
46
+						  if ($accountinfo['type'] == 1) { ?>
47
+                          <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li>
48
+                          <?php } else { ?>
49 49
 			    <li><a href="#">Billing</a></li>
50 50
                           <?php } ?>
51 51
 			  <li class='active'>
52
-                            <a href="<?= base_url() . "user/user_charges_history/"; ?>">Charges History </a>
52
+                            <a href="<?= base_url()."user/user_charges_history/"; ?>">Charges History </a>
53 53
                           </li>
54 54
                     </ul>
55 55
                 </div>
56
-                <?php if($accountinfo['type']==1) { ?>
56
+                <?php if ($accountinfo['type'] == 1) { ?>
57 57
                    <div class="pull-right">
58 58
                     <ul class="breadcrumb">
59 59
 		      <li class="active pull-right">
60
-		      <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
60
+		      <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
61 61
                     </ul>
62 62
                    </div>
63 63
                 <?php }?>
Please login to merge, or discard this patch.
astpp/application/modules/dashboard/models/dashboard_model.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
 
32 32
 	function get_recent_recharge()
33 33
 	{
34
-	$accountinfo=$this->session->userdata('accountinfo');
35
-	$userlevel_logintype=$this->session->userdata('userlevel_logintype');
34
+	$accountinfo = $this->session->userdata('accountinfo');
35
+	$userlevel_logintype = $this->session->userdata('userlevel_logintype');
36 36
 	
37
-	$where_arr=array('payment_by'=>-1);
38
-	if($userlevel_logintype == 1){
39
-	  $where_arr=array('payment_by'=>$accountinfo['id']);
37
+	$where_arr = array('payment_by'=>-1);
38
+	if ($userlevel_logintype == 1) {
39
+	  $where_arr = array('payment_by'=>$accountinfo['id']);
40 40
 	}
41
-	if($userlevel_logintype == 0 || $userlevel_logintype == 3){
42
-	  $where_arr=array('accountid'=>$accountinfo['id']);
41
+	if ($userlevel_logintype == 0 || $userlevel_logintype == 3) {
42
+	  $where_arr = array('accountid'=>$accountinfo['id']);
43 43
 	}
44 44
 		$this->db->where($where_arr);
45 45
 		$this->db->select('id,accountid,credit,payment_date');
46 46
 		$this->db->limit(12);
47
-		$this->db->order_by('payment_date','desc');
47
+		$this->db->order_by('payment_date', 'desc');
48 48
 	return $this->db->get('payments');
49 49
 	}
50
-	 function get_call_statistics($table,$parent_id,$start_date='',$end_date='',$group_flag=true) 
50
+	 function get_call_statistics($table, $parent_id, $start_date = '', $end_date = '', $group_flag = true) 
51 51
 	{
52 52
 		$this->db->select("count(uniqueid) as sum,
53 53
                            count(CASE WHEN billseconds > 0 THEN 1 END) as answered,
@@ -59,46 +59,46 @@  discard block
 block discarded – undo
59 59
                            sum(cost) as cost,
60 60
                            SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,
61 61
                            DAY(callstart) as day",false);
62
-		$this->db->where('callstart >=',$start_date." 00:00:00");
63
-		$this->db->where('callstart <=',$end_date." 23:59:59");
64
-		$this->db->where('reseller_id',$parent_id);
65
-		if($group_flag)
62
+		$this->db->where('callstart >=', $start_date." 00:00:00");
63
+		$this->db->where('callstart <=', $end_date." 23:59:59");
64
+		$this->db->where('reseller_id', $parent_id);
65
+		if ($group_flag)
66 66
 		$this->db->group_by("DAY(callstart)");
67
-		$result=$this->db->get($table);
67
+		$result = $this->db->get($table);
68 68
 	return $result;
69 69
 	}
70
-	function get_customer_maximum_callminutes($start_date,$end_date)
70
+	function get_customer_maximum_callminutes($start_date, $end_date)
71 71
 	{
72
-	$start_date=$start_date." 00:00:00";
73
-	$end_date=$end_date." 23:59:59";
74
-	$accountinfo=$this->session->userdata('accountinfo');
75
-	$parent_id= ($accountinfo['type'] == 1) ? $accountinfo['id']:0;
76
-	if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3) {
77
-		 $where ="reseller_id ='$parent_id'";
72
+	$start_date = $start_date." 00:00:00";
73
+	$end_date = $end_date." 23:59:59";
74
+	$accountinfo = $this->session->userdata('accountinfo');
75
+	$parent_id = ($accountinfo['type'] == 1) ? $accountinfo['id'] : 0;
76
+	if ($this->session->userdata('userlevel_logintype') != 0 && $this->session->userdata('userlevel_logintype') != 3) {
77
+		 $where = "reseller_id ='$parent_id'";
78 78
 	} else {
79
-		 $where ="accountid ='$parent_id'";
79
+		 $where = "accountid ='$parent_id'";
80 80
 	}
81
-	$where= $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
82
-	$select_query= "(SELECT sum( billseconds ) AS billseconds,accountid FROM (cdrs) WHERE $where group by accountid order by sum(billseconds) desc limit 10)
81
+	$where = $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
82
+	$select_query = "(SELECT sum( billseconds ) AS billseconds,accountid FROM (cdrs) WHERE $where group by accountid order by sum(billseconds) desc limit 10)
83 83
 			union
84 84
 			(SELECT sum( billseconds ) AS billseconds,accountid FROM (reseller_cdrs) WHERE $where 
85 85
 			group by accountid order by sum(billseconds) desc limit 10 ) ORDER BY billseconds DESC LIMIT 10 ";
86 86
 	return $this->db->query($select_query);
87 87
 	}
88 88
 
89
-	function get_customer_maximum_callcount($start_date,$end_date)
89
+	function get_customer_maximum_callcount($start_date, $end_date)
90 90
 	{
91
-	$start_date=$start_date." 00:00:00";
92
-	$end_date=$end_date." 23:59:59";
93
-	$accountinfo=$this->session->userdata('accountinfo');
94
-	$parent_id= ($accountinfo['type'] == 1) ? $accountinfo['id']:0;
95
-	  if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3) {
96
-	  	  $where ="reseller_id ='$parent_id'";
91
+	$start_date = $start_date." 00:00:00";
92
+	$end_date = $end_date." 23:59:59";
93
+	$accountinfo = $this->session->userdata('accountinfo');
94
+	$parent_id = ($accountinfo['type'] == 1) ? $accountinfo['id'] : 0;
95
+	  if ($this->session->userdata('userlevel_logintype') != 0 && $this->session->userdata('userlevel_logintype') != 3) {
96
+	  	  $where = "reseller_id ='$parent_id'";
97 97
 	  } else {
98
-		  $where ="accountid ='$parent_id'";
98
+		  $where = "accountid ='$parent_id'";
99 99
 	}
100
-	  $where= $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
101
-	  $select_query="(SELECT count(uniqueid) as call_count, `accountid` FROM (`cdrs`) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
100
+	  $where = $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
101
+	  $select_query = "(SELECT count(uniqueid) as call_count, `accountid` FROM (`cdrs`) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
102 102
 	  UNION
103 103
 	  (SELECT count(uniqueid) as call_count,accountid FROM (reseller_cdrs) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
104 104
 	  ORDER BY call_count desc limit 10";
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,9 @@
 block discarded – undo
62 62
 		$this->db->where('callstart >=',$start_date." 00:00:00");
63 63
 		$this->db->where('callstart <=',$end_date." 23:59:59");
64 64
 		$this->db->where('reseller_id',$parent_id);
65
-		if($group_flag)
66
-		$this->db->group_by("DAY(callstart)");
65
+		if($group_flag) {
66
+				$this->db->group_by("DAY(callstart)");
67
+		}
67 68
 		$result=$this->db->get($table);
68 69
 	return $result;
69 70
 	}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/dashboard/controllers/dashboard.php 2 patches
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -38,215 +38,215 @@
 block discarded – undo
38 38
 	function index() 
39 39
 	{
40 40
 		if ($this->session->userdata('user_login') == FALSE) 
41
-			redirect(base_url() . 'login/login');
41
+			redirect(base_url().'login/login');
42 42
 			$data['page_title'] = 'Dashboard';
43 43
 		if ($this->session->userdata('logintype') == 0) 
44 44
 	{
45 45
 			$this->load->view('view_user_dashboard', $data);
46 46
 		} else {
47
-		$gmtoffset=$this->common->get_timezone_offset();	    
47
+		$gmtoffset = $this->common->get_timezone_offset();	    
48 48
 			$this->load->view('view_dashboard', $data);
49 49
 		}
50 50
 	}
51
-	function user_recent_payments(){
51
+	function user_recent_payments() {
52 52
 	  $this->customerReport_recent_payments();
53 53
 	}     
54 54
 	function customerReport_recent_payments() 
55 55
 	{
56
-	$accountinfo=$this->session->userdata('accountinfo');
57
-	$currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id']));
56
+	$accountinfo = $this->session->userdata('accountinfo');
57
+	$currency = $this->common->get_field_name('currency', 'currency', array("id"=>$accountinfo['currency_id']));
58 58
 		$json_data = array();
59
-	$i=1;
59
+	$i = 1;
60 60
 	$result = $this->dashboard_model->get_recent_recharge();
61
-	$gmtoffset=$this->common->get_timezone_offset();
62
-		if($result->num_rows() > 0)
61
+	$gmtoffset = $this->common->get_timezone_offset();
62
+		if ($result->num_rows() > 0)
63 63
 	{
64
-		 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts','');
65
-		 $json_data[0]['accountid']='Accounts';
66
-		 $json_data[0]['credit']='Amount('.$currency.")";
67
-		 $json_data[0]['payment_date']='Date';
68
-		 foreach($result->result_array() as $key=>$data){
69
-			  $current_timestamp=strtotime($data['payment_date']);
70
-			  $modified_date=$current_timestamp+$gmtoffset;
71
-		  		  $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
72
-			  $json_data[$i]['accountid']=$data['accountid'];
73
-			  $json_data[$i]['credit']=$this->common_model->calculate_currency($data['credit'],'','',true,false);
74
-			  $json_data[$i]['payment_date']=date('Y-m-d H:i:s',strtotime($data['payment_date'])+$gmtoffset);
64
+		 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', '');
65
+		 $json_data[0]['accountid'] = 'Accounts';
66
+		 $json_data[0]['credit'] = 'Amount('.$currency.")";
67
+		 $json_data[0]['payment_date'] = 'Date';
68
+		 foreach ($result->result_array() as $key=>$data) {
69
+			  $current_timestamp = strtotime($data['payment_date']);
70
+			  $modified_date = $current_timestamp + $gmtoffset;
71
+		  		  $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] : "Anonymous";
72
+			  $json_data[$i]['accountid'] = $data['accountid'];
73
+			  $json_data[$i]['credit'] = $this->common_model->calculate_currency($data['credit'], '', '', true, false);
74
+			  $json_data[$i]['payment_date'] = date('Y-m-d H:i:s', strtotime($data['payment_date']) + $gmtoffset);
75 75
 			  $i++;
76 76
 		  	}
77 77
 		  }
78 78
 		 echo json_encode($json_data); 
79 79
 	}
80
-	function  user_call_statistics_with_profit(){
80
+	function  user_call_statistics_with_profit() {
81 81
 	  $this->customerReport_call_statistics_with_profit();
82 82
 	 }
83 83
 	function customerReport_call_statistics_with_profit() {
84
-		$post=$this->input->post();
85
-		$year=isset($post['year']) && $post['year'] >0 ? $post['year']:date("Y");
86
-		$month=isset($post['month'])&& $post['month'] >0 ? $post['month']:date("m");
84
+		$post = $this->input->post();
85
+		$year = isset($post['year']) && $post['year'] > 0 ? $post['year'] : date("Y");
86
+		$month = isset($post['month']) && $post['month'] > 0 ? $post['month'] : date("m");
87 87
 	$json_data = array();
88
-	$start_date=date($year.'-'.$month.'-01');
89
-		$end_day= $year==date("Y") && $month ==date("m") ? date("d") :cal_days_in_month(CAL_GREGORIAN, $month, $year);
90
-	$gmtoffset=$this->common->get_timezone_offset();
91
-	$end_date=date($year."-".$month."-".$end_day.' H:i:s');
92
-	$end_date=date('Y-m-d',strtotime($end_date)+$gmtoffset);
93
-	$current_date=(int)date("d");
94
-		$count=0;
95
-		$i=0;
88
+	$start_date = date($year.'-'.$month.'-01');
89
+		$end_day = $year == date("Y") && $month == date("m") ? date("d") : cal_days_in_month(CAL_GREGORIAN, $month, $year);
90
+	$gmtoffset = $this->common->get_timezone_offset();
91
+	$end_date = date($year."-".$month."-".$end_day.' H:i:s');
92
+	$end_date = date('Y-m-d', strtotime($end_date) + $gmtoffset);
93
+	$current_date = (int)date("d");
94
+		$count = 0;
95
+		$i = 0;
96 96
 		$begin = new DateTime($start_date);
97 97
 	$end = new DateTime($end_date);
98
-	$end=$end->modify('+1 day');
98
+	$end = $end->modify('+1 day');
99 99
 	$daterange = new DatePeriod($begin, new DateInterval('P1D'), $end);
100
-	$records_date=array();
101
-	$accountinfo=$this->session->userdata('accountinfo');
102
-	$parent_id= ($accountinfo['type'] == 1) ? $accountinfo['id'] : 0;
103
-		$customerresult = $this->dashboard_model->get_call_statistics('cdrs',$parent_id,$start_date,$end_date);
104
-		$resellerresult = $this->dashboard_model->get_call_statistics('reseller_cdrs',$parent_id,$start_date,$end_date);
100
+	$records_date = array();
101
+	$accountinfo = $this->session->userdata('accountinfo');
102
+	$parent_id = ($accountinfo['type'] == 1) ? $accountinfo['id'] : 0;
103
+		$customerresult = $this->dashboard_model->get_call_statistics('cdrs', $parent_id, $start_date, $end_date);
104
+		$resellerresult = $this->dashboard_model->get_call_statistics('reseller_cdrs', $parent_id, $start_date, $end_date);
105 105
 		$acc_arr = array();
106 106
 	foreach ($customerresult->result_array() as $data) {
107 107
 	  $acc_arr[$data['day']] = $data;
108 108
 	}
109
-	foreach($resellerresult->result_array() as $data){
110
-	  $reseller_arr[$data['day']]=$data;
111
-	  if(isset($acc_arr[$data['day']])){
112
-		$acc_arr[$data['day']]['sum']= $data['sum']+$acc_arr[$data['day']]['sum'];
113
-		$acc_arr[$data['day']]['answered']= $data['answered']+$acc_arr[$data['day']]['answered'];
114
-		$acc_arr[$data['day']]['failed']= $data['failed']+$acc_arr[$data['day']]['failed'];
115
-		$acc_arr[$data['day']]['profit']= $data['profit']+$acc_arr[$data['day']]['profit'];
116
-			$acc_arr[$data['day']]['completed']= $data['completed']+$acc_arr[$data['day']]['completed'];
117
-			$acc_arr[$data['day']]['duration'] = $data['duration']+$acc_arr[$data['day']]['duration'];
118
-			$acc_arr[$data['day']]['mcd'] =$data['mcd'] > $acc_arr[$data['day']]['mcd'] ? $data['mcd']: $acc_arr[$data['day']]['mcd'];
119
-	  }else{
120
-		$acc_arr[$data['day']]=$data;
109
+	foreach ($resellerresult->result_array() as $data) {
110
+	  $reseller_arr[$data['day']] = $data;
111
+	  if (isset($acc_arr[$data['day']])) {
112
+		$acc_arr[$data['day']]['sum'] = $data['sum'] + $acc_arr[$data['day']]['sum'];
113
+		$acc_arr[$data['day']]['answered'] = $data['answered'] + $acc_arr[$data['day']]['answered'];
114
+		$acc_arr[$data['day']]['failed'] = $data['failed'] + $acc_arr[$data['day']]['failed'];
115
+		$acc_arr[$data['day']]['profit'] = $data['profit'] + $acc_arr[$data['day']]['profit'];
116
+			$acc_arr[$data['day']]['completed'] = $data['completed'] + $acc_arr[$data['day']]['completed'];
117
+			$acc_arr[$data['day']]['duration'] = $data['duration'] + $acc_arr[$data['day']]['duration'];
118
+			$acc_arr[$data['day']]['mcd'] = $data['mcd'] > $acc_arr[$data['day']]['mcd'] ? $data['mcd'] : $acc_arr[$data['day']]['mcd'];
119
+	  } else {
120
+		$acc_arr[$data['day']] = $data;
121 121
 	  }
122 122
 	}
123
-	if(!empty($acc_arr)){
124
-		foreach($daterange as $date){
125
-		$json_data['date'][]=$date->format("d");
126
-		$day = (int) $date->format("d");
127
-		if(isset($acc_arr[$day])){
128
-				  $asr= ($acc_arr[$day]['sum'] > 0 ) ? (round(($acc_arr[$day]['completed'] / $acc_arr[$day]['sum']) * 100,2)) : 0;
129
-				  $acd= ($acc_arr[$day]['completed'] > 0 ) ? round($acc_arr[$day]['duration'] / $acc_arr[$day]['completed'],2) : 0;
130
-		  $json_data['total'][]=  array((string)$acc_arr[$day]['day'],(int) $acc_arr[$day]['sum']);
131
-		  $json_data['answered'][]=  array((string)$acc_arr[$day]['day'],(int) $acc_arr[$day]['answered']);
132
-		  $json_data['failed'][]=  array((string)$acc_arr[$day]['day'],(int) $acc_arr[$day]['failed']);
133
-		  $json_data['profit'][]=  array((string)$acc_arr[$day]['day'],(float)  str_replace(",", "", $this->common_model->calculate_currency($acc_arr[$day]['profit'])));
134
-				  $json_data['acd'][]=array((string)$acc_arr[$day]['day'],(float)$acd);
135
-				  $json_data['mcd'][]=array((string)$acc_arr[$day]['day'],(float)$acc_arr[$day]['mcd']);
136
-				  $json_data['asr'][]=array((string)$acc_arr[$day]['day'],(float)$asr);
137
-		}else{
138
-		  $json_data['total'][]=  array($date->format("d"), 0);
139
-		  $json_data['answered'][]=  array($date->format("d"), 0);
140
-		  $json_data['failed'][]=  array($date->format("d"), 0);
141
-		  $json_data['profit'][]=  array($date->format("d"), 0);
142
-				  $json_data['acd'][]=array($date->format("d"), 0);
143
-				  $json_data['mcd'][]=array($date->format("d"), 0);
144
-				  $json_data['asr'][]=array($date->format("d"),0);
123
+	if ( ! empty($acc_arr)) {
124
+		foreach ($daterange as $date) {
125
+		$json_data['date'][] = $date->format("d");
126
+		$day = (int)$date->format("d");
127
+		if (isset($acc_arr[$day])) {
128
+				  $asr = ($acc_arr[$day]['sum'] > 0) ? (round(($acc_arr[$day]['completed'] / $acc_arr[$day]['sum']) * 100, 2)) : 0;
129
+				  $acd = ($acc_arr[$day]['completed'] > 0) ? round($acc_arr[$day]['duration'] / $acc_arr[$day]['completed'], 2) : 0;
130
+		  $json_data['total'][] = array((string)$acc_arr[$day]['day'], (int)$acc_arr[$day]['sum']);
131
+		  $json_data['answered'][] = array((string)$acc_arr[$day]['day'], (int)$acc_arr[$day]['answered']);
132
+		  $json_data['failed'][] = array((string)$acc_arr[$day]['day'], (int)$acc_arr[$day]['failed']);
133
+		  $json_data['profit'][] = array((string)$acc_arr[$day]['day'], (float)str_replace(",", "", $this->common_model->calculate_currency($acc_arr[$day]['profit'])));
134
+				  $json_data['acd'][] = array((string)$acc_arr[$day]['day'], (float)$acd);
135
+				  $json_data['mcd'][] = array((string)$acc_arr[$day]['day'], (float)$acc_arr[$day]['mcd']);
136
+				  $json_data['asr'][] = array((string)$acc_arr[$day]['day'], (float)$asr);
137
+		} else {
138
+		  $json_data['total'][] = array($date->format("d"), 0);
139
+		  $json_data['answered'][] = array($date->format("d"), 0);
140
+		  $json_data['failed'][] = array($date->format("d"), 0);
141
+		  $json_data['profit'][] = array($date->format("d"), 0);
142
+				  $json_data['acd'][] = array($date->format("d"), 0);
143
+				  $json_data['mcd'][] = array($date->format("d"), 0);
144
+				  $json_data['asr'][] = array($date->format("d"), 0);
145 145
 		}
146 146
 		
147 147
 		}
148 148
 	}
149
-	else{
150
-	foreach($daterange as $date){
151
-		$json_data['date'][]=$date->format("d");
152
-		$day = (int) $date->format("d");
153
-		$json_data['total'][]=  array($date->format("d"), 0);
154
-		$json_data['answered'][]=  array($date->format("d"), 0);
155
-		$json_data['failed'][]=  array($date->format("d"), 0);
156
-		$json_data['profit'][]=  array($date->format("d"), 0);
157
-				$json_data['acd'][]=array($date->format("d"), 0);
158
-				$json_data['mcd'][]=array($date->format("d"), 0);
159
-				$json_data['asr'][]=array($date->format("d"), 0);
149
+	else {
150
+	foreach ($daterange as $date) {
151
+		$json_data['date'][] = $date->format("d");
152
+		$day = (int)$date->format("d");
153
+		$json_data['total'][] = array($date->format("d"), 0);
154
+		$json_data['answered'][] = array($date->format("d"), 0);
155
+		$json_data['failed'][] = array($date->format("d"), 0);
156
+		$json_data['profit'][] = array($date->format("d"), 0);
157
+				$json_data['acd'][] = array($date->format("d"), 0);
158
+				$json_data['mcd'][] = array($date->format("d"), 0);
159
+				$json_data['asr'][] = array($date->format("d"), 0);
160 160
 	}
161 161
 	}
162
-		$customer_total_result = $this->dashboard_model->get_call_statistics('cdrs',$parent_id,$start_date,$end_date,false);
163
-		$reseller_total_result = $this->dashboard_model->get_call_statistics('reseller_cdrs',$parent_id,$start_date,$end_date,false);
164
-		$customer_total_result=(array)$customer_total_result->first_row();
165
-		$reseller_total_result=(array)$reseller_total_result->first_row();
166
-	$json_data['total_count']['sum']=$reseller_total_result['sum']+$customer_total_result['sum'];
167
-		$json_data['total_count']['debit']=$this->common_model->to_calculate_currency($reseller_total_result['debit']+$customer_total_result['debit'],'','',true,true);
168
-		$json_data['total_count']['cost']=$this->common_model->to_calculate_currency($reseller_total_result['cost']+$customer_total_result['cost'],'','',true,true);
169
-		$json_data['total_count']['profit']=$this->common_model->to_calculate_currency($reseller_total_result['profit']+$customer_total_result['profit'],'','',true,true);
170
-		$json_data['total_count']['completed']=$reseller_total_result['completed']+$customer_total_result['completed'];
171
-		$json_data['total_count']['duration']=$reseller_total_result['duration']+$customer_total_result['duration'];
172
-		$json_data['total_count']['acd']=$json_data['total_count']['completed'] > 0 ? round($json_data['total_count']['duration']/$json_data['total_count']['completed'],2):0;
173
-		$json_data['total_count']['mcd']=($customer_total_result['mcd'] > 0 || $reseller_total_result['mcd'] > 0 ) ? ($customer_total_result['mcd'] > $reseller_total_result['mcd'] ? $customer_total_result['mcd']:$reseller_total_result['mcd']) : 0;
174
-		$json_data['total_count']['asr']=($json_data['total_count']['sum'] > 0 ) ? (round(($json_data['total_count']['completed'] / $json_data['total_count']['sum']) * 100,2)) : 0;
175
-		$json_data['total_count']['asr']=$this->common_model->format_currency($json_data['total_count']['asr']);
162
+		$customer_total_result = $this->dashboard_model->get_call_statistics('cdrs', $parent_id, $start_date, $end_date, false);
163
+		$reseller_total_result = $this->dashboard_model->get_call_statistics('reseller_cdrs', $parent_id, $start_date, $end_date, false);
164
+		$customer_total_result = (array)$customer_total_result->first_row();
165
+		$reseller_total_result = (array)$reseller_total_result->first_row();
166
+	$json_data['total_count']['sum'] = $reseller_total_result['sum'] + $customer_total_result['sum'];
167
+		$json_data['total_count']['debit'] = $this->common_model->to_calculate_currency($reseller_total_result['debit'] + $customer_total_result['debit'], '', '', true, true);
168
+		$json_data['total_count']['cost'] = $this->common_model->to_calculate_currency($reseller_total_result['cost'] + $customer_total_result['cost'], '', '', true, true);
169
+		$json_data['total_count']['profit'] = $this->common_model->to_calculate_currency($reseller_total_result['profit'] + $customer_total_result['profit'], '', '', true, true);
170
+		$json_data['total_count']['completed'] = $reseller_total_result['completed'] + $customer_total_result['completed'];
171
+		$json_data['total_count']['duration'] = $reseller_total_result['duration'] + $customer_total_result['duration'];
172
+		$json_data['total_count']['acd'] = $json_data['total_count']['completed'] > 0 ? round($json_data['total_count']['duration'] / $json_data['total_count']['completed'], 2) : 0;
173
+		$json_data['total_count']['mcd'] = ($customer_total_result['mcd'] > 0 || $reseller_total_result['mcd'] > 0) ? ($customer_total_result['mcd'] > $reseller_total_result['mcd'] ? $customer_total_result['mcd'] : $reseller_total_result['mcd']) : 0;
174
+		$json_data['total_count']['asr'] = ($json_data['total_count']['sum'] > 0) ? (round(($json_data['total_count']['completed'] / $json_data['total_count']['sum']) * 100, 2)) : 0;
175
+		$json_data['total_count']['asr'] = $this->common_model->format_currency($json_data['total_count']['asr']);
176 176
 	echo json_encode($json_data);
177 177
 }
178 178
 
179
-	 function user_maximum_callminutes(){
179
+	 function user_maximum_callminutes() {
180 180
 	  $this->customerReport_maximum_callminutes();
181 181
 	}
182 182
 	 function customerReport_maximum_callminutes()
183 183
 	 {
184
-		$post=$this->input->post();
185
-		$year=isset($post['year']) && $post['year'] >0 ? $post['year']:date("Y");
186
-		$month=isset($post['month'])&& $post['month'] >0 ? $post['month']:date("m");
187
-	$start_date=date($year.'-'.$month.'-01');
188
-		$end_day= $year==date("Y") && $month ==date("m") ? date("d") :cal_days_in_month(CAL_GREGORIAN, $month, $year);
189
-	$gmtoffset=$this->common->get_timezone_offset();
190
-	$end_date=date($year."-".$month."-".$end_day.' H:i:s');
191
-	$end_date=date('Y-m-d',strtotime($end_date)+$gmtoffset);
184
+		$post = $this->input->post();
185
+		$year = isset($post['year']) && $post['year'] > 0 ? $post['year'] : date("Y");
186
+		$month = isset($post['month']) && $post['month'] > 0 ? $post['month'] : date("m");
187
+	$start_date = date($year.'-'.$month.'-01');
188
+		$end_day = $year == date("Y") && $month == date("m") ? date("d") : cal_days_in_month(CAL_GREGORIAN, $month, $year);
189
+	$gmtoffset = $this->common->get_timezone_offset();
190
+	$end_date = date($year."-".$month."-".$end_day.' H:i:s');
191
+	$end_date = date('Y-m-d', strtotime($end_date) + $gmtoffset);
192 192
 	 	$json_data = array();
193
- 	$result = $this->dashboard_model->get_customer_maximum_callminutes($start_date,$end_date);
194
-	$i=0;
195
-	$accountinfo=$this->session->userdata('accountinfo');
196
-	$reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id'];
197
-	if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3){
198
-	  $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('reseller_id'=>$reseller_id));
199
-	} else{
200
-	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('id'=>$reseller_id));
193
+ 	$result = $this->dashboard_model->get_customer_maximum_callminutes($start_date, $end_date);
194
+	$i = 0;
195
+	$accountinfo = $this->session->userdata('accountinfo');
196
+	$reseller_id = $accountinfo['type'] == -1 ? 0 : $accountinfo['id'];
197
+	if ($this->session->userdata('userlevel_logintype') != 0 && $this->session->userdata('userlevel_logintype') != 3) {
198
+	  $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', array('reseller_id'=>$reseller_id));
199
+	} else {
200
+	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', array('id'=>$reseller_id));
201 201
 	}
202
-		if($result->num_rows() > 0 )
202
+		if ($result->num_rows() > 0)
203 203
 	{	
204
-		   foreach ($result->result_array() as $data){
205
-			$data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
206
-			$json_data[$i][]= $data['accountid'];
207
-			$json_data[$i][]= round($data['billseconds']/60,0);
204
+		   foreach ($result->result_array() as $data) {
205
+			$data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] : "Anonymous";
206
+			$json_data[$i][] = $data['accountid'];
207
+			$json_data[$i][] = round($data['billseconds'] / 60, 0);
208 208
 			$i++;
209 209
 		   } 
210
-		}else{
210
+		} else {
211 211
 	  $json_data[] = array();
212 212
 	  	}
213 213
 	 	echo json_encode($json_data);
214 214
 	 }
215 215
 
216
-	 function user_maximum_callcount(){
216
+	 function user_maximum_callcount() {
217 217
 	   $this->customerReport_maximum_callcount();
218 218
 	 }
219 219
 	 function customerReport_maximum_callcount()
220 220
 	 {
221
-	 	$post=$this->input->post();
222
-		$year=isset($post['year']) && $post['year'] >0 ? $post['year']:date("Y");
223
-		$month=isset($post['month'])&& $post['month'] >0 ? $post['month']:date("m");
224
-	$start_date=date($year.'-'.$month.'-01');
225
-		$end_day= $year==date("Y") && $month ==date("m") ? date("d") :cal_days_in_month(CAL_GREGORIAN, $month, $year);
226
-	$gmtoffset=$this->common->get_timezone_offset();
227
-	$end_date=date($year."-".$month."-".$end_day.' H:i:s');
228
-	$end_date=date('Y-m-d',strtotime($end_date)+$gmtoffset);
221
+	 	$post = $this->input->post();
222
+		$year = isset($post['year']) && $post['year'] > 0 ? $post['year'] : date("Y");
223
+		$month = isset($post['month']) && $post['month'] > 0 ? $post['month'] : date("m");
224
+	$start_date = date($year.'-'.$month.'-01');
225
+		$end_day = $year == date("Y") && $month == date("m") ? date("d") : cal_days_in_month(CAL_GREGORIAN, $month, $year);
226
+	$gmtoffset = $this->common->get_timezone_offset();
227
+	$end_date = date($year."-".$month."-".$end_day.' H:i:s');
228
+	$end_date = date('Y-m-d', strtotime($end_date) + $gmtoffset);
229 229
 	 	$json_data = array();
230
-	$result = $this->dashboard_model->get_customer_maximum_callcount($start_date,$end_date);
231
-	$accountinfo=$this->session->userdata('accountinfo');
232
-	$reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id'];
233
-	if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3){
234
-	  $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('reseller_id'=>$reseller_id));
235
-	} else{
236
-	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('id'=>$reseller_id));
230
+	$result = $this->dashboard_model->get_customer_maximum_callcount($start_date, $end_date);
231
+	$accountinfo = $this->session->userdata('accountinfo');
232
+	$reseller_id = $accountinfo['type'] == -1 ? 0 : $accountinfo['id'];
233
+	if ($this->session->userdata('userlevel_logintype') != 0 && $this->session->userdata('userlevel_logintype') != 3) {
234
+	  $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', array('reseller_id'=>$reseller_id));
235
+	} else {
236
+	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', array('id'=>$reseller_id));
237 237
 	}
238
-	$i=0;
239
-		if($result->num_rows() > 0 )
238
+	$i = 0;
239
+		if ($result->num_rows() > 0)
240 240
 	{
241 241
 		foreach ($result->result_array() as $data) 
242 242
 		{
243
-				$data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
244
-				$json_data[$i][]= $data['accountid'];
245
-				$json_data[$i][]= (int)$data['call_count'];
243
+				$data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] : "Anonymous";
244
+				$json_data[$i][] = $data['accountid'];
245
+				$json_data[$i][] = (int)$data['call_count'];
246 246
 				$i++;
247 247
 			}
248 248
     	    
249
-		}else{
249
+		} else {
250 250
 				$json_data[] = array();
251 251
 	 		 }
252 252
 	echo json_encode($json_data);
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
 	function index() 
39 39
 	{
40
-		if ($this->session->userdata('user_login') == FALSE) 
41
-			redirect(base_url() . 'login/login');
40
+		if ($this->session->userdata('user_login') == FALSE) {
41
+					redirect(base_url() . 'login/login');
42
+		}
42 43
 			$data['page_title'] = 'Dashboard';
43 44
 		if ($this->session->userdata('logintype') == 0) 
44 45
 	{
@@ -116,7 +117,7 @@  discard block
 block discarded – undo
116 117
 			$acc_arr[$data['day']]['completed']= $data['completed']+$acc_arr[$data['day']]['completed'];
117 118
 			$acc_arr[$data['day']]['duration'] = $data['duration']+$acc_arr[$data['day']]['duration'];
118 119
 			$acc_arr[$data['day']]['mcd'] =$data['mcd'] > $acc_arr[$data['day']]['mcd'] ? $data['mcd']: $acc_arr[$data['day']]['mcd'];
119
-	  }else{
120
+	  } else{
120 121
 		$acc_arr[$data['day']]=$data;
121 122
 	  }
122 123
 	}
@@ -134,7 +135,7 @@  discard block
 block discarded – undo
134 135
 				  $json_data['acd'][]=array((string)$acc_arr[$day]['day'],(float)$acd);
135 136
 				  $json_data['mcd'][]=array((string)$acc_arr[$day]['day'],(float)$acc_arr[$day]['mcd']);
136 137
 				  $json_data['asr'][]=array((string)$acc_arr[$day]['day'],(float)$asr);
137
-		}else{
138
+		} else{
138 139
 		  $json_data['total'][]=  array($date->format("d"), 0);
139 140
 		  $json_data['answered'][]=  array($date->format("d"), 0);
140 141
 		  $json_data['failed'][]=  array($date->format("d"), 0);
@@ -145,8 +146,7 @@  discard block
 block discarded – undo
145 146
 		}
146 147
 		
147 148
 		}
148
-	}
149
-	else{
149
+	} else{
150 150
 	foreach($daterange as $date){
151 151
 		$json_data['date'][]=$date->format("d");
152 152
 		$day = (int) $date->format("d");
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			$json_data[$i][]= round($data['billseconds']/60,0);
208 208
 			$i++;
209 209
 		   } 
210
-		}else{
210
+		} else{
211 211
 	  $json_data[] = array();
212 212
 	  	}
213 213
 	 	echo json_encode($json_data);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 				$i++;
247 247
 			}
248 248
     	    
249
-		}else{
249
+		} else{
250 250
 				$json_data[] = array();
251 251
 	 		 }
252 252
 	echo json_encode($json_data);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/dashboard/views/view_dashboard.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 											$yearArray = range($start_year, $end_year);
376 376
 											foreach ($yearArray as $year) {
377 377
 												$selected = ($year == $currentyear) ? 'selected' : '';
378
-												echo '<option ' . $selected . ' value="' . $year . '">' . $year . '</option>';
378
+												echo '<option '.$selected.' value="'.$year.'">'.$year.'</option>';
379 379
 											}
380 380
 											?>
381 381
                                         </select>
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 												$monthPadding = str_pad($month, 2, "0", STR_PAD_LEFT);
389 389
 												$fdate = date("F", strtotime($monthPadding));
390 390
 												$selected = (date("m") == $monthPadding) ? 'selected' : null;
391
-												echo '<option value="' . $monthPadding . '" ' . $selected . '>' . date("F", mktime(null, null, null, $monthPadding, 1)) . '</option>';
391
+												echo '<option value="'.$monthPadding.'" '.$selected.'>'.date("F", mktime(null, null, null, $monthPadding, 1)).'</option>';
392 392
 											}
393 393
 											?>
394 394
                                         </select>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/invoices/models/invoices_model.php 2 patches
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -40,86 +40,86 @@  discard block
 block discarded – undo
40 40
 Invoice manually
41 41
 **/
42 42
 
43
-	if($this->session->userdata('advance_search')!= 1){
44
-	  if($result->num_rows() >0){
45
-	  $acc_arr=array();
46
-	  $result=$result->result_array();
47
-		foreach($result as $data){
48
-		  $acc_arr[]=$data['id'];
43
+	if ($this->session->userdata('advance_search') != 1) {
44
+	  if ($result->num_rows() > 0) {
45
+	  $acc_arr = array();
46
+	  $result = $result->result_array();
47
+		foreach ($result as $data) {
48
+		  $acc_arr[] = $data['id'];
49 49
 		}
50
-		$this->db->where_in('accountid',$acc_arr);
51
-		if($flag){
50
+		$this->db->where_in('accountid', $acc_arr);
51
+		if ($flag) {
52 52
 		  $this->db->select('*');
53 53
 		}
54
-		else{
54
+		else {
55 55
 		  $this->db->select('count(id) as count');
56 56
 		}
57
-		if($flag){
58
-		  $this->db->where('deleted',0);
59
-		  $this->db->order_by('invoice_date','desc');
57
+		if ($flag) {
58
+		  $this->db->where('deleted', 0);
59
+		  $this->db->order_by('invoice_date', 'desc');
60 60
 		  $this->db->limit($limit, $start);
61 61
 		}
62
-		$result=$this->db->get('invoices');
62
+		$result = $this->db->get('invoices');
63 63
  		//echo $this->db->last_query();exit;    
64
-		if($flag){
64
+		if ($flag) {
65 65
 		  return $result;
66
-		}else{
67
-		  $result=$result->result_array();
66
+		} else {
67
+		  $result = $result->result_array();
68 68
 		  return $result[0]['count'];
69 69
 		}
70
-	  }else{
71
-		  if($flag){
72
-		  $query=(object)array('num_rows'=>0);
70
+	  } else {
71
+		  if ($flag) {
72
+		  $query = (object)array('num_rows'=>0);
73 73
 	  }
74
-	  else{
75
-		  $query=0;
74
+	  else {
75
+		  $query = 0;
76 76
 	  }
77 77
  	  
78 78
 	  return $query;
79 79
 		}
80
-	}else{
80
+	} else {
81 81
           
82
-		 if($result->num_rows() >0){
82
+		 if ($result->num_rows() > 0) {
83 83
 /****
84 84
 Invoice manually
85 85
 **/
86
-		$acc_arr=array();
87
-		$result=$result->result_array();
88
-		foreach($result as $data){
89
-		  $acc_arr[]=$data['id'];
86
+		$acc_arr = array();
87
+		$result = $result->result_array();
88
+		foreach ($result as $data) {
89
+		  $acc_arr[] = $data['id'];
90 90
 		}
91
-		$this->db->where_in('accountid',$acc_arr);
91
+		$this->db->where_in('accountid', $acc_arr);
92 92
 	}
93 93
          
94
-		 if($flag){
94
+		 if ($flag) {
95 95
 	  $this->db->select('*');
96 96
 		 }
97
-		 else{
97
+		 else {
98 98
 		  $this->db->select('count(id) as count');
99 99
 		 }
100
-		 if($flag){
101
-	  $this->db->order_by('invoice_date','desc');
100
+		 if ($flag) {
101
+	  $this->db->order_by('invoice_date', 'desc');
102 102
 	  $this->db->limit($limit, $start);
103 103
 		 }
104
-		 $result=$this->db->get('invoices');
104
+		 $result = $this->db->get('invoices');
105 105
   //	echo $this->db->last_query();exit;              
106
-		 if($result->num_rows() > 0){
107
-		  if($flag){
106
+		 if ($result->num_rows() > 0) {
107
+		  if ($flag) {
108 108
 	        
109 109
 		return $result;
110
-		  }else{
111
-		$result=$result->result_array();
110
+		  } else {
111
+		$result = $result->result_array();
112 112
 		
113 113
 		return $result[0]['count'];
114 114
 		  }
115
-		 }else{
116
-		  if($flag){
115
+		 } else {
116
+		  if ($flag) {
117 117
 	          
118
-		  $query=(object)array('num_rows'=>0);
118
+		  $query = (object)array('num_rows'=>0);
119 119
 		 // echo '<pre>'; print_r($query); 	
120 120
 		  }
121
-		  else{
122
-		  $query=0;
121
+		  else {
122
+		  $query = 0;
123 123
 		  }
124 124
 	return $query;
125 125
 	}
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 
153 153
 		return NULL;
154 154
 	}
155
-	function get_user_invoice_list($flag, $start = 0, $limit = 0){
155
+	function get_user_invoice_list($flag, $start = 0, $limit = 0) {
156 156
 	$this->db_model->build_search('invoice_list_search');
157
-	$accountinfo=$this->session->userdata('accountinfo');
157
+	$accountinfo = $this->session->userdata('accountinfo');
158 158
 /****
159 159
 Invoice manually
160 160
 **/
161
-		$where = array("accountid" => $accountinfo['id'],'confirm'=>1);
161
+		$where = array("accountid" => $accountinfo['id'], 'confirm'=>1);
162 162
 		if ($flag) {
163 163
 			$query = $this->db_model->select("*", "invoices", $where, "invoice_date", "desc", $limit, $start);
164 164
             
@@ -188,42 +188,42 @@  discard block
 block discarded – undo
188 188
 		return $query;
189 189
 	}
190 190
 	function get_invoiceconf($accountid) {
191
-		$return_array=array();
191
+		$return_array = array();
192 192
  	$logintype = $this->session->userdata('logintype');
193 193
 		if ($logintype == 1 || $logintype == 5) {
194 194
           
195 195
 		$where = array("accountid" => $this->session->userdata["accountinfo"]['id']);
196
-		}else{
197
-	   		 $where=array('id'=> $accountid);
196
+		} else {
197
+	   		 $where = array('id'=> $accountid);
198 198
 	}      
199
-		$query = $this->db_model->getSelect("*","invoice_conf",$where);
200
-		foreach($query->result_array() as $key => $value)
199
+		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
200
+		foreach ($query->result_array() as $key => $value)
201 201
 		{
202
-			$return_array=$value;
202
+			$return_array = $value;
203 203
 		}       
204 204
 		 return $return_array;
205 205
 	} 
206 206
 
207 207
 
208
-	function save_invoiceconf($post_array){
209
-	$where_arr=array('id'=>$post_array['id']);
208
+	function save_invoiceconf($post_array) {
209
+	$where_arr = array('id'=>$post_array['id']);
210 210
 	unset($post_array['action']);
211
-	if($post_array['id'] != "" ){
211
+	if ($post_array['id'] != "") {
212 212
 		$this->db->where($where_arr);
213 213
 		unset($post_array['accountid']);
214 214
 		unset($post_array['logo_main']);
215
-		$this->db->update('invoice_conf',$post_array);
216
-	} else{
215
+		$this->db->update('invoice_conf', $post_array);
216
+	} else {
217 217
 		unset($post_array['logo_main']);
218 218
 		$logintype = $this->session->userdata('logintype');
219 219
 		if ($logintype == 1 || $logintype == 5) {
220 220
 			$accountdata = $this->session->userdata('accountinfo');
221 221
 			$post_array['accountid'] = $accountdata['id'];
222 222
 		}
223
-		if($post_array['accountid'] == 0){
224
-			$post_array['accountid']=1;
223
+		if ($post_array['accountid'] == 0) {
224
+			$post_array['accountid'] = 1;
225 225
 		}
226
-		$this->db->insert('invoice_conf',$post_array);
226
+		$this->db->insert('invoice_conf', $post_array);
227 227
 	}
228 228
 	return true;
229 229
 	}
Please login to merge, or discard this patch.
Braces   +10 added lines, -14 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
 		$this->db->where_in('accountid',$acc_arr);
51 51
 		if($flag){
52 52
 		  $this->db->select('*');
53
-		}
54
-		else{
53
+		} else{
55 54
 		  $this->db->select('count(id) as count');
56 55
 		}
57 56
 		if($flag){
@@ -63,21 +62,20 @@  discard block
 block discarded – undo
63 62
  		//echo $this->db->last_query();exit;    
64 63
 		if($flag){
65 64
 		  return $result;
66
-		}else{
65
+		} else{
67 66
 		  $result=$result->result_array();
68 67
 		  return $result[0]['count'];
69 68
 		}
70
-	  }else{
69
+	  } else{
71 70
 		  if($flag){
72 71
 		  $query=(object)array('num_rows'=>0);
73
-	  }
74
-	  else{
72
+	  } else{
75 73
 		  $query=0;
76 74
 	  }
77 75
  	  
78 76
 	  return $query;
79 77
 		}
80
-	}else{
78
+	} else{
81 79
           
82 80
 		 if($result->num_rows() >0){
83 81
 /****
@@ -93,8 +91,7 @@  discard block
 block discarded – undo
93 91
          
94 92
 		 if($flag){
95 93
 	  $this->db->select('*');
96
-		 }
97
-		 else{
94
+		 } else{
98 95
 		  $this->db->select('count(id) as count');
99 96
 		 }
100 97
 		 if($flag){
@@ -107,18 +104,17 @@  discard block
 block discarded – undo
107 104
 		  if($flag){
108 105
 	        
109 106
 		return $result;
110
-		  }else{
107
+		  } else{
111 108
 		$result=$result->result_array();
112 109
 		
113 110
 		return $result[0]['count'];
114 111
 		  }
115
-		 }else{
112
+		 } else{
116 113
 		  if($flag){
117 114
 	          
118 115
 		  $query=(object)array('num_rows'=>0);
119 116
 		 // echo '<pre>'; print_r($query); 	
120
-		  }
121
-		  else{
117
+		  } else{
122 118
 		  $query=0;
123 119
 		  }
124 120
 	return $query;
@@ -193,7 +189,7 @@  discard block
 block discarded – undo
193 189
 		if ($logintype == 1 || $logintype == 5) {
194 190
           
195 191
 		$where = array("accountid" => $this->session->userdata["accountinfo"]['id']);
196
-		}else{
192
+		} else{
197 193
 	   		 $where=array('id'=> $accountid);
198 194
 	}      
199 195
 		$query = $this->db_model->getSelect("*","invoice_conf",$where);
Please login to merge, or discard this patch.