@@ -50,19 +50,19 @@ discard block |
||
50 | 50 | <select name="accountid" class='col-md-5 form-control selectpicker' data-live-search='true'> |
51 | 51 | <option value=''>--Select--</option> |
52 | 52 | <?php if (!empty($accountlist)) { |
53 | - foreach ($accountlist as $key => $value) { |
|
54 | - ?> |
|
53 | + foreach ($accountlist as $key => $value) { |
|
54 | + ?> |
|
55 | 55 | <optgroup label="<?php echo $key ?>"> |
56 | 56 | <?php |
57 | - foreach ($value as $sub_key => $sub_value) { |
|
58 | - $selected = null; |
|
59 | - if (isset($session_info['accountid']) && $session_info['accountid'] > 0 && $sub_key == $session_info['accountid']) { |
|
60 | - $selected = "selected"; |
|
61 | - } |
|
62 | - ?> |
|
57 | + foreach ($value as $sub_key => $sub_value) { |
|
58 | + $selected = null; |
|
59 | + if (isset($session_info['accountid']) && $session_info['accountid'] > 0 && $sub_key == $session_info['accountid']) { |
|
60 | + $selected = "selected"; |
|
61 | + } |
|
62 | + ?> |
|
63 | 63 | <option value='<?php echo $sub_key; ?>'<?php echo $selected; ?>><?php echo $sub_value ?></option> |
64 | 64 | <? } |
65 | - ?> |
|
65 | + ?> |
|
66 | 66 | </optgroup> |
67 | 67 | <? } |
68 | 68 | } |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | <input type="text" name="pattern[pattern]" value="<?php echo (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern'])) ? $session_info['pattern']['pattern'] : ''; ?>" size="20" maxlength="15" class="col-md-5 form-control text field "/> |
75 | 75 | <select name="pattern[pattern-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
76 | 76 | <?php |
77 | - if (!empty($search_string_type)) { |
|
78 | - foreach ($search_string_type as $key => $value) { |
|
79 | - $selected = null; |
|
80 | - if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) { |
|
81 | - $selected = "selected"; |
|
82 | - } |
|
83 | - ?> |
|
77 | + if (!empty($search_string_type)) { |
|
78 | + foreach ($search_string_type as $key => $value) { |
|
79 | + $selected = null; |
|
80 | + if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) { |
|
81 | + $selected = "selected"; |
|
82 | + } |
|
83 | + ?> |
|
84 | 84 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
85 | 85 | <?php } |
86 | 86 | } |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | <input type="text" name="notes[notes]" value="<?php echo (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes'])) ? $session_info['notes']['notes'] : ''; ?>" size="20" class="col-md-5 form-control text field " /> |
93 | 93 | <select name="notes[notes-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
94 | 94 | <?php |
95 | - if (!empty($search_string_type)) { |
|
96 | - foreach ($search_string_type as $key => $value) { |
|
97 | - $selected = null; |
|
98 | - if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) { |
|
99 | - $selected = "selected"; |
|
100 | - } |
|
101 | - ?> |
|
95 | + if (!empty($search_string_type)) { |
|
96 | + foreach ($search_string_type as $key => $value) { |
|
97 | + $selected = null; |
|
98 | + if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) { |
|
99 | + $selected = "selected"; |
|
100 | + } |
|
101 | + ?> |
|
102 | 102 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
103 | 103 | <?php } |
104 | 104 | } |
@@ -120,68 +120,68 @@ discard block |
||
120 | 120 | <label class="search_label col-md-12 no-padding">Group By #Time</label> |
121 | 121 | <select name="time" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
122 | 122 | <?php |
123 | - if (!empty($groupby_time)) { |
|
124 | - foreach ($groupby_time as $key => $value) { |
|
125 | - $selected = null; |
|
126 | - if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) { |
|
127 | - $selected = "selected"; |
|
128 | - } |
|
129 | - ?> |
|
123 | + if (!empty($groupby_time)) { |
|
124 | + foreach ($groupby_time as $key => $value) { |
|
125 | + $selected = null; |
|
126 | + if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) { |
|
127 | + $selected = "selected"; |
|
128 | + } |
|
129 | + ?> |
|
130 | 130 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
131 | 131 | <?php } |
132 | - } |
|
133 | - ?> |
|
132 | + } |
|
133 | + ?> |
|
134 | 134 | </select> |
135 | 135 | </div> |
136 | 136 | <div class="col-md-3 no-padding"> |
137 | 137 | <label class="search_label col-md-12 no-padding">Group By #1</label> |
138 | 138 | <select name="groupby_1" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
139 | 139 | <?php |
140 | - if (!empty($groupby_field)) { |
|
141 | - foreach ($groupby_field as $key => $value) { |
|
142 | - $selected = null; |
|
143 | - if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
144 | - $selected = "selected"; |
|
145 | - } |
|
146 | - ?> |
|
140 | + if (!empty($groupby_field)) { |
|
141 | + foreach ($groupby_field as $key => $value) { |
|
142 | + $selected = null; |
|
143 | + if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
144 | + $selected = "selected"; |
|
145 | + } |
|
146 | + ?> |
|
147 | 147 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
148 | 148 | <?php } |
149 | - } |
|
150 | - ?> |
|
149 | + } |
|
150 | + ?> |
|
151 | 151 | </select> |
152 | 152 | </div> |
153 | 153 | <div class="col-md-3 no-padding"> |
154 | 154 | <label class="search_label col-md-12 no-padding">Group By #2</label> |
155 | 155 | <select name="groupby_2" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
156 | 156 | <?php |
157 | - if (!empty($groupby_field)) { |
|
158 | - foreach ($groupby_field as $key => $value) { |
|
159 | - $selected = null; |
|
160 | - if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
161 | - $selected = "selected"; |
|
162 | - } |
|
163 | - ?> |
|
157 | + if (!empty($groupby_field)) { |
|
158 | + foreach ($groupby_field as $key => $value) { |
|
159 | + $selected = null; |
|
160 | + if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
161 | + $selected = "selected"; |
|
162 | + } |
|
163 | + ?> |
|
164 | 164 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
165 | 165 | <?php } |
166 | - } |
|
167 | - ?> |
|
166 | + } |
|
167 | + ?> |
|
168 | 168 | </select> |
169 | 169 | </div> |
170 | 170 | <div class="col-md-3 no-padding"> |
171 | 171 | <label class="search_label col-md-12 no-padding">Group By #3</label> |
172 | 172 | <select name="groupby_3" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
173 | 173 | <?php |
174 | - if (!empty($groupby_field)) { |
|
175 | - foreach ($groupby_field as $key => $value) { |
|
176 | - $selected = null; |
|
177 | - if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
178 | - $selected = "selected"; |
|
179 | - } |
|
180 | - ?> |
|
174 | + if (!empty($groupby_field)) { |
|
175 | + foreach ($groupby_field as $key => $value) { |
|
176 | + $selected = null; |
|
177 | + if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
178 | + $selected = "selected"; |
|
179 | + } |
|
180 | + ?> |
|
181 | 181 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
182 | 182 | <?php } |
183 | - } |
|
184 | - ?> |
|
183 | + } |
|
184 | + ?> |
|
185 | 185 | </select> |
186 | 186 | </div> |
187 | 187 | </fieldset> |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | <select name="search_in" class='col-md-5 form-control selectpicker' style='background: #ddd; width: 23% !important;' data-live-search='true'> |
195 | 195 | <?php |
196 | 196 | if (!empty($search_report)) { |
197 | - foreach ($search_report as $key => $value) { |
|
198 | - $selected = null; |
|
199 | - if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) { |
|
200 | - //echo $key;exit; |
|
201 | - $selected = "selected"; |
|
202 | - } |
|
203 | - ?> |
|
197 | + foreach ($search_report as $key => $value) { |
|
198 | + $selected = null; |
|
199 | + if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) { |
|
200 | + //echo $key;exit; |
|
201 | + $selected = "selected"; |
|
202 | + } |
|
203 | + ?> |
|
204 | 204 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
205 | 205 | <?php } |
206 | 206 | } |
@@ -50,19 +50,19 @@ discard block |
||
50 | 50 | <select name="accountid" class='col-md-5 form-control selectpicker' data-live-search='true'> |
51 | 51 | <option value=''>--Select--</option> |
52 | 52 | <?php if (!empty($accountlist)) { |
53 | - foreach ($accountlist as $key => $value) { |
|
54 | - ?> |
|
53 | + foreach ($accountlist as $key => $value) { |
|
54 | + ?> |
|
55 | 55 | <optgroup label="<?php echo $key ?>"> |
56 | 56 | <?php |
57 | - foreach ($value as $sub_key => $sub_value) { |
|
58 | - $selected = null; |
|
59 | - if (isset($session_info['accountid']) && $session_info['accountid'] > 0 && $sub_key == $session_info['accountid']) { |
|
60 | - $selected = "selected"; |
|
61 | - } |
|
62 | - ?> |
|
57 | + foreach ($value as $sub_key => $sub_value) { |
|
58 | + $selected = null; |
|
59 | + if (isset($session_info['accountid']) && $session_info['accountid'] > 0 && $sub_key == $session_info['accountid']) { |
|
60 | + $selected = "selected"; |
|
61 | + } |
|
62 | + ?> |
|
63 | 63 | <option value='<?php echo $sub_key; ?>'<?php echo $selected; ?>><?php echo $sub_value ?></option> |
64 | 64 | <? } |
65 | - ?> |
|
65 | + ?> |
|
66 | 66 | </optgroup> |
67 | 67 | <? } |
68 | 68 | } |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | <input type="text" name="pattern[pattern]" value="<?php echo (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern'])) ? $session_info['pattern']['pattern'] : ''; ?>" size="20" maxlength="15" class="col-md-5 form-control text field "/> |
75 | 75 | <select name="pattern[pattern-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
76 | 76 | <?php |
77 | - if (!empty($search_string_type)) { |
|
78 | - foreach ($search_string_type as $key => $value) { |
|
79 | - $selected = null; |
|
80 | - if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) { |
|
81 | - $selected = "selected"; |
|
82 | - } |
|
83 | - ?> |
|
77 | + if (!empty($search_string_type)) { |
|
78 | + foreach ($search_string_type as $key => $value) { |
|
79 | + $selected = null; |
|
80 | + if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) { |
|
81 | + $selected = "selected"; |
|
82 | + } |
|
83 | + ?> |
|
84 | 84 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
85 | 85 | <?php } |
86 | 86 | } |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | <input type="text" name="notes[notes]" value="<?php echo (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes'])) ? $session_info['notes']['notes'] : ''; ?>" size="20" class="col-md-5 form-control text field " /> |
93 | 93 | <select name="notes[notes-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
94 | 94 | <?php |
95 | - if (!empty($search_string_type)) { |
|
96 | - foreach ($search_string_type as $key => $value) { |
|
97 | - $selected = null; |
|
98 | - if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) { |
|
99 | - $selected = "selected"; |
|
100 | - } |
|
101 | - ?> |
|
95 | + if (!empty($search_string_type)) { |
|
96 | + foreach ($search_string_type as $key => $value) { |
|
97 | + $selected = null; |
|
98 | + if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) { |
|
99 | + $selected = "selected"; |
|
100 | + } |
|
101 | + ?> |
|
102 | 102 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
103 | 103 | <?php } |
104 | 104 | } |
@@ -120,68 +120,68 @@ discard block |
||
120 | 120 | <label class="search_label col-md-12 no-padding">Group By #time</label> |
121 | 121 | <select name="time" class='col-md-5 form-control' style='margin-left:5px; selectpicker' data-live-search='true'> |
122 | 122 | <?php |
123 | - if (!empty($groupby_time)) { |
|
124 | - foreach ($groupby_time as $key => $value) { |
|
125 | - $selected = null; |
|
126 | - if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) { |
|
127 | - $selected = "selected"; |
|
128 | - } |
|
129 | - ?> |
|
123 | + if (!empty($groupby_time)) { |
|
124 | + foreach ($groupby_time as $key => $value) { |
|
125 | + $selected = null; |
|
126 | + if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) { |
|
127 | + $selected = "selected"; |
|
128 | + } |
|
129 | + ?> |
|
130 | 130 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
131 | 131 | <?php } |
132 | - } |
|
133 | - ?> |
|
132 | + } |
|
133 | + ?> |
|
134 | 134 | </select> |
135 | 135 | </div> |
136 | 136 | <div class="col-md-3 no-padding"> |
137 | 137 | <label class="search_label col-md-12 no-padding">Group By #1</label> |
138 | 138 | <select name="groupby_1" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
139 | 139 | <?php |
140 | - if (!empty($groupby_field)) { |
|
141 | - foreach ($groupby_field as $key => $value) { |
|
142 | - $selected = null; |
|
143 | - if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
144 | - $selected = "selected"; |
|
145 | - } |
|
146 | - ?> |
|
140 | + if (!empty($groupby_field)) { |
|
141 | + foreach ($groupby_field as $key => $value) { |
|
142 | + $selected = null; |
|
143 | + if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
144 | + $selected = "selected"; |
|
145 | + } |
|
146 | + ?> |
|
147 | 147 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
148 | 148 | <?php } |
149 | - } |
|
150 | - ?> |
|
149 | + } |
|
150 | + ?> |
|
151 | 151 | </select> |
152 | 152 | </div> |
153 | 153 | <div class="col-md-3 no-padding"> |
154 | 154 | <label class="search_label col-md-12 no-padding">Group By #2</label> |
155 | 155 | <select name="groupby_2" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
156 | 156 | <?php |
157 | - if (!empty($groupby_field)) { |
|
158 | - foreach ($groupby_field as $key => $value) { |
|
159 | - $selected = null; |
|
160 | - if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
161 | - $selected = "selected"; |
|
162 | - } |
|
163 | - ?> |
|
157 | + if (!empty($groupby_field)) { |
|
158 | + foreach ($groupby_field as $key => $value) { |
|
159 | + $selected = null; |
|
160 | + if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
161 | + $selected = "selected"; |
|
162 | + } |
|
163 | + ?> |
|
164 | 164 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
165 | 165 | <?php } |
166 | - } |
|
167 | - ?> |
|
166 | + } |
|
167 | + ?> |
|
168 | 168 | </select> |
169 | 169 | </div> |
170 | 170 | <div class="col-md-3 no-padding"> |
171 | 171 | <label class="search_label col-md-12 no-padding">Group By #3</label> |
172 | 172 | <select name="groupby_3" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
173 | 173 | <?php |
174 | - if (!empty($groupby_field)) { |
|
175 | - foreach ($groupby_field as $key => $value) { |
|
176 | - $selected = null; |
|
177 | - if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
178 | - $selected = "selected"; |
|
179 | - } |
|
180 | - ?> |
|
174 | + if (!empty($groupby_field)) { |
|
175 | + foreach ($groupby_field as $key => $value) { |
|
176 | + $selected = null; |
|
177 | + if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
178 | + $selected = "selected"; |
|
179 | + } |
|
180 | + ?> |
|
181 | 181 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
182 | 182 | <?php } |
183 | - } |
|
184 | - ?> |
|
183 | + } |
|
184 | + ?> |
|
185 | 185 | </select> |
186 | 186 | </div> |
187 | 187 | </fieldset> |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | <select name="search_in" class='col-md-5 form-control selectpicker' style='background: #ddd; width: 23% !important;' data-live-search='true'> |
195 | 195 | <?php |
196 | 196 | if (!empty($search_report)) { |
197 | - foreach ($search_report as $key => $value) { |
|
198 | - $selected = null; |
|
199 | - if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) { |
|
200 | - //echo $key;exit; |
|
201 | - $selected = "selected"; |
|
202 | - } |
|
203 | - ?> |
|
197 | + foreach ($search_report as $key => $value) { |
|
198 | + $selected = null; |
|
199 | + if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) { |
|
200 | + //echo $key;exit; |
|
201 | + $selected = "selected"; |
|
202 | + } |
|
203 | + ?> |
|
204 | 204 | <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value ?></option> |
205 | 205 | <?php } |
206 | 206 | } |
@@ -24,95 +24,95 @@ |
||
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 | } |
@@ -24,127 +24,127 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | ?> |
@@ -369,28 +369,28 @@ |
||
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> |
@@ -24,13 +24,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ?> |
@@ -22,159 +22,159 @@ |
||
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 |
@@ -21,72 +21,72 @@ |
||
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 |
@@ -22,41 +22,41 @@ |
||
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 | } |