Completed
Pull Request — v3.0 (#136)
by
unknown
25:07
created
web_interface/astpp/application/modules/summary/models/summary_model.php 3 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -24,95 +24,95 @@
 block discarded – undo
24 24
 
25 25
 class Summary_model extends CI_Model {
26 26
 
27
-    function Summary_model() {
28
-        parent::__construct();
29
-    }
27
+	function Summary_model() {
28
+		parent::__construct();
29
+	}
30 30
 
31
-    function get_resellersummary_report_list($flag, $start = 0, $limit = 0,$group_by, $select,$order, $export = false) {
31
+	function get_resellersummary_report_list($flag, $start = 0, $limit = 0,$group_by, $select,$order, $export = false) {
32 32
 
33
-        $this->db_model->build_search('summary_reseller_search');
34
-        $accountinfo=$this->session->userdata('accountinfo');
35
-        $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
36
-        $where['reseller_id']=$reseller_id;
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
-        }
41
-        $this->db->where($where);
42
-        if(!empty($group_by))
43
-            $this->db->group_by($group_by);
44
-        if ($flag) {
45
-            if ($export) {
46
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', '', '', '');
47
-            } else {
48
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', $limit, $start, '');
49
-            }
50
-        } else {
51
-            $result = $this->db_model->getSelect("count(*) as total_count", "reseller_cdrs", '');
52
-            if ($result->num_rows() > 0) {
53
-                return $result->num_rows();
54
-            } else {
55
-                return 0;
56
-            }
57
-        }
58
-        return $result;
59
-    }
33
+		$this->db_model->build_search('summary_reseller_search');
34
+		$accountinfo=$this->session->userdata('accountinfo');
35
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
36
+		$where['reseller_id']=$reseller_id;
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
+		}
41
+		$this->db->where($where);
42
+		if(!empty($group_by))
43
+			$this->db->group_by($group_by);
44
+		if ($flag) {
45
+			if ($export) {
46
+				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', '', '', '');
47
+			} else {
48
+				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', $limit, $start, '');
49
+			}
50
+		} else {
51
+			$result = $this->db_model->getSelect("count(*) as total_count", "reseller_cdrs", '');
52
+			if ($result->num_rows() > 0) {
53
+				return $result->num_rows();
54
+			} else {
55
+				return 0;
56
+			}
57
+		}
58
+		return $result;
59
+	}
60 60
 
61
-    function get_providersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select,$order, $export = false) {
62
-        $this->db_model->build_search('summary_provider_search');
63
-        $where['provider_id >']=0;
64
-        if ($this->session->userdata('advance_search') != 1) {
65
-            $where['callstart >=']=date('Y-m-d') . " 00:00:00";
66
-            $where['callstart <=']=date('Y-m-d') . " 23:59:59";
67
-        }
68
-        $this->db->where($where);
69
-        if(!empty($group_by))
70
-            $this->db->group_by($group_by);
71
-        if ($flag) {
72
-            if ($export) {
73
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
74
-            } else {
75
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
76
-            }
77
-        } else {
78
-            $result = $this->db_model->getSelect("count(*) as total_count", "cdrs", '');
79
-            if ($result->num_rows() > 0) {
80
-                return $result->num_rows();
81
-            } else {
82
-                return 0;
83
-            }
84
-        }
85
-        return $result;
86
-    }
61
+	function get_providersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select,$order, $export = false) {
62
+		$this->db_model->build_search('summary_provider_search');
63
+		$where['provider_id >']=0;
64
+		if ($this->session->userdata('advance_search') != 1) {
65
+			$where['callstart >=']=date('Y-m-d') . " 00:00:00";
66
+			$where['callstart <=']=date('Y-m-d') . " 23:59:59";
67
+		}
68
+		$this->db->where($where);
69
+		if(!empty($group_by))
70
+			$this->db->group_by($group_by);
71
+		if ($flag) {
72
+			if ($export) {
73
+				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
74
+			} else {
75
+				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
76
+			}
77
+		} else {
78
+			$result = $this->db_model->getSelect("count(*) as total_count", "cdrs", '');
79
+			if ($result->num_rows() > 0) {
80
+				return $result->num_rows();
81
+			} else {
82
+				return 0;
83
+			}
84
+		}
85
+		return $result;
86
+	}
87 87
 
88
-    function get_customersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select,$order, $export) {
89
-        $this->db_model->build_search('summary_customer_search');
90
-        $accountinfo=$this->session->userdata('accountinfo');
91
-        $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
92
-        $where['reseller_id']=$reseller_id;
93
-        $where['type']=0;
94
-        if ($this->session->userdata('advance_search') != 1) {
95
-            $where['callstart >=']=date('Y-m-d') . " 00:00:00";
96
-            $where['callstart <=']=date('Y-m-d') . " 23:59:59";
97
-        }
98
-        $this->db->where($where);
99
-        if(!empty($group_by))
100
-            $this->db->group_by($group_by);
101
-        if ($flag) {
102
-            if ($export) {
103
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
104
-            } else {
105
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
106
-            }
107
-        } else {
108
-            $result = $this->db_model->getSelect("count(*) as total_count", "cdrs", '');
109
-            if ($result->num_rows() > 0) {
110
-                return $result->num_rows();
111
-            } else {
112
-                return 0;
113
-            }
114
-        }
115
-        return $result;
116
-    }
88
+	function get_customersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select,$order, $export) {
89
+		$this->db_model->build_search('summary_customer_search');
90
+		$accountinfo=$this->session->userdata('accountinfo');
91
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
92
+		$where['reseller_id']=$reseller_id;
93
+		$where['type']=0;
94
+		if ($this->session->userdata('advance_search') != 1) {
95
+			$where['callstart >=']=date('Y-m-d') . " 00:00:00";
96
+			$where['callstart <=']=date('Y-m-d') . " 23:59:59";
97
+		}
98
+		$this->db->where($where);
99
+		if(!empty($group_by))
100
+			$this->db->group_by($group_by);
101
+		if ($flag) {
102
+			if ($export) {
103
+				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
104
+			} else {
105
+				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
106
+			}
107
+		} else {
108
+			$result = $this->db_model->getSelect("count(*) as total_count", "cdrs", '');
109
+			if ($result->num_rows() > 0) {
110
+				return $result->num_rows();
111
+			} else {
112
+				return 0;
113
+			}
114
+		}
115
+		return $result;
116
+	}
117 117
 
118 118
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
         parent::__construct();
29 29
     }
30 30
 
31
-    function get_resellersummary_report_list($flag, $start = 0, $limit = 0,$group_by, $select,$order, $export = false) {
31
+    function get_resellersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export = false) {
32 32
 
33 33
         $this->db_model->build_search('summary_reseller_search');
34
-        $accountinfo=$this->session->userdata('accountinfo');
34
+        $accountinfo = $this->session->userdata('accountinfo');
35 35
         $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
36
-        $where['reseller_id']=$reseller_id;
36
+        $where['reseller_id'] = $reseller_id;
37 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";
38
+            $where['callstart >='] = date('Y-m-d')." 00:00:00";
39
+            $where['callstart <='] = date('Y-m-d')." 23:59:59";
40 40
         }
41 41
         $this->db->where($where);
42
-        if(!empty($group_by))
42
+        if ( ! empty($group_by))
43 43
             $this->db->group_by($group_by);
44 44
         if ($flag) {
45 45
             if ($export) {
46
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', '', '', '');
46
+                $result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', '', '', '');
47 47
             } else {
48
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', $limit, $start, '');
48
+                $result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', $limit, $start, '');
49 49
             }
50 50
         } else {
51 51
             $result = $this->db_model->getSelect("count(*) as total_count", "reseller_cdrs", '');
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
         return $result;
59 59
     }
60 60
 
61
-    function get_providersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select,$order, $export = false) {
61
+    function get_providersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export = false) {
62 62
         $this->db_model->build_search('summary_provider_search');
63
-        $where['provider_id >']=0;
63
+        $where['provider_id >'] = 0;
64 64
         if ($this->session->userdata('advance_search') != 1) {
65
-            $where['callstart >=']=date('Y-m-d') . " 00:00:00";
66
-            $where['callstart <=']=date('Y-m-d') . " 23:59:59";
65
+            $where['callstart >='] = date('Y-m-d')." 00:00:00";
66
+            $where['callstart <='] = date('Y-m-d')." 23:59:59";
67 67
         }
68 68
         $this->db->where($where);
69
-        if(!empty($group_by))
69
+        if ( ! empty($group_by))
70 70
             $this->db->group_by($group_by);
71 71
         if ($flag) {
72 72
             if ($export) {
73
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
73
+                $result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
74 74
             } else {
75
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
75
+                $result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
76 76
             }
77 77
         } else {
78 78
             $result = $this->db_model->getSelect("count(*) as total_count", "cdrs", '');
@@ -85,24 +85,24 @@  discard block
 block discarded – undo
85 85
         return $result;
86 86
     }
87 87
 
88
-    function get_customersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select,$order, $export) {
88
+    function get_customersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export) {
89 89
         $this->db_model->build_search('summary_customer_search');
90
-        $accountinfo=$this->session->userdata('accountinfo');
90
+        $accountinfo = $this->session->userdata('accountinfo');
91 91
         $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
92
-        $where['reseller_id']=$reseller_id;
93
-        $where['type']=0;
92
+        $where['reseller_id'] = $reseller_id;
93
+        $where['type'] = 0;
94 94
         if ($this->session->userdata('advance_search') != 1) {
95
-            $where['callstart >=']=date('Y-m-d') . " 00:00:00";
96
-            $where['callstart <=']=date('Y-m-d') . " 23:59:59";
95
+            $where['callstart >='] = date('Y-m-d')." 00:00:00";
96
+            $where['callstart <='] = date('Y-m-d')." 23:59:59";
97 97
         }
98 98
         $this->db->where($where);
99
-        if(!empty($group_by))
99
+        if ( ! empty($group_by))
100 100
             $this->db->group_by($group_by);
101 101
         if ($flag) {
102 102
             if ($export) {
103
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
103
+                $result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
104 104
             } else {
105
-                $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
105
+                $result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
106 106
             }
107 107
         } else {
108 108
             $result = $this->db_model->getSelect("count(*) as total_count", "cdrs", '');
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
             $where['callstart <=']=date('Y-m-d') . " 23:59:59";
40 40
         }
41 41
         $this->db->where($where);
42
-        if(!empty($group_by))
43
-            $this->db->group_by($group_by);
42
+        if(!empty($group_by)) {
43
+                    $this->db->group_by($group_by);
44
+        }
44 45
         if ($flag) {
45 46
             if ($export) {
46 47
                 $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', '', '', '');
@@ -66,8 +67,9 @@  discard block
 block discarded – undo
66 67
             $where['callstart <=']=date('Y-m-d') . " 23:59:59";
67 68
         }
68 69
         $this->db->where($where);
69
-        if(!empty($group_by))
70
-            $this->db->group_by($group_by);
70
+        if(!empty($group_by)) {
71
+                    $this->db->group_by($group_by);
72
+        }
71 73
         if ($flag) {
72 74
             if ($export) {
73 75
                 $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
@@ -96,8 +98,9 @@  discard block
 block discarded – undo
96 98
             $where['callstart <=']=date('Y-m-d') . " 23:59:59";
97 99
         }
98 100
         $this->db->where($where);
99
-        if(!empty($group_by))
100
-            $this->db->group_by($group_by);
101
+        if(!empty($group_by)) {
102
+                    $this->db->group_by($group_by);
103
+        }
101 104
         if ($flag) {
102 105
             if ($export) {
103 106
                 $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/dashboard/controllers/dashboard.php 3 patches
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -24,127 +24,127 @@  discard block
 block discarded – undo
24 24
 
25 25
 class dashboard extends CI_Controller {
26 26
 
27
-    function dashboard() 
28
-    {
29
-        parent::__construct();
30
-        $this->load->helper('form');
31
-        $this->load->model('Auth_model');
32
-        $this->load->library("astpp/form");
33
-        $this->load->model('Astpp_common');
27
+	function dashboard() 
28
+	{
29
+		parent::__construct();
30
+		$this->load->helper('form');
31
+		$this->load->model('Auth_model');
32
+		$this->load->library("astpp/form");
33
+		$this->load->model('Astpp_common');
34 34
 	$this->load->model('dashboard_model');
35
-        $this->load->library('freeswitch_lib');  
36
-    }
35
+		$this->load->library('freeswitch_lib');  
36
+	}
37 37
 
38
-    function index() 
39
-    {
40
-        if ($this->session->userdata('user_login') == FALSE) 
41
-            redirect(base_url() . 'login/login');
42
-            $data['page_title'] = 'Dashboard';
43
-        if ($this->session->userdata('logintype') == 0) 
38
+	function index() 
39
+	{
40
+		if ($this->session->userdata('user_login') == FALSE) 
41
+			redirect(base_url() . 'login/login');
42
+			$data['page_title'] = 'Dashboard';
43
+		if ($this->session->userdata('logintype') == 0) 
44
+	{
45
+			$this->load->view('view_user_dashboard', $data);
46
+		} else {
47
+		$gmtoffset=$this->common->get_timezone_offset();	    
48
+			$this->load->view('view_dashboard', $data);
49
+		}
50
+	}
51
+	function user_recent_payments(){
52
+	  $this->customerReport_recent_payments();
53
+	}     
54
+	function customerReport_recent_payments() 
44 55
 	{
45
-            $this->load->view('view_user_dashboard', $data);
46
-        } else {
47
-	    $gmtoffset=$this->common->get_timezone_offset();	    
48
-            $this->load->view('view_dashboard', $data);
49
-        }
50
-    }
51
-    function user_recent_payments(){
52
-      $this->customerReport_recent_payments();
53
-    }     
54
-    function customerReport_recent_payments() 
55
-    {
56 56
 	$accountinfo=$this->session->userdata('accountinfo');
57 57
 	$currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id']));
58
-        $json_data = array();
58
+		$json_data = array();
59 59
 	$i=1;
60 60
 	$result = $this->dashboard_model->get_recent_recharge();
61 61
 	$gmtoffset=$this->common->get_timezone_offset();
62
-        if($result->num_rows() > 0)
62
+		if($result->num_rows() > 0)
63 63
 	{
64 64
 		 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts','');
65 65
 		 $json_data[0]['accountid']='Accounts';
66 66
 		 $json_data[0]['credit']='Amount('.$currency.")";
67 67
 		 $json_data[0]['payment_date']='Date';
68 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
-		      $i++;
76
-          	}
77
-          }
78
-         echo json_encode($json_data); 
79
-    }
80
-    function  user_call_statistics_with_profit(){
81
-      $this->customerReport_call_statistics_with_profit();
82
-     }
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");
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
+			  $i++;
76
+		  	}
77
+		  }
78
+		 echo json_encode($json_data); 
79
+	}
80
+	function  user_call_statistics_with_profit(){
81
+	  $this->customerReport_call_statistics_with_profit();
82
+	 }
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");
87 87
 	$json_data = array();
88 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);
89
+		$end_day= $year==date("Y") && $month ==date("m") ? date("d") :cal_days_in_month(CAL_GREGORIAN, $month, $year);
90 90
 	$gmtoffset=$this->common->get_timezone_offset();
91 91
 	$end_date=date($year."-".$month."-".$end_day.' H:i:s');
92 92
 	$end_date=date('Y-m-d',strtotime($end_date)+$gmtoffset);
93 93
 	$current_date=(int)date("d");
94
-        $count=0;
95
-        $i=0;
96
-        $begin = new DateTime($start_date);
94
+		$count=0;
95
+		$i=0;
96
+		$begin = new DateTime($start_date);
97 97
 	$end = new DateTime($end_date);
98 98
 	$end=$end->modify('+1 day');
99 99
 	$daterange = new DatePeriod($begin, new DateInterval('P1D'), $end);
100 100
 	$records_date=array();
101 101
 	$accountinfo=$this->session->userdata('accountinfo');
102 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
-        $acc_arr = array();
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
+		$acc_arr = array();
106 106
 	foreach ($customerresult->result_array() as $data) {
107 107
 	  $acc_arr[$data['day']] = $data;
108 108
 	}
109 109
 	foreach($resellerresult->result_array() as $data){
110 110
 	  $reseller_arr[$data['day']]=$data;
111 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'];
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 119
 	  }else{
120
-	    $acc_arr[$data['day']]=$data;
120
+		$acc_arr[$data['day']]=$data;
121 121
 	  }
122 122
 	}
123 123
 	if(!empty($acc_arr)){
124
-	    foreach($daterange as $date){
124
+		foreach($daterange as $date){
125 125
 		$json_data['date'][]=$date->format("d");
126 126
 		$day = (int) $date->format("d");
127 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;
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 130
 		  $json_data['total'][]=  array((string)$acc_arr[$day]['day'],(int) $acc_arr[$day]['sum']);
131 131
 		  $json_data['answered'][]=  array((string)$acc_arr[$day]['day'],(int) $acc_arr[$day]['answered']);
132 132
 		  $json_data['failed'][]=  array((string)$acc_arr[$day]['day'],(int) $acc_arr[$day]['failed']);
133 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);
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 137
 		}else{
138 138
 		  $json_data['total'][]=  array($date->format("d"), 0);
139 139
 		  $json_data['answered'][]=  array($date->format("d"), 0);
140 140
 		  $json_data['failed'][]=  array($date->format("d"), 0);
141 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);
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 149
 	else{
150 150
 	foreach($daterange as $date){
@@ -154,42 +154,42 @@  discard block
 block discarded – undo
154 154
 		$json_data['answered'][]=  array($date->format("d"), 0);
155 155
 		$json_data['failed'][]=  array($date->format("d"), 0);
156 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);
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();
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 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']);
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(){
180
-      $this->customerReport_maximum_callminutes();
181
-    }
182
-     function customerReport_maximum_callminutes()
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");
179
+	 function user_maximum_callminutes(){
180
+	  $this->customerReport_maximum_callminutes();
181
+	}
182
+	 function customerReport_maximum_callminutes()
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 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);
188
+		$end_day= $year==date("Y") && $month ==date("m") ? date("d") :cal_days_in_month(CAL_GREGORIAN, $month, $year);
189 189
 	$gmtoffset=$this->common->get_timezone_offset();
190 190
 	$end_date=date($year."-".$month."-".$end_day.' H:i:s');
191 191
 	$end_date=date('Y-m-d',strtotime($end_date)+$gmtoffset);
192
-     	$json_data = array();
192
+	 	$json_data = array();
193 193
  	$result = $this->dashboard_model->get_customer_maximum_callminutes($start_date,$end_date);
194 194
 	$i=0;
195 195
 	$accountinfo=$this->session->userdata('accountinfo');
@@ -200,34 +200,34 @@  discard block
 block discarded – undo
200 200
 	else{
201 201
 	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('id'=>$reseller_id));
202 202
 	}
203
-    	if($result->num_rows() > 0 )
203
+		if($result->num_rows() > 0 )
204 204
 	{	
205
-           foreach ($result->result_array() as $data){
206
-            $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
207
-            $json_data[$i][]= $data['accountid'];
208
-            $json_data[$i][]= round($data['billseconds']/60,0);
209
-            $i++;
210
-           } 
211
-    	}else{
205
+		   foreach ($result->result_array() as $data){
206
+			$data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
207
+			$json_data[$i][]= $data['accountid'];
208
+			$json_data[$i][]= round($data['billseconds']/60,0);
209
+			$i++;
210
+		   } 
211
+		}else{
212 212
 	  $json_data[] = array();
213
-      	}
214
-     	echo json_encode($json_data);
215
-     }
213
+	  	}
214
+	 	echo json_encode($json_data);
215
+	 }
216 216
 
217
-     function user_maximum_callcount(){
218
-       $this->customerReport_maximum_callcount();
219
-     }
220
-     function customerReport_maximum_callcount()
221
-     {
222
-     	$post=$this->input->post();
223
-        $year=isset($post['year']) && $post['year'] >0 ? $post['year']:date("Y");
224
-        $month=isset($post['month'])&& $post['month'] >0 ? $post['month']:date("m");
217
+	 function user_maximum_callcount(){
218
+	   $this->customerReport_maximum_callcount();
219
+	 }
220
+	 function customerReport_maximum_callcount()
221
+	 {
222
+	 	$post=$this->input->post();
223
+		$year=isset($post['year']) && $post['year'] >0 ? $post['year']:date("Y");
224
+		$month=isset($post['month'])&& $post['month'] >0 ? $post['month']:date("m");
225 225
 	$start_date=date($year.'-'.$month.'-01');
226
-        $end_day= $year==date("Y") && $month ==date("m") ? date("d") :cal_days_in_month(CAL_GREGORIAN, $month, $year);
226
+		$end_day= $year==date("Y") && $month ==date("m") ? date("d") :cal_days_in_month(CAL_GREGORIAN, $month, $year);
227 227
 	$gmtoffset=$this->common->get_timezone_offset();
228 228
 	$end_date=date($year."-".$month."-".$end_day.' H:i:s');
229 229
 	$end_date=date('Y-m-d',strtotime($end_date)+$gmtoffset);
230
-     	$json_data = array();
230
+	 	$json_data = array();
231 231
 	$result = $this->dashboard_model->get_customer_maximum_callcount($start_date,$end_date);
232 232
 	$accountinfo=$this->session->userdata('accountinfo');
233 233
 	$reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id'];
@@ -238,21 +238,21 @@  discard block
 block discarded – undo
238 238
 	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('id'=>$reseller_id));
239 239
 	}
240 240
 	$i=0;
241
-    	if($result->num_rows() > 0 )
241
+		if($result->num_rows() > 0 )
242 242
 	{
243
-	    foreach ($result->result_array() as $data) 
244
-	    {
245
-		        $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
246
-		        $json_data[$i][]= $data['accountid'];
247
-		        $json_data[$i][]= (int)$data['call_count'];
248
-		        $i++;
249
-            }
243
+		foreach ($result->result_array() as $data) 
244
+		{
245
+				$data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
246
+				$json_data[$i][]= $data['accountid'];
247
+				$json_data[$i][]= (int)$data['call_count'];
248
+				$i++;
249
+			}
250 250
     	    
251
-        }else{
252
-    	        $json_data[] = array();
253
-     	     }
251
+		}else{
252
+				$json_data[] = array();
253
+	 		 }
254 254
 	echo json_encode($json_data);
255
-     }
255
+	 }
256 256
 }
257 257
 
258 258
 ?>
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -38,217 +38,217 @@
 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));
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 199
 	} 
200
-	else{
201
-	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('id'=>$reseller_id));
200
+	else {
201
+	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', array('id'=>$reseller_id));
202 202
 	}
203
-    	if($result->num_rows() > 0 )
203
+    	if ($result->num_rows() > 0)
204 204
 	{	
205
-           foreach ($result->result_array() as $data){
206
-            $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
207
-            $json_data[$i][]= $data['accountid'];
208
-            $json_data[$i][]= round($data['billseconds']/60,0);
205
+           foreach ($result->result_array() as $data) {
206
+            $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] : "Anonymous";
207
+            $json_data[$i][] = $data['accountid'];
208
+            $json_data[$i][] = round($data['billseconds'] / 60, 0);
209 209
             $i++;
210 210
            } 
211
-    	}else{
211
+    	} else {
212 212
 	  $json_data[] = array();
213 213
       	}
214 214
      	echo json_encode($json_data);
215 215
      }
216 216
 
217
-     function user_maximum_callcount(){
217
+     function user_maximum_callcount() {
218 218
        $this->customerReport_maximum_callcount();
219 219
      }
220 220
      function customerReport_maximum_callcount()
221 221
      {
222
-     	$post=$this->input->post();
223
-        $year=isset($post['year']) && $post['year'] >0 ? $post['year']:date("Y");
224
-        $month=isset($post['month'])&& $post['month'] >0 ? $post['month']:date("m");
225
-	$start_date=date($year.'-'.$month.'-01');
226
-        $end_day= $year==date("Y") && $month ==date("m") ? date("d") :cal_days_in_month(CAL_GREGORIAN, $month, $year);
227
-	$gmtoffset=$this->common->get_timezone_offset();
228
-	$end_date=date($year."-".$month."-".$end_day.' H:i:s');
229
-	$end_date=date('Y-m-d',strtotime($end_date)+$gmtoffset);
222
+     	$post = $this->input->post();
223
+        $year = isset($post['year']) && $post['year'] > 0 ? $post['year'] : date("Y");
224
+        $month = isset($post['month']) && $post['month'] > 0 ? $post['month'] : date("m");
225
+	$start_date = date($year.'-'.$month.'-01');
226
+        $end_day = $year == date("Y") && $month == date("m") ? date("d") : cal_days_in_month(CAL_GREGORIAN, $month, $year);
227
+	$gmtoffset = $this->common->get_timezone_offset();
228
+	$end_date = date($year."-".$month."-".$end_day.' H:i:s');
229
+	$end_date = date('Y-m-d', strtotime($end_date) + $gmtoffset);
230 230
      	$json_data = array();
231
-	$result = $this->dashboard_model->get_customer_maximum_callcount($start_date,$end_date);
232
-	$accountinfo=$this->session->userdata('accountinfo');
233
-	$reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id'];
234
-	if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3){
235
-	  $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('reseller_id'=>$reseller_id));
231
+	$result = $this->dashboard_model->get_customer_maximum_callcount($start_date, $end_date);
232
+	$accountinfo = $this->session->userdata('accountinfo');
233
+	$reseller_id = $accountinfo['type'] == -1 ? 0 : $accountinfo['id'];
234
+	if ($this->session->userdata('userlevel_logintype') != 0 && $this->session->userdata('userlevel_logintype') != 3) {
235
+	  $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', array('reseller_id'=>$reseller_id));
236 236
 	} 
237
-	else{
238
-	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('id'=>$reseller_id));
237
+	else {
238
+	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', array('id'=>$reseller_id));
239 239
 	}
240
-	$i=0;
241
-    	if($result->num_rows() > 0 )
240
+	$i = 0;
241
+    	if ($result->num_rows() > 0)
242 242
 	{
243 243
 	    foreach ($result->result_array() as $data) 
244 244
 	    {
245
-		        $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
246
-		        $json_data[$i][]= $data['accountid'];
247
-		        $json_data[$i][]= (int)$data['call_count'];
245
+		        $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] : "Anonymous";
246
+		        $json_data[$i][] = $data['accountid'];
247
+		        $json_data[$i][] = (int)$data['call_count'];
248 248
 		        $i++;
249 249
             }
250 250
     	    
251
-        }else{
251
+        } else {
252 252
     	        $json_data[] = array();
253 253
      	     }
254 254
 	echo json_encode($json_data);
Please login to merge, or discard this patch.
Braces   +10 added lines, -12 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");
@@ -196,8 +196,7 @@  discard block
 block discarded – undo
196 196
 	$reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id'];
197 197
 	if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3){
198 198
 	  $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('reseller_id'=>$reseller_id));
199
-	} 
200
-	else{
199
+	} else{
201 200
 	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('id'=>$reseller_id));
202 201
 	}
203 202
     	if($result->num_rows() > 0 )
@@ -208,7 +207,7 @@  discard block
 block discarded – undo
208 207
             $json_data[$i][]= round($data['billseconds']/60,0);
209 208
             $i++;
210 209
            } 
211
-    	}else{
210
+    	} else{
212 211
 	  $json_data[] = array();
213 212
       	}
214 213
      	echo json_encode($json_data);
@@ -233,8 +232,7 @@  discard block
 block discarded – undo
233 232
 	$reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id'];
234 233
 	if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3){
235 234
 	  $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('reseller_id'=>$reseller_id));
236
-	} 
237
-	else{
235
+	} else{
238 236
 	 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',array('id'=>$reseller_id));
239 237
 	}
240 238
 	$i=0;
@@ -248,7 +246,7 @@  discard block
 block discarded – undo
248 246
 		        $i++;
249 247
             }
250 248
     	    
251
-        }else{
249
+        } else{
252 250
     	        $json_data[] = array();
253 251
      	     }
254 252
 	echo json_encode($json_data);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/dashboard/views/view_dashboard.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -369,28 +369,28 @@
 block discarded – undo
369 369
                                     <div class="col-md-5 no-padding pull-right ">
370 370
                                         <select id="year_dropdown" name='year' class="form-control no-margin" style="z-index:9;height:29px;width:100% !important;">
371 371
                                             <?php
372
-                                            $currentyear = gmdate('Y');
373
-                                            $start_year = $currentyear - 1;
374
-                                            $end_year = $currentyear;
375
-                                            $yearArray = range($start_year, $end_year);
376
-                                            foreach ($yearArray as $year) {
377
-                                                $selected = ($year == $currentyear) ? 'selected' : '';
378
-                                                echo '<option ' . $selected . ' value="' . $year . '">' . $year . '</option>';
379
-                                            }
380
-                                            ?>
372
+											$currentyear = gmdate('Y');
373
+											$start_year = $currentyear - 1;
374
+											$end_year = $currentyear;
375
+											$yearArray = range($start_year, $end_year);
376
+											foreach ($yearArray as $year) {
377
+												$selected = ($year == $currentyear) ? 'selected' : '';
378
+												echo '<option ' . $selected . ' value="' . $year . '">' . $year . '</option>';
379
+											}
380
+											?>
381 381
                                         </select>
382 382
                                     </div>
383 383
                                            <div class="col-md-6 no-padding pull-right margin-x-4">
384 384
                                         <select id="month_dropdown" name="month" class="form-control no-margin" style="z-index:9;height:29px;width:100% !important;">
385 385
                                             <?php
386
-                                            $monthArray = range(1, 12);
387
-                                            foreach ($monthArray as $month) {
388
-                                                $monthPadding = str_pad($month, 2, "0", STR_PAD_LEFT);
389
-                                                $fdate = date("F", strtotime($monthPadding));
390
-                                                $selected = (date("m") == $monthPadding) ? 'selected' : null;
391
-                                                echo '<option value="' . $monthPadding . '" ' . $selected . '>' . date("F", mktime(null, null, null, $monthPadding, 1)) . '</option>';
392
-                                            }
393
-                                            ?>
386
+											$monthArray = range(1, 12);
387
+											foreach ($monthArray as $month) {
388
+												$monthPadding = str_pad($month, 2, "0", STR_PAD_LEFT);
389
+												$fdate = date("F", strtotime($monthPadding));
390
+												$selected = (date("m") == $monthPadding) ? 'selected' : null;
391
+												echo '<option value="' . $monthPadding . '" ' . $selected . '>' . date("F", mktime(null, null, null, $monthPadding, 1)) . '</option>';
392
+											}
393
+											?>
394 394
                                         </select>
395 395
                                     </div>
396 396
                                      </div>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
                                           <div class='col-sm-11 no-padding'>
357 357
 											   <div style="font-size: 13px; width: auto; background:rgba(243, 236, 49, 0.34) none repeat scroll 0% 0% !important;" class="pull-left back_strip panel_padding" >
358
-													<div id="month_year_name" class='pull-left'><?=date('F');?></div>
358
+													<div id="month_year_name" class='pull-left'><?=date('F'); ?></div>
359 359
 	                                           </div>
360 360
 											   <div style="width: 91%; font-size: 13px;" class="pull-left back_strip panel_padding">
361 361
 												    <div id="month_total_info" style="color:#FFFC00;font-weight: 500;" class="pull-left"></div>
@@ -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.
astpp/application/modules/dashboard/models/dashboard_model.php 3 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 
25 25
 class Dashboard_model extends CI_Model {
26 26
 
27
-    function Dashboard_model() 
28
-    {
29
-        parent::__construct();
30
-    }
27
+	function Dashboard_model() 
28
+	{
29
+		parent::__construct();
30
+	}
31 31
 
32
-    function get_recent_recharge()
33
-    {
32
+	function get_recent_recharge()
33
+	{
34 34
 	$accountinfo=$this->session->userdata('accountinfo');
35 35
 	$userlevel_logintype=$this->session->userdata('userlevel_logintype');
36 36
 	
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 	if($userlevel_logintype == 0 || $userlevel_logintype == 3){
42 42
 	  $where_arr=array('accountid'=>$accountinfo['id']);
43 43
 	}
44
-        $this->db->where($where_arr);
45
-        $this->db->select('id,accountid,credit,payment_date');
46
-        $this->db->limit(12);
47
-        $this->db->order_by('payment_date','desc');
44
+		$this->db->where($where_arr);
45
+		$this->db->select('id,accountid,credit,payment_date');
46
+		$this->db->limit(12);
47
+		$this->db->order_by('payment_date','desc');
48 48
 	return $this->db->get('payments');
49
-    }
50
-     function get_call_statistics($table,$parent_id,$start_date='',$end_date='',$group_flag=true) 
51
-    {
52
-        $this->db->select("count(uniqueid) as sum,
49
+	}
50
+	 function get_call_statistics($table,$parent_id,$start_date='',$end_date='',$group_flag=true) 
51
+	{
52
+		$this->db->select("count(uniqueid) as sum,
53 53
                            count(CASE WHEN billseconds > 0 THEN 1 END) as answered,
54 54
                            MAX(billseconds) AS mcd,
55 55
                            SUM(billseconds) AS duration,
@@ -59,16 +59,16 @@  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)
66
-        $this->db->group_by("DAY(callstart)");
67
-        $result=$this->db->get($table);
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
+		$this->db->group_by("DAY(callstart)");
67
+		$result=$this->db->get($table);
68 68
 	return $result;
69
-    }
70
-    function get_customer_maximum_callminutes($start_date,$end_date)
71
-    {
69
+	}
70
+	function get_customer_maximum_callminutes($start_date,$end_date)
71
+	{
72 72
 	$start_date=$start_date." 00:00:00";
73 73
 	$end_date=$end_date." 23:59:59";
74 74
 	$accountinfo=$this->session->userdata('accountinfo');
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 			(SELECT sum( billseconds ) AS billseconds,accountid FROM (reseller_cdrs) WHERE $where 
84 84
 			group by accountid order by sum(billseconds) desc limit 10 ) ORDER BY billseconds DESC LIMIT 10 ";
85 85
 	return $this->db->query($select_query);
86
-    }
86
+	}
87 87
 
88
-    function get_customer_maximum_callcount($start_date,$end_date)
89
-    {
88
+	function get_customer_maximum_callcount($start_date,$end_date)
89
+	{
90 90
 	$start_date=$start_date." 00:00:00";
91 91
 	$end_date=$end_date." 23:59:59";
92 92
 	$accountinfo=$this->session->userdata('accountinfo');
@@ -101,6 +101,6 @@  discard block
 block discarded – undo
101 101
 	  (SELECT count(uniqueid) as call_count,accountid FROM (reseller_cdrs) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
102 102
 	  ORDER BY call_count desc limit 10";
103 103
 	return $this->db->query($select_query);
104
-    }
104
+	}
105 105
 }
106 106
 ?>
Please login to merge, or discard this patch.
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,44 +59,44 @@  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'";
80
-	$where= $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
81
-	$select_query= "(SELECT sum( billseconds ) AS billseconds,accountid FROM (cdrs) WHERE $where group by accountid order by sum(billseconds) desc limit 10)
79
+	 $where = "accountid ='$parent_id'";
80
+	$where = $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
81
+	$select_query = "(SELECT sum( billseconds ) AS billseconds,accountid FROM (cdrs) WHERE $where group by accountid order by sum(billseconds) desc limit 10)
82 82
 			union
83 83
 			(SELECT sum( billseconds ) AS billseconds,accountid FROM (reseller_cdrs) WHERE $where 
84 84
 			group by accountid order by sum(billseconds) desc limit 10 ) ORDER BY billseconds DESC LIMIT 10 ";
85 85
 	return $this->db->query($select_query);
86 86
     }
87 87
 
88
-    function get_customer_maximum_callcount($start_date,$end_date)
88
+    function get_customer_maximum_callcount($start_date, $end_date)
89 89
     {
90
-	$start_date=$start_date." 00:00:00";
91
-	$end_date=$end_date." 23:59:59";
92
-	$accountinfo=$this->session->userdata('accountinfo');
93
-	$parent_id= ($accountinfo['type'] == 1) ? $accountinfo['id']:0;
94
-	  if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3)
95
-	  $where ="reseller_id ='$parent_id'";
90
+	$start_date = $start_date." 00:00:00";
91
+	$end_date = $end_date." 23:59:59";
92
+	$accountinfo = $this->session->userdata('accountinfo');
93
+	$parent_id = ($accountinfo['type'] == 1) ? $accountinfo['id'] : 0;
94
+	  if ($this->session->userdata('userlevel_logintype') != 0 && $this->session->userdata('userlevel_logintype') != 3)
95
+	  $where = "reseller_id ='$parent_id'";
96 96
 	else
97
-	  $where ="accountid ='$parent_id'";
98
-	  $where= $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
99
-	  $select_query="(SELECT count(uniqueid) as call_count, `accountid` FROM (`cdrs`) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
97
+	  $where = "accountid ='$parent_id'";
98
+	  $where = $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
99
+	  $select_query = "(SELECT count(uniqueid) as call_count, `accountid` FROM (`cdrs`) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
100 100
 	  UNION
101 101
 	  (SELECT count(uniqueid) as call_count,accountid FROM (reseller_cdrs) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
102 102
 	  ORDER BY call_count desc limit 10";
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,8 +62,9 @@  discard block
 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
     }
@@ -73,10 +74,11 @@  discard block
 block discarded – undo
73 74
 	$end_date=$end_date." 23:59:59";
74 75
 	$accountinfo=$this->session->userdata('accountinfo');
75 76
 	$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
-	else
79
-	 $where ="accountid ='$parent_id'";
77
+	if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3) {
78
+		 $where ="reseller_id ='$parent_id'";
79
+	} else {
80
+		 $where ="accountid ='$parent_id'";
81
+	}
80 82
 	$where= $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
81 83
 	$select_query= "(SELECT sum( billseconds ) AS billseconds,accountid FROM (cdrs) WHERE $where group by accountid order by sum(billseconds) desc limit 10)
82 84
 			union
@@ -91,10 +93,11 @@  discard block
 block discarded – undo
91 93
 	$end_date=$end_date." 23:59:59";
92 94
 	$accountinfo=$this->session->userdata('accountinfo');
93 95
 	$parent_id= ($accountinfo['type'] == 1) ? $accountinfo['id']:0;
94
-	  if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3)
95
-	  $where ="reseller_id ='$parent_id'";
96
-	else
97
-	  $where ="accountid ='$parent_id'";
96
+	  if($this->session->userdata('userlevel_logintype')!= 0 && $this->session->userdata('userlevel_logintype')!= 3) {
97
+	  	  $where ="reseller_id ='$parent_id'";
98
+	  } else {
99
+		  $where ="accountid ='$parent_id'";
100
+	}
98 101
 	  $where= $where." AND callstart >= '".$start_date."' AND  callstart <= '".$end_date."'";
99 102
 	  $select_query="(SELECT count(uniqueid) as call_count, `accountid` FROM (`cdrs`) WHERE $where GROUP BY `accountid` ORDER BY `call_count` desc LIMIT 10)
100 103
 	  UNION
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/trunk/controllers/trunk.php 3 patches
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -22,159 +22,159 @@
 block discarded – undo
22 22
 ###############################################################################
23 23
 class Trunk extends CI_Controller {
24 24
 
25
-    function Trunk() {
26
-        parent::__construct();
27
-
28
-        $this->load->helper('template_inheritance');
29
-
30
-        $this->load->library('session');
31
-        $this->load->library("trunk_form");
32
-        $this->load->library('astpp/form');
33
-        $this->load->model('trunk_model');
34
-
35
-        if ($this->session->userdata('user_login') == FALSE)
36
-            redirect(base_url() . '/astpp/login');
37
-    }
38
-
39
-    function trunk_list() {
40
-        $data['username'] = $this->session->userdata('user_name');
41
-        $data['page_title'] = 'Trunks';
42
-        $data['search_flag'] = true;
43
-        $this->session->set_userdata('advance_search', 0);
44
-        $data['grid_fields'] = $this->trunk_form->build_trunk_list_for_admin();
45
-        $data["grid_buttons"] = $this->trunk_form->build_grid_buttons();
46
-        $data['form_search'] = $this->form->build_serach_form($this->trunk_form->get_trunk_search_form());
47
-        $this->load->view('view_trunk_list', $data);
48
-    }
49
-
50
-    function trunk_list_json() {
51
-        $json_data = array();
52
-        $count_all = $this->trunk_model->gettrunk_list(false);
53
-        $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']);
54
-        $json_data = $paging_data["json_paging"];
55
-        $query = $this->trunk_model->gettrunk_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
56
-        $grid_fields = json_decode($this->trunk_form->build_trunk_list_for_admin());
57
-        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
58
-        echo json_encode($json_data);
59
-    }
60
-
61
-    function trunk_add($type = "") {
62
-        $data['username'] = $this->session->userdata('user_name');
63
-        $data['flag'] = 'create';
64
-        $data['page_title'] = 'Create Trunk';
65
-        $data['form'] = $this->form->build_form($this->trunk_form->get_trunk_form_fields(), '');
66
-        $this->load->view('view_trunk_add_edit', $data);
67
-    }
68
-
69
-    function trunk_edit($edit_id = '') {
70
-        $data['page_title'] = 'Edit Trunk';
71
-        $where = array('id' => $edit_id);
72
-        $account = $this->db_model->getSelect("*", "trunks", $where);
73
-        foreach ($account->result_array() as $key => $value) {
74
-            $edit_data = $value;
75
-        }
76
-        $edit_data["resellers_id"] = explode(",", $edit_data["resellers_id"]);
77
-        $data['form'] = $this->form->build_form($this->trunk_form->get_trunk_form_fields(), $edit_data);
78
-        $this->load->view('view_trunk_add_edit', $data);
79
-    }
80
-
81
-    function trunk_save() {
82
-        $add_array = $this->input->post();
83
-        $data['form'] = $this->form->build_form($this->trunk_form->get_trunk_form_fields(), $add_array);
84
-        if ($add_array['id'] != '') {
85
-            $data['page_title'] = 'Edit Trunk Rates';
86
-            if ($this->form_validation->run() == FALSE) {
87
-                $data['validation_errors'] = validation_errors();
88
-                echo $data['validation_errors'];
89
-                exit;
90
-            } else {
91
-                $this->trunk_model->edit_trunk($add_array, $add_array['id']);
92
-                echo json_encode(array("SUCCESS"=> $add_array["name"]." Trunk updated successfully!"));
93
-                exit;
94
-            }
95
-        } else {
96
-            $data['page_title'] = 'Termination Details';
97
-            if ($this->form_validation->run() == FALSE) {
98
-                $data['validation_errors'] = validation_errors();
99
-                echo $data['validation_errors'];
100
-                exit;
101
-            } else {
102
-                $this->trunk_model->add_trunk($add_array);
103
-                echo json_encode(array("SUCCESS"=> $add_array["name"]." Trunk added successfully!"));
104
-                exit;
105
-            }
106
-        }
107
-    }
108
-
109
-    function trunk_list_search() {
110
-        $ajax_search = $this->input->post('ajax_search', 0);
111
-
112
-        if ($this->input->post('advance_search', TRUE) == 1) {
113
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
114
-            $action = $this->input->post();
115
-            unset($action['action']);
116
-            unset($action['advance_search']);
117
-            $this->session->set_userdata('trunk_list_search', $action);
118
-        }
119
-        if (@$ajax_search != 1) {
120
-            redirect(base_url() . 'trunk/trunk_list/');
121
-        }
122
-    }
123
-
124
-    function trunk_list_clearsearchfilter() {
125
-        $this->session->set_userdata('advance_search', 0);
126
-        $this->session->set_userdata('account_search', "");
127
-    }
128
-
129
-    function trunk_remove($id) {
130
-        $this->trunk_model->remove_trunk($id);
25
+	function Trunk() {
26
+		parent::__construct();
27
+
28
+		$this->load->helper('template_inheritance');
29
+
30
+		$this->load->library('session');
31
+		$this->load->library("trunk_form");
32
+		$this->load->library('astpp/form');
33
+		$this->load->model('trunk_model');
34
+
35
+		if ($this->session->userdata('user_login') == FALSE)
36
+			redirect(base_url() . '/astpp/login');
37
+	}
38
+
39
+	function trunk_list() {
40
+		$data['username'] = $this->session->userdata('user_name');
41
+		$data['page_title'] = 'Trunks';
42
+		$data['search_flag'] = true;
43
+		$this->session->set_userdata('advance_search', 0);
44
+		$data['grid_fields'] = $this->trunk_form->build_trunk_list_for_admin();
45
+		$data["grid_buttons"] = $this->trunk_form->build_grid_buttons();
46
+		$data['form_search'] = $this->form->build_serach_form($this->trunk_form->get_trunk_search_form());
47
+		$this->load->view('view_trunk_list', $data);
48
+	}
49
+
50
+	function trunk_list_json() {
51
+		$json_data = array();
52
+		$count_all = $this->trunk_model->gettrunk_list(false);
53
+		$paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']);
54
+		$json_data = $paging_data["json_paging"];
55
+		$query = $this->trunk_model->gettrunk_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
56
+		$grid_fields = json_decode($this->trunk_form->build_trunk_list_for_admin());
57
+		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
58
+		echo json_encode($json_data);
59
+	}
60
+
61
+	function trunk_add($type = "") {
62
+		$data['username'] = $this->session->userdata('user_name');
63
+		$data['flag'] = 'create';
64
+		$data['page_title'] = 'Create Trunk';
65
+		$data['form'] = $this->form->build_form($this->trunk_form->get_trunk_form_fields(), '');
66
+		$this->load->view('view_trunk_add_edit', $data);
67
+	}
68
+
69
+	function trunk_edit($edit_id = '') {
70
+		$data['page_title'] = 'Edit Trunk';
71
+		$where = array('id' => $edit_id);
72
+		$account = $this->db_model->getSelect("*", "trunks", $where);
73
+		foreach ($account->result_array() as $key => $value) {
74
+			$edit_data = $value;
75
+		}
76
+		$edit_data["resellers_id"] = explode(",", $edit_data["resellers_id"]);
77
+		$data['form'] = $this->form->build_form($this->trunk_form->get_trunk_form_fields(), $edit_data);
78
+		$this->load->view('view_trunk_add_edit', $data);
79
+	}
80
+
81
+	function trunk_save() {
82
+		$add_array = $this->input->post();
83
+		$data['form'] = $this->form->build_form($this->trunk_form->get_trunk_form_fields(), $add_array);
84
+		if ($add_array['id'] != '') {
85
+			$data['page_title'] = 'Edit Trunk Rates';
86
+			if ($this->form_validation->run() == FALSE) {
87
+				$data['validation_errors'] = validation_errors();
88
+				echo $data['validation_errors'];
89
+				exit;
90
+			} else {
91
+				$this->trunk_model->edit_trunk($add_array, $add_array['id']);
92
+				echo json_encode(array("SUCCESS"=> $add_array["name"]." Trunk updated successfully!"));
93
+				exit;
94
+			}
95
+		} else {
96
+			$data['page_title'] = 'Termination Details';
97
+			if ($this->form_validation->run() == FALSE) {
98
+				$data['validation_errors'] = validation_errors();
99
+				echo $data['validation_errors'];
100
+				exit;
101
+			} else {
102
+				$this->trunk_model->add_trunk($add_array);
103
+				echo json_encode(array("SUCCESS"=> $add_array["name"]." Trunk added successfully!"));
104
+				exit;
105
+			}
106
+		}
107
+	}
108
+
109
+	function trunk_list_search() {
110
+		$ajax_search = $this->input->post('ajax_search', 0);
111
+
112
+		if ($this->input->post('advance_search', TRUE) == 1) {
113
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
114
+			$action = $this->input->post();
115
+			unset($action['action']);
116
+			unset($action['advance_search']);
117
+			$this->session->set_userdata('trunk_list_search', $action);
118
+		}
119
+		if (@$ajax_search != 1) {
120
+			redirect(base_url() . 'trunk/trunk_list/');
121
+		}
122
+	}
123
+
124
+	function trunk_list_clearsearchfilter() {
125
+		$this->session->set_userdata('advance_search', 0);
126
+		$this->session->set_userdata('account_search', "");
127
+	}
128
+
129
+	function trunk_remove($id) {
130
+		$this->trunk_model->remove_trunk($id);
131 131
 	$this->db->delete("routing",array("trunk_id"=>$id));
132
-        $this->session->set_flashdata('astpp_notification', 'Trunk removed successfully!');
133
-        redirect(base_url() . 'trunk/trunk_list/');
134
-    }
135
-
136
-    function trunk_delete_multiple() {
137
-        $add_array = $this->input->post();
138
-        $where = 'IN ('.$add_array['selected_ids'].')';
139
-        if (isset($add_array['flag'])) {            
140
-            $update_data = array('status' => '2');
141
-            $this->db->where('trunk_id '.$where);
142
-            $this->db->delete('outbound_routes');
143
-            $this->db->where('id '.$where);
144
-            $this->db->update('trunks', $update_data);
145
-            echo TRUE;
146
-        } else {
147
-            $trunk_arr=array();
148
-            $this->db->select('id,name');
149
-            $this->db->where('id '.$where);
150
-            $trunk_res=$this->db->get('trunks');
151
-            $trunk_res=$trunk_res->result_array();
152
-            foreach($trunk_res as $value){
153
-                $trunk_arr[$value['id']]['name']=$value['name'];
154
-            }
155
-            $this->db->where('trunk_id '.$where);
156
-            $this->db->select('count(id) as cnt,trunk_id');
157
-            $this->db->group_by('trunk_id');
158
-            $outbound_routes_res=$this->db->get('outbound_routes');
159
-            if($outbound_routes_res->num_rows() > 0){
160
-             $outbound_routes_res=$outbound_routes_res->result_array();
161
-             foreach($outbound_routes_res as $key=>$value){
162
-                $trunk_arr[$value['trunk_id']]['outbound_routes']=$value['cnt'];
163
-             }
164
-            }
165
-            $str=null;
166
-            foreach($trunk_arr as $key=>$value){
167
-                 if(isset($value['outbound_routes'])){
168
-                     $str.= $value['name']."trunk using by ".$value['outbound_routes']." termination rates \n";
169
-                 }
170
-            } 
171
-            if(!empty($str)){
172
-                $data['str']=$str;
173
-            }
174
-            $data['selected_ids']=$add_array['selected_ids'];
175
-            echo json_encode($data);
176
-        }
177
-    }
132
+		$this->session->set_flashdata('astpp_notification', 'Trunk removed successfully!');
133
+		redirect(base_url() . 'trunk/trunk_list/');
134
+	}
135
+
136
+	function trunk_delete_multiple() {
137
+		$add_array = $this->input->post();
138
+		$where = 'IN ('.$add_array['selected_ids'].')';
139
+		if (isset($add_array['flag'])) {            
140
+			$update_data = array('status' => '2');
141
+			$this->db->where('trunk_id '.$where);
142
+			$this->db->delete('outbound_routes');
143
+			$this->db->where('id '.$where);
144
+			$this->db->update('trunks', $update_data);
145
+			echo TRUE;
146
+		} else {
147
+			$trunk_arr=array();
148
+			$this->db->select('id,name');
149
+			$this->db->where('id '.$where);
150
+			$trunk_res=$this->db->get('trunks');
151
+			$trunk_res=$trunk_res->result_array();
152
+			foreach($trunk_res as $value){
153
+				$trunk_arr[$value['id']]['name']=$value['name'];
154
+			}
155
+			$this->db->where('trunk_id '.$where);
156
+			$this->db->select('count(id) as cnt,trunk_id');
157
+			$this->db->group_by('trunk_id');
158
+			$outbound_routes_res=$this->db->get('outbound_routes');
159
+			if($outbound_routes_res->num_rows() > 0){
160
+			 $outbound_routes_res=$outbound_routes_res->result_array();
161
+			 foreach($outbound_routes_res as $key=>$value){
162
+				$trunk_arr[$value['trunk_id']]['outbound_routes']=$value['cnt'];
163
+			 }
164
+			}
165
+			$str=null;
166
+			foreach($trunk_arr as $key=>$value){
167
+				 if(isset($value['outbound_routes'])){
168
+					 $str.= $value['name']."trunk using by ".$value['outbound_routes']." termination rates \n";
169
+				 }
170
+			} 
171
+			if(!empty($str)){
172
+				$data['str']=$str;
173
+			}
174
+			$data['selected_ids']=$add_array['selected_ids'];
175
+			echo json_encode($data);
176
+		}
177
+	}
178 178
 
179 179
 }
180 180
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $this->load->model('trunk_model');
34 34
 
35 35
         if ($this->session->userdata('user_login') == FALSE)
36
-            redirect(base_url() . '/astpp/login');
36
+            redirect(base_url().'/astpp/login');
37 37
     }
38 38
 
39 39
     function trunk_list() {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     function trunk_list_json() {
51 51
         $json_data = array();
52 52
         $count_all = $this->trunk_model->gettrunk_list(false);
53
-        $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']);
53
+        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
54 54
         $json_data = $paging_data["json_paging"];
55 55
         $query = $this->trunk_model->gettrunk_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
56 56
         $grid_fields = json_decode($this->trunk_form->build_trunk_list_for_admin());
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $this->session->set_userdata('trunk_list_search', $action);
118 118
         }
119 119
         if (@$ajax_search != 1) {
120
-            redirect(base_url() . 'trunk/trunk_list/');
120
+            redirect(base_url().'trunk/trunk_list/');
121 121
         }
122 122
     }
123 123
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
     function trunk_remove($id) {
130 130
         $this->trunk_model->remove_trunk($id);
131
-	$this->db->delete("routing",array("trunk_id"=>$id));
131
+	$this->db->delete("routing", array("trunk_id"=>$id));
132 132
         $this->session->set_flashdata('astpp_notification', 'Trunk removed successfully!');
133
-        redirect(base_url() . 'trunk/trunk_list/');
133
+        redirect(base_url().'trunk/trunk_list/');
134 134
     }
135 135
 
136 136
     function trunk_delete_multiple() {
@@ -144,34 +144,34 @@  discard block
 block discarded – undo
144 144
             $this->db->update('trunks', $update_data);
145 145
             echo TRUE;
146 146
         } else {
147
-            $trunk_arr=array();
147
+            $trunk_arr = array();
148 148
             $this->db->select('id,name');
149 149
             $this->db->where('id '.$where);
150
-            $trunk_res=$this->db->get('trunks');
151
-            $trunk_res=$trunk_res->result_array();
152
-            foreach($trunk_res as $value){
153
-                $trunk_arr[$value['id']]['name']=$value['name'];
150
+            $trunk_res = $this->db->get('trunks');
151
+            $trunk_res = $trunk_res->result_array();
152
+            foreach ($trunk_res as $value) {
153
+                $trunk_arr[$value['id']]['name'] = $value['name'];
154 154
             }
155 155
             $this->db->where('trunk_id '.$where);
156 156
             $this->db->select('count(id) as cnt,trunk_id');
157 157
             $this->db->group_by('trunk_id');
158
-            $outbound_routes_res=$this->db->get('outbound_routes');
159
-            if($outbound_routes_res->num_rows() > 0){
160
-             $outbound_routes_res=$outbound_routes_res->result_array();
161
-             foreach($outbound_routes_res as $key=>$value){
162
-                $trunk_arr[$value['trunk_id']]['outbound_routes']=$value['cnt'];
158
+            $outbound_routes_res = $this->db->get('outbound_routes');
159
+            if ($outbound_routes_res->num_rows() > 0) {
160
+             $outbound_routes_res = $outbound_routes_res->result_array();
161
+             foreach ($outbound_routes_res as $key=>$value) {
162
+                $trunk_arr[$value['trunk_id']]['outbound_routes'] = $value['cnt'];
163 163
              }
164 164
             }
165
-            $str=null;
166
-            foreach($trunk_arr as $key=>$value){
167
-                 if(isset($value['outbound_routes'])){
168
-                     $str.= $value['name']."trunk using by ".$value['outbound_routes']." termination rates \n";
165
+            $str = null;
166
+            foreach ($trunk_arr as $key=>$value) {
167
+                 if (isset($value['outbound_routes'])) {
168
+                     $str .= $value['name']."trunk using by ".$value['outbound_routes']." termination rates \n";
169 169
                  }
170 170
             } 
171
-            if(!empty($str)){
172
-                $data['str']=$str;
171
+            if ( ! empty($str)) {
172
+                $data['str'] = $str;
173 173
             }
174
-            $data['selected_ids']=$add_array['selected_ids'];
174
+            $data['selected_ids'] = $add_array['selected_ids'];
175 175
             echo json_encode($data);
176 176
         }
177 177
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@
 block discarded – undo
32 32
         $this->load->library('astpp/form');
33 33
         $this->load->model('animap_model');
34 34
 
35
-        if ($this->session->userdata('user_login') == FALSE)
36
-            redirect(base_url() . '/astpp/login');
35
+        if ($this->session->userdata('user_login') == FALSE) {
36
+                    redirect(base_url() . '/astpp/login');
37
+        }
37 38
     }
38 39
 
39 40
     function animap_add() {
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/trunk/libraries/trunk_form.php 3 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -21,72 +21,72 @@
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 if (!defined('BASEPATH'))
24
-    exit('No direct script access allowed');
24
+	exit('No direct script access allowed');
25 25
 
26 26
 class trunk_form {
27 27
 
28
-    function get_trunk_form_fields() {
29
-        $form['forms'] = array(base_url() . 'trunk/trunk_save/', array('id' => 'trunks_form', 'method' => 'POST', 'name' => 'trunks_form'));
30
-        $form['Information'] = array(
31
-            array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
32
-            array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
28
+	function get_trunk_form_fields() {
29
+		$form['forms'] = array(base_url() . 'trunk/trunk_save/', array('id' => 'trunks_form', 'method' => 'POST', 'name' => 'trunks_form'));
30
+		$form['Information'] = array(
31
+			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
32
+			array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
33 33
 			array('Provider', 'provider_id', 'SELECT', '', 'trim|required|xss_clean', '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")),
34
-            array('Gateway Name', 'gateway_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
34
+			array('Gateway Name', 'gateway_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
35 35
 			array('Failover GW Name #1', 'failover_gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
36 36
 			array('Failover GW Name #2', 'failover_gateway_id1', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),            
37
-            array('CC', 'INPUT', array('name' => 'maxchannels', 'value' => '0' , 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''));
38
-        $form['Settings'] = array(  
39
-            array('Number Translation', 'INPUT', array('name' => 'dialed_modify', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
37
+			array('CC', 'INPUT', array('name' => 'maxchannels', 'value' => '0' , 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''));
38
+		$form['Settings'] = array(  
39
+			array('Number Translation', 'INPUT', array('name' => 'dialed_modify', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
40 40
 			array('Codecs', 'INPUT', array('name' => 'codec', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
41
-            array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
42
-            array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
43
-        );
44
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
45
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
46
-        return $form;
47
-    }
41
+			array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
42
+			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
43
+		);
44
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
45
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
46
+		return $form;
47
+	}
48 48
 
49
-    function get_trunk_search_form() {
50
-        $form['forms'] = array("", array('id' => "trunk_search"));
51
-        $form['Search'] = array(
52
-            array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
53
-            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, "status"=>0, "deleted" => 0)),
54
-            array('Gateway Name', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
49
+	function get_trunk_search_form() {
50
+		$form['forms'] = array("", array('id' => "trunk_search"));
51
+		$form['Search'] = array(
52
+			array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
53
+			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, "status"=>0, "deleted" => 0)),
54
+			array('Gateway Name', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
55 55
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
56 56
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
57
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
58
-        );
59
-        $form['button_search'] = array('name' => 'action', 'id' => "trunk_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
60
-        $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');
61
-        return $form;
62
-    }
57
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
58
+		);
59
+		$form['button_search'] = array('name' => 'action', 'id' => "trunk_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
60
+		$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');
61
+		return $form;
62
+	}
63 63
 
64
-    function build_trunk_list_for_admin() {
64
+	function build_trunk_list_for_admin() {
65 65
         
66
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
67
-            array("Name", "100", "name", "", "", "","EDITABLE","true","center"),
68
-            array("Provider", "110", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
69
-            array("Gateway Name", "100", "gateway_id", "name", "gateways", "get_field_name","","true","center"),
66
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
67
+			array("Name", "100", "name", "", "", "","EDITABLE","true","center"),
68
+			array("Provider", "110", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
69
+			array("Gateway Name", "100", "gateway_id", "name", "gateways", "get_field_name","","true","center"),
70 70
 			array("Failover <br>GW Name #1", "130", "failover_gateway_id","name", "gateways", "get_field_name","","true","center"),
71
-            array("Failover<br> GW Name #2", "130", "failover_gateway_id1","name", "gateways", "get_field_name","","true","center"),
71
+			array("Failover<br> GW Name #2", "130", "failover_gateway_id1","name", "gateways", "get_field_name","","true","center"),
72 72
 			array("CC", "90", "maxchannels", "", "", "","","true","center"),
73
-            array("Codecs", "90", "codec", "", "", "","","true","center"),
73
+			array("Codecs", "90", "codec", "", "", "","","true","center"),
74 74
 			array("Rate<br>Count", "70", "id", "trunk_id", "outbound_routes", "get_field_count","","true","center"),
75
-            array("Status", "100", "status", "status", "trunks", "get_status","","true","center"),
76
-            array("Created Date", "110", "creation_date", "creation_date", "creation_date", "convert_GMT_to"),
77
-            array("Modified <br/>Date", "105", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
75
+			array("Status", "100", "status", "status", "trunks", "get_status","","true","center"),
76
+			array("Created Date", "110", "creation_date", "creation_date", "creation_date", "convert_GMT_to"),
77
+			array("Modified <br/>Date", "105", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
78 78
 			array("Action", "100", "", "", "", array("EDIT" => array("url" => "trunk/trunk_edit/", "mode" => "popup","layout"=>"medium"),
79
-                    "DELETE" => array("url" => "trunk/trunk_remove/", "mode" => "single")))
80
-                ));
79
+					"DELETE" => array("url" => "trunk/trunk_remove/", "mode" => "single")))
80
+				));
81 81
 			return $grid_field_arr;
82
-    }
82
+	}
83 83
 
84
-    function build_grid_buttons() {
85
-        $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/trunk/trunk_add/", "popup","medium"),
86
-            array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/trunk/trunk_delete_multiple/")
87
-            ));
88
-        return $buttons_json;
89
-    }
84
+	function build_grid_buttons() {
85
+		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/trunk/trunk_add/", "popup","medium"),
86
+			array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/trunk/trunk_delete_multiple/")
87
+			));
88
+		return $buttons_json;
89
+	}
90 90
 
91 91
 }
92 92
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,25 +20,25 @@  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 trunk_form {
27 27
 
28 28
     function get_trunk_form_fields() {
29
-        $form['forms'] = array(base_url() . 'trunk/trunk_save/', array('id' => 'trunks_form', 'method' => 'POST', 'name' => 'trunks_form'));
29
+        $form['forms'] = array(base_url().'trunk/trunk_save/', array('id' => 'trunks_form', 'method' => 'POST', 'name' => 'trunks_form'));
30 30
         $form['Information'] = array(
31 31
             array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
32 32
             array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
33
-			array('Provider', 'provider_id', 'SELECT', '', 'trim|required|xss_clean', '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")),
34
-            array('Gateway Name', 'gateway_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
33
+			array('Provider', 'provider_id', 'SELECT', '', 'trim|required|xss_clean', '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")),
34
+            array('Gateway Name', 'gateway_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
35 35
 			array('Failover GW Name #1', 'failover_gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
36 36
 			array('Failover GW Name #2', 'failover_gateway_id1', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),            
37
-            array('CC', 'INPUT', array('name' => 'maxchannels', 'value' => '0' , 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''));
37
+            array('CC', 'INPUT', array('name' => 'maxchannels', 'value' => '0', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''));
38 38
         $form['Settings'] = array(  
39
-            array('Number Translation', 'INPUT', array('name' => 'dialed_modify', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
39
+            array('Number Translation', 'INPUT', array('name' => 'dialed_modify', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
40 40
 			array('Codecs', 'INPUT', array('name' => 'codec', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
41
-            array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
41
+            array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
42 42
             array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
43 43
         );
44 44
         $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
         $form['forms'] = array("", array('id' => "trunk_search"));
51 51
         $form['Search'] = array(
52 52
             array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
53
-            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, "status"=>0, "deleted" => 0)),
54
-            array('Gateway Name', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
53
+            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, "status"=>0, "deleted" => 0)),
54
+            array('Gateway Name', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
55 55
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
56 56
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
57 57
             array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
@@ -63,26 +63,26 @@  discard block
 block discarded – undo
63 63
 
64 64
     function build_trunk_list_for_admin() {
65 65
         
66
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
67
-            array("Name", "100", "name", "", "", "","EDITABLE","true","center"),
68
-            array("Provider", "110", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
69
-            array("Gateway Name", "100", "gateway_id", "name", "gateways", "get_field_name","","true","center"),
70
-			array("Failover <br>GW Name #1", "130", "failover_gateway_id","name", "gateways", "get_field_name","","true","center"),
71
-            array("Failover<br> GW Name #2", "130", "failover_gateway_id1","name", "gateways", "get_field_name","","true","center"),
72
-			array("CC", "90", "maxchannels", "", "", "","","true","center"),
73
-            array("Codecs", "90", "codec", "", "", "","","true","center"),
74
-			array("Rate<br>Count", "70", "id", "trunk_id", "outbound_routes", "get_field_count","","true","center"),
75
-            array("Status", "100", "status", "status", "trunks", "get_status","","true","center"),
66
+        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
67
+            array("Name", "100", "name", "", "", "", "EDITABLE", "true", "center"),
68
+            array("Provider", "110", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
69
+            array("Gateway Name", "100", "gateway_id", "name", "gateways", "get_field_name", "", "true", "center"),
70
+			array("Failover <br>GW Name #1", "130", "failover_gateway_id", "name", "gateways", "get_field_name", "", "true", "center"),
71
+            array("Failover<br> GW Name #2", "130", "failover_gateway_id1", "name", "gateways", "get_field_name", "", "true", "center"),
72
+			array("CC", "90", "maxchannels", "", "", "", "", "true", "center"),
73
+            array("Codecs", "90", "codec", "", "", "", "", "true", "center"),
74
+			array("Rate<br>Count", "70", "id", "trunk_id", "outbound_routes", "get_field_count", "", "true", "center"),
75
+            array("Status", "100", "status", "status", "trunks", "get_status", "", "true", "center"),
76 76
             array("Created Date", "110", "creation_date", "creation_date", "creation_date", "convert_GMT_to"),
77
-            array("Modified <br/>Date", "105", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
78
-			array("Action", "100", "", "", "", array("EDIT" => array("url" => "trunk/trunk_edit/", "mode" => "popup","layout"=>"medium"),
77
+            array("Modified <br/>Date", "105", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
78
+			array("Action", "100", "", "", "", array("EDIT" => array("url" => "trunk/trunk_edit/", "mode" => "popup", "layout"=>"medium"),
79 79
                     "DELETE" => array("url" => "trunk/trunk_remove/", "mode" => "single")))
80 80
                 ));
81 81
 			return $grid_field_arr;
82 82
     }
83 83
 
84 84
     function build_grid_buttons() {
85
-        $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/trunk/trunk_add/", "popup","medium"),
85
+        $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/trunk/trunk_add/", "popup", "medium"),
86 86
             array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/trunk/trunk_delete_multiple/")
87 87
             ));
88 88
         return $buttons_json;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@
 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 Package_form {
29 30
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/trunk/models/trunk_model.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -22,41 +22,41 @@
 block discarded – undo
22 22
 ###############################################################################
23 23
 class trunk_model extends CI_Model {
24 24
 
25
-    function trunk_model() {
26
-        parent::__construct();
27
-    }
25
+	function trunk_model() {
26
+		parent::__construct();
27
+	}
28 28
 
29
-    function gettrunk_list($flag, $start = 0, $limit = 0) {
30
-        $this->db_model->build_search('trunk_list_search');
31
-        $where = array("status != " => "2");
32
-        if ($flag) {
33
-            $query = $this->db_model->select("*", "trunks", $where, "id", "ASC", $limit, $start);
34
-        } else {
35
-            $query = $this->db_model->countQuery("*", "trunks", $where);
36
-        }
37
-        return $query;
38
-    }
29
+	function gettrunk_list($flag, $start = 0, $limit = 0) {
30
+		$this->db_model->build_search('trunk_list_search');
31
+		$where = array("status != " => "2");
32
+		if ($flag) {
33
+			$query = $this->db_model->select("*", "trunks", $where, "id", "ASC", $limit, $start);
34
+		} else {
35
+			$query = $this->db_model->countQuery("*", "trunks", $where);
36
+		}
37
+		return $query;
38
+	}
39 39
 
40
-    function add_trunk($add_array) {
41
-        unset($add_array["action"]);
42
-        $add_array['creation_date']=gmdate('Y-m-d H:i:s');
43
-        $this->db->insert("trunks", $add_array);
44
-        return true;
45
-    }
40
+	function add_trunk($add_array) {
41
+		unset($add_array["action"]);
42
+		$add_array['creation_date']=gmdate('Y-m-d H:i:s');
43
+		$this->db->insert("trunks", $add_array);
44
+		return true;
45
+	}
46 46
 
47
-    function edit_trunk($data, $id) {
48
-        unset($data["action"]);
47
+	function edit_trunk($data, $id) {
48
+		unset($data["action"]);
49 49
 		$data['last_modified_date']=gmdate('Y-m-d H:i:s');
50
-        $this->db->where("id", $id);
51
-        $this->db->update("trunks", $data);
52
-    }
50
+		$this->db->where("id", $id);
51
+		$this->db->update("trunks", $data);
52
+	}
53 53
 
54
-    function remove_trunk($id) {
55
-        $this->db->where("id", $id);
56
-        $this->db->update("trunks", array("status" => 2));
57
-        $this->db->where('trunk_id',$id);
58
-        $this->db->delete('outbound_routes');
59
-        return true;
60
-    }
54
+	function remove_trunk($id) {
55
+		$this->db->where("id", $id);
56
+		$this->db->update("trunks", array("status" => 2));
57
+		$this->db->where('trunk_id',$id);
58
+		$this->db->delete('outbound_routes');
59
+		return true;
60
+	}
61 61
 
62 62
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 
40 40
     function add_trunk($add_array) {
41 41
         unset($add_array["action"]);
42
-        $add_array['creation_date']=gmdate('Y-m-d H:i:s');
42
+        $add_array['creation_date'] = gmdate('Y-m-d H:i:s');
43 43
         $this->db->insert("trunks", $add_array);
44 44
         return true;
45 45
     }
46 46
 
47 47
     function edit_trunk($data, $id) {
48 48
         unset($data["action"]);
49
-		$data['last_modified_date']=gmdate('Y-m-d H:i:s');
49
+		$data['last_modified_date'] = gmdate('Y-m-d H:i:s');
50 50
         $this->db->where("id", $id);
51 51
         $this->db->update("trunks", $data);
52 52
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     function remove_trunk($id) {
55 55
         $this->db->where("id", $id);
56 56
         $this->db->update("trunks", array("status" => 2));
57
-        $this->db->where('trunk_id',$id);
57
+        $this->db->where('trunk_id', $id);
58 58
         $this->db->delete('outbound_routes');
59 59
         return true;
60 60
     }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/controllers/rates.php 3 patches
Indentation   +791 added lines, -791 removed lines patch added patch discarded remove patch
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
22 22
 ###############################################################################
23 23
 class Rates extends MX_Controller {
24 24
 
25
-    function Rates() {
26
-        parent::__construct();
25
+	function Rates() {
26
+		parent::__construct();
27 27
 
28
-        $this->load->helper('template_inheritance');
28
+		$this->load->helper('template_inheritance');
29 29
 
30
-        $this->load->library('session');
31
-        $this->load->library('rates_form');
32
-        $this->load->library('astpp/form');
33
-        $this->load->model('rates_model');
34
-        $this->load->library('csvreader');
30
+		$this->load->library('session');
31
+		$this->load->library('rates_form');
32
+		$this->load->library('astpp/form');
33
+		$this->load->model('rates_model');
34
+		$this->load->library('csvreader');
35 35
 	ini_set("memory_limit","2048M");
36 36
 	ini_set("max_execution_time","259200");
37
-        if ($this->session->userdata('user_login') == FALSE)
38
-            redirect(base_url() . '/astpp/login');
39
-    }
37
+		if ($this->session->userdata('user_login') == FALSE)
38
+			redirect(base_url() . '/astpp/login');
39
+	}
40 40
 
41
-    function termination_rates_list() {
42
-        $data['username'] = $this->session->userdata('user_name');
43
-        $data['page_title'] = 'Termination Rates';
41
+	function termination_rates_list() {
42
+		$data['username'] = $this->session->userdata('user_name');
43
+		$data['page_title'] = 'Termination Rates';
44 44
 		$data['search_flag'] = true;
45 45
 		$data['batch_update_flag'] = true;
46 46
 /*********
@@ -49,58 +49,58 @@  discard block
 block discarded – undo
49 49
 *********/
50 50
 		$data['delete_batch_flag'] = true;
51 51
 /***************/
52
-        $this->session->set_userdata('advance_search', 0);
53
-        $data['grid_fields'] = $this->rates_form->build_termination_rate_for_admin();
54
-        $data["grid_buttons"] = $this->rates_form->build_grid_buttons();
55
-        $data['form_search'] = $this->form->build_serach_form($this->rates_form->get_termination_rate_search_form());
56
-        $data['form_batch_update'] = $this->form->build_batchupdate_form($this->rates_form->termination_rate_batch_update_form());
57
-        $this->load->view('view_termination_rates_list', $data);
58
-    }
59
-    /**
60
-     * -------Here we write code for controller accounts functions account_list------
61
-     * Listing of Accounts table data through php function json_encode
62
-     */
63
-    function termination_rates_list_json() {
64
-        $json_data = array();
65
-        $count_all = $this->rates_model->get_termination_rates_list(false);
66
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
67
-        $json_data = $paging_data["json_paging"];
52
+		$this->session->set_userdata('advance_search', 0);
53
+		$data['grid_fields'] = $this->rates_form->build_termination_rate_for_admin();
54
+		$data["grid_buttons"] = $this->rates_form->build_grid_buttons();
55
+		$data['form_search'] = $this->form->build_serach_form($this->rates_form->get_termination_rate_search_form());
56
+		$data['form_batch_update'] = $this->form->build_batchupdate_form($this->rates_form->termination_rate_batch_update_form());
57
+		$this->load->view('view_termination_rates_list', $data);
58
+	}
59
+	/**
60
+	 * -------Here we write code for controller accounts functions account_list------
61
+	 * Listing of Accounts table data through php function json_encode
62
+	 */
63
+	function termination_rates_list_json() {
64
+		$json_data = array();
65
+		$count_all = $this->rates_model->get_termination_rates_list(false);
66
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
67
+		$json_data = $paging_data["json_paging"];
68 68
 
69
-        $query = $this->rates_model->get_termination_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
70
-        $grid_fields = json_decode($this->rates_form->build_termination_rate_for_admin());
71
-        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
69
+		$query = $this->rates_model->get_termination_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
70
+		$grid_fields = json_decode($this->rates_form->build_termination_rate_for_admin());
71
+		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
72 72
 
73
-        echo json_encode($json_data);
74
-    }
75
-      function termination_rates_list_delete($flag='') {
76
-        $json_data = array();
77
-        $this->session->set_userdata('advance_batch_data_delete',1);
78
-        $count_all = $this->rates_model->get_termination_rates_list(false);
73
+		echo json_encode($json_data);
74
+	}
75
+	  function termination_rates_list_delete($flag='') {
76
+		$json_data = array();
77
+		$this->session->set_userdata('advance_batch_data_delete',1);
78
+		$count_all = $this->rates_model->get_termination_rates_list(false);
79 79
 	echo $count_all; 
80
-    } 
80
+	} 
81 81
 /****************/
82
-     function termination_rate_import() {
83
-        $data['page_title'] = 'Import Termination Rates';
84
-        $this->session->set_userdata('import_termination_rate_csv',"");
85
-        $this->session->set_userdata('import_termination_rate_csv_error',"");
86
-        $this->load->view('view_import_termination_rate', $data);
87
-    }
88
-    function termination_rate_preview_file(){
89
-    	$invalid_flag= false;
82
+	 function termination_rate_import() {
83
+		$data['page_title'] = 'Import Termination Rates';
84
+		$this->session->set_userdata('import_termination_rate_csv',"");
85
+		$this->session->set_userdata('import_termination_rate_csv_error',"");
86
+		$this->load->view('view_import_termination_rate', $data);
87
+	}
88
+	function termination_rate_preview_file(){
89
+		$invalid_flag= false;
90 90
 	$check_header=$this->input->post('check_header',true);
91 91
 	$data['page_title'] = 'Import Termination Rates';
92
-        $new_final_arr_key = $this->config->item('Termination-rates-field');
93
-        if(empty($_FILES) || !isset($_FILES)){
92
+		$new_final_arr_key = $this->config->item('Termination-rates-field');
93
+		if(empty($_FILES) || !isset($_FILES)){
94 94
 	  redirect(base_url()."rates/termination_rates_list/");
95 95
 	}
96
-        if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" &&  isset($_POST['trunk_id']) && $_POST['trunk_id'] != '') {
97
-            list($txt, $ext) = explode(".", $_FILES['termination_rate_import']['name']);
98
-            if($ext == "csv" && $_FILES['termination_rate_import']['size'] > 0){ 
99
-                $error = $_FILES['termination_rate_import']['error'];
100
-                if ($error == 0 ) {
101
-                    $uploadedFile = $_FILES["termination_rate_import"]["tmp_name"];
102
-                    $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header);
103
-		    if(!empty($csv_data)){
96
+		if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" &&  isset($_POST['trunk_id']) && $_POST['trunk_id'] != '') {
97
+			list($txt, $ext) = explode(".", $_FILES['termination_rate_import']['name']);
98
+			if($ext == "csv" && $_FILES['termination_rate_import']['size'] > 0){ 
99
+				$error = $_FILES['termination_rate_import']['error'];
100
+				if ($error == 0 ) {
101
+					$uploadedFile = $_FILES["termination_rate_import"]["tmp_name"];
102
+					$csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header);
103
+			if(!empty($csv_data)){
104 104
 			$full_path = $this->config->item('rates-file-path');
105 105
 			$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s"). "." . $ext;
106 106
 			if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) {
@@ -112,115 +112,115 @@  discard block
 block discarded – undo
112 112
 			}else{
113 113
 			  $data['error'] = "File Uploading Fail Please Try Again";
114 114
 			}
115
-                    }
116
-                }
117
-                else{
118
-                    $data['error']=="File Uploading Fail Please Try Again";
119
-                }
120
-            }else {
121
-                $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
122
-            }
123
-        }else{
115
+					}
116
+				}
117
+				else{
118
+					$data['error']=="File Uploading Fail Please Try Again";
119
+				}
120
+			}else {
121
+				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
122
+			}
123
+		}else{
124 124
 		$invalid_flag=true;
125
-        }
126
-        if ($invalid_flag) {
127
-            $str = '';
128
-            if (!isset($_POST['trunk_id']) || empty($_POST['trunk_id'])) {
129
-                $str.= '<br/>Please Create Trunk.';
130
-            }
131
-            if (empty($_FILES['termination_rate_import']['name'])) {
132
-                $str.= '<br/>Please Select  File.';
133
-            }
134
-            $data['error']=$str;
135
-        }
136
-        $this->load->view('view_import_termination_rate', $data);
137
-    }
138
-    function termination_rate_rates_import($trunkID,$check_header=false) {
139
-        $new_final_arr = array();
140
-        $invalid_array = array();
141
-        $new_final_arr_key = $this->config->item('Termination-rates-field');
125
+		}
126
+		if ($invalid_flag) {
127
+			$str = '';
128
+			if (!isset($_POST['trunk_id']) || empty($_POST['trunk_id'])) {
129
+				$str.= '<br/>Please Create Trunk.';
130
+			}
131
+			if (empty($_FILES['termination_rate_import']['name'])) {
132
+				$str.= '<br/>Please Select  File.';
133
+			}
134
+			$data['error']=$str;
135
+		}
136
+		$this->load->view('view_import_termination_rate', $data);
137
+	}
138
+	function termination_rate_rates_import($trunkID,$check_header=false) {
139
+		$new_final_arr = array();
140
+		$invalid_array = array();
141
+		$new_final_arr_key = $this->config->item('Termination-rates-field');
142 142
 	$screen_path = $this->config->item('screen_path');
143
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
144
-            $account_data = $this->session->userdata("accountinfo");
145
-        }
143
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
144
+			$account_data = $this->session->userdata("accountinfo");
145
+		}
146 146
 	$full_path = $this->config->item('rates-file-path');
147
-        $terminationrate_file_name = $this->session->userdata('import_termination_rate_csv');	
148
-        $csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name,$new_final_arr_key,$check_header); 
147
+		$terminationrate_file_name = $this->session->userdata('import_termination_rate_csv');	
148
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name,$new_final_arr_key,$check_header); 
149 149
 	$i=0;
150
-        foreach ($csv_tmp_data as $key => $csv_data) {
150
+		foreach ($csv_tmp_data as $key => $csv_data) {
151 151
 	 if(isset($csv_data['pattern']) && $csv_data['pattern']!= '' && $i != 0){
152
-	    $str=null;
153
-	    $csv_data['prepend']= isset($csv_data['prepend'])? $csv_data['prepend'] :'';
154
-	    $csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :'';
155
-	    $csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0;
156
-	    $csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0;
157
-	    $csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0;
158
-	    $csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0;
159
-	    $csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :'';
160
-	    $csv_data['strip']= isset($csv_data['strip']) ? $csv_data['strip'] :'';
161
-	    $csv_data['last_modified_date'] = date("Y-m-d H:i:s");
162
-	    $str=$this->data_validate($csv_data);
163
-	    if($str != ""){
164
-	      $invalid_array[$i]=$csv_data;
165
-	      $invalid_array[$i]['error'] = $str;
166
-	    }
167
-	    else{
168
-	      $csv_data['trunk_id']=$trunkID;
169
-	      $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
170
-	      $new_final_arr[$i]=$csv_data;
171
-	    }
152
+		$str=null;
153
+		$csv_data['prepend']= isset($csv_data['prepend'])? $csv_data['prepend'] :'';
154
+		$csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :'';
155
+		$csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0;
156
+		$csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0;
157
+		$csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0;
158
+		$csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0;
159
+		$csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :'';
160
+		$csv_data['strip']= isset($csv_data['strip']) ? $csv_data['strip'] :'';
161
+		$csv_data['last_modified_date'] = date("Y-m-d H:i:s");
162
+		$str=$this->data_validate($csv_data);
163
+		if($str != ""){
164
+		  $invalid_array[$i]=$csv_data;
165
+		  $invalid_array[$i]['error'] = $str;
166
+		}
167
+		else{
168
+		  $csv_data['trunk_id']=$trunkID;
169
+		  $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
170
+		  $new_final_arr[$i]=$csv_data;
171
+		}
172 172
 	  }
173
-          $i++;
174
-        }
175
-         if(!empty($new_final_arr)){
176
- 	    $result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
177
-         }
178
-          unlink($full_path.$terminationrate_file_name);
173
+		  $i++;
174
+		}
175
+		 if(!empty($new_final_arr)){
176
+ 		$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
177
+		 }
178
+		  unlink($full_path.$terminationrate_file_name);
179 179
 	  $count=count($invalid_array);
180
-        if($count >0){
181
-            $session_id = "-1";
182
-            $fp = fopen($full_path.$session_id.'.csv', 'w');
183
-            foreach($new_final_arr_key as $key=>$value){
184
-	      $custom_array[0][$key]=ucfirst($key);
185
-            }
186
-            $custom_array[0]['error']= "Error";
187
-            $invalid_array =array_merge($custom_array,$invalid_array);
188
-            foreach($invalid_array as $err_data){
189
-                    fputcsv($fp,$err_data);
190
-            }
191
-           fclose($fp);
192
-           $this->session->set_userdata('import_termination_rate_csv_error', $session_id.".csv");
193
-           $data["error"] = $invalid_array;
194
-           $data['trunkid'] = $trunkID;
195
-           $data['impoted_count'] = count($new_final_arr);
196
-           $data['failure_count'] = count($invalid_array)-1;
197
-           $data['page_title'] = 'Termination Rates Import Error';	
198
-           $this->load->view('view_import_error',$data);
199
-         } else{
180
+		if($count >0){
181
+			$session_id = "-1";
182
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
183
+			foreach($new_final_arr_key as $key=>$value){
184
+		  $custom_array[0][$key]=ucfirst($key);
185
+			}
186
+			$custom_array[0]['error']= "Error";
187
+			$invalid_array =array_merge($custom_array,$invalid_array);
188
+			foreach($invalid_array as $err_data){
189
+					fputcsv($fp,$err_data);
190
+			}
191
+		   fclose($fp);
192
+		   $this->session->set_userdata('import_termination_rate_csv_error', $session_id.".csv");
193
+		   $data["error"] = $invalid_array;
194
+		   $data['trunkid'] = $trunkID;
195
+		   $data['impoted_count'] = count($new_final_arr);
196
+		   $data['failure_count'] = count($invalid_array)-1;
197
+		   $data['page_title'] = 'Termination Rates Import Error';	
198
+		   $this->load->view('view_import_error',$data);
199
+		 } else{
200 200
 	  $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Termination rates imported successfully!');
201
-           redirect(base_url()."rates/termination_rates_list/");
202
-         }        
203
-    }
204
-    function termination_rate_error_download(){
205
-        $this->load->helper('download');
206
-        $error_data =  $this->session->userdata('import_termination_rate_csv_error');
207
-        $full_path = $this->config->item('rates-file-path');
208
-        $data = file_get_contents($full_path.$error_data);
209
-        force_download("Termination_rate_error.csv", $data); 
201
+		   redirect(base_url()."rates/termination_rates_list/");
202
+		 }        
203
+	}
204
+	function termination_rate_error_download(){
205
+		$this->load->helper('download');
206
+		$error_data =  $this->session->userdata('import_termination_rate_csv_error');
207
+		$full_path = $this->config->item('rates-file-path');
208
+		$data = file_get_contents($full_path.$error_data);
209
+		force_download("Termination_rate_error.csv", $data); 
210 210
 
211
-    }  
212
-    function origination_rate_import() {
213
-        $data['page_title'] = 'Import Origination Rates';
214
-        $this->session->set_userdata('import_origination_rate_csv',"");
215
-        $error_data =  $this->session->userdata('import_origination_rate_csv_error');
216
-        $full_path = $this->config->item('rates-file-path');
217
-        if(file_exists($full_path.$error_data) && $error_data != ""){
218
-            unlink($full_path.$error_data);
219
-            $this->session->set_userdata('import_origination_rate_csv_error',"");
220
-        }
221
-        $this->load->view('view_import_origination_rate', $data);
222
-    }
223
-    function origination_rate_preview_file(){
211
+	}  
212
+	function origination_rate_import() {
213
+		$data['page_title'] = 'Import Origination Rates';
214
+		$this->session->set_userdata('import_origination_rate_csv',"");
215
+		$error_data =  $this->session->userdata('import_origination_rate_csv_error');
216
+		$full_path = $this->config->item('rates-file-path');
217
+		if(file_exists($full_path.$error_data) && $error_data != ""){
218
+			unlink($full_path.$error_data);
219
+			$this->session->set_userdata('import_origination_rate_csv_error',"");
220
+		}
221
+		$this->load->view('view_import_origination_rate', $data);
222
+	}
223
+	function origination_rate_preview_file(){
224 224
 	$invalid_flag= false;
225 225
 	$data=array();
226 226
 	$data['page_title'] = 'Import Origination Rates';
@@ -232,268 +232,268 @@  discard block
 block discarded – undo
232 232
 	$new_final_arr_key = $this->config->item('Origination-rates-field');
233 233
 	if(!$get_extension){
234 234
 		$data['error']= "Please Upload File Atleast";
235
-        }
236
-        if (isset($_FILES['origination_rate_import']['name']) && $_FILES['origination_rate_import']['name'] != "" && isset($_POST['pricelist_id']) && $_POST['pricelist_id'] != '') {
237
-            list($txt,$ext) = explode(".", $_FILES['origination_rate_import']['name']);
235
+		}
236
+		if (isset($_FILES['origination_rate_import']['name']) && $_FILES['origination_rate_import']['name'] != "" && isset($_POST['pricelist_id']) && $_POST['pricelist_id'] != '') {
237
+			list($txt,$ext) = explode(".", $_FILES['origination_rate_import']['name']);
238 238
             
239
-            if($ext == "csv" && $_FILES['origination_rate_import']['size'] > 0){ 
240
-                $error = $_FILES['origination_rate_import']['error'];
241
-                if ($error == 0) {
242
-                    $uploadedFile = $_FILES["origination_rate_import"]["tmp_name"];
243
-                    $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header);
244
-                    if(!empty($csv_data)){
245
-		    $full_path = $this->config->item('rates-file-path');
246
-                    $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s"). "." . $ext;
247
-                    if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) {
239
+			if($ext == "csv" && $_FILES['origination_rate_import']['size'] > 0){ 
240
+				$error = $_FILES['origination_rate_import']['error'];
241
+				if ($error == 0) {
242
+					$uploadedFile = $_FILES["origination_rate_import"]["tmp_name"];
243
+					$csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header);
244
+					if(!empty($csv_data)){
245
+			$full_path = $this->config->item('rates-file-path');
246
+					$actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s"). "." . $ext;
247
+					if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) {
248 248
 			$flag=false;
249 249
 			$data['trunkid']=isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0;
250
-                        $data['csv_tmp_data'] = $csv_data;
251
-                        $data['pricelistid'] = $_POST['pricelist_id'];
252
-                        $data['page_title'] = "Origination Rates Preview";
253
-                        $data['check_header']=$check_header;
254
-                        $this->session->set_userdata('import_origination_rate_csv',$actual_file_name);
255
-                    }else{
256
-                        $data['error'] = "File Uploading Fail Please Try Again";
257
-                    }
258
-                }
259
-             }   
260
-            else{
261
-                    $data['error']=="File Uploading Fail Please Try Again";
262
-                }
263
-           }
264
-           else {
265
-                $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
266
-            }
267
-            }else{
250
+						$data['csv_tmp_data'] = $csv_data;
251
+						$data['pricelistid'] = $_POST['pricelist_id'];
252
+						$data['page_title'] = "Origination Rates Preview";
253
+						$data['check_header']=$check_header;
254
+						$this->session->set_userdata('import_origination_rate_csv',$actual_file_name);
255
+					}else{
256
+						$data['error'] = "File Uploading Fail Please Try Again";
257
+					}
258
+				}
259
+			 }   
260
+			else{
261
+					$data['error']=="File Uploading Fail Please Try Again";
262
+				}
263
+		   }
264
+		   else {
265
+				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
266
+			}
267
+			}else{
268 268
 		$invalid_flag=true;
269
-            }
270
-        if ($invalid_flag) {
271
-            $str = '';
272
-            if (!isset($_POST['pricelist_id']) || empty($_POST['pricelist_id'])) {
273
-                $str.= '<br/>Please Create Rate Group.';
274
-            }
275
-            if (empty($_FILES['origination_rate_import']['name'])) {
276
-                $str.= '<br/>Please Select File.';
277
-            }
278
-            $data['error']=$str;
279
-        }
280
-        $this->load->view('view_import_origination_rate', $data);
281
-    }
282
-    function origination_rate_import_file($pricelistID,$trunkid,$check_header=false) {
283
-       $new_final_arr = array();
284
-        $invalid_array = array();
285
-        $new_final_arr_key = $this->config->item('Origination-rates-field');
269
+			}
270
+		if ($invalid_flag) {
271
+			$str = '';
272
+			if (!isset($_POST['pricelist_id']) || empty($_POST['pricelist_id'])) {
273
+				$str.= '<br/>Please Create Rate Group.';
274
+			}
275
+			if (empty($_FILES['origination_rate_import']['name'])) {
276
+				$str.= '<br/>Please Select File.';
277
+			}
278
+			$data['error']=$str;
279
+		}
280
+		$this->load->view('view_import_origination_rate', $data);
281
+	}
282
+	function origination_rate_import_file($pricelistID,$trunkid,$check_header=false) {
283
+	   $new_final_arr = array();
284
+		$invalid_array = array();
285
+		$new_final_arr_key = $this->config->item('Origination-rates-field');
286 286
 	$screen_path = $this->config->item('screen_path');
287 287
 	$reseller_id=0;
288
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
289
-            $reseller_id = $this->session->userdata["accountinfo"]['id'];
290
-        }
288
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
289
+			$reseller_id = $this->session->userdata["accountinfo"]['id'];
290
+		}
291 291
         
292 292
 		$full_path = $this->config->item('rates-file-path');
293
-        $originationrate_file_name = $this->session->userdata('import_origination_rate_csv');	
294
-        $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name,$new_final_arr_key,$check_header); 
295
-        //echo "<pre>";print_r($csv_tmp_data);exit;
293
+		$originationrate_file_name = $this->session->userdata('import_origination_rate_csv');	
294
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name,$new_final_arr_key,$check_header); 
295
+		//echo "<pre>";print_r($csv_tmp_data);exit;
296 296
 	$i=0;
297
-        foreach ($csv_tmp_data as $key => $csv_data) {	
297
+		foreach ($csv_tmp_data as $key => $csv_data) {	
298 298
 	  if(isset($csv_data['pattern']) && $csv_data['pattern']!= '' && $i != 0){
299
-	    $str=null;
300
-	    $csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :'';
301
-	    $csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0;
302
-	    $csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0;
303
-	    $csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0;
304
-	    $csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0;
305
-	    $csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :'';
306
-	    $csv_data['last_modified_date'] = date("Y-m-d H:i:s");
307
-	    $str=$this->data_validate($csv_data);
308
-	    if($str != ""){
309
-	      $invalid_array[$i]=$csv_data;
310
-	      $invalid_array[$i]['error'] = $str;
311
-	    }
312
-	    else{
313
-	      $csv_data['pricelist_id']=$pricelistID;
314
-	      $csv_data['trunk_id']=$trunkid;
315
-	      $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
316
-	      $csv_data['reseller_id']= $reseller_id;
317
-	      $csv_data['creation_date'] = gmdate('Y-m-d H:i:s');
318
-	      $new_final_arr[$i]=$csv_data;
319
-	    }
299
+		$str=null;
300
+		$csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :'';
301
+		$csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0;
302
+		$csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0;
303
+		$csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0;
304
+		$csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0;
305
+		$csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :'';
306
+		$csv_data['last_modified_date'] = date("Y-m-d H:i:s");
307
+		$str=$this->data_validate($csv_data);
308
+		if($str != ""){
309
+		  $invalid_array[$i]=$csv_data;
310
+		  $invalid_array[$i]['error'] = $str;
311
+		}
312
+		else{
313
+		  $csv_data['pricelist_id']=$pricelistID;
314
+		  $csv_data['trunk_id']=$trunkid;
315
+		  $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
316
+		  $csv_data['reseller_id']= $reseller_id;
317
+		  $csv_data['creation_date'] = gmdate('Y-m-d H:i:s');
318
+		  $new_final_arr[$i]=$csv_data;
319
+		}
320 320
 	  }
321
-          $i++;
322
-        }
323
-          if(!empty($new_final_arr)){
324
-  	    $result = $this->rates_model->bulk_insert_origination_rate($new_final_arr);
325
-          }
326
-          unlink($full_path.$originationrate_file_name);
321
+		  $i++;
322
+		}
323
+		  if(!empty($new_final_arr)){
324
+  		$result = $this->rates_model->bulk_insert_origination_rate($new_final_arr);
325
+		  }
326
+		  unlink($full_path.$originationrate_file_name);
327 327
 	 $count=count($invalid_array);
328
-        if($count >0){
329
-            $session_id = "-1";
330
-            $fp = fopen($full_path.$session_id.'.csv', 'w');
331
-            foreach($new_final_arr_key as $key=>$value){
332
-	      $custom_array[0][$key]=ucfirst($key);
333
-            }
334
-            $custom_array[0]['error']= "Error";
335
-            $invalid_array =array_merge($custom_array,$invalid_array);
336
-            foreach($invalid_array as $err_data){
337
-                    fputcsv($fp,$err_data);
338
-            }
339
-            fclose($fp);
340
-           $this->session->set_userdata('import_origination_rate_csv_error', $session_id.".csv");
341
-           $data["error"] = $invalid_array;
342
-           $data['pricelistid'] = $pricelistID;
343
-           $data['impoted_count'] = count($new_final_arr);
344
-           $data['failure_count'] = count($invalid_array)-1;
345
-           $data['page_title'] = 'Origination Rates Import Error';	
346
-           $this->load->view('view_import_error',$data);
347
-         } else{
328
+		if($count >0){
329
+			$session_id = "-1";
330
+			$fp = fopen($full_path.$session_id.'.csv', 'w');
331
+			foreach($new_final_arr_key as $key=>$value){
332
+		  $custom_array[0][$key]=ucfirst($key);
333
+			}
334
+			$custom_array[0]['error']= "Error";
335
+			$invalid_array =array_merge($custom_array,$invalid_array);
336
+			foreach($invalid_array as $err_data){
337
+					fputcsv($fp,$err_data);
338
+			}
339
+			fclose($fp);
340
+		   $this->session->set_userdata('import_origination_rate_csv_error', $session_id.".csv");
341
+		   $data["error"] = $invalid_array;
342
+		   $data['pricelistid'] = $pricelistID;
343
+		   $data['impoted_count'] = count($new_final_arr);
344
+		   $data['failure_count'] = count($invalid_array)-1;
345
+		   $data['page_title'] = 'Origination Rates Import Error';	
346
+		   $this->load->view('view_import_error',$data);
347
+		 } else{
348 348
 	   $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Origination rates imported successfully!');
349
-           redirect(base_url()."rates/origination_rates_list/");
350
-           }
351
-    }
352
-     function data_validate($csvdata){
353
-          $str=null;
349
+		   redirect(base_url()."rates/origination_rates_list/");
350
+		   }
351
+	}
352
+	 function data_validate($csvdata){
353
+		  $str=null;
354 354
 	  $alpha_regex = "/^[a-z ,.'-]+$/i";
355 355
 	  $alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i";
356 356
 	  $email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/"; 
357 357
 	  $str.= $csvdata['pattern']!= '' ? null : 'Code,';
358 358
 	  $str=rtrim($str,',');
359 359
 	  if(!$str){
360
-	      $str.= is_numeric($csvdata['pattern']) ? null : 'Code,';
360
+		  $str.= is_numeric($csvdata['pattern']) ? null : 'Code,';
361 361
 
362
-	      $str.= !empty($csvdata['connectcost']) && is_numeric( $csvdata['connectcost']) ? null :( empty($csvdata['connectcost']) ? null : 'Connect Cost,');
363
-	      $str.= !empty($csvdata['includedseconds']) && is_numeric( $csvdata['includedseconds']) ? null :( empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
362
+		  $str.= !empty($csvdata['connectcost']) && is_numeric( $csvdata['connectcost']) ? null :( empty($csvdata['connectcost']) ? null : 'Connect Cost,');
363
+		  $str.= !empty($csvdata['includedseconds']) && is_numeric( $csvdata['includedseconds']) ? null :( empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
364 364
 
365
-	      $str.= !empty($csvdata['inc']) && is_numeric( $csvdata['inc']) ? null :( empty($csvdata['inc']) ? null : 'Increment,');
366
-	      $str.= !empty($csvdata['precedence']) && is_numeric( $csvdata['precedence']) ? null :( empty($csvdata['precedence']) ? null : 'Precedence,');
367
-	      $str.= (isset($csvdata['strip']) && !empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null :'Strip,') : null;
368
-	      if($str){
365
+		  $str.= !empty($csvdata['inc']) && is_numeric( $csvdata['inc']) ? null :( empty($csvdata['inc']) ? null : 'Increment,');
366
+		  $str.= !empty($csvdata['precedence']) && is_numeric( $csvdata['precedence']) ? null :( empty($csvdata['precedence']) ? null : 'Precedence,');
367
+		  $str.= (isset($csvdata['strip']) && !empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null :'Strip,') : null;
368
+		  if($str){
369 369
 		$str=rtrim($str,',');
370 370
 		$error_field=explode(',',$str);
371 371
 		$count = count($error_field);
372 372
 		$str.= $count > 1 ? ' are not valid' : ' is not Valid';
373 373
 		return $str;
374
-	      }
375
-	      else{
376
-	      return false;
377
-	      }
374
+		  }
375
+		  else{
376
+		  return false;
377
+		  }
378 378
 	  }
379 379
 	  else{
380 380
 	  $str=rtrim($str,',');
381
-	    $error_field=explode(',',$str);
382
-	    $count = count($error_field);
383
-	    $str.= $count > 1 ? ' are required' : ' is Required';
384
-    return $str;
385
-    }
386
-    }
387
-    function origination_rate_error_download(){
388
-        $this->load->helper('download');
389
-        $error_data =  $this->session->userdata('import_origination_rate_csv_error');
390
-        $full_path = $this->config->item('rates-file-path');
391
-        $data = file_get_contents($full_path.$error_data);
392
-        force_download("Origination_rate_error.csv", $data); 
393
-    }
394
-    function origination_rate_add($type = "") {
381
+		$error_field=explode(',',$str);
382
+		$count = count($error_field);
383
+		$str.= $count > 1 ? ' are required' : ' is Required';
384
+	return $str;
385
+	}
386
+	}
387
+	function origination_rate_error_download(){
388
+		$this->load->helper('download');
389
+		$error_data =  $this->session->userdata('import_origination_rate_csv_error');
390
+		$full_path = $this->config->item('rates-file-path');
391
+		$data = file_get_contents($full_path.$error_data);
392
+		force_download("Origination_rate_error.csv", $data); 
393
+	}
394
+	function origination_rate_add($type = "") {
395 395
 	
396
-        $data['username'] = $this->session->userdata('user_name');
397
-        $data['flag'] = 'create';
398
-        $data['page_title'] = 'Create Origination Rate';
399
-        $data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), '');
396
+		$data['username'] = $this->session->userdata('user_name');
397
+		$data['flag'] = 'create';
398
+		$data['page_title'] = 'Create Origination Rate';
399
+		$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), '');
400 400
 
401
-        $this->load->view('view_origination_rate_add_edit', $data);
402
-    }
401
+		$this->load->view('view_origination_rate_add_edit', $data);
402
+	}
403 403
 
404
-    function origination_rate_edit($edit_id = '') {
405
-        $data['page_title'] = 'Edit Origination Rate';
406
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
407
-            $account_data = $this->session->userdata("accountinfo");
408
-            $reseller = $account_data['id'];
409
-            $where = array('id' => $edit_id, "reseller_id" => $reseller);
410
-        } else {
411
-            $where = array('id' => $edit_id);
412
-        }
413
-        $account = $this->db_model->getSelect("*", "routes", $where);
414
-        if ($account->num_rows > 0) {
415
-            foreach ($account->result_array() as $key => $value) {
416
-                $edit_data = $value;
417
-            }
418
-            $edit_data['connectcost'] = $this->common_model->to_calculate_currency($edit_data['connectcost'], '', '', true, false);
419
-            $edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '',true, false);
420
-            $edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
404
+	function origination_rate_edit($edit_id = '') {
405
+		$data['page_title'] = 'Edit Origination Rate';
406
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
407
+			$account_data = $this->session->userdata("accountinfo");
408
+			$reseller = $account_data['id'];
409
+			$where = array('id' => $edit_id, "reseller_id" => $reseller);
410
+		} else {
411
+			$where = array('id' => $edit_id);
412
+		}
413
+		$account = $this->db_model->getSelect("*", "routes", $where);
414
+		if ($account->num_rows > 0) {
415
+			foreach ($account->result_array() as $key => $value) {
416
+				$edit_data = $value;
417
+			}
418
+			$edit_data['connectcost'] = $this->common_model->to_calculate_currency($edit_data['connectcost'], '', '', true, false);
419
+			$edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '',true, false);
420
+			$edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
421 421
 
422
-            $data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $edit_data);
423
-            $this->load->view('view_origination_rate_add_edit', $data);
424
-        } else {
425
-            redirect(base_url() . 'rates/origination_rate_list/');
426
-        }
427
-    }
422
+			$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $edit_data);
423
+			$this->load->view('view_origination_rate_add_edit', $data);
424
+		} else {
425
+			redirect(base_url() . 'rates/origination_rate_list/');
426
+		}
427
+	}
428 428
 
429
-    function origination_rate_save() {
430
-        $add_array = $this->input->post();
431
-        $data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $add_array);
432
-        if ($add_array['id'] != '') {
433
-            $data['page_title'] = 'Edit Origination Rate';
434
-            if ($this->form_validation->run() == FALSE) {
435
-                $data['validation_errors'] = validation_errors();
436
-                echo $data['validation_errors'];
437
-                exit;
438
-            } else {
439
-                $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
440
-                $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
441
-                $this->rates_model->edit_origination_rate($add_array, $add_array['id']);
442
-                echo json_encode(array("SUCCESS"=> "Origination rate updated successfully!"));
443
-                exit;
444
-            }
445
-        } else {
446
-            $data['page_title'] = 'Add Origination Rate';
447
-            if ($this->form_validation->run() == FALSE) {
448
-                $data['validation_errors'] = validation_errors();
449
-                echo $data['validation_errors'];
450
-                exit;
451
-            } else {
429
+	function origination_rate_save() {
430
+		$add_array = $this->input->post();
431
+		$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $add_array);
432
+		if ($add_array['id'] != '') {
433
+			$data['page_title'] = 'Edit Origination Rate';
434
+			if ($this->form_validation->run() == FALSE) {
435
+				$data['validation_errors'] = validation_errors();
436
+				echo $data['validation_errors'];
437
+				exit;
438
+			} else {
439
+				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
440
+				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
441
+				$this->rates_model->edit_origination_rate($add_array, $add_array['id']);
442
+				echo json_encode(array("SUCCESS"=> "Origination rate updated successfully!"));
443
+				exit;
444
+			}
445
+		} else {
446
+			$data['page_title'] = 'Add Origination Rate';
447
+			if ($this->form_validation->run() == FALSE) {
448
+				$data['validation_errors'] = validation_errors();
449
+				echo $data['validation_errors'];
450
+				exit;
451
+			} else {
452 452
 
453
-                $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
454
-                $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
455
-                $this->rates_model->add_origination_rate($add_array);
456
-                echo json_encode(array("SUCCESS"=> "Origination rate added successfully!"));
457
-                exit;
458
-            }
459
-        }
460
-    }
453
+				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
454
+				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
455
+				$this->rates_model->add_origination_rate($add_array);
456
+				echo json_encode(array("SUCCESS"=> "Origination rate added successfully!"));
457
+				exit;
458
+			}
459
+		}
460
+	}
461 461
 
462
-    function origination_rates_list_search() {
463
-        $ajax_search = $this->input->post('ajax_search', 0);
462
+	function origination_rates_list_search() {
463
+		$ajax_search = $this->input->post('ajax_search', 0);
464 464
 
465
-        if ($this->input->post('advance_search', TRUE) == 1) {
466
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
467
-            $action = $this->input->post();
468
-            unset($action['action']);
469
-            unset($action['advance_search']);
470
-            $this->session->set_userdata('origination_rate_list_search', $action);
471
-        }
472
-        if (@$ajax_search != 1) {
473
-            redirect(base_url() . 'rates/origination_rates_list/');
474
-        }
475
-    }
465
+		if ($this->input->post('advance_search', TRUE) == 1) {
466
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
467
+			$action = $this->input->post();
468
+			unset($action['action']);
469
+			unset($action['advance_search']);
470
+			$this->session->set_userdata('origination_rate_list_search', $action);
471
+		}
472
+		if (@$ajax_search != 1) {
473
+			redirect(base_url() . 'rates/origination_rates_list/');
474
+		}
475
+	}
476 476
 
477
-    function origination_rates_list_clearsearchfilter() {
478
-        $this->session->set_userdata('advance_search', 0);
479
-        $this->session->set_userdata('account_search', "");
480
-    }
477
+	function origination_rates_list_clearsearchfilter() {
478
+		$this->session->set_userdata('advance_search', 0);
479
+		$this->session->set_userdata('account_search', "");
480
+	}
481 481
 
482
-    function termination_rate_delete($id) {
483
-        $this->rates_model->remove_termination_rate($id);
484
-        $this->session->set_flashdata('astpp_notification', 'Termination removed successfully!');
485
-        redirect(base_url() . '/rates/termination_rates_list/');
486
-    }
482
+	function termination_rate_delete($id) {
483
+		$this->rates_model->remove_termination_rate($id);
484
+		$this->session->set_flashdata('astpp_notification', 'Termination removed successfully!');
485
+		redirect(base_url() . '/rates/termination_rates_list/');
486
+	}
487 487
 
488
-    function origination_rate_delete($id) {
489
-        $this->rates_model->remove_origination_rate($id);
490
-        $this->session->set_flashdata('astpp_notification', 'Origination rate removed successfully!');
491
-        redirect(base_url() . 'rates/origination_rates_list/');
492
-    }
488
+	function origination_rate_delete($id) {
489
+		$this->rates_model->remove_origination_rate($id);
490
+		$this->session->set_flashdata('astpp_notification', 'Origination rate removed successfully!');
491
+		redirect(base_url() . 'rates/origination_rates_list/');
492
+	}
493 493
 
494
-    function origination_rates_list() {
495
-        $data['username'] = $this->session->userdata('user_name');
496
-        $data['page_title'] = 'Origination Rates';
494
+	function origination_rates_list() {
495
+		$data['username'] = $this->session->userdata('user_name');
496
+		$data['page_title'] = 'Origination Rates';
497 497
 	$data['search_flag'] = true;
498 498
 	$data['batch_update_flag'] = true;
499 499
 /*********
@@ -502,195 +502,195 @@  discard block
 block discarded – undo
502 502
 *********/
503 503
 	$data['delete_batch_flag'] = true;
504 504
 /***************/
505
-        $this->session->set_userdata('advance_search', 0);
506
-        $data['grid_fields'] = $this->rates_form->build_origination_rate_list_for_admin();
507
-        $data["grid_buttons"] = $this->rates_form->build_grid_buttons_origination_rate();
508
-        $data['form_search'] = $this->form->build_serach_form($this->rates_form->get_origination_rate_search_form());
509
-        $data['form_batch_update'] = $this->form->build_batchupdate_form($this->rates_form->origination_rate_batch_update_form());
510
-        $this->load->view('view_origination_rate_list', $data);
511
-    }
505
+		$this->session->set_userdata('advance_search', 0);
506
+		$data['grid_fields'] = $this->rates_form->build_origination_rate_list_for_admin();
507
+		$data["grid_buttons"] = $this->rates_form->build_grid_buttons_origination_rate();
508
+		$data['form_search'] = $this->form->build_serach_form($this->rates_form->get_origination_rate_search_form());
509
+		$data['form_batch_update'] = $this->form->build_batchupdate_form($this->rates_form->origination_rate_batch_update_form());
510
+		$this->load->view('view_origination_rate_list', $data);
511
+	}
512 512
 
513 513
 /*********
514 514
 ASTPP  3.0 
515 515
 Batch Delete
516 516
 *********/
517
-    function origination_rates_list_json() {
518
-        $json_data = array();
519
-        $count_all = $this->rates_model->get_origination_rate_list(false);
520
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
521
-        $json_data = $paging_data["json_paging"];
517
+	function origination_rates_list_json() {
518
+		$json_data = array();
519
+		$count_all = $this->rates_model->get_origination_rate_list(false);
520
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
521
+		$json_data = $paging_data["json_paging"];
522 522
 //echo "<pre>"; print_r($json_data); 
523
-        $query = $this->rates_model->get_origination_rate_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
524
-        $grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_admin());
525
-        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
523
+		$query = $this->rates_model->get_origination_rate_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
524
+		$grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_admin());
525
+		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
526 526
 
527
-        echo json_encode($json_data);
528
-    }
527
+		echo json_encode($json_data);
528
+	}
529 529
 
530
-      function origination_rates_list_delete($flag='') {
531
-        $json_data = array();
532
-        $this->session->set_userdata('advance_batch_data_delete',1);
533
-        $count_all = $this->rates_model->get_origination_rate_list(false);
530
+	  function origination_rates_list_delete($flag='') {
531
+		$json_data = array();
532
+		$this->session->set_userdata('advance_batch_data_delete',1);
533
+		$count_all = $this->rates_model->get_origination_rate_list(false);
534 534
 		echo $count_all; 
535
-    } 
535
+	} 
536 536
 /*******************/
537
-    function termination_rate_add($type = "") {
538
-        $data['username'] = $this->session->userdata('user_name');
539
-        $data['flag'] = 'create';
540
-        $data['page_title'] = 'Create Termination Rate';
541
-        $data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), '');
542
-        $this->load->view('view_termination_rate_add_edit', $data);
543
-    }
537
+	function termination_rate_add($type = "") {
538
+		$data['username'] = $this->session->userdata('user_name');
539
+		$data['flag'] = 'create';
540
+		$data['page_title'] = 'Create Termination Rate';
541
+		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), '');
542
+		$this->load->view('view_termination_rate_add_edit', $data);
543
+	}
544 544
 
545
-    function termination_rate_edit($edit_id = '') {
545
+	function termination_rate_edit($edit_id = '') {
546 546
     
547
-        $data['page_title'] = 'Edit Termination Rate';
548
-        $where = array('id' => $edit_id);
549
-        $account = $this->db_model->getSelect("*", "outbound_routes", $where);
550
-        foreach ($account->result_array() as $key => $value) {
551
-            $edit_data = $value;
552
-        }
547
+		$data['page_title'] = 'Edit Termination Rate';
548
+		$where = array('id' => $edit_id);
549
+		$account = $this->db_model->getSelect("*", "outbound_routes", $where);
550
+		foreach ($account->result_array() as $key => $value) {
551
+			$edit_data = $value;
552
+		}
553 553
 	$edit_data['connectcost'] = $this->common_model->to_calculate_currency($edit_data['connectcost'], '', '', false, false);
554 554
 	$edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '', false, false);
555 555
 
556
-        $edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
557
-        $data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), $edit_data);
558
-        $this->load->view('view_termination_rate_add_edit', $data);
559
-    }
556
+		$edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
557
+		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), $edit_data);
558
+		$this->load->view('view_termination_rate_add_edit', $data);
559
+	}
560 560
 
561
-    function termination_rate_save() {
562
-        $add_array = $this->input->post();
563
-        $data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), $add_array);
564
-        if ($add_array['id'] != '') {
565
-            $data['page_title'] = 'Edit Termination Rate';
566
-            if ($this->form_validation->run() == FALSE) {
567
-                $data['validation_errors'] = validation_errors();
568
-                echo $data['validation_errors'];
569
-                exit;
570
-            } else {
571
-                $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
572
-                $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
573
-                $this->rates_model->edit_termination_rate($add_array, $add_array['id']);
574
-                echo json_encode(array("SUCCESS"=> "Termination updated successfully!"));
575
-                exit;
576
-            }
577
-        } else {
578
-            $data['page_title'] = 'Add Termination Rate';
579
-            if ($this->form_validation->run() == FALSE) {
580
-                $data['validation_errors'] = validation_errors();
581
-                echo $data['validation_errors'];
582
-                exit;
583
-            } else {
561
+	function termination_rate_save() {
562
+		$add_array = $this->input->post();
563
+		$data['form'] = $this->form->build_form($this->rates_form->get_termination_rate_form_fields(), $add_array);
564
+		if ($add_array['id'] != '') {
565
+			$data['page_title'] = 'Edit Termination Rate';
566
+			if ($this->form_validation->run() == FALSE) {
567
+				$data['validation_errors'] = validation_errors();
568
+				echo $data['validation_errors'];
569
+				exit;
570
+			} else {
571
+				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
572
+				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
573
+				$this->rates_model->edit_termination_rate($add_array, $add_array['id']);
574
+				echo json_encode(array("SUCCESS"=> "Termination updated successfully!"));
575
+				exit;
576
+			}
577
+		} else {
578
+			$data['page_title'] = 'Add Termination Rate';
579
+			if ($this->form_validation->run() == FALSE) {
580
+				$data['validation_errors'] = validation_errors();
581
+				echo $data['validation_errors'];
582
+				exit;
583
+			} else {
584 584
 
585
-                $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
586
-                $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
587
-                $this->rates_model->add_termination_rate($add_array);
588
-                echo json_encode(array("SUCCESS"=> "Termination added successfully!"));
589
-                exit;
590
-            }
591
-        }
592
-        $this->load->view('view_termination_rate_add_edit', $data);
593
-    }
585
+				$add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false);
586
+				$add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false);
587
+				$this->rates_model->add_termination_rate($add_array);
588
+				echo json_encode(array("SUCCESS"=> "Termination added successfully!"));
589
+				exit;
590
+			}
591
+		}
592
+		$this->load->view('view_termination_rate_add_edit', $data);
593
+	}
594 594
 
595
-    function termination_rates_list_search() {
596
-        $ajax_search = $this->input->post('ajax_search', 0);
595
+	function termination_rates_list_search() {
596
+		$ajax_search = $this->input->post('ajax_search', 0);
597 597
 
598
-        if ($this->input->post('advance_search', TRUE) == 1) {
599
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
600
-            $action = $this->input->post();
601
-            unset($action['action']);
602
-            unset($action['advance_search']);
603
-            $this->session->set_userdata('termination_rates_list_search', $action);
604
-        }
605
-        if (@$ajax_search != 1) {
606
-            redirect(base_url() . 'rates/termination_rates_list/');
607
-        }
608
-    }
598
+		if ($this->input->post('advance_search', TRUE) == 1) {
599
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
600
+			$action = $this->input->post();
601
+			unset($action['action']);
602
+			unset($action['advance_search']);
603
+			$this->session->set_userdata('termination_rates_list_search', $action);
604
+		}
605
+		if (@$ajax_search != 1) {
606
+			redirect(base_url() . 'rates/termination_rates_list/');
607
+		}
608
+	}
609 609
 
610
-    function termination_rates_list_clearsearchfilter() {
611
-        $this->session->set_userdata('advance_search', 0);
612
-        $this->session->set_userdata('account_search', "");
613
-    }
610
+	function termination_rates_list_clearsearchfilter() {
611
+		$this->session->set_userdata('advance_search', 0);
612
+		$this->session->set_userdata('account_search', "");
613
+	}
614 614
 
615
-    function customer_block_pattern_list($accountid,$accounttype) {
616
-        $json_data = array();
617
-        $where = array('accountid' => $accountid);
618
-        $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
619
-        $like_str=!empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" :null;
620
-        if(!empty($like_str))
621
-        $this->db->where($like_str);
622
-        $count_all = $this->db_model->countQuery("*", "block_patterns", $where);
623
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
624
-        $json_data = $paging_data["json_paging"];
625
-        if(!empty($like_str))
626
-        $this->db->where($like_str);
627
-        $pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
628
-        $grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid,$accounttype));
629
-        $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
630
-        echo json_encode($json_data);
631
-    }
615
+	function customer_block_pattern_list($accountid,$accounttype) {
616
+		$json_data = array();
617
+		$where = array('accountid' => $accountid);
618
+		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
619
+		$like_str=!empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" :null;
620
+		if(!empty($like_str))
621
+		$this->db->where($like_str);
622
+		$count_all = $this->db_model->countQuery("*", "block_patterns", $where);
623
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
624
+		$json_data = $paging_data["json_paging"];
625
+		if(!empty($like_str))
626
+		$this->db->where($like_str);
627
+		$pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
628
+		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid,$accounttype));
629
+		$json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
630
+		echo json_encode($json_data);
631
+	}
632 632
 
633
-    function termination_rate_delete_multiple() {
634
-        $ids = $this->input->post("selected_ids", true);
635
-        $where = "id IN ($ids)";
636
-        $this->db->where($where);
637
-        echo $this->db->delete("outbound_routes");
638
-    }
633
+	function termination_rate_delete_multiple() {
634
+		$ids = $this->input->post("selected_ids", true);
635
+		$where = "id IN ($ids)";
636
+		$this->db->where($where);
637
+		echo $this->db->delete("outbound_routes");
638
+	}
639 639
 
640
-    function origination_rate_delete_multiple() {
641
-        $ids = $this->input->post("selected_ids", true);
642
-        $where = "id IN ($ids)";
643
-        $this->db->where($where);
644
-        echo $this->db->delete("routes");
645
-    }
640
+	function origination_rate_delete_multiple() {
641
+		$ids = $this->input->post("selected_ids", true);
642
+		$where = "id IN ($ids)";
643
+		$this->db->where($where);
644
+		echo $this->db->delete("routes");
645
+	}
646 646
 
647
-    function user_origination_rate_list_json() {
648
-        $json_data = array();
649
-        $account_data = $this->session->userdata("accountinfo");
650
-        $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"]));
651
-        $markup = ($markup > 0)?$markup:1;
647
+	function user_origination_rate_list_json() {
648
+		$json_data = array();
649
+		$account_data = $this->session->userdata("accountinfo");
650
+		$markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"]));
651
+		$markup = ($markup > 0)?$markup:1;
652 652
 
653
-        $count_all = $this->rates_model->get_origination_rate_list_for_user(false);
654
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
655
-        $json_data = $paging_data["json_paging"];
653
+		$count_all = $this->rates_model->get_origination_rate_list_for_user(false);
654
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
655
+		$json_data = $paging_data["json_paging"];
656 656
 
657
-        $query = $this->rates_model->get_origination_rate_list_for_user(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
658
-        $grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_user());
659
-        foreach ($query->result_array() as $key => $value) {
660
-            $json_data['rows'][] = array('cell' => array(
661
-                    $this->common->get_only_numeric_val("","",$value["pattern"]),
662
-                    $value['comment'],
663
-                    $value['inc'],
664
-                    $this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','',true),
665
-                    $this->common_model->calculate_currency($value['connectcost'],'','','',true),
666
-                    $value['includedseconds']                    
667
-            ));
668
-        }
657
+		$query = $this->rates_model->get_origination_rate_list_for_user(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
658
+		$grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_user());
659
+		foreach ($query->result_array() as $key => $value) {
660
+			$json_data['rows'][] = array('cell' => array(
661
+					$this->common->get_only_numeric_val("","",$value["pattern"]),
662
+					$value['comment'],
663
+					$value['inc'],
664
+					$this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','',true),
665
+					$this->common_model->calculate_currency($value['connectcost'],'','','',true),
666
+					$value['includedseconds']                    
667
+			));
668
+		}
669 669
 //        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
670
-        echo json_encode($json_data);
671
-    }
670
+		echo json_encode($json_data);
671
+	}
672 672
 
673
-    function user_origination_rate_list_search() {
674
-        $ajax_search = $this->input->post('ajax_search', 0);
673
+	function user_origination_rate_list_search() {
674
+		$ajax_search = $this->input->post('ajax_search', 0);
675 675
 
676
-        if ($this->input->post('advance_search', TRUE) == 1) {
677
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
678
-            $action = $this->input->post();
679
-            unset($action['action']);
680
-            unset($action['advance_search']);
681
-            $this->session->set_userdata('origination_rate_list_search', $action);
682
-        }
683
-        if (@$ajax_search != 1) {
684
-            redirect(base_url() . 'user/user_rates_list/');
685
-        }
686
-    }
676
+		if ($this->input->post('advance_search', TRUE) == 1) {
677
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
678
+			$action = $this->input->post();
679
+			unset($action['action']);
680
+			unset($action['advance_search']);
681
+			$this->session->set_userdata('origination_rate_list_search', $action);
682
+		}
683
+		if (@$ajax_search != 1) {
684
+			redirect(base_url() . 'user/user_rates_list/');
685
+		}
686
+	}
687 687
 
688
-    function user_origination_rate_list_clearsearchfilter() {
689
-        $this->session->set_userdata('advance_search', 0);
690
-        $this->session->set_userdata('account_search', "");
691
-    }
692
-    function customer_rates_download_sample_file($file_name){
693
-        $this->load->helper('download');
688
+	function user_origination_rate_list_clearsearchfilter() {
689
+		$this->session->set_userdata('advance_search', 0);
690
+		$this->session->set_userdata('account_search', "");
691
+	}
692
+	function customer_rates_download_sample_file($file_name){
693
+		$this->load->helper('download');
694 694
 		$full_path = base_url()."assets/Rates_File/".$file_name.".csv";
695 695
 		$arrContextOptions=array(
696 696
 			"ssl"=>array(
@@ -698,46 +698,46 @@  discard block
 block discarded – undo
698 698
 			"verify_peer_name"=>false,
699 699
 			),
700 700
 		);  
701
-        $file = file_get_contents($full_path, false, stream_context_create($arrContextOptions));
702
-        force_download("samplefile.csv", $file); 
703
-    }
704
-    function termination_rate_batch_update(){
705
-        $batch_update_arr = $this->input->post();
701
+		$file = file_get_contents($full_path, false, stream_context_create($arrContextOptions));
702
+		force_download("samplefile.csv", $file); 
703
+	}
704
+	function termination_rate_batch_update(){
705
+		$batch_update_arr = $this->input->post();
706 706
 	$batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000";
707 707
 	$batch_update_arr["connectcost"]["connectcost"] = isset($batch_update_arr["connectcost"]["connectcost"])?$this->common_model->add_calculate_currency($batch_update_arr["connectcost"]["connectcost"], '', '', true, false):"0.0000";
708 708
 //        $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4"));
709
-        $result = $this->rates_model->termination_rate_batch_update($batch_update_arr);
710
-        echo json_encode(array("SUCCESS"=> "Termination rates batch updated successfully!"));
711
-        exit;
712
-    }
709
+		$result = $this->rates_model->termination_rate_batch_update($batch_update_arr);
710
+		echo json_encode(array("SUCCESS"=> "Termination rates batch updated successfully!"));
711
+		exit;
712
+	}
713 713
     
714
-    function origination_rate_batch_update(){
715
-        $batch_update_arr = $this->input->post();
716
-	     $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000";
714
+	function origination_rate_batch_update(){
715
+		$batch_update_arr = $this->input->post();
716
+		 $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000";
717 717
 //        $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4"));
718
-        $result = $this->rates_model->origination_rate_batch_update($batch_update_arr);
719
-        echo json_encode(array("SUCCESS"=> "Origination rates batch updated successfully!"));
720
-        exit;
721
-    }
718
+		$result = $this->rates_model->origination_rate_batch_update($batch_update_arr);
719
+		echo json_encode(array("SUCCESS"=> "Origination rates batch updated successfully!"));
720
+		exit;
721
+	}
722 722
 
723
-    function termination_rate_export_cdr_xls() {
723
+	function termination_rate_export_cdr_xls() {
724 724
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
725 725
 		$currency_id=$account_info['currency_id'];
726 726
 		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
727
-        $query = $this->rates_model->get_termination_rate(true, '', '', false);
728
-        $outbound_array = array();
729
-        ob_clean();
730
-        $outbound_array[] = array("Code", "Destination",  "Connect Cost($currency)", "Included Seconds","Per Minute Cost($currency)","Initial Increment", "Increment","Priority","Strip","Prepend","Trunk","Status","Created Date");
731
-        if ($query->num_rows() > 0) {
727
+		$query = $this->rates_model->get_termination_rate(true, '', '', false);
728
+		$outbound_array = array();
729
+		ob_clean();
730
+		$outbound_array[] = array("Code", "Destination",  "Connect Cost($currency)", "Included Seconds","Per Minute Cost($currency)","Initial Increment", "Increment","Priority","Strip","Prepend","Trunk","Status","Created Date");
731
+		if ($query->num_rows() > 0) {
732 732
 
733
-            foreach ($query->result_array() as $row) {
733
+			foreach ($query->result_array() as $row) {
734 734
 				//echo"<pre>";print_r($row);exit;
735
-                    $outbound_array[] = array(
736
-                        $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
737
-                        $row['comment'],
738
-                        $this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false),
735
+					$outbound_array[] = array(
736
+						$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
737
+						$row['comment'],
738
+						$this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false),
739 739
                         
740
-                        $row['includedseconds'],
740
+						$row['includedseconds'],
741 741
 			$this->common_model->calculate_currency($row['cost'],'','',TRUE,false),
742 742
 /**
743 743
 ASTPP  3.0 
@@ -745,41 +745,41 @@  discard block
 block discarded – undo
745 745
 **/
746 746
 			$row['init_inc'],
747 747
 /****************************************/
748
-                        $row['inc'],
749
-                        $row['precedence'],
750
-                        $row['strip'],
751
-                        $row['prepend'],
752
-                        //$row['trunk_id'],
753
-                        $this->common->get_field_name('name','trunks',$row["trunk_id"]),
754
-                        $this->common->get_status('export', '', $row['status']),
755
-                        $row['creation_date'],
748
+						$row['inc'],
749
+						$row['precedence'],
750
+						$row['strip'],
751
+						$row['prepend'],
752
+						//$row['trunk_id'],
753
+						$this->common->get_field_name('name','trunks',$row["trunk_id"]),
754
+						$this->common->get_status('export', '', $row['status']),
755
+						$row['creation_date'],
756 756
                         
757
-                        );
758
-                }
759
-            }
760
-        $this->load->helper('csv');
757
+						);
758
+				}
759
+			}
760
+		$this->load->helper('csv');
761 761
         
762
-        array_to_csv($outbound_array, 'Termination_Rates_' . date("Y-m-d") . '.csv');
762
+		array_to_csv($outbound_array, 'Termination_Rates_' . date("Y-m-d") . '.csv');
763 763
        
764
-    }
764
+	}
765 765
 
766
-    function termination_rate_export_cdr_pdf() {
767
-        $query = $this->rates_model->get_termination_rate(true, '', '', false);
768
-        $outbound_array = array();
769
-        $this->load->library('fpdf');
770
-        $this->load->library('pdf');
771
-        $this->fpdf = new PDF('P', 'pt');
772
-        $this->fpdf->initialize('P', 'mm', 'A4');
773
-        $this->fpdf->tablewidths = array(20, 30, 20, 20, 20, 20, 20,20,20);
774
-        $outbound_array[] = array("Code", "Destination",  "Connect Cost","Included Seconds","Per Minute Cost","Initial Increment", "Increment","Precedence","Prepend","Strip");
775
-        if ($query->num_rows() > 0) {
766
+	function termination_rate_export_cdr_pdf() {
767
+		$query = $this->rates_model->get_termination_rate(true, '', '', false);
768
+		$outbound_array = array();
769
+		$this->load->library('fpdf');
770
+		$this->load->library('pdf');
771
+		$this->fpdf = new PDF('P', 'pt');
772
+		$this->fpdf->initialize('P', 'mm', 'A4');
773
+		$this->fpdf->tablewidths = array(20, 30, 20, 20, 20, 20, 20,20,20);
774
+		$outbound_array[] = array("Code", "Destination",  "Connect Cost","Included Seconds","Per Minute Cost","Initial Increment", "Increment","Precedence","Prepend","Strip");
775
+		if ($query->num_rows() > 0) {
776 776
 
777
-            foreach ($query->result_array() as $row) {
778
-                    $outbound_array[] = array(
777
+			foreach ($query->result_array() as $row) {
778
+					$outbound_array[] = array(
779 779
 			$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
780
-                        $row['comment'],
781
-                        $row['connectcost'],
782
-                        $row['includedseconds'],
780
+						$row['comment'],
781
+						$row['connectcost'],
782
+						$row['includedseconds'],
783 783
 			$this->common_model->calculate_currency($row['cost']),
784 784
 /**
785 785
 ASTPP  3.0 
@@ -787,204 +787,204 @@  discard block
 block discarded – undo
787 787
 **/
788 788
 			$row['init_inc'],
789 789
 /*******************************************/
790
-                        $row['inc'],
791
-                        $row['precedence'],
792
-                        $row['prepend'],
793
-                        $row['strip']
794
-                    );
795
-                }
796
-        }
797
-        $this->fpdf->AliasNbPages();
798
-        $this->fpdf->AddPage();
790
+						$row['inc'],
791
+						$row['precedence'],
792
+						$row['prepend'],
793
+						$row['strip']
794
+					);
795
+				}
796
+		}
797
+		$this->fpdf->AliasNbPages();
798
+		$this->fpdf->AddPage();
799 799
 
800
-        $this->fpdf->SetFont('Arial', '', 15);
801
-        $this->fpdf->SetXY(60, 5);
802
-        $this->fpdf->Cell(100, 10, "Outbound Rates Report " . date('Y-m-d'));
800
+		$this->fpdf->SetFont('Arial', '', 15);
801
+		$this->fpdf->SetXY(60, 5);
802
+		$this->fpdf->Cell(100, 10, "Outbound Rates Report " . date('Y-m-d'));
803 803
 
804
-        $this->fpdf->SetY(20);
805
-        $this->fpdf->SetFont('Arial', '', 7);
806
-        $this->fpdf->SetFillColor(255, 255, 255);
807
-        $this->fpdf->lMargin = 2;
804
+		$this->fpdf->SetY(20);
805
+		$this->fpdf->SetFont('Arial', '', 7);
806
+		$this->fpdf->SetFillColor(255, 255, 255);
807
+		$this->fpdf->lMargin = 2;
808 808
 
809
-        $dimensions = $this->fpdf->export_pdf($outbound_array, "7");
810
-        $this->fpdf->Output('Termination_Rate_' . date("Y-m-d") . '.pdf', "D");
811
-    }
809
+		$dimensions = $this->fpdf->export_pdf($outbound_array, "7");
810
+		$this->fpdf->Output('Termination_Rate_' . date("Y-m-d") . '.pdf', "D");
811
+	}
812 812
     
813 813
 
814
-    function origination_rate_export_cdr_xls() {
814
+	function origination_rate_export_cdr_xls() {
815 815
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
816 816
 		$currency_id=$account_info['currency_id'];
817 817
 		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
818
-        $query = $this->rates_model->get_origination_rate(true, '', '', false);
818
+		$query = $this->rates_model->get_origination_rate(true, '', '', false);
819 819
 	//echo "<pre>";print_r($query);exit;
820
-        $inbound_array = array();
821
-        ob_clean();
822
-        $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)", "Initial Increment", "Increment","Rate Group","Status","Created Date");
823
-        if ($query->num_rows() > 0) {
820
+		$inbound_array = array();
821
+		ob_clean();
822
+		$inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)", "Initial Increment", "Increment","Rate Group","Status","Created Date");
823
+		if ($query->num_rows() > 0) {
824 824
 
825
-            foreach ($query->result_array() as $row) {
825
+			foreach ($query->result_array() as $row) {
826 826
 				//echo"<pre>";print_r($row);exit;
827
-                    $inbound_array[] = array(
828
-                        $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
829
-                        $row['comment'],
830
-                        $this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false),
831
-                        $row['includedseconds'],
832
-                        $this->common_model->calculate_currency($row['cost'],'','',TRUE,false),
827
+					$inbound_array[] = array(
828
+						$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
829
+						$row['comment'],
830
+						$this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false),
831
+						$row['includedseconds'],
832
+						$this->common_model->calculate_currency($row['cost'],'','',TRUE,false),
833 833
 /**
834 834
 ASTPP  3.0 
835 835
 For Add Initial Increment field
836 836
 **/
837 837
 						$row['init_inc'],
838 838
 /********************************************/
839
-                        $row['inc'],
840
-                       // $row['precedence'],
841
-                        $this->common->get_field_name('name', 'pricelists', $row['pricelist_id']),
842
-                        $this->common->get_status('export', '', $row['status']),
843
-                        $row['creation_date'],
844
-                    );
845
-                }
846
-            }
847
-        $this->load->helper('csv');
848
-        array_to_csv($inbound_array, 'Origination_Rates_' . date("Y-m-d") . '.csv');
849
-    }
850
-    function origination_rate_export_cdr_pdf() {
851
-        $query = $this->rates_model->get_origination_rate(true, '', '', false);
839
+						$row['inc'],
840
+					   // $row['precedence'],
841
+						$this->common->get_field_name('name', 'pricelists', $row['pricelist_id']),
842
+						$this->common->get_status('export', '', $row['status']),
843
+						$row['creation_date'],
844
+					);
845
+				}
846
+			}
847
+		$this->load->helper('csv');
848
+		array_to_csv($inbound_array, 'Origination_Rates_' . date("Y-m-d") . '.csv');
849
+	}
850
+	function origination_rate_export_cdr_pdf() {
851
+		$query = $this->rates_model->get_origination_rate(true, '', '', false);
852 852
 	
853
-        $inbound_array = array();
854
-        $this->load->library('fpdf');
855
-        $this->load->library('pdf');
856
-        $this->fpdf = new PDF('P', 'pt');
857
-        $this->fpdf->initialize('P', 'mm', 'A4');
858
-        $this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20);
853
+		$inbound_array = array();
854
+		$this->load->library('fpdf');
855
+		$this->load->library('pdf');
856
+		$this->fpdf = new PDF('P', 'pt');
857
+		$this->fpdf->initialize('P', 'mm', 'A4');
858
+		$this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20);
859 859
 	$inbound_array[] = array("Code", "Destination","Connect Cost","Included Seconds","Per Minute Cost","Initial Increment","Increment");
860
-        if ($query->num_rows() > 0) {
861
-            foreach ($query->result_array() as $row) {
862
-                    $inbound_array[] = array(
863
-                       $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
864
-                        $row['comment'],
865
-                        $row['connectcost'],
866
-                        $row['includedseconds'],
867
-                        $this->common_model->calculate_currency($row['cost'],'','','',false),
860
+		if ($query->num_rows() > 0) {
861
+			foreach ($query->result_array() as $row) {
862
+					$inbound_array[] = array(
863
+					   $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
864
+						$row['comment'],
865
+						$row['connectcost'],
866
+						$row['includedseconds'],
867
+						$this->common_model->calculate_currency($row['cost'],'','','',false),
868 868
 /**
869 869
 ASTPP  3.0 
870 870
 For Add Initial Increment field
871 871
 **/
872 872
 			$row['init_inc'],
873 873
 /*************************************************/
874
-                        $row['inc']
875
-                    );
876
-                }
877
-        }
878
-        $this->fpdf->AliasNbPages();
879
-        $this->fpdf->AddPage();
874
+						$row['inc']
875
+					);
876
+				}
877
+		}
878
+		$this->fpdf->AliasNbPages();
879
+		$this->fpdf->AddPage();
880 880
 
881
-        $this->fpdf->SetFont('Arial', '', 15);
882
-        $this->fpdf->SetXY(60, 5);
883
-        $this->fpdf->Cell(100, 10, "Origination Rates Report " . date('Y-m-d'));
881
+		$this->fpdf->SetFont('Arial', '', 15);
882
+		$this->fpdf->SetXY(60, 5);
883
+		$this->fpdf->Cell(100, 10, "Origination Rates Report " . date('Y-m-d'));
884 884
 
885
-        $this->fpdf->SetY(20);
886
-        $this->fpdf->SetFont('Arial', '', 7);
887
-        $this->fpdf->SetFillColor(255, 255, 255);
888
-        $this->fpdf->lMargin = 2;
885
+		$this->fpdf->SetY(20);
886
+		$this->fpdf->SetFont('Arial', '', 7);
887
+		$this->fpdf->SetFillColor(255, 255, 255);
888
+		$this->fpdf->lMargin = 2;
889 889
 
890
-        $dimensions = $this->fpdf->export_pdf($inbound_array, "5");
891
-        $this->fpdf->Output('Origination_Rate_' . date("Y-m-d") . '.pdf', "D");
892
-    }
890
+		$dimensions = $this->fpdf->export_pdf($inbound_array, "5");
891
+		$this->fpdf->Output('Origination_Rate_' . date("Y-m-d") . '.pdf', "D");
892
+	}
893 893
 
894 894
   
895
-    function user_origination_rate_cdr_pdf() {
896
-        $query = $this->rates_model->get_origination_rate_for_user(true, '', '', false);
897
-        $inbound_array = array();
898
-        $this->load->library('fpdf');
899
-        $this->load->library('pdf');
900
-        $this->fpdf = new PDF('P', 'pt');
901
-        $this->fpdf->initialize('P', 'mm', 'A4');
895
+	function user_origination_rate_cdr_pdf() {
896
+		$query = $this->rates_model->get_origination_rate_for_user(true, '', '', false);
897
+		$inbound_array = array();
898
+		$this->load->library('fpdf');
899
+		$this->load->library('pdf');
900
+		$this->fpdf = new PDF('P', 'pt');
901
+		$this->fpdf->initialize('P', 'mm', 'A4');
902 902
 	$this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20);
903
-        $inbound_array[] = array("Code", "Destination", "Increment","Cost Per Minutes",  "Connect Charge", "Included Seconds");
904
-        if ($query->num_rows() > 0) {
905
-            foreach ($query->result_array() as $row) {
906
-                    $inbound_array[] = array(
907
-                       $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
908
-                        $row['comment'],
909
-                        $row['inc'],
903
+		$inbound_array[] = array("Code", "Destination", "Increment","Cost Per Minutes",  "Connect Charge", "Included Seconds");
904
+		if ($query->num_rows() > 0) {
905
+			foreach ($query->result_array() as $row) {
906
+					$inbound_array[] = array(
907
+					   $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
908
+						$row['comment'],
909
+						$row['inc'],
910 910
 			$this->common_model->calculate_currency($row['cost'],'','','',false),
911
-                        $row['connectcost'],
912
-                        $row['includedseconds']
913
-                    );
914
-            }
915
-        }
911
+						$row['connectcost'],
912
+						$row['includedseconds']
913
+					);
914
+			}
915
+		}
916 916
 
917
-        $this->fpdf->AliasNbPages();
918
-        $this->fpdf->AddPage();
917
+		$this->fpdf->AliasNbPages();
918
+		$this->fpdf->AddPage();
919 919
 
920
-        $this->fpdf->SetFont('Arial', '', 15);
921
-        $this->fpdf->SetXY(60, 5);
922
-        $this->fpdf->Cell(100, 10, "Rates Report " . date('Y-m-d'));
920
+		$this->fpdf->SetFont('Arial', '', 15);
921
+		$this->fpdf->SetXY(60, 5);
922
+		$this->fpdf->Cell(100, 10, "Rates Report " . date('Y-m-d'));
923 923
 
924
-        $this->fpdf->SetY(20);
925
-        $this->fpdf->SetFont('Arial', '', 7);
926
-        $this->fpdf->SetFillColor(255, 255, 255);
927
-        $this->fpdf->lMargin = 2;
924
+		$this->fpdf->SetY(20);
925
+		$this->fpdf->SetFont('Arial', '', 7);
926
+		$this->fpdf->SetFillColor(255, 255, 255);
927
+		$this->fpdf->lMargin = 2;
928 928
 
929
-        $dimensions = $this->fpdf->export_pdf($inbound_array, "5");
930
-        $this->fpdf->Output('Rates_' . date("Y-m-d") . '.pdf', "D");
931
-    }
932
-    function resellersrates_list(){
929
+		$dimensions = $this->fpdf->export_pdf($inbound_array, "5");
930
+		$this->fpdf->Output('Rates_' . date("Y-m-d") . '.pdf', "D");
931
+	}
932
+	function resellersrates_list(){
933 933
 	$accountinfo=$this->session->userdata('accountinfo');
934 934
 	$data['username'] = $this->session->userdata('user_name');
935
-        $data['page_title'] = 'My Rates' ;
936
-        $data['search_flag'] = true;
937
-        $this->session->set_userdata('advance_search', 0);
938
-        $data['grid_fields'] = $this->rates_form->build_rates_list_for_reseller();
935
+		$data['page_title'] = 'My Rates' ;
936
+		$data['search_flag'] = true;
937
+		$this->session->set_userdata('advance_search', 0);
938
+		$data['grid_fields'] = $this->rates_form->build_rates_list_for_reseller();
939 939
 		$data["grid_buttons"] = $this->rates_form->build_grid_buttons_rates();
940
-        $data['form_search'] = $this->form->build_serach_form($this->rates_form->get_reseller_origination_rate_search_form());
941
-        $this->load->view('view_resellersrates_list', $data);
942
-    }
943
-    function resellersrates_list_json() {
944
-        $json_data = array();
945
-        $account_data = $this->session->userdata("accountinfo");
946
-        $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"]));
947
-        //$markup = ($markup > 0)?$markup:1;
948
-        $count_all = $this->rates_model->getreseller_rates_list(false);
949
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
950
-        $json_data = $paging_data["json_paging"];
951
-        $query = $this->rates_model->getreseller_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
952
-        $grid_fields = json_decode($this->rates_form->build_rates_list_for_reseller());
953
-        foreach ($query->result_array() as $key => $value) {
954
-            $json_data['rows'][] = array('cell' => array(
955
-                    $this->common->get_only_numeric_val("","",$value["pattern"]),
956
-                    $value['comment'],
957
-                    $this->common_model->calculate_currency($value['connectcost'],'','','true',true),
958
-                    $value['includedseconds'],
959
-                    $this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','true',true),
960
-                    $value['inc'],
961
-                    $value['precedence'],
962
-            ));
963
-        }
940
+		$data['form_search'] = $this->form->build_serach_form($this->rates_form->get_reseller_origination_rate_search_form());
941
+		$this->load->view('view_resellersrates_list', $data);
942
+	}
943
+	function resellersrates_list_json() {
944
+		$json_data = array();
945
+		$account_data = $this->session->userdata("accountinfo");
946
+		$markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"]));
947
+		//$markup = ($markup > 0)?$markup:1;
948
+		$count_all = $this->rates_model->getreseller_rates_list(false);
949
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
950
+		$json_data = $paging_data["json_paging"];
951
+		$query = $this->rates_model->getreseller_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
952
+		$grid_fields = json_decode($this->rates_form->build_rates_list_for_reseller());
953
+		foreach ($query->result_array() as $key => $value) {
954
+			$json_data['rows'][] = array('cell' => array(
955
+					$this->common->get_only_numeric_val("","",$value["pattern"]),
956
+					$value['comment'],
957
+					$this->common_model->calculate_currency($value['connectcost'],'','','true',true),
958
+					$value['includedseconds'],
959
+					$this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','true',true),
960
+					$value['inc'],
961
+					$value['precedence'],
962
+			));
963
+		}
964 964
 //        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
965
-        echo json_encode($json_data);
966
-    }
967
-    function resellersrates_list_search() {
968
-        $ajax_search = $this->input->post('ajax_search', 0);
965
+		echo json_encode($json_data);
966
+	}
967
+	function resellersrates_list_search() {
968
+		$ajax_search = $this->input->post('ajax_search', 0);
969 969
 
970
-        if ($this->input->post('advance_search', TRUE) == 1) {
971
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
972
-            $action = $this->input->post();
970
+		if ($this->input->post('advance_search', TRUE) == 1) {
971
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
972
+			$action = $this->input->post();
973 973
             
974
-            unset($action['action']);
975
-            unset($action['advance_search']);
976
-            $this->session->set_userdata('resellerrates_list_search', $action);
977
-        }
978
-        if (@$ajax_search != 1) {
979
-            redirect(base_url() . 'rates/resellersrates_list/');
980
-        }
981
-    }
982
-    function resellersrates_list_clearsearchfilter() {
983
-        $this->session->set_userdata('advance_search', 0);
984
-        $this->session->set_userdata('resellerrates_list_search', "");
985
-    }
986
-    function resellersrates_xls()
987
-    {
974
+			unset($action['action']);
975
+			unset($action['advance_search']);
976
+			$this->session->set_userdata('resellerrates_list_search', $action);
977
+		}
978
+		if (@$ajax_search != 1) {
979
+			redirect(base_url() . 'rates/resellersrates_list/');
980
+		}
981
+	}
982
+	function resellersrates_list_clearsearchfilter() {
983
+		$this->session->set_userdata('advance_search', 0);
984
+		$this->session->set_userdata('resellerrates_list_search', "");
985
+	}
986
+	function resellersrates_xls()
987
+	{
988 988
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
989 989
 		$currency_id=$account_info['currency_id'];
990 990
 		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
@@ -997,54 +997,54 @@  discard block
 block discarded – undo
997 997
 
998 998
 	if ($query->num_rows() > 0) {
999 999
 
1000
-            foreach ($query->result_array() as $row) {
1000
+			foreach ($query->result_array() as $row) {
1001 1001
                 
1002
-                    $customer_array[] = array(
1003
-                        $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
1004
-                        $row['comment'],
1005
-                        $row['connectcost'],
1002
+					$customer_array[] = array(
1003
+						$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
1004
+						$row['comment'],
1005
+						$row['connectcost'],
1006 1006
 			$row['includedseconds'],
1007 1007
 			$this->common_model->calculate_currency($row['cost']),
1008
-                        $row['inc'],
1009
-                        $row['precedence']
1010
-                    );
1008
+						$row['inc'],
1009
+						$row['precedence']
1010
+					);
1011 1011
                 
1012
-            }
1013
-        }
1014
-        $this->load->helper('csv');
1015
-        array_to_csv($customer_array, 'My_Own_Rate_' . date("Y-m-d") . '.csv');
1016
-        exit;
1017
-    }
1012
+			}
1013
+		}
1014
+		$this->load->helper('csv');
1015
+		array_to_csv($customer_array, 'My_Own_Rate_' . date("Y-m-d") . '.csv');
1016
+		exit;
1017
+	}
1018 1018
 /***********
1019 1019
 ASTPP  3.0 
1020 1020
 Batch delete
1021 1021
 ***********/
1022
-    function termination_rates_list_batch_delete() {
1023
-        $ajax_search = $this->input->post('ajax_search', 0);
1024
-        if ($this->input->post('advance_search', TRUE) == 1) {
1025
-            $this->session->set_userdata('advance_batch_delete', $this->input->post('advance_search'));
1026
-            $action = $this->input->post();
1027
-            unset($action['action']);
1028
-            unset($action['advance_search']);
1029
-            $this->session->set_userdata('termination_rates_list_search', $action);
1030
-        }
1031
-        if (@$ajax_search != 1) {
1032
-            redirect(base_url() . 'rates/termination_rates_list/');
1033
-        }
1034
-    }
1035
-    function origination_rates_list_batch_delete() {
1036
-        $ajax_search = $this->input->post('ajax_search', 0);
1037
-        if ($this->input->post('advance_search', TRUE) == 1) {
1038
-            $this->session->set_userdata('advance_batch_delete', $this->input->post('advance_search'));
1039
-            $action = $this->input->post();
1040
-            unset($action['action']);
1041
-            unset($action['advance_search']);
1042
-            $this->session->set_userdata('origination_rate_list_search', $action);
1043
-        }
1044
-        if (@$ajax_search != 1) {
1045
-            redirect(base_url() . 'rates/origination_rates_list/');
1046
-        }
1047
-    }
1022
+	function termination_rates_list_batch_delete() {
1023
+		$ajax_search = $this->input->post('ajax_search', 0);
1024
+		if ($this->input->post('advance_search', TRUE) == 1) {
1025
+			$this->session->set_userdata('advance_batch_delete', $this->input->post('advance_search'));
1026
+			$action = $this->input->post();
1027
+			unset($action['action']);
1028
+			unset($action['advance_search']);
1029
+			$this->session->set_userdata('termination_rates_list_search', $action);
1030
+		}
1031
+		if (@$ajax_search != 1) {
1032
+			redirect(base_url() . 'rates/termination_rates_list/');
1033
+		}
1034
+	}
1035
+	function origination_rates_list_batch_delete() {
1036
+		$ajax_search = $this->input->post('ajax_search', 0);
1037
+		if ($this->input->post('advance_search', TRUE) == 1) {
1038
+			$this->session->set_userdata('advance_batch_delete', $this->input->post('advance_search'));
1039
+			$action = $this->input->post();
1040
+			unset($action['action']);
1041
+			unset($action['advance_search']);
1042
+			$this->session->set_userdata('origination_rate_list_search', $action);
1043
+		}
1044
+		if (@$ajax_search != 1) {
1045
+			redirect(base_url() . 'rates/origination_rates_list/');
1046
+		}
1047
+	}
1048 1048
 /*************************/
1049 1049
 }
1050 1050
 ?>
Please login to merge, or discard this patch.
Spacing   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         $this->load->library('astpp/form');
33 33
         $this->load->model('rates_model');
34 34
         $this->load->library('csvreader');
35
-	ini_set("memory_limit","2048M");
36
-	ini_set("max_execution_time","259200");
35
+	ini_set("memory_limit", "2048M");
36
+	ini_set("max_execution_time", "259200");
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 termination_rates_list() {
@@ -72,70 +72,70 @@  discard block
 block discarded – undo
72 72
 
73 73
         echo json_encode($json_data);
74 74
     }
75
-      function termination_rates_list_delete($flag='') {
75
+      function termination_rates_list_delete($flag = '') {
76 76
         $json_data = array();
77
-        $this->session->set_userdata('advance_batch_data_delete',1);
77
+        $this->session->set_userdata('advance_batch_data_delete', 1);
78 78
         $count_all = $this->rates_model->get_termination_rates_list(false);
79 79
 	echo $count_all; 
80 80
     } 
81 81
 /****************/
82 82
      function termination_rate_import() {
83 83
         $data['page_title'] = 'Import Termination Rates';
84
-        $this->session->set_userdata('import_termination_rate_csv',"");
85
-        $this->session->set_userdata('import_termination_rate_csv_error',"");
84
+        $this->session->set_userdata('import_termination_rate_csv', "");
85
+        $this->session->set_userdata('import_termination_rate_csv_error', "");
86 86
         $this->load->view('view_import_termination_rate', $data);
87 87
     }
88
-    function termination_rate_preview_file(){
89
-    	$invalid_flag= false;
90
-	$check_header=$this->input->post('check_header',true);
88
+    function termination_rate_preview_file() {
89
+    	$invalid_flag = false;
90
+	$check_header = $this->input->post('check_header', true);
91 91
 	$data['page_title'] = 'Import Termination Rates';
92 92
         $new_final_arr_key = $this->config->item('Termination-rates-field');
93
-        if(empty($_FILES) || !isset($_FILES)){
93
+        if (empty($_FILES) || ! isset($_FILES)) {
94 94
 	  redirect(base_url()."rates/termination_rates_list/");
95 95
 	}
96
-        if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" &&  isset($_POST['trunk_id']) && $_POST['trunk_id'] != '') {
96
+        if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" && isset($_POST['trunk_id']) && $_POST['trunk_id'] != '') {
97 97
             list($txt, $ext) = explode(".", $_FILES['termination_rate_import']['name']);
98
-            if($ext == "csv" && $_FILES['termination_rate_import']['size'] > 0){ 
98
+            if ($ext == "csv" && $_FILES['termination_rate_import']['size'] > 0) { 
99 99
                 $error = $_FILES['termination_rate_import']['error'];
100
-                if ($error == 0 ) {
100
+                if ($error == 0) {
101 101
                     $uploadedFile = $_FILES["termination_rate_import"]["tmp_name"];
102
-                    $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header);
103
-		    if(!empty($csv_data)){
102
+                    $csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
103
+		    if ( ! empty($csv_data)) {
104 104
 			$full_path = $this->config->item('rates-file-path');
105
-			$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s"). "." . $ext;
106
-			if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) {
105
+			$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s").".".$ext;
106
+			if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) {
107 107
 			  $data['csv_tmp_data'] = $csv_data;
108 108
 			  $data['trunkid'] = $_POST['trunk_id'];
109
-			  $data['check_header']=$check_header;
109
+			  $data['check_header'] = $check_header;
110 110
 			  $data['page_title'] = 'Termination Rates Preview';
111
-			  $this->session->set_userdata('import_termination_rate_csv',$actual_file_name);
112
-			}else{
111
+			  $this->session->set_userdata('import_termination_rate_csv', $actual_file_name);
112
+			} else {
113 113
 			  $data['error'] = "File Uploading Fail Please Try Again";
114 114
 			}
115 115
                     }
116 116
                 }
117
-                else{
118
-                    $data['error']=="File Uploading Fail Please Try Again";
117
+                else {
118
+                    $data['error'] == "File Uploading Fail Please Try Again";
119 119
                 }
120
-            }else {
120
+            } else {
121 121
                 $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
122 122
             }
123
-        }else{
124
-		$invalid_flag=true;
123
+        } else {
124
+		$invalid_flag = true;
125 125
         }
126 126
         if ($invalid_flag) {
127 127
             $str = '';
128
-            if (!isset($_POST['trunk_id']) || empty($_POST['trunk_id'])) {
129
-                $str.= '<br/>Please Create Trunk.';
128
+            if ( ! isset($_POST['trunk_id']) || empty($_POST['trunk_id'])) {
129
+                $str .= '<br/>Please Create Trunk.';
130 130
             }
131 131
             if (empty($_FILES['termination_rate_import']['name'])) {
132
-                $str.= '<br/>Please Select  File.';
132
+                $str .= '<br/>Please Select  File.';
133 133
             }
134
-            $data['error']=$str;
134
+            $data['error'] = $str;
135 135
         }
136 136
         $this->load->view('view_import_termination_rate', $data);
137 137
     }
138
-    function termination_rate_rates_import($trunkID,$check_header=false) {
138
+    function termination_rate_rates_import($trunkID, $check_header = false) {
139 139
         $new_final_arr = array();
140 140
         $invalid_array = array();
141 141
         $new_final_arr_key = $this->config->item('Termination-rates-field');
@@ -145,65 +145,65 @@  discard block
 block discarded – undo
145 145
         }
146 146
 	$full_path = $this->config->item('rates-file-path');
147 147
         $terminationrate_file_name = $this->session->userdata('import_termination_rate_csv');	
148
-        $csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name,$new_final_arr_key,$check_header); 
149
-	$i=0;
148
+        $csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name, $new_final_arr_key, $check_header); 
149
+	$i = 0;
150 150
         foreach ($csv_tmp_data as $key => $csv_data) {
151
-	 if(isset($csv_data['pattern']) && $csv_data['pattern']!= '' && $i != 0){
152
-	    $str=null;
153
-	    $csv_data['prepend']= isset($csv_data['prepend'])? $csv_data['prepend'] :'';
154
-	    $csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :'';
155
-	    $csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0;
156
-	    $csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0;
157
-	    $csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0;
158
-	    $csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0;
159
-	    $csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :'';
160
-	    $csv_data['strip']= isset($csv_data['strip']) ? $csv_data['strip'] :'';
151
+	 if (isset($csv_data['pattern']) && $csv_data['pattern'] != '' && $i != 0) {
152
+	    $str = null;
153
+	    $csv_data['prepend'] = isset($csv_data['prepend']) ? $csv_data['prepend'] : '';
154
+	    $csv_data['comment'] = isset($csv_data['comment']) ? $csv_data['comment'] : '';
155
+	    $csv_data['connectcost'] = isset($csv_data['connectcost']) ? $csv_data['connectcost'] : 0;
156
+	    $csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0;
157
+	    $csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
158
+	    $csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0;
159
+	    $csv_data['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : '';
160
+	    $csv_data['strip'] = isset($csv_data['strip']) ? $csv_data['strip'] : '';
161 161
 	    $csv_data['last_modified_date'] = date("Y-m-d H:i:s");
162
-	    $str=$this->data_validate($csv_data);
163
-	    if($str != ""){
164
-	      $invalid_array[$i]=$csv_data;
162
+	    $str = $this->data_validate($csv_data);
163
+	    if ($str != "") {
164
+	      $invalid_array[$i] = $csv_data;
165 165
 	      $invalid_array[$i]['error'] = $str;
166 166
 	    }
167
-	    else{
168
-	      $csv_data['trunk_id']=$trunkID;
169
-	      $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
170
-	      $new_final_arr[$i]=$csv_data;
167
+	    else {
168
+	      $csv_data['trunk_id'] = $trunkID;
169
+	      $csv_data['pattern'] = "^".$csv_data['pattern'].".*";
170
+	      $new_final_arr[$i] = $csv_data;
171 171
 	    }
172 172
 	  }
173 173
           $i++;
174 174
         }
175
-         if(!empty($new_final_arr)){
175
+         if ( ! empty($new_final_arr)) {
176 176
  	    $result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
177 177
          }
178 178
           unlink($full_path.$terminationrate_file_name);
179
-	  $count=count($invalid_array);
180
-        if($count >0){
179
+	  $count = count($invalid_array);
180
+        if ($count > 0) {
181 181
             $session_id = "-1";
182 182
             $fp = fopen($full_path.$session_id.'.csv', 'w');
183
-            foreach($new_final_arr_key as $key=>$value){
184
-	      $custom_array[0][$key]=ucfirst($key);
183
+            foreach ($new_final_arr_key as $key=>$value) {
184
+	      $custom_array[0][$key] = ucfirst($key);
185 185
             }
186
-            $custom_array[0]['error']= "Error";
187
-            $invalid_array =array_merge($custom_array,$invalid_array);
188
-            foreach($invalid_array as $err_data){
189
-                    fputcsv($fp,$err_data);
186
+            $custom_array[0]['error'] = "Error";
187
+            $invalid_array = array_merge($custom_array, $invalid_array);
188
+            foreach ($invalid_array as $err_data) {
189
+                    fputcsv($fp, $err_data);
190 190
             }
191 191
            fclose($fp);
192 192
            $this->session->set_userdata('import_termination_rate_csv_error', $session_id.".csv");
193 193
            $data["error"] = $invalid_array;
194 194
            $data['trunkid'] = $trunkID;
195 195
            $data['impoted_count'] = count($new_final_arr);
196
-           $data['failure_count'] = count($invalid_array)-1;
196
+           $data['failure_count'] = count($invalid_array) - 1;
197 197
            $data['page_title'] = 'Termination Rates Import Error';	
198
-           $this->load->view('view_import_error',$data);
199
-         } else{
198
+           $this->load->view('view_import_error', $data);
199
+         } else {
200 200
 	  $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Termination rates imported successfully!');
201 201
            redirect(base_url()."rates/termination_rates_list/");
202 202
          }        
203 203
     }
204
-    function termination_rate_error_download(){
204
+    function termination_rate_error_download() {
205 205
         $this->load->helper('download');
206
-        $error_data =  $this->session->userdata('import_termination_rate_csv_error');
206
+        $error_data = $this->session->userdata('import_termination_rate_csv_error');
207 207
         $full_path = $this->config->item('rates-file-path');
208 208
         $data = file_get_contents($full_path.$error_data);
209 209
         force_download("Termination_rate_error.csv", $data); 
@@ -211,182 +211,182 @@  discard block
 block discarded – undo
211 211
     }  
212 212
     function origination_rate_import() {
213 213
         $data['page_title'] = 'Import Origination Rates';
214
-        $this->session->set_userdata('import_origination_rate_csv',"");
215
-        $error_data =  $this->session->userdata('import_origination_rate_csv_error');
214
+        $this->session->set_userdata('import_origination_rate_csv', "");
215
+        $error_data = $this->session->userdata('import_origination_rate_csv_error');
216 216
         $full_path = $this->config->item('rates-file-path');
217
-        if(file_exists($full_path.$error_data) && $error_data != ""){
217
+        if (file_exists($full_path.$error_data) && $error_data != "") {
218 218
             unlink($full_path.$error_data);
219
-            $this->session->set_userdata('import_origination_rate_csv_error',"");
219
+            $this->session->set_userdata('import_origination_rate_csv_error', "");
220 220
         }
221 221
         $this->load->view('view_import_origination_rate', $data);
222 222
     }
223
-    function origination_rate_preview_file(){
224
-	$invalid_flag= false;
225
-	$data=array();
223
+    function origination_rate_preview_file() {
224
+	$invalid_flag = false;
225
+	$data = array();
226 226
 	$data['page_title'] = 'Import Origination Rates';
227
-	$check_header=$this->input->post('check_header',true);
228
-	if(empty($_FILES) || !isset($_FILES)){
227
+	$check_header = $this->input->post('check_header', true);
228
+	if (empty($_FILES) || ! isset($_FILES)) {
229 229
 	  redirect(base_url()."rates/origination_rate_list/");
230 230
 	}
231
-	$get_extension=strpos($_FILES['origination_rate_import']['name'],'.');
231
+	$get_extension = strpos($_FILES['origination_rate_import']['name'], '.');
232 232
 	$new_final_arr_key = $this->config->item('Origination-rates-field');
233
-	if(!$get_extension){
234
-		$data['error']= "Please Upload File Atleast";
233
+	if ( ! $get_extension) {
234
+		$data['error'] = "Please Upload File Atleast";
235 235
         }
236 236
         if (isset($_FILES['origination_rate_import']['name']) && $_FILES['origination_rate_import']['name'] != "" && isset($_POST['pricelist_id']) && $_POST['pricelist_id'] != '') {
237
-            list($txt,$ext) = explode(".", $_FILES['origination_rate_import']['name']);
237
+            list($txt, $ext) = explode(".", $_FILES['origination_rate_import']['name']);
238 238
             
239
-            if($ext == "csv" && $_FILES['origination_rate_import']['size'] > 0){ 
239
+            if ($ext == "csv" && $_FILES['origination_rate_import']['size'] > 0) { 
240 240
                 $error = $_FILES['origination_rate_import']['error'];
241 241
                 if ($error == 0) {
242 242
                     $uploadedFile = $_FILES["origination_rate_import"]["tmp_name"];
243
-                    $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header);
244
-                    if(!empty($csv_data)){
243
+                    $csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
244
+                    if ( ! empty($csv_data)) {
245 245
 		    $full_path = $this->config->item('rates-file-path');
246
-                    $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s"). "." . $ext;
247
-                    if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) {
248
-			$flag=false;
249
-			$data['trunkid']=isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0;
246
+                    $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s").".".$ext;
247
+                    if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) {
248
+			$flag = false;
249
+			$data['trunkid'] = isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0;
250 250
                         $data['csv_tmp_data'] = $csv_data;
251 251
                         $data['pricelistid'] = $_POST['pricelist_id'];
252 252
                         $data['page_title'] = "Origination Rates Preview";
253
-                        $data['check_header']=$check_header;
254
-                        $this->session->set_userdata('import_origination_rate_csv',$actual_file_name);
255
-                    }else{
253
+                        $data['check_header'] = $check_header;
254
+                        $this->session->set_userdata('import_origination_rate_csv', $actual_file_name);
255
+                    } else {
256 256
                         $data['error'] = "File Uploading Fail Please Try Again";
257 257
                     }
258 258
                 }
259 259
              }   
260
-            else{
261
-                    $data['error']=="File Uploading Fail Please Try Again";
260
+            else {
261
+                    $data['error'] == "File Uploading Fail Please Try Again";
262 262
                 }
263 263
            }
264 264
            else {
265 265
                 $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
266 266
             }
267
-            }else{
268
-		$invalid_flag=true;
267
+            } else {
268
+		$invalid_flag = true;
269 269
             }
270 270
         if ($invalid_flag) {
271 271
             $str = '';
272
-            if (!isset($_POST['pricelist_id']) || empty($_POST['pricelist_id'])) {
273
-                $str.= '<br/>Please Create Rate Group.';
272
+            if ( ! isset($_POST['pricelist_id']) || empty($_POST['pricelist_id'])) {
273
+                $str .= '<br/>Please Create Rate Group.';
274 274
             }
275 275
             if (empty($_FILES['origination_rate_import']['name'])) {
276
-                $str.= '<br/>Please Select File.';
276
+                $str .= '<br/>Please Select File.';
277 277
             }
278
-            $data['error']=$str;
278
+            $data['error'] = $str;
279 279
         }
280 280
         $this->load->view('view_import_origination_rate', $data);
281 281
     }
282
-    function origination_rate_import_file($pricelistID,$trunkid,$check_header=false) {
282
+    function origination_rate_import_file($pricelistID, $trunkid, $check_header = false) {
283 283
        $new_final_arr = array();
284 284
         $invalid_array = array();
285 285
         $new_final_arr_key = $this->config->item('Origination-rates-field');
286 286
 	$screen_path = $this->config->item('screen_path');
287
-	$reseller_id=0;
287
+	$reseller_id = 0;
288 288
         if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
289 289
             $reseller_id = $this->session->userdata["accountinfo"]['id'];
290 290
         }
291 291
         
292 292
 		$full_path = $this->config->item('rates-file-path');
293 293
         $originationrate_file_name = $this->session->userdata('import_origination_rate_csv');	
294
-        $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name,$new_final_arr_key,$check_header); 
294
+        $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name, $new_final_arr_key, $check_header); 
295 295
         //echo "<pre>";print_r($csv_tmp_data);exit;
296
-	$i=0;
296
+	$i = 0;
297 297
         foreach ($csv_tmp_data as $key => $csv_data) {	
298
-	  if(isset($csv_data['pattern']) && $csv_data['pattern']!= '' && $i != 0){
299
-	    $str=null;
300
-	    $csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :'';
301
-	    $csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0;
302
-	    $csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0;
303
-	    $csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0;
304
-	    $csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0;
305
-	    $csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :'';
298
+	  if (isset($csv_data['pattern']) && $csv_data['pattern'] != '' && $i != 0) {
299
+	    $str = null;
300
+	    $csv_data['comment'] = isset($csv_data['comment']) ? $csv_data['comment'] : '';
301
+	    $csv_data['connectcost'] = isset($csv_data['connectcost']) ? $csv_data['connectcost'] : 0;
302
+	    $csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0;
303
+	    $csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
304
+	    $csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0;
305
+	    $csv_data['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : '';
306 306
 	    $csv_data['last_modified_date'] = date("Y-m-d H:i:s");
307
-	    $str=$this->data_validate($csv_data);
308
-	    if($str != ""){
309
-	      $invalid_array[$i]=$csv_data;
307
+	    $str = $this->data_validate($csv_data);
308
+	    if ($str != "") {
309
+	      $invalid_array[$i] = $csv_data;
310 310
 	      $invalid_array[$i]['error'] = $str;
311 311
 	    }
312
-	    else{
313
-	      $csv_data['pricelist_id']=$pricelistID;
314
-	      $csv_data['trunk_id']=$trunkid;
315
-	      $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
316
-	      $csv_data['reseller_id']= $reseller_id;
312
+	    else {
313
+	      $csv_data['pricelist_id'] = $pricelistID;
314
+	      $csv_data['trunk_id'] = $trunkid;
315
+	      $csv_data['pattern'] = "^".$csv_data['pattern'].".*";
316
+	      $csv_data['reseller_id'] = $reseller_id;
317 317
 	      $csv_data['creation_date'] = gmdate('Y-m-d H:i:s');
318
-	      $new_final_arr[$i]=$csv_data;
318
+	      $new_final_arr[$i] = $csv_data;
319 319
 	    }
320 320
 	  }
321 321
           $i++;
322 322
         }
323
-          if(!empty($new_final_arr)){
323
+          if ( ! empty($new_final_arr)) {
324 324
   	    $result = $this->rates_model->bulk_insert_origination_rate($new_final_arr);
325 325
           }
326 326
           unlink($full_path.$originationrate_file_name);
327
-	 $count=count($invalid_array);
328
-        if($count >0){
327
+	 $count = count($invalid_array);
328
+        if ($count > 0) {
329 329
             $session_id = "-1";
330 330
             $fp = fopen($full_path.$session_id.'.csv', 'w');
331
-            foreach($new_final_arr_key as $key=>$value){
332
-	      $custom_array[0][$key]=ucfirst($key);
331
+            foreach ($new_final_arr_key as $key=>$value) {
332
+	      $custom_array[0][$key] = ucfirst($key);
333 333
             }
334
-            $custom_array[0]['error']= "Error";
335
-            $invalid_array =array_merge($custom_array,$invalid_array);
336
-            foreach($invalid_array as $err_data){
337
-                    fputcsv($fp,$err_data);
334
+            $custom_array[0]['error'] = "Error";
335
+            $invalid_array = array_merge($custom_array, $invalid_array);
336
+            foreach ($invalid_array as $err_data) {
337
+                    fputcsv($fp, $err_data);
338 338
             }
339 339
             fclose($fp);
340 340
            $this->session->set_userdata('import_origination_rate_csv_error', $session_id.".csv");
341 341
            $data["error"] = $invalid_array;
342 342
            $data['pricelistid'] = $pricelistID;
343 343
            $data['impoted_count'] = count($new_final_arr);
344
-           $data['failure_count'] = count($invalid_array)-1;
344
+           $data['failure_count'] = count($invalid_array) - 1;
345 345
            $data['page_title'] = 'Origination Rates Import Error';	
346
-           $this->load->view('view_import_error',$data);
347
-         } else{
346
+           $this->load->view('view_import_error', $data);
347
+         } else {
348 348
 	   $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Origination rates imported successfully!');
349 349
            redirect(base_url()."rates/origination_rates_list/");
350 350
            }
351 351
     }
352
-     function data_validate($csvdata){
353
-          $str=null;
352
+     function data_validate($csvdata) {
353
+          $str = null;
354 354
 	  $alpha_regex = "/^[a-z ,.'-]+$/i";
355 355
 	  $alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i";
356 356
 	  $email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/"; 
357
-	  $str.= $csvdata['pattern']!= '' ? null : 'Code,';
358
-	  $str=rtrim($str,',');
359
-	  if(!$str){
360
-	      $str.= is_numeric($csvdata['pattern']) ? null : 'Code,';
357
+	  $str .= $csvdata['pattern'] != '' ? null : 'Code,';
358
+	  $str = rtrim($str, ',');
359
+	  if ( ! $str) {
360
+	      $str .= is_numeric($csvdata['pattern']) ? null : 'Code,';
361 361
 
362
-	      $str.= !empty($csvdata['connectcost']) && is_numeric( $csvdata['connectcost']) ? null :( empty($csvdata['connectcost']) ? null : 'Connect Cost,');
363
-	      $str.= !empty($csvdata['includedseconds']) && is_numeric( $csvdata['includedseconds']) ? null :( empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
362
+	      $str .= ! empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : (empty($csvdata['connectcost']) ? null : 'Connect Cost,');
363
+	      $str .= ! empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : (empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
364 364
 
365
-	      $str.= !empty($csvdata['inc']) && is_numeric( $csvdata['inc']) ? null :( empty($csvdata['inc']) ? null : 'Increment,');
366
-	      $str.= !empty($csvdata['precedence']) && is_numeric( $csvdata['precedence']) ? null :( empty($csvdata['precedence']) ? null : 'Precedence,');
367
-	      $str.= (isset($csvdata['strip']) && !empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null :'Strip,') : null;
368
-	      if($str){
369
-		$str=rtrim($str,',');
370
-		$error_field=explode(',',$str);
365
+	      $str .= ! empty($csvdata['inc']) && is_numeric($csvdata['inc']) ? null : (empty($csvdata['inc']) ? null : 'Increment,');
366
+	      $str .= ! empty($csvdata['precedence']) && is_numeric($csvdata['precedence']) ? null : (empty($csvdata['precedence']) ? null : 'Precedence,');
367
+	      $str .= (isset($csvdata['strip']) && ! empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null : 'Strip,') : null;
368
+	      if ($str) {
369
+		$str = rtrim($str, ',');
370
+		$error_field = explode(',', $str);
371 371
 		$count = count($error_field);
372
-		$str.= $count > 1 ? ' are not valid' : ' is not Valid';
372
+		$str .= $count > 1 ? ' are not valid' : ' is not Valid';
373 373
 		return $str;
374 374
 	      }
375
-	      else{
375
+	      else {
376 376
 	      return false;
377 377
 	      }
378 378
 	  }
379
-	  else{
380
-	  $str=rtrim($str,',');
381
-	    $error_field=explode(',',$str);
379
+	  else {
380
+	  $str = rtrim($str, ',');
381
+	    $error_field = explode(',', $str);
382 382
 	    $count = count($error_field);
383
-	    $str.= $count > 1 ? ' are required' : ' is Required';
383
+	    $str .= $count > 1 ? ' are required' : ' is Required';
384 384
     return $str;
385 385
     }
386 386
     }
387
-    function origination_rate_error_download(){
387
+    function origination_rate_error_download() {
388 388
         $this->load->helper('download');
389
-        $error_data =  $this->session->userdata('import_origination_rate_csv_error');
389
+        $error_data = $this->session->userdata('import_origination_rate_csv_error');
390 390
         $full_path = $this->config->item('rates-file-path');
391 391
         $data = file_get_contents($full_path.$error_data);
392 392
         force_download("Origination_rate_error.csv", $data); 
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
                 $edit_data = $value;
417 417
             }
418 418
             $edit_data['connectcost'] = $this->common_model->to_calculate_currency($edit_data['connectcost'], '', '', true, false);
419
-            $edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '',true, false);
419
+            $edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '', true, false);
420 420
             $edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
421 421
 
422 422
             $data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $edit_data);
423 423
             $this->load->view('view_origination_rate_add_edit', $data);
424 424
         } else {
425
-            redirect(base_url() . 'rates/origination_rate_list/');
425
+            redirect(base_url().'rates/origination_rate_list/');
426 426
         }
427 427
     }
428 428
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
             $this->session->set_userdata('origination_rate_list_search', $action);
471 471
         }
472 472
         if (@$ajax_search != 1) {
473
-            redirect(base_url() . 'rates/origination_rates_list/');
473
+            redirect(base_url().'rates/origination_rates_list/');
474 474
         }
475 475
     }
476 476
 
@@ -482,13 +482,13 @@  discard block
 block discarded – undo
482 482
     function termination_rate_delete($id) {
483 483
         $this->rates_model->remove_termination_rate($id);
484 484
         $this->session->set_flashdata('astpp_notification', 'Termination removed successfully!');
485
-        redirect(base_url() . '/rates/termination_rates_list/');
485
+        redirect(base_url().'/rates/termination_rates_list/');
486 486
     }
487 487
 
488 488
     function origination_rate_delete($id) {
489 489
         $this->rates_model->remove_origination_rate($id);
490 490
         $this->session->set_flashdata('astpp_notification', 'Origination rate removed successfully!');
491
-        redirect(base_url() . 'rates/origination_rates_list/');
491
+        redirect(base_url().'rates/origination_rates_list/');
492 492
     }
493 493
 
494 494
     function origination_rates_list() {
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
         echo json_encode($json_data);
528 528
     }
529 529
 
530
-      function origination_rates_list_delete($flag='') {
530
+      function origination_rates_list_delete($flag = '') {
531 531
         $json_data = array();
532
-        $this->session->set_userdata('advance_batch_data_delete',1);
532
+        $this->session->set_userdata('advance_batch_data_delete', 1);
533 533
         $count_all = $this->rates_model->get_origination_rate_list(false);
534 534
 		echo $count_all; 
535 535
     } 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
             $this->session->set_userdata('termination_rates_list_search', $action);
604 604
         }
605 605
         if (@$ajax_search != 1) {
606
-            redirect(base_url() . 'rates/termination_rates_list/');
606
+            redirect(base_url().'rates/termination_rates_list/');
607 607
         }
608 608
     }
609 609
 
@@ -612,20 +612,20 @@  discard block
 block discarded – undo
612 612
         $this->session->set_userdata('account_search', "");
613 613
     }
614 614
 
615
-    function customer_block_pattern_list($accountid,$accounttype) {
615
+    function customer_block_pattern_list($accountid, $accounttype) {
616 616
         $json_data = array();
617 617
         $where = array('accountid' => $accountid);
618
-        $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
619
-        $like_str=!empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" :null;
620
-        if(!empty($like_str))
618
+        $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
619
+        $like_str = ! empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" : null;
620
+        if ( ! empty($like_str))
621 621
         $this->db->where($like_str);
622 622
         $count_all = $this->db_model->countQuery("*", "block_patterns", $where);
623 623
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
624 624
         $json_data = $paging_data["json_paging"];
625
-        if(!empty($like_str))
625
+        if ( ! empty($like_str))
626 626
         $this->db->where($like_str);
627 627
         $pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
628
-        $grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid,$accounttype));
628
+        $grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid, $accounttype));
629 629
         $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
630 630
         echo json_encode($json_data);
631 631
     }
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
         $json_data = array();
649 649
         $account_data = $this->session->userdata("accountinfo");
650 650
         $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"]));
651
-        $markup = ($markup > 0)?$markup:1;
651
+        $markup = ($markup > 0) ? $markup : 1;
652 652
 
653 653
         $count_all = $this->rates_model->get_origination_rate_list_for_user(false);
654 654
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
         $grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_user());
659 659
         foreach ($query->result_array() as $key => $value) {
660 660
             $json_data['rows'][] = array('cell' => array(
661
-                    $this->common->get_only_numeric_val("","",$value["pattern"]),
661
+                    $this->common->get_only_numeric_val("", "", $value["pattern"]),
662 662
                     $value['comment'],
663 663
                     $value['inc'],
664
-                    $this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','',true),
665
-                    $this->common_model->calculate_currency($value['connectcost'],'','','',true),
664
+                    $this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100), '', '', '', true),
665
+                    $this->common_model->calculate_currency($value['connectcost'], '', '', '', true),
666 666
                     $value['includedseconds']                    
667 667
             ));
668 668
         }
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             $this->session->set_userdata('origination_rate_list_search', $action);
682 682
         }
683 683
         if (@$ajax_search != 1) {
684
-            redirect(base_url() . 'user/user_rates_list/');
684
+            redirect(base_url().'user/user_rates_list/');
685 685
         }
686 686
     }
687 687
 
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
         $this->session->set_userdata('advance_search', 0);
690 690
         $this->session->set_userdata('account_search', "");
691 691
     }
692
-    function customer_rates_download_sample_file($file_name){
692
+    function customer_rates_download_sample_file($file_name) {
693 693
         $this->load->helper('download');
694 694
 		$full_path = base_url()."assets/Rates_File/".$file_name.".csv";
695
-		$arrContextOptions=array(
695
+		$arrContextOptions = array(
696 696
 			"ssl"=>array(
697 697
 			"verify_peer"=>false,
698 698
 			"verify_peer_name"=>false,
@@ -701,19 +701,19 @@  discard block
 block discarded – undo
701 701
         $file = file_get_contents($full_path, false, stream_context_create($arrContextOptions));
702 702
         force_download("samplefile.csv", $file); 
703 703
     }
704
-    function termination_rate_batch_update(){
704
+    function termination_rate_batch_update() {
705 705
         $batch_update_arr = $this->input->post();
706
-	$batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000";
707
-	$batch_update_arr["connectcost"]["connectcost"] = isset($batch_update_arr["connectcost"]["connectcost"])?$this->common_model->add_calculate_currency($batch_update_arr["connectcost"]["connectcost"], '', '', true, false):"0.0000";
706
+	$batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false) : "0.0000";
707
+	$batch_update_arr["connectcost"]["connectcost"] = isset($batch_update_arr["connectcost"]["connectcost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["connectcost"]["connectcost"], '', '', true, false) : "0.0000";
708 708
 //        $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4"));
709 709
         $result = $this->rates_model->termination_rate_batch_update($batch_update_arr);
710 710
         echo json_encode(array("SUCCESS"=> "Termination rates batch updated successfully!"));
711 711
         exit;
712 712
     }
713 713
     
714
-    function origination_rate_batch_update(){
714
+    function origination_rate_batch_update() {
715 715
         $batch_update_arr = $this->input->post();
716
-	     $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000";
716
+	     $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false) : "0.0000";
717 717
 //        $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4"));
718 718
         $result = $this->rates_model->origination_rate_batch_update($batch_update_arr);
719 719
         echo json_encode(array("SUCCESS"=> "Origination rates batch updated successfully!"));
@@ -722,23 +722,23 @@  discard block
 block discarded – undo
722 722
 
723 723
     function termination_rate_export_cdr_xls() {
724 724
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
725
-		$currency_id=$account_info['currency_id'];
726
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
725
+		$currency_id = $account_info['currency_id'];
726
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
727 727
         $query = $this->rates_model->get_termination_rate(true, '', '', false);
728 728
         $outbound_array = array();
729 729
         ob_clean();
730
-        $outbound_array[] = array("Code", "Destination",  "Connect Cost($currency)", "Included Seconds","Per Minute Cost($currency)","Initial Increment", "Increment","Priority","Strip","Prepend","Trunk","Status","Created Date");
730
+        $outbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Initial Increment", "Increment", "Priority", "Strip", "Prepend", "Trunk", "Status", "Created Date");
731 731
         if ($query->num_rows() > 0) {
732 732
 
733 733
             foreach ($query->result_array() as $row) {
734 734
 				//echo"<pre>";print_r($row);exit;
735 735
                     $outbound_array[] = array(
736
-                        $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
736
+                        $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
737 737
                         $row['comment'],
738
-                        $this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false),
738
+                        $this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false),
739 739
                         
740 740
                         $row['includedseconds'],
741
-			$this->common_model->calculate_currency($row['cost'],'','',TRUE,false),
741
+			$this->common_model->calculate_currency($row['cost'], '', '', TRUE, false),
742 742
 /**
743 743
 ASTPP  3.0 
744 744
 For Add Initial Increment field
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
                         $row['strip'],
751 751
                         $row['prepend'],
752 752
                         //$row['trunk_id'],
753
-                        $this->common->get_field_name('name','trunks',$row["trunk_id"]),
753
+                        $this->common->get_field_name('name', 'trunks', $row["trunk_id"]),
754 754
                         $this->common->get_status('export', '', $row['status']),
755 755
                         $row['creation_date'],
756 756
                         
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
             }
760 760
         $this->load->helper('csv');
761 761
         
762
-        array_to_csv($outbound_array, 'Termination_Rates_' . date("Y-m-d") . '.csv');
762
+        array_to_csv($outbound_array, 'Termination_Rates_'.date("Y-m-d").'.csv');
763 763
        
764 764
     }
765 765
 
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
         $this->load->library('pdf');
771 771
         $this->fpdf = new PDF('P', 'pt');
772 772
         $this->fpdf->initialize('P', 'mm', 'A4');
773
-        $this->fpdf->tablewidths = array(20, 30, 20, 20, 20, 20, 20,20,20);
774
-        $outbound_array[] = array("Code", "Destination",  "Connect Cost","Included Seconds","Per Minute Cost","Initial Increment", "Increment","Precedence","Prepend","Strip");
773
+        $this->fpdf->tablewidths = array(20, 30, 20, 20, 20, 20, 20, 20, 20);
774
+        $outbound_array[] = array("Code", "Destination", "Connect Cost", "Included Seconds", "Per Minute Cost", "Initial Increment", "Increment", "Precedence", "Prepend", "Strip");
775 775
         if ($query->num_rows() > 0) {
776 776
 
777 777
             foreach ($query->result_array() as $row) {
778 778
                     $outbound_array[] = array(
779
-			$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
779
+			$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
780 780
                         $row['comment'],
781 781
                         $row['connectcost'],
782 782
                         $row['includedseconds'],
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 
800 800
         $this->fpdf->SetFont('Arial', '', 15);
801 801
         $this->fpdf->SetXY(60, 5);
802
-        $this->fpdf->Cell(100, 10, "Outbound Rates Report " . date('Y-m-d'));
802
+        $this->fpdf->Cell(100, 10, "Outbound Rates Report ".date('Y-m-d'));
803 803
 
804 804
         $this->fpdf->SetY(20);
805 805
         $this->fpdf->SetFont('Arial', '', 7);
@@ -807,29 +807,29 @@  discard block
 block discarded – undo
807 807
         $this->fpdf->lMargin = 2;
808 808
 
809 809
         $dimensions = $this->fpdf->export_pdf($outbound_array, "7");
810
-        $this->fpdf->Output('Termination_Rate_' . date("Y-m-d") . '.pdf', "D");
810
+        $this->fpdf->Output('Termination_Rate_'.date("Y-m-d").'.pdf', "D");
811 811
     }
812 812
     
813 813
 
814 814
     function origination_rate_export_cdr_xls() {
815 815
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
816
-		$currency_id=$account_info['currency_id'];
817
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
816
+		$currency_id = $account_info['currency_id'];
817
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
818 818
         $query = $this->rates_model->get_origination_rate(true, '', '', false);
819 819
 	//echo "<pre>";print_r($query);exit;
820 820
         $inbound_array = array();
821 821
         ob_clean();
822
-        $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)", "Initial Increment", "Increment","Rate Group","Status","Created Date");
822
+        $inbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Initial Increment", "Increment", "Rate Group", "Status", "Created Date");
823 823
         if ($query->num_rows() > 0) {
824 824
 
825 825
             foreach ($query->result_array() as $row) {
826 826
 				//echo"<pre>";print_r($row);exit;
827 827
                     $inbound_array[] = array(
828
-                        $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
828
+                        $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
829 829
                         $row['comment'],
830
-                        $this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false),
830
+                        $this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false),
831 831
                         $row['includedseconds'],
832
-                        $this->common_model->calculate_currency($row['cost'],'','',TRUE,false),
832
+                        $this->common_model->calculate_currency($row['cost'], '', '', TRUE, false),
833 833
 /**
834 834
 ASTPP  3.0 
835 835
 For Add Initial Increment field
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
                 }
846 846
             }
847 847
         $this->load->helper('csv');
848
-        array_to_csv($inbound_array, 'Origination_Rates_' . date("Y-m-d") . '.csv');
848
+        array_to_csv($inbound_array, 'Origination_Rates_'.date("Y-m-d").'.csv');
849 849
     }
850 850
     function origination_rate_export_cdr_pdf() {
851 851
         $query = $this->rates_model->get_origination_rate(true, '', '', false);
@@ -856,15 +856,15 @@  discard block
 block discarded – undo
856 856
         $this->fpdf = new PDF('P', 'pt');
857 857
         $this->fpdf->initialize('P', 'mm', 'A4');
858 858
         $this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20);
859
-	$inbound_array[] = array("Code", "Destination","Connect Cost","Included Seconds","Per Minute Cost","Initial Increment","Increment");
859
+	$inbound_array[] = array("Code", "Destination", "Connect Cost", "Included Seconds", "Per Minute Cost", "Initial Increment", "Increment");
860 860
         if ($query->num_rows() > 0) {
861 861
             foreach ($query->result_array() as $row) {
862 862
                     $inbound_array[] = array(
863
-                       $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
863
+                       $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
864 864
                         $row['comment'],
865 865
                         $row['connectcost'],
866 866
                         $row['includedseconds'],
867
-                        $this->common_model->calculate_currency($row['cost'],'','','',false),
867
+                        $this->common_model->calculate_currency($row['cost'], '', '', '', false),
868 868
 /**
869 869
 ASTPP  3.0 
870 870
 For Add Initial Increment field
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 
881 881
         $this->fpdf->SetFont('Arial', '', 15);
882 882
         $this->fpdf->SetXY(60, 5);
883
-        $this->fpdf->Cell(100, 10, "Origination Rates Report " . date('Y-m-d'));
883
+        $this->fpdf->Cell(100, 10, "Origination Rates Report ".date('Y-m-d'));
884 884
 
885 885
         $this->fpdf->SetY(20);
886 886
         $this->fpdf->SetFont('Arial', '', 7);
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
         $this->fpdf->lMargin = 2;
889 889
 
890 890
         $dimensions = $this->fpdf->export_pdf($inbound_array, "5");
891
-        $this->fpdf->Output('Origination_Rate_' . date("Y-m-d") . '.pdf', "D");
891
+        $this->fpdf->Output('Origination_Rate_'.date("Y-m-d").'.pdf', "D");
892 892
     }
893 893
 
894 894
   
@@ -900,14 +900,14 @@  discard block
 block discarded – undo
900 900
         $this->fpdf = new PDF('P', 'pt');
901 901
         $this->fpdf->initialize('P', 'mm', 'A4');
902 902
 	$this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20);
903
-        $inbound_array[] = array("Code", "Destination", "Increment","Cost Per Minutes",  "Connect Charge", "Included Seconds");
903
+        $inbound_array[] = array("Code", "Destination", "Increment", "Cost Per Minutes", "Connect Charge", "Included Seconds");
904 904
         if ($query->num_rows() > 0) {
905 905
             foreach ($query->result_array() as $row) {
906 906
                     $inbound_array[] = array(
907
-                       $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
907
+                       $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
908 908
                         $row['comment'],
909 909
                         $row['inc'],
910
-			$this->common_model->calculate_currency($row['cost'],'','','',false),
910
+			$this->common_model->calculate_currency($row['cost'], '', '', '', false),
911 911
                         $row['connectcost'],
912 912
                         $row['includedseconds']
913 913
                     );
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 
920 920
         $this->fpdf->SetFont('Arial', '', 15);
921 921
         $this->fpdf->SetXY(60, 5);
922
-        $this->fpdf->Cell(100, 10, "Rates Report " . date('Y-m-d'));
922
+        $this->fpdf->Cell(100, 10, "Rates Report ".date('Y-m-d'));
923 923
 
924 924
         $this->fpdf->SetY(20);
925 925
         $this->fpdf->SetFont('Arial', '', 7);
@@ -927,12 +927,12 @@  discard block
 block discarded – undo
927 927
         $this->fpdf->lMargin = 2;
928 928
 
929 929
         $dimensions = $this->fpdf->export_pdf($inbound_array, "5");
930
-        $this->fpdf->Output('Rates_' . date("Y-m-d") . '.pdf', "D");
930
+        $this->fpdf->Output('Rates_'.date("Y-m-d").'.pdf', "D");
931 931
     }
932
-    function resellersrates_list(){
933
-	$accountinfo=$this->session->userdata('accountinfo');
932
+    function resellersrates_list() {
933
+	$accountinfo = $this->session->userdata('accountinfo');
934 934
 	$data['username'] = $this->session->userdata('user_name');
935
-        $data['page_title'] = 'My Rates' ;
935
+        $data['page_title'] = 'My Rates';
936 936
         $data['search_flag'] = true;
937 937
         $this->session->set_userdata('advance_search', 0);
938 938
         $data['grid_fields'] = $this->rates_form->build_rates_list_for_reseller();
@@ -952,11 +952,11 @@  discard block
 block discarded – undo
952 952
         $grid_fields = json_decode($this->rates_form->build_rates_list_for_reseller());
953 953
         foreach ($query->result_array() as $key => $value) {
954 954
             $json_data['rows'][] = array('cell' => array(
955
-                    $this->common->get_only_numeric_val("","",$value["pattern"]),
955
+                    $this->common->get_only_numeric_val("", "", $value["pattern"]),
956 956
                     $value['comment'],
957
-                    $this->common_model->calculate_currency($value['connectcost'],'','','true',true),
957
+                    $this->common_model->calculate_currency($value['connectcost'], '', '', 'true', true),
958 958
                     $value['includedseconds'],
959
-                    $this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','true',true),
959
+                    $this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100), '', '', 'true', true),
960 960
                     $value['inc'],
961 961
                     $value['precedence'],
962 962
             ));
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
             $this->session->set_userdata('resellerrates_list_search', $action);
977 977
         }
978 978
         if (@$ajax_search != 1) {
979
-            redirect(base_url() . 'rates/resellersrates_list/');
979
+            redirect(base_url().'rates/resellersrates_list/');
980 980
         }
981 981
     }
982 982
     function resellersrates_list_clearsearchfilter() {
@@ -986,13 +986,13 @@  discard block
 block discarded – undo
986 986
     function resellersrates_xls()
987 987
     {
988 988
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
989
-		$currency_id=$account_info['currency_id'];
990
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
991
-	$query = $this->rates_model->getreseller_rates_list(true,'0','0','1');
989
+		$currency_id = $account_info['currency_id'];
990
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
991
+	$query = $this->rates_model->getreseller_rates_list(true, '0', '0', '1');
992 992
 	$customer_array = array();
993 993
 	ob_clean();
994 994
 
995
-	$customer_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)","Increment","Precedence");
995
+	$customer_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Increment", "Precedence");
996 996
 
997 997
 
998 998
 	if ($query->num_rows() > 0) {
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
             foreach ($query->result_array() as $row) {
1001 1001
                 
1002 1002
                     $customer_array[] = array(
1003
-                        $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
1003
+                        $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
1004 1004
                         $row['comment'],
1005 1005
                         $row['connectcost'],
1006 1006
 			$row['includedseconds'],
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
             }
1013 1013
         }
1014 1014
         $this->load->helper('csv');
1015
-        array_to_csv($customer_array, 'My_Own_Rate_' . date("Y-m-d") . '.csv');
1015
+        array_to_csv($customer_array, 'My_Own_Rate_'.date("Y-m-d").'.csv');
1016 1016
         exit;
1017 1017
     }
1018 1018
 /***********
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
             $this->session->set_userdata('termination_rates_list_search', $action);
1030 1030
         }
1031 1031
         if (@$ajax_search != 1) {
1032
-            redirect(base_url() . 'rates/termination_rates_list/');
1032
+            redirect(base_url().'rates/termination_rates_list/');
1033 1033
         }
1034 1034
     }
1035 1035
     function origination_rates_list_batch_delete() {
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
             $this->session->set_userdata('origination_rate_list_search', $action);
1043 1043
         }
1044 1044
         if (@$ajax_search != 1) {
1045
-            redirect(base_url() . 'rates/origination_rates_list/');
1045
+            redirect(base_url().'rates/origination_rates_list/');
1046 1046
         }
1047 1047
     }
1048 1048
 /*************************/
Please login to merge, or discard this patch.
Braces   +21 added lines, -25 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
         $this->load->library('csvreader');
35 35
 	ini_set("memory_limit","2048M");
36 36
 	ini_set("max_execution_time","259200");
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 termination_rates_list() {
@@ -109,18 +110,17 @@  discard block
 block discarded – undo
109 110
 			  $data['check_header']=$check_header;
110 111
 			  $data['page_title'] = 'Termination Rates Preview';
111 112
 			  $this->session->set_userdata('import_termination_rate_csv',$actual_file_name);
112
-			}else{
113
+			} else{
113 114
 			  $data['error'] = "File Uploading Fail Please Try Again";
114 115
 			}
115 116
                     }
116
-                }
117
-                else{
117
+                } else{
118 118
                     $data['error']=="File Uploading Fail Please Try Again";
119 119
                 }
120
-            }else {
120
+            } else {
121 121
                 $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
122 122
             }
123
-        }else{
123
+        } else{
124 124
 		$invalid_flag=true;
125 125
         }
126 126
         if ($invalid_flag) {
@@ -163,8 +163,7 @@  discard block
 block discarded – undo
163 163
 	    if($str != ""){
164 164
 	      $invalid_array[$i]=$csv_data;
165 165
 	      $invalid_array[$i]['error'] = $str;
166
-	    }
167
-	    else{
166
+	    } else{
168 167
 	      $csv_data['trunk_id']=$trunkID;
169 168
 	      $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
170 169
 	      $new_final_arr[$i]=$csv_data;
@@ -252,19 +251,17 @@  discard block
 block discarded – undo
252 251
                         $data['page_title'] = "Origination Rates Preview";
253 252
                         $data['check_header']=$check_header;
254 253
                         $this->session->set_userdata('import_origination_rate_csv',$actual_file_name);
255
-                    }else{
254
+                    } else{
256 255
                         $data['error'] = "File Uploading Fail Please Try Again";
257 256
                     }
258 257
                 }
259
-             }   
260
-            else{
258
+             } else{
261 259
                     $data['error']=="File Uploading Fail Please Try Again";
262 260
                 }
263
-           }
264
-           else {
261
+           } else {
265 262
                 $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
266 263
             }
267
-            }else{
264
+            } else{
268 265
 		$invalid_flag=true;
269 266
             }
270 267
         if ($invalid_flag) {
@@ -308,8 +305,7 @@  discard block
 block discarded – undo
308 305
 	    if($str != ""){
309 306
 	      $invalid_array[$i]=$csv_data;
310 307
 	      $invalid_array[$i]['error'] = $str;
311
-	    }
312
-	    else{
308
+	    } else{
313 309
 	      $csv_data['pricelist_id']=$pricelistID;
314 310
 	      $csv_data['trunk_id']=$trunkid;
315 311
 	      $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
@@ -371,12 +367,10 @@  discard block
 block discarded – undo
371 367
 		$count = count($error_field);
372 368
 		$str.= $count > 1 ? ' are not valid' : ' is not Valid';
373 369
 		return $str;
374
-	      }
375
-	      else{
370
+	      } else{
376 371
 	      return false;
377 372
 	      }
378
-	  }
379
-	  else{
373
+	  } else{
380 374
 	  $str=rtrim($str,',');
381 375
 	    $error_field=explode(',',$str);
382 376
 	    $count = count($error_field);
@@ -617,13 +611,15 @@  discard block
 block discarded – undo
617 611
         $where = array('accountid' => $accountid);
618 612
         $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
619 613
         $like_str=!empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" :null;
620
-        if(!empty($like_str))
621
-        $this->db->where($like_str);
614
+        if(!empty($like_str)) {
615
+                $this->db->where($like_str);
616
+        }
622 617
         $count_all = $this->db_model->countQuery("*", "block_patterns", $where);
623 618
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
624 619
         $json_data = $paging_data["json_paging"];
625
-        if(!empty($like_str))
626
-        $this->db->where($like_str);
620
+        if(!empty($like_str)) {
621
+                $this->db->where($like_str);
622
+        }
627 623
         $pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
628 624
         $grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid,$accounttype));
629 625
         $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/libraries/rates_form.php 3 patches
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -21,422 +21,422 @@
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 if (!defined('BASEPATH'))
24
-    exit('No direct script access allowed');
24
+	exit('No direct script access allowed');
25 25
 
26 26
 class rates_form {
27
-    function __construct($library_name = '') {
28
-        $this->CI = & get_instance();
29
-    }
30
-    function get_termination_rate_form_fields() {
31
-        $form['forms'] = array(base_url() . 'rates/termination_rate_save/', array('id' => 'termination_rate_form', 'method' => 'POST', 'name' => 'termination_rate_form'));
32
-        $form['Rate Information'] = array(
33
-        array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
34
-            array('Trunk', 'trunk_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),     
35
-            array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
36
-            array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20',  'class' => "text field medium"), 'tOOL TIP', ''),            
37
-            array('Strip', 'INPUT', array('name' => 'strip', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
38
-            array('Prepend', 'INPUT', array('name' => 'prepend', 'size' => '20',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
39
-            array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
27
+	function __construct($library_name = '') {
28
+		$this->CI = & get_instance();
29
+	}
30
+	function get_termination_rate_form_fields() {
31
+		$form['forms'] = array(base_url() . 'rates/termination_rate_save/', array('id' => 'termination_rate_form', 'method' => 'POST', 'name' => 'termination_rate_form'));
32
+		$form['Rate Information'] = array(
33
+		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
34
+			array('Trunk', 'trunk_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),     
35
+			array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
36
+			array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20',  'class' => "text field medium"), 'tOOL TIP', ''),            
37
+			array('Strip', 'INPUT', array('name' => 'strip', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
38
+			array('Prepend', 'INPUT', array('name' => 'prepend', 'size' => '20',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
39
+			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
40 40
             
41 41
         
42 42
 );
43
-        $form['Billing Information'] = array(
44
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
45
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
46
-             array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
43
+		$form['Billing Information'] = array(
44
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
45
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
46
+			 array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
47 47
 /**
48 48
 ASTPP  3.0 
49 49
 For Add Initial Increment field
50 50
 **/
51
-	    array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
51
+		array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
52 52
 /*******************************************************/
53
-            array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
54
-            array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''));
53
+			array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
54
+			array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''));
55 55
 	
56
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
57
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
56
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
57
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
58 58
 
59
-        return $form;
60
-    }
59
+		return $form;
60
+	}
61 61
 
62
-    function get_origination_rate_form_fields() {
62
+	function get_origination_rate_form_fields() {
63 63
 	 $logintype=$this->CI->session->userdata('userlevel_logintype');
64
-        $trunk=null;
65
-        if($logintype !=1)
64
+		$trunk=null;
65
+		if($logintype !=1)
66 66
 	  $trunk = array('Force Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"));
67
-        $form['forms'] = array(base_url() . 'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
68
-        $form['Rate Information'] = array(
69
-            array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
70
-            array('Rate Group', 'pricelist_id', 'SELECT', '','', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0",'reseller_id'=>0)),        
71
-            array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
72
-            array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), 'tOOL TIP', ''),
73
-            //array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
74
-            array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
67
+		$form['forms'] = array(base_url() . 'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
68
+		$form['Rate Information'] = array(
69
+			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
70
+			array('Rate Group', 'pricelist_id', 'SELECT', '','', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0",'reseller_id'=>0)),        
71
+			array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
72
+			array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), 'tOOL TIP', ''),
73
+			//array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
74
+			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
75 75
         
76 76
 );
77
-        $form['Billing Information'] = array(
78
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
79
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
80
-             array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
77
+		$form['Billing Information'] = array(
78
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
79
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
80
+			 array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
81 81
 /**
82 82
 ASTPP  3.0 
83 83
 For Add Initial Increment field
84 84
 **/
85
-    	    array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
85
+			array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
86 86
 /********************************************************************/
87
-            array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
88
-            $trunk,
87
+			array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
88
+			$trunk,
89 89
             
90 90
         
91 91
 );
92 92
 
93
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
94
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
93
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
94
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
95 95
 
96
-        return $form;
97
-    }
96
+		return $form;
97
+	}
98 98
 	
99
-    function get_termination_rate_search_form() {
100
-        $form['forms'] = array("", array('id' => "termination_rate_search"));
101
-        $form['Search'] = array(
99
+	function get_termination_rate_search_form() {
100
+		$form['forms'] = array("", array('id' => "termination_rate_search"));
101
+		$form['Search'] = array(
102 102
             
103
-            array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
104
-            array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
105
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
106
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
107
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
103
+			array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
104
+			array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
105
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
106
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
107
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
108 108
 /**
109 109
 ASTPP  3.0 
110 110
 For Add Initial Increment field
111 111
 **/
112 112
 			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', ''),
113 113
 /***************************************************************/
114
-	    array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
115
-                array('Priority', 'INPUT', array('name' => 'prepend[prepend]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'prepend[prepend-string]', '', '', '', 'search_string_type', ''),
116
-            array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
117
-           array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
114
+		array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
115
+				array('Priority', 'INPUT', array('name' => 'prepend[prepend]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'prepend[prepend-string]', '', '', '', 'search_string_type', ''),
116
+			array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
117
+		   array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
118 118
  /******
119 119
 ASTPP  3.0 
120 120
 Batch Delete
121 121
 ******/
122
-	         array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),            
122
+			 array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),            
123 123
 /************************/           
124 124
 		 array('', 'HIDDEN', 'advance_search', '1', '', '', '')
125 125
             
126 126
             
127
-        );
127
+		);
128 128
 /******
129 129
 ASTPP  3.0 
130 130
 Batch Delete
131 131
 ******/
132
-        $form['button_search_delete'] = array('name' => 'action', 'id' => "termination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'submit', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
132
+		$form['button_search_delete'] = array('name' => 'action', 'id' => "termination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'submit', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
133 133
 
134 134
 /***********************/
135 135
 /******
136 136
 ASTPP  3.0 
137 137
 Batch Delete
138 138
 ******/
139
-        $form['button_search'] = array('name' => 'action', 'id' => "termination_rate_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right margin-x-10');
139
+		$form['button_search'] = array('name' => 'action', 'id' => "termination_rate_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right margin-x-10');
140 140
 /***********************/
141
-        $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');
141
+		$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');
142 142
 
143
-        return $form;
144
-    }
143
+		return $form;
144
+	}
145 145
 
146 146
     
147
-    function termination_rate_batch_update_form() {
148
-        $form['forms'] = array("rates/termination_rate_batch_update/", array('id' => "termination_rate_batch_update"));
149
-        $form['Batch Update'] = array(
150
-	    array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
151
-	    array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
152
-	    array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]','id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
147
+	function termination_rate_batch_update_form() {
148
+		$form['forms'] = array("rates/termination_rate_batch_update/", array('id' => "termination_rate_batch_update"));
149
+		$form['Batch Update'] = array(
150
+		array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
151
+		array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
152
+		array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]','id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
153 153
             
154
-	    array('Increment', 'INPUT', array('name' => 'inc[inc]','id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
155
-	    array('Priority', 'INPUT', array('name' => 'precedence[precedence]','id'=>'precedence', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'precedence[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
156
-	    array('Prepand', 'INPUT', array('name' => 'prepend[prepend]','id'=>'prepend', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'prepend[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
157
-            array('Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type'),
158
-        );
154
+		array('Increment', 'INPUT', array('name' => 'inc[inc]','id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
155
+		array('Priority', 'INPUT', array('name' => 'precedence[precedence]','id'=>'precedence', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'precedence[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
156
+		array('Prepand', 'INPUT', array('name' => 'prepend[prepend]','id'=>'prepend', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'prepend[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
157
+			array('Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type'),
158
+		);
159 159
 
160
-        $form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' =>'btn btn-line-parrot pull-right');
161
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
160
+		$form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' =>'btn btn-line-parrot pull-right');
161
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
162 162
 
163
-        return $form;
164
-    }
165
-    function origination_rate_batch_update_form() {
166
-    $logintype=$this->CI->session->userdata('userlevel_logintype');
167
-            $trunk=null;
168
-        if($logintype !=1)
163
+		return $form;
164
+	}
165
+	function origination_rate_batch_update_form() {
166
+	$logintype=$this->CI->session->userdata('userlevel_logintype');
167
+			$trunk=null;
168
+		if($logintype !=1)
169 169
 	  $trunk = array('Force Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type');
170
-        $form['forms'] = array("rates/origination_rate_batch_update/",array('id' => "origination_rate_batch_update"));        
171
-        $form['Batch Update'] = array(
172
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
173
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
174
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
175
-            array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
176
-            array('Rate Group', array('name'=> 'pricelist_id[pricelist_id]','id'=>'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0"),array('name'=>'pricelist_id[operator]','class'=>'update_drp'), 'update_drp_type'),
177
-           $trunk,
178
-        );
170
+		$form['forms'] = array("rates/origination_rate_batch_update/",array('id' => "origination_rate_batch_update"));        
171
+		$form['Batch Update'] = array(
172
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
173
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
174
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
175
+			array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
176
+			array('Rate Group', array('name'=> 'pricelist_id[pricelist_id]','id'=>'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0"),array('name'=>'pricelist_id[operator]','class'=>'update_drp'), 'update_drp_type'),
177
+		   $trunk,
178
+		);
179 179
 
180
-        $form['button_search'] = array('name' => 'action', 'id' => "batch_update", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
181
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' =>'btn btn-line-sky pull-right margin-x-10');
180
+		$form['button_search'] = array('name' => 'action', 'id' => "batch_update", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
181
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' =>'btn btn-line-sky pull-right margin-x-10');
182 182
 
183
-        return $form;
184
-    }
183
+		return $form;
184
+	}
185 185
     
186
-         function build_rates_list_for_reseller() {
186
+		 function build_rates_list_for_reseller() {
187 187
 			 
188 188
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
189 189
 $currency_id=$account_info['currency_id'];
190 190
 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);			 
191 191
 			 
192
-        $grid_field_arr = json_encode(array(array('Code', "140", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
193
-		    array('Destination', "240", "comment", "", "", ""),
194
-		    array('Connection Cost('.$currency.')', "210", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
195
-		    array('Included Seconds', "180", "includedseconds", "", "", "","","true","center"),
196
-		    array('Per Minute Cost('.$currency.')', "180", "cost", "cost", "cost", "convert_to_currency","","true","right"),
197
-		    array('Increment', "140", "inc", "", "", "","","true","center"),
198
-		    array('Priority', "155", "precedence", "", "", "","","true","center"),
199
-                ));
200
-        return $grid_field_arr;
201
-    }
202
-    function get_reseller_origination_rate_search_form() {
192
+		$grid_field_arr = json_encode(array(array('Code', "140", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
193
+			array('Destination', "240", "comment", "", "", ""),
194
+			array('Connection Cost('.$currency.')', "210", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
195
+			array('Included Seconds', "180", "includedseconds", "", "", "","","true","center"),
196
+			array('Per Minute Cost('.$currency.')', "180", "cost", "cost", "cost", "convert_to_currency","","true","right"),
197
+			array('Increment', "140", "inc", "", "", "","","true","center"),
198
+			array('Priority', "155", "precedence", "", "", "","","true","center"),
199
+				));
200
+		return $grid_field_arr;
201
+	}
202
+	function get_reseller_origination_rate_search_form() {
203 203
 	$accountinfo=$this->CI->session->userdata('accountinfo');
204 204
 	
205
-        $form['forms'] = array("", array('id' => "resellerrates_list_search"));
206
-        $form['Search My Rates'] = array(
205
+		$form['forms'] = array("", array('id' => "resellerrates_list_search"));
206
+		$form['Search My Rates'] = array(
207 207
            
208
-            array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
209
-            array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
210
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
211
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
212
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
213
-	    array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
214
-            array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
215
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
216
-        );
208
+			array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
209
+			array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
210
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
211
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
212
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
213
+		array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
214
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
215
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
216
+		);
217 217
 
218
-        $form['button_search'] = array('name' => 'action', 'id' => "resellerrates_list_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
219
-        $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');
218
+		$form['button_search'] = array('name' => 'action', 'id' => "resellerrates_list_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
219
+		$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');
220 220
 
221
-        return $form;
222
-    }
223
-    function get_origination_rate_search_form() {
224
-        $form['forms'] = array("", array('id' => "origination_rate_list_search"));
225
-        $form['Search'] = array(
221
+		return $form;
222
+	}
223
+	function get_origination_rate_search_form() {
224
+		$form['forms'] = array("", array('id' => "origination_rate_list_search"));
225
+		$form['Search'] = array(
226 226
            
227
-            array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
228
-            array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
229
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
230
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
231
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
227
+			array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
228
+			array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
229
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
230
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
231
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
232 232
 /**
233 233
 ASTPP  3.0 
234 234
 For Add Initial Increment field
235 235
 **/
236
-            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', ''),
236
+			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', ''),
237 237
 /**************************************************************/
238 238
 			array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
239
-            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id"=>"0")),
239
+			array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id"=>"0")),
240 240
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
241
-            array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
242
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
243
-        );
241
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
242
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
243
+		);
244 244
 /******
245 245
 ASTPP  3.0 
246 246
 Batch Delete
247 247
 ******/
248
-        $form['button_search_delete'] = array('name' => 'action', 'id' => "origination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'save', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
248
+		$form['button_search_delete'] = array('name' => 'action', 'id' => "origination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'save', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
249 249
 
250 250
 /***********************/
251 251
 /******** 
252 252
 ASTPP  3.0 
253 253
 Batch delete
254 254
 *********/
255
-        $form['button_search'] = array('name' => 'action', 'id' => "origination_rate_list_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right  margin-x-10');
255
+		$form['button_search'] = array('name' => 'action', 'id' => "origination_rate_list_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right  margin-x-10');
256 256
 /**************************/
257
-        $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');
257
+		$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');
258 258
 
259
-        return $form;
260
-    }
259
+		return $form;
260
+	}
261 261
     
262 262
     
263 263
 
264
-    /*
264
+	/*
265 265
     ASTPP  3.0
266 266
     changes in grid size
267 267
     */
268 268
 
269
-    function build_termination_rate_for_admin() {
269
+	function build_termination_rate_for_admin() {
270 270
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
271 271
 $currency_id=$account_info['currency_id'];
272 272
 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
273 273
 		
274
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
275
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
274
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
275
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
276 276
 /**
277 277
 ASTPP  3.0
278 278
 For Termination Rate edit on Code
279 279
 **/
280
-            array("Code", "78", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
280
+			array("Code", "78", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
281 281
 /*********************************/
282
-            array("Destination", "80", "comment", "", "", "","","true","center"),
283
-            array("Connect Cost($currency)", "125", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
284
-            array("Included<br/> Seconds", "70", "includedseconds", "", "", "","","true","center"),
285
-            array("Per Minute <br/>Cost($currency)", "100", "cost", "cost", "cost", "convert_to_currency","","true","right"),
286
-  	    array("Initial <br/> Increment", "95", "init_inc", "", "", "","","true","center"),
287
-            array("Increment", "75", "inc", "", "", "","","true","center"),
288
-            array("Priority", "70", "precedence", "", "", "","","true","center"),
289
-            array("Strip","60", "strip", "", "", "","","true","center"),
290
-            array("Prepend", "70", "prepend", "pattern", "", "get_only_numeric_val","","true","center"),
291
-            array("Trunk", "80", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
292
-           /*
282
+			array("Destination", "80", "comment", "", "", "","","true","center"),
283
+			array("Connect Cost($currency)", "125", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
284
+			array("Included<br/> Seconds", "70", "includedseconds", "", "", "","","true","center"),
285
+			array("Per Minute <br/>Cost($currency)", "100", "cost", "cost", "cost", "convert_to_currency","","true","right"),
286
+  		array("Initial <br/> Increment", "95", "init_inc", "", "", "","","true","center"),
287
+			array("Increment", "75", "inc", "", "", "","","true","center"),
288
+			array("Priority", "70", "precedence", "", "", "","","true","center"),
289
+			array("Strip","60", "strip", "", "", "","","true","center"),
290
+			array("Prepend", "70", "prepend", "pattern", "", "get_only_numeric_val","","true","center"),
291
+			array("Trunk", "80", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
292
+		   /*
293 293
             ASTPP  3.0 
294 294
             creation field show in grid
295 295
             */
296
-            array("Status", "100", "status", "status", "outbound_routes", "get_status","","true","center"),
296
+			array("Status", "100", "status", "status", "outbound_routes", "get_status","","true","center"),
297 297
 //            array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
298
-            array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
299
-            /********************************************************************/
300
-             /*
298
+			array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
299
+			/********************************************************************/
300
+			 /*
301 301
             ASTPP  3.0
302 302
              status show active or inactive
303 303
             */
304 304
        
305
-            /***********************************************************************/
305
+			/***********************************************************************/
306 306
 //             array("Reseller", "103", "reseller_id", "number", "accounts", "get_field_name"),
307
-            array("Action", "80", "", "", "", array("EDIT" => array("url" => "rates/termination_rate_edit/", "mode" => "popup","layout"=>"medium"),
308
-                    "DELETE" => array("url" => "rates/termination_rate_delete/", "mode" => "single")))
309
-                ));
310
-        return $grid_field_arr;
311
-    }
312
-    /**************************************************/
307
+			array("Action", "80", "", "", "", array("EDIT" => array("url" => "rates/termination_rate_edit/", "mode" => "popup","layout"=>"medium"),
308
+					"DELETE" => array("url" => "rates/termination_rate_delete/", "mode" => "single")))
309
+				));
310
+		return $grid_field_arr;
311
+	}
312
+	/**************************************************/
313 313
 	
314 314
    /*
315 315
    ASTPP  3.0 
316 316
     changes in grid size
317 317
    */
318
-    function build_origination_rate_list_for_admin() {
318
+	function build_origination_rate_list_for_admin() {
319 319
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
320 320
 $currency_id=$account_info['currency_id'];
321 321
 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
322 322
 		
323
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
324
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
323
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
324
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
325 325
 /**
326 326
 ASTPP  3.0 
327 327
 For Origination rate edit on code
328 328
 **/
329
-            array("Code", "75", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
329
+			array("Code", "75", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
330 330
 /************************************/
331
-            array("Destination", "100", "comment", "", "", "","","true","center"),
332
-            array("Connect Cost($currency)", "130", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
333
-            array("Included Seconds", "120", "includedseconds", "", "", "","","true","center"),
334
-            array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency","","true","right"),
331
+			array("Destination", "100", "comment", "", "", "","","true","center"),
332
+			array("Connect Cost($currency)", "130", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
333
+			array("Included Seconds", "120", "includedseconds", "", "", "","","true","center"),
334
+			array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency","","true","right"),
335 335
 /**
336 336
 ASTPP  3.0 
337 337
 For Add Initial Increment field
338 338
 **/
339 339
 			array("Initial Increment", "130", "init_inc", "", "", "","","true","center"),
340 340
 /*******************************************************************/
341
-            array("Increment", "90", "inc", "", "", "","","true","center"),
342
-            //array("Priority", "72", "precedence", "", "", "","","true","center"),
343
-            array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
344
-            /*
341
+			array("Increment", "90", "inc", "", "", "","","true","center"),
342
+			//array("Priority", "72", "precedence", "", "", "","","true","center"),
343
+			array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
344
+			/*
345 345
             ASTPP  3.0  creation field show in grid
346 346
             */
347
-            array("Status", "100", "status", "status", "routes", "get_status","","true","center"),
347
+			array("Status", "100", "status", "status", "routes", "get_status","","true","center"),
348 348
 //            array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
349
-            array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
349
+			array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
350 350
 
351
-            /********************************************************************/
352
-            /*
351
+			/********************************************************************/
352
+			/*
353 353
             ASTPP  3.0
354 354
             chnage in status active or inactive
355 355
             */
356 356
             
357
-            array("Action", "95", "", "", "", array("EDIT" => array("url" => "rates/origination_rate_edit/", "mode" => "popup","layout"=>"medium"),
358
-                    "DELETE" => array("url" => "/rates/origination_rate_delete/", "mode" => "single")))
359
-                ));
360
-        return $grid_field_arr;
361
-    }
362
-    /****************************************************************************************/
357
+			array("Action", "95", "", "", "", array("EDIT" => array("url" => "rates/origination_rate_edit/", "mode" => "popup","layout"=>"medium"),
358
+					"DELETE" => array("url" => "/rates/origination_rate_delete/", "mode" => "single")))
359
+				));
360
+		return $grid_field_arr;
361
+	}
362
+	/****************************************************************************************/
363 363
 
364
-    function build_grid_buttons() {
365
-        $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/termination_rate_add/", "popup","medium"),
366
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/termination_rate_delete_multiple/"),
367
-            array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import/", 'single'),
368
-            array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/termination_rate_export_cdr_xls/", 'single')
369
-            ));
370
-        return $buttons_json;
371
-    }
364
+	function build_grid_buttons() {
365
+		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/termination_rate_add/", "popup","medium"),
366
+			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/termination_rate_delete_multiple/"),
367
+			array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import/", 'single'),
368
+			array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/termination_rate_export_cdr_xls/", 'single')
369
+			));
370
+		return $buttons_json;
371
+	}
372 372
 
373
-    function build_grid_buttons_origination_rate() {
374
-        $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/origination_rate_add/", "popup","medium"),
375
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/origination_rate_delete_multiple/"),
376
-            array("import", "btn btn-line-blue","fa fa-upload fa-lg", "button_action", "/rates/origination_rate_import/", 'single'),
377
-            array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/origination_rate_export_cdr_xls/", 'single')
373
+	function build_grid_buttons_origination_rate() {
374
+		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/origination_rate_add/", "popup","medium"),
375
+			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/origination_rate_delete_multiple/"),
376
+			array("import", "btn btn-line-blue","fa fa-upload fa-lg", "button_action", "/rates/origination_rate_import/", 'single'),
377
+			array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/origination_rate_export_cdr_xls/", 'single')
378 378
             
379
-            ));
380
-        return $buttons_json;
381
-    }
379
+			));
380
+		return $buttons_json;
381
+	}
382 382
 
383
-    function build_termination_rate_list_for_customer() {
384
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
385
-        $grid_field_arr = json_encode(array(
386
-            array("<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
387
-            array("Code", "70", "pattern", "pattern", "", "get_only_numeric_val"),
388
-            array("Increment", "75", "inc", "", "", ""),
389
-            array("Connect <br> Charge", "100", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
390
-            array("Included <br> Seconds", "100", "includedseconds", "", "", ""),
391
-            array("Destination", "100", "comment", "", "", ""),
392
-            array("Cost per <br> Minutes", "100", "cost", "cost", "cost", "convert_to_currency"),
393
-            array("Priority", "80", "precedence", "", "", ""),
394
-            array("Reseller", "80", "reseller_id", "number", "accounts", "get_field_name")
395
-                ));
396
-        return $grid_field_arr;
397
-    }
398
-    function build_block_pattern_list_for_customer() {
399
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
400
-        $grid_field_arr = json_encode(array(
401
-            array("<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>", "30", "", "", "", "","","false","center","PatternChkBox"),
402
-            array("Code", "350", "pattern", "pattern", "", "get_only_numeric_val"),
403
-            array("Destination", "350", "comment", "", "", ""),
404
-                ));
405
-        return $grid_field_arr;
406
-    }
407
-    function build_pattern_list_for_customer($accountid,$accounttype) {
383
+	function build_termination_rate_list_for_customer() {
384
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
385
+		$grid_field_arr = json_encode(array(
386
+			array("<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
387
+			array("Code", "70", "pattern", "pattern", "", "get_only_numeric_val"),
388
+			array("Increment", "75", "inc", "", "", ""),
389
+			array("Connect <br> Charge", "100", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
390
+			array("Included <br> Seconds", "100", "includedseconds", "", "", ""),
391
+			array("Destination", "100", "comment", "", "", ""),
392
+			array("Cost per <br> Minutes", "100", "cost", "cost", "cost", "convert_to_currency"),
393
+			array("Priority", "80", "precedence", "", "", ""),
394
+			array("Reseller", "80", "reseller_id", "number", "accounts", "get_field_name")
395
+				));
396
+		return $grid_field_arr;
397
+	}
398
+	function build_block_pattern_list_for_customer() {
399
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
400
+		$grid_field_arr = json_encode(array(
401
+			array("<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>", "30", "", "", "", "","","false","center","PatternChkBox"),
402
+			array("Code", "350", "pattern", "pattern", "", "get_only_numeric_val"),
403
+			array("Destination", "350", "comment", "", "", ""),
404
+				));
405
+		return $grid_field_arr;
406
+	}
407
+	function build_pattern_list_for_customer($accountid,$accounttype) {
408 408
 
409
-        $grid_field_arr = json_encode(array(
410
-            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
411
-            array("Code", "450", "blocked_patterns", "blocked_patterns", "", "get_only_numeric_val"),
412
-            array("Destination", "450", "destination", "", "", ""),
413
-            array("Action", "100", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_delete_block_pattern/$accountid/", "mode" => "single")))
414
-                ));
415
-        return $grid_field_arr;
416
-    }
409
+		$grid_field_arr = json_encode(array(
410
+			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
411
+			array("Code", "450", "blocked_patterns", "blocked_patterns", "", "get_only_numeric_val"),
412
+			array("Destination", "450", "destination", "", "", ""),
413
+			array("Action", "100", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_delete_block_pattern/$accountid/", "mode" => "single")))
414
+				));
415
+		return $grid_field_arr;
416
+	}
417 417
 
418
-    function set_pattern_grid_buttons($accountid) {
419
-        $buttons_json = json_encode(array(array("Add Prefixes","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add_blockpatterns/$accountid", "popup")));
420
-        return $buttons_json;
421
-    }
418
+	function set_pattern_grid_buttons($accountid) {
419
+		$buttons_json = json_encode(array(array("Add Prefixes","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add_blockpatterns/$accountid", "popup")));
420
+		return $buttons_json;
421
+	}
422 422
 
423
-    function build_origination_rate_list_for_user() {
424
-              // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
425
-        $grid_field_arr = json_encode(array(array("Code", "155", "pattern", "pattern", "", "get_only_numeric_val"),
426
-	      array("Destination", "225", "comment", "", "", ""),
427
-	      array("Increment", "235", "inc", "", "", ""),
428
-	      array("Cost per Minutes", "240", "cost", "cost", "cost", "convert_to_currency"),
429
-	      array("Connect Charge", "200", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
430
-	      array("Included Seconds", "200", "includedseconds", "", "", "")
423
+	function build_origination_rate_list_for_user() {
424
+			  // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
425
+		$grid_field_arr = json_encode(array(array("Code", "155", "pattern", "pattern", "", "get_only_numeric_val"),
426
+		  array("Destination", "225", "comment", "", "", ""),
427
+		  array("Increment", "235", "inc", "", "", ""),
428
+		  array("Cost per Minutes", "240", "cost", "cost", "cost", "convert_to_currency"),
429
+		  array("Connect Charge", "200", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
430
+		  array("Included Seconds", "200", "includedseconds", "", "", "")
431 431
 	));
432
-        return $grid_field_arr;
433
-    }
432
+		return $grid_field_arr;
433
+	}
434 434
 
435 435
 
436 436
 function build_grid_buttons_rates() {
437
-        $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/resellersrates_xls/", 'single')));
438
-        return $buttons_json;
439
-    }
437
+		$buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/resellersrates_xls/", 'single')));
438
+		return $buttons_json;
439
+	}
440 440
 
441 441
 
442 442
 }
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 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 rates_form {
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
         $this->CI = & get_instance();
29 29
     }
30 30
     function get_termination_rate_form_fields() {
31
-        $form['forms'] = array(base_url() . 'rates/termination_rate_save/', array('id' => 'termination_rate_form', 'method' => 'POST', 'name' => 'termination_rate_form'));
31
+        $form['forms'] = array(base_url().'rates/termination_rate_save/', array('id' => 'termination_rate_form', 'method' => 'POST', 'name' => 'termination_rate_form'));
32 32
         $form['Rate Information'] = array(
33 33
         array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
34 34
             array('Trunk', 'trunk_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),     
35
-            array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
36
-            array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20',  'class' => "text field medium"), 'tOOL TIP', ''),            
37
-            array('Strip', 'INPUT', array('name' => 'strip', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
38
-            array('Prepend', 'INPUT', array('name' => 'prepend', 'size' => '20',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
35
+            array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
36
+            array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), 'tOOL TIP', ''),            
37
+            array('Strip', 'INPUT', array('name' => 'strip', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
38
+            array('Prepend', 'INPUT', array('name' => 'prepend', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
39 39
             array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
40 40
             
41 41
         
42 42
 );
43 43
         $form['Billing Information'] = array(
44
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
44
+            array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
45 45
             array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
46 46
              array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
47 47
 /**
48 48
 ASTPP  3.0 
49 49
 For Add Initial Increment field
50 50
 **/
51
-	    array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
51
+	    array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
52 52
 /*******************************************************/
53
-            array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
53
+            array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
54 54
             array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''));
55 55
 	
56 56
         $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
     }
61 61
 
62 62
     function get_origination_rate_form_fields() {
63
-	 $logintype=$this->CI->session->userdata('userlevel_logintype');
64
-        $trunk=null;
65
-        if($logintype !=1)
63
+	 $logintype = $this->CI->session->userdata('userlevel_logintype');
64
+        $trunk = null;
65
+        if ($logintype != 1)
66 66
 	  $trunk = array('Force Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"));
67
-        $form['forms'] = array(base_url() . 'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
67
+        $form['forms'] = array(base_url().'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
68 68
         $form['Rate Information'] = array(
69 69
             array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
70
-            array('Rate Group', 'pricelist_id', 'SELECT', '','', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0",'reseller_id'=>0)),        
70
+            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", 'reseller_id'=>0)),        
71 71
             array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
72 72
             array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), 'tOOL TIP', ''),
73 73
             //array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         
76 76
 );
77 77
         $form['Billing Information'] = array(
78
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
79
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
80
-             array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
78
+            array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
79
+            array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
80
+             array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
81 81
 /**
82 82
 ASTPP  3.0 
83 83
 For Add Initial Increment field
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 /***************************************************************/
114 114
 	    array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
115 115
                 array('Priority', 'INPUT', array('name' => 'prepend[prepend]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'prepend[prepend-string]', '', '', '', 'search_string_type', ''),
116
-            array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
116
+            array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")), array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
117 117
            array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
118 118
  /******
119 119
 ASTPP  3.0 
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 ASTPP  3.0 
130 130
 Batch Delete
131 131
 ******/
132
-        $form['button_search_delete'] = array('name' => 'action', 'id' => "termination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'submit', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
132
+        $form['button_search_delete'] = array('name' => 'action', 'id' => "termination_rate_batch_dlt", 'onclick'=>"check_btn();", 'content' => 'Delete Search Record', 'style'=>'display:none;', 'value' => 'submit', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
133 133
 
134 134
 /***********************/
135 135
 /******
136 136
 ASTPP  3.0 
137 137
 Batch Delete
138 138
 ******/
139
-        $form['button_search'] = array('name' => 'action', 'id' => "termination_rate_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right margin-x-10');
139
+        $form['button_search'] = array('name' => 'action', 'id' => "termination_rate_search_btn", 'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right margin-x-10');
140 140
 /***********************/
141 141
         $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');
142 142
 
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
     function termination_rate_batch_update_form() {
148 148
         $form['forms'] = array("rates/termination_rate_batch_update/", array('id' => "termination_rate_batch_update"));
149 149
         $form['Batch Update'] = array(
150
-	    array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
151
-	    array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
152
-	    array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]','id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
150
+	    array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
151
+	    array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
152
+	    array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
153 153
             
154
-	    array('Increment', 'INPUT', array('name' => 'inc[inc]','id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
155
-	    array('Priority', 'INPUT', array('name' => 'precedence[precedence]','id'=>'precedence', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'precedence[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
156
-	    array('Prepand', 'INPUT', array('name' => 'prepend[prepend]','id'=>'prepend', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'prepend[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
157
-            array('Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type'),
154
+	    array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
155
+	    array('Priority', 'INPUT', array('name' => 'precedence[precedence]', 'id'=>'precedence', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'precedence[operator]', 'class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
156
+	    array('Prepand', 'INPUT', array('name' => 'prepend[prepend]', 'id'=>'prepend', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'prepend[operator]', 'class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
157
+            array('Trunk', array('name'=> 'trunk_id[trunk_id]', 'id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"), array('name'=>'trunk_id[operator]', 'class'=>'update_drp'), 'update_drp_type'),
158 158
         );
159 159
 
160 160
         $form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' =>'btn btn-line-parrot pull-right');
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
         return $form;
164 164
     }
165 165
     function origination_rate_batch_update_form() {
166
-    $logintype=$this->CI->session->userdata('userlevel_logintype');
167
-            $trunk=null;
168
-        if($logintype !=1)
169
-	  $trunk = array('Force Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type');
170
-        $form['forms'] = array("rates/origination_rate_batch_update/",array('id' => "origination_rate_batch_update"));        
166
+    $logintype = $this->CI->session->userdata('userlevel_logintype');
167
+            $trunk = null;
168
+        if ($logintype != 1)
169
+	  $trunk = array('Force Trunk', array('name'=> 'trunk_id[trunk_id]', 'id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"), array('name'=>'trunk_id[operator]', 'class'=>'update_drp'), 'update_drp_type');
170
+        $form['forms'] = array("rates/origination_rate_batch_update/", array('id' => "origination_rate_batch_update"));        
171 171
         $form['Batch Update'] = array(
172
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
173
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
174
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
175
-            array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
176
-            array('Rate Group', array('name'=> 'pricelist_id[pricelist_id]','id'=>'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0"),array('name'=>'pricelist_id[operator]','class'=>'update_drp'), 'update_drp_type'),
172
+            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
173
+            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
174
+            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
175
+            array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]', 'class'=>'update_drp'), '', '', '', 'update_int_type', ''),
176
+            array('Rate Group', array('name'=> 'pricelist_id[pricelist_id]', 'id'=>'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0"), array('name'=>'pricelist_id[operator]', 'class'=>'update_drp'), 'update_drp_type'),
177 177
            $trunk,
178 178
         );
179 179
 
@@ -186,21 +186,21 @@  discard block
 block discarded – undo
186 186
          function build_rates_list_for_reseller() {
187 187
 			 
188 188
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
189
-$currency_id=$account_info['currency_id'];
190
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);			 
189
+$currency_id = $account_info['currency_id'];
190
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);			 
191 191
 			 
192
-        $grid_field_arr = json_encode(array(array('Code', "140", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
192
+        $grid_field_arr = json_encode(array(array('Code', "140", "pattern", "pattern", "", "get_only_numeric_val", "", "true", "center"),
193 193
 		    array('Destination', "240", "comment", "", "", ""),
194
-		    array('Connection Cost('.$currency.')', "210", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
195
-		    array('Included Seconds', "180", "includedseconds", "", "", "","","true","center"),
196
-		    array('Per Minute Cost('.$currency.')', "180", "cost", "cost", "cost", "convert_to_currency","","true","right"),
197
-		    array('Increment', "140", "inc", "", "", "","","true","center"),
198
-		    array('Priority', "155", "precedence", "", "", "","","true","center"),
194
+		    array('Connection Cost('.$currency.')', "210", "connectcost", "connectcost", "connectcost", "convert_to_currency", "", "true", "right"),
195
+		    array('Included Seconds', "180", "includedseconds", "", "", "", "", "true", "center"),
196
+		    array('Per Minute Cost('.$currency.')', "180", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
197
+		    array('Increment', "140", "inc", "", "", "", "", "true", "center"),
198
+		    array('Priority', "155", "precedence", "", "", "", "", "true", "center"),
199 199
                 ));
200 200
         return $grid_field_arr;
201 201
     }
202 202
     function get_reseller_origination_rate_search_form() {
203
-	$accountinfo=$this->CI->session->userdata('accountinfo');
203
+	$accountinfo = $this->CI->session->userdata('accountinfo');
204 204
 	
205 205
         $form['forms'] = array("", array('id' => "resellerrates_list_search"));
206 206
         $form['Search My Rates'] = array(
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             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', ''),
237 237
 /**************************************************************/
238 238
 			array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
239
-            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id"=>"0")),
239
+            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id"=>"0")),
240 240
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
241 241
             array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
242 242
             array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 ASTPP  3.0 
246 246
 Batch Delete
247 247
 ******/
248
-        $form['button_search_delete'] = array('name' => 'action', 'id' => "origination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'save', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
248
+        $form['button_search_delete'] = array('name' => 'action', 'id' => "origination_rate_batch_dlt", 'onclick'=>"check_btn();", 'content' => 'Delete Search Record', 'style'=>'display:none;', 'value' => 'save', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
249 249
 
250 250
 /***********************/
251 251
 /******** 
252 252
 ASTPP  3.0 
253 253
 Batch delete
254 254
 *********/
255
-        $form['button_search'] = array('name' => 'action', 'id' => "origination_rate_list_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right  margin-x-10');
255
+        $form['button_search'] = array('name' => 'action', 'id' => "origination_rate_list_search_btn", 'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right  margin-x-10');
256 256
 /**************************/
257 257
         $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');
258 258
 
@@ -268,34 +268,34 @@  discard block
 block discarded – undo
268 268
 
269 269
     function build_termination_rate_for_admin() {
270 270
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
271
-$currency_id=$account_info['currency_id'];
272
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
271
+$currency_id = $account_info['currency_id'];
272
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
273 273
 		
274 274
         // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
275
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
275
+        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
276 276
 /**
277 277
 ASTPP  3.0
278 278
 For Termination Rate edit on Code
279 279
 **/
280
-            array("Code", "78", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
280
+            array("Code", "78", "pattern", "pattern", "", "get_only_numeric_val", "EDITABLE", "true", "center"),
281 281
 /*********************************/
282
-            array("Destination", "80", "comment", "", "", "","","true","center"),
283
-            array("Connect Cost($currency)", "125", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
284
-            array("Included<br/> Seconds", "70", "includedseconds", "", "", "","","true","center"),
285
-            array("Per Minute <br/>Cost($currency)", "100", "cost", "cost", "cost", "convert_to_currency","","true","right"),
286
-  	    array("Initial <br/> Increment", "95", "init_inc", "", "", "","","true","center"),
287
-            array("Increment", "75", "inc", "", "", "","","true","center"),
288
-            array("Priority", "70", "precedence", "", "", "","","true","center"),
289
-            array("Strip","60", "strip", "", "", "","","true","center"),
290
-            array("Prepend", "70", "prepend", "pattern", "", "get_only_numeric_val","","true","center"),
291
-            array("Trunk", "80", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
282
+            array("Destination", "80", "comment", "", "", "", "", "true", "center"),
283
+            array("Connect Cost($currency)", "125", "connectcost", "connectcost", "connectcost", "convert_to_currency", "", "true", "right"),
284
+            array("Included<br/> Seconds", "70", "includedseconds", "", "", "", "", "true", "center"),
285
+            array("Per Minute <br/>Cost($currency)", "100", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
286
+  	    array("Initial <br/> Increment", "95", "init_inc", "", "", "", "", "true", "center"),
287
+            array("Increment", "75", "inc", "", "", "", "", "true", "center"),
288
+            array("Priority", "70", "precedence", "", "", "", "", "true", "center"),
289
+            array("Strip", "60", "strip", "", "", "", "", "true", "center"),
290
+            array("Prepend", "70", "prepend", "pattern", "", "get_only_numeric_val", "", "true", "center"),
291
+            array("Trunk", "80", "trunk_id", "name", "trunks", "get_field_name", "", "true", "center"),
292 292
            /*
293 293
             ASTPP  3.0 
294 294
             creation field show in grid
295 295
             */
296
-            array("Status", "100", "status", "status", "outbound_routes", "get_status","","true","center"),
296
+            array("Status", "100", "status", "status", "outbound_routes", "get_status", "", "true", "center"),
297 297
 //            array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
298
-            array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
298
+            array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
299 299
             /********************************************************************/
300 300
              /*
301 301
             ASTPP  3.0
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
        
305 305
             /***********************************************************************/
306 306
 //             array("Reseller", "103", "reseller_id", "number", "accounts", "get_field_name"),
307
-            array("Action", "80", "", "", "", array("EDIT" => array("url" => "rates/termination_rate_edit/", "mode" => "popup","layout"=>"medium"),
307
+            array("Action", "80", "", "", "", array("EDIT" => array("url" => "rates/termination_rate_edit/", "mode" => "popup", "layout"=>"medium"),
308 308
                     "DELETE" => array("url" => "rates/termination_rate_delete/", "mode" => "single")))
309 309
                 ));
310 310
         return $grid_field_arr;
@@ -317,36 +317,36 @@  discard block
 block discarded – undo
317 317
    */
318 318
     function build_origination_rate_list_for_admin() {
319 319
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
320
-$currency_id=$account_info['currency_id'];
321
-$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
320
+$currency_id = $account_info['currency_id'];
321
+$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
322 322
 		
323 323
         // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
324
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
324
+        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
325 325
 /**
326 326
 ASTPP  3.0 
327 327
 For Origination rate edit on code
328 328
 **/
329
-            array("Code", "75", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
329
+            array("Code", "75", "pattern", "pattern", "", "get_only_numeric_val", "EDITABLE", "true", "center"),
330 330
 /************************************/
331
-            array("Destination", "100", "comment", "", "", "","","true","center"),
332
-            array("Connect Cost($currency)", "130", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
333
-            array("Included Seconds", "120", "includedseconds", "", "", "","","true","center"),
334
-            array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency","","true","right"),
331
+            array("Destination", "100", "comment", "", "", "", "", "true", "center"),
332
+            array("Connect Cost($currency)", "130", "connectcost", "connectcost", "connectcost", "convert_to_currency", "", "true", "right"),
333
+            array("Included Seconds", "120", "includedseconds", "", "", "", "", "true", "center"),
334
+            array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency", "", "true", "right"),
335 335
 /**
336 336
 ASTPP  3.0 
337 337
 For Add Initial Increment field
338 338
 **/
339
-			array("Initial Increment", "130", "init_inc", "", "", "","","true","center"),
339
+			array("Initial Increment", "130", "init_inc", "", "", "", "", "true", "center"),
340 340
 /*******************************************************************/
341
-            array("Increment", "90", "inc", "", "", "","","true","center"),
341
+            array("Increment", "90", "inc", "", "", "", "", "true", "center"),
342 342
             //array("Priority", "72", "precedence", "", "", "","","true","center"),
343
-            array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
343
+            array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
344 344
             /*
345 345
             ASTPP  3.0  creation field show in grid
346 346
             */
347
-            array("Status", "100", "status", "status", "routes", "get_status","","true","center"),
347
+            array("Status", "100", "status", "status", "routes", "get_status", "", "true", "center"),
348 348
 //            array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
349
-            array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
349
+            array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
350 350
 
351 351
             /********************************************************************/
352 352
             /*
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
             chnage in status active or inactive
355 355
             */
356 356
             
357
-            array("Action", "95", "", "", "", array("EDIT" => array("url" => "rates/origination_rate_edit/", "mode" => "popup","layout"=>"medium"),
357
+            array("Action", "95", "", "", "", array("EDIT" => array("url" => "rates/origination_rate_edit/", "mode" => "popup", "layout"=>"medium"),
358 358
                     "DELETE" => array("url" => "/rates/origination_rate_delete/", "mode" => "single")))
359 359
                 ));
360 360
         return $grid_field_arr;
@@ -362,19 +362,19 @@  discard block
 block discarded – undo
362 362
     /****************************************************************************************/
363 363
 
364 364
     function build_grid_buttons() {
365
-        $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/termination_rate_add/", "popup","medium"),
366
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/termination_rate_delete_multiple/"),
367
-            array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import/", 'single'),
368
-            array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/termination_rate_export_cdr_xls/", 'single')
365
+        $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/rates/termination_rate_add/", "popup", "medium"),
366
+            array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/rates/termination_rate_delete_multiple/"),
367
+            array("import", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import/", 'single'),
368
+            array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/rates/termination_rate_export_cdr_xls/", 'single')
369 369
             ));
370 370
         return $buttons_json;
371 371
     }
372 372
 
373 373
     function build_grid_buttons_origination_rate() {
374
-        $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/origination_rate_add/", "popup","medium"),
375
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/origination_rate_delete_multiple/"),
376
-            array("import", "btn btn-line-blue","fa fa-upload fa-lg", "button_action", "/rates/origination_rate_import/", 'single'),
377
-            array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/origination_rate_export_cdr_xls/", 'single')
374
+        $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/rates/origination_rate_add/", "popup", "medium"),
375
+            array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/rates/origination_rate_delete_multiple/"),
376
+            array("import", "btn btn-line-blue", "fa fa-upload fa-lg", "button_action", "/rates/origination_rate_import/", 'single'),
377
+            array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/rates/origination_rate_export_cdr_xls/", 'single')
378 378
             
379 379
             ));
380 380
         return $buttons_json;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
     function build_termination_rate_list_for_customer() {
384 384
         // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
385 385
         $grid_field_arr = json_encode(array(
386
-            array("<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
386
+            array("<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
387 387
             array("Code", "70", "pattern", "pattern", "", "get_only_numeric_val"),
388 388
             array("Increment", "75", "inc", "", "", ""),
389 389
             array("Connect <br> Charge", "100", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
@@ -398,16 +398,16 @@  discard block
 block discarded – undo
398 398
     function build_block_pattern_list_for_customer() {
399 399
         // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
400 400
         $grid_field_arr = json_encode(array(
401
-            array("<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>", "30", "", "", "", "","","false","center","PatternChkBox"),
401
+            array("<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center", "PatternChkBox"),
402 402
             array("Code", "350", "pattern", "pattern", "", "get_only_numeric_val"),
403 403
             array("Destination", "350", "comment", "", "", ""),
404 404
                 ));
405 405
         return $grid_field_arr;
406 406
     }
407
-    function build_pattern_list_for_customer($accountid,$accounttype) {
407
+    function build_pattern_list_for_customer($accountid, $accounttype) {
408 408
 
409 409
         $grid_field_arr = json_encode(array(
410
-            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
410
+            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
411 411
             array("Code", "450", "blocked_patterns", "blocked_patterns", "", "get_only_numeric_val"),
412 412
             array("Destination", "450", "destination", "", "", ""),
413 413
             array("Action", "100", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_delete_block_pattern/$accountid/", "mode" => "single")))
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     }
417 417
 
418 418
     function set_pattern_grid_buttons($accountid) {
419
-        $buttons_json = json_encode(array(array("Add Prefixes","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add_blockpatterns/$accountid", "popup")));
419
+        $buttons_json = json_encode(array(array("Add Prefixes", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add_blockpatterns/$accountid", "popup")));
420 420
         return $buttons_json;
421 421
     }
422 422
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 
435 435
 
436 436
 function build_grid_buttons_rates() {
437
-        $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/resellersrates_xls/", 'single')));
437
+        $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/rates/resellersrates_xls/", 'single')));
438 438
         return $buttons_json;
439 439
     }
440 440
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 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 rates_form {
27 28
     function __construct($library_name = '') {
@@ -62,8 +63,9 @@  discard block
 block discarded – undo
62 63
     function get_origination_rate_form_fields() {
63 64
 	 $logintype=$this->CI->session->userdata('userlevel_logintype');
64 65
         $trunk=null;
65
-        if($logintype !=1)
66
-	  $trunk = array('Force Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"));
66
+        if($logintype !=1) {
67
+        	  $trunk = array('Force Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"));
68
+        }
67 69
         $form['forms'] = array(base_url() . 'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
68 70
         $form['Rate Information'] = array(
69 71
             array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
@@ -165,8 +167,9 @@  discard block
 block discarded – undo
165 167
     function origination_rate_batch_update_form() {
166 168
     $logintype=$this->CI->session->userdata('userlevel_logintype');
167 169
             $trunk=null;
168
-        if($logintype !=1)
169
-	  $trunk = array('Force Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type');
170
+        if($logintype !=1) {
171
+        	  $trunk = array('Force Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type');
172
+        }
170 173
         $form['forms'] = array("rates/origination_rate_batch_update/",array('id' => "origination_rate_batch_update"));        
171 174
         $form['Batch Update'] = array(
172 175
             array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
Please login to merge, or discard this patch.