@@ -22,8 +22,9 @@ discard block |
||
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 Charges_form { |
29 | 30 | function __construct($library_name = '') { |
@@ -52,7 +53,7 @@ discard block |
||
52 | 53 | $account_data = $this->CI->session->userdata("accountinfo"); |
53 | 54 | $loginid = $account_data['id']; |
54 | 55 | |
55 | - }else{ |
|
56 | + } else{ |
|
56 | 57 | $loginid = "0"; |
57 | 58 | } |
58 | 59 | $form['forms'] = array("", array('id' => "charges_search")); |
@@ -105,13 +105,13 @@ |
||
105 | 105 | change status active or inactive. |
106 | 106 | */ |
107 | 107 | |
108 | - /***********************************************/ |
|
109 | - array(gettext("Action"), "150", "", "", "", array("EDIT" => array("url" => "charges/periodiccharges_edit/", "mode" => "popup", 'popup'), |
|
110 | - "DELETE" => array("url" => "charges/periodiccharges_delete/", "mode" => "single"))) |
|
111 | - )); |
|
112 | - return $grid_field_arr; |
|
113 | - } |
|
114 | - /********************************************/ |
|
108 | + /***********************************************/ |
|
109 | + array(gettext("Action"), "150", "", "", "", array("EDIT" => array("url" => "charges/periodiccharges_edit/", "mode" => "popup", 'popup'), |
|
110 | + "DELETE" => array("url" => "charges/periodiccharges_delete/", "mode" => "single"))) |
|
111 | + )); |
|
112 | + return $grid_field_arr; |
|
113 | + } |
|
114 | + /********************************************/ |
|
115 | 115 | |
116 | 116 | function build_grid_buttons() { |
117 | 117 | $buttons_json = json_encode(array(array("Create" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"), |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
25 | +if ( ! defined('BASEPATH')) |
|
26 | 26 | exit('No direct script access allowed'); |
27 | 27 | |
28 | 28 | class Charges_form { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | function get_charge_form_fields() { |
34 | - $form['forms'] = array(base_url() . 'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form')); |
|
34 | + $form['forms'] = array(base_url().'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form')); |
|
35 | 35 | $form['Information'] = array( |
36 | 36 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
37 | 37 | array('Name', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'), |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | $account_data = $this->CI->session->userdata("accountinfo"); |
53 | 53 | $loginid = $account_data['id']; |
54 | 54 | |
55 | - }else{ |
|
55 | + } else { |
|
56 | 56 | $loginid = "0"; |
57 | 57 | } |
58 | 58 | $form['forms'] = array("", array('id' => "charges_search")); |
59 | 59 | $form['Search'] = array( |
60 | 60 | array('Name', 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''), |
61 | - array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0,'reseller_id'=>$loginid)), |
|
61 | + array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0, 'reseller_id'=>$loginid)), |
|
62 | 62 | array('Amount', 'INPUT', array('name' => 'charge[charge]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'charge[charge-integer]', '', '', '', 'search_int_type', ''), |
63 | 63 | array('Billing Cycle', 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), |
64 | 64 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
@@ -77,28 +77,28 @@ discard block |
||
77 | 77 | function build_charge_list_for_admin() { |
78 | 78 | |
79 | 79 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
80 | - $currency_id=$account_info['currency_id']; |
|
81 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
80 | + $currency_id = $account_info['currency_id']; |
|
81 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
82 | 82 | |
83 | 83 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
84 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
84 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"), |
|
85 | 85 | /** |
86 | 86 | ASTPP 3.0 |
87 | 87 | For DID edit on DID number |
88 | 88 | **/ |
89 | - array(gettext("Name"), "140", "description", "", "", "","EDITABLE","true","center"), |
|
89 | + array(gettext("Name"), "140", "description", "", "", "", "EDITABLE", "true", "center"), |
|
90 | 90 | /**************************************************/ |
91 | - array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
92 | - array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency","","true","right"), |
|
93 | - array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"), |
|
94 | - array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"), |
|
91 | + array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"), |
|
92 | + array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency", "", "true", "right"), |
|
93 | + array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate", "", "true", "center"), |
|
94 | + array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name", "", "true", "center"), |
|
95 | 95 | /** |
96 | 96 | ASTPP 3.0 |
97 | 97 | Show Creation date,last_modified date in reseller grid with admin login |
98 | 98 | **/ |
99 | - array(gettext("Status"), "125", "status", "status", "charges", "get_status","","true","center"), |
|
100 | - array(gettext("Created Date"), "150", "creation_date", "", "", "","","true","center"), |
|
101 | - array(gettext("Modified Date"), "150", "last_modified_date", "", "", "","","true","center"), |
|
99 | + array(gettext("Status"), "125", "status", "status", "charges", "get_status", "", "true", "center"), |
|
100 | + array(gettext("Created Date"), "150", "creation_date", "", "", "", "", "true", "center"), |
|
101 | + array(gettext("Modified Date"), "150", "last_modified_date", "", "", "", "", "true", "center"), |
|
102 | 102 | /************************************************/ |
103 | 103 | /* |
104 | 104 | ASTPP 3.0 |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | /********************************************/ |
115 | 115 | |
116 | 116 | function build_grid_buttons() { |
117 | - $buttons_json = json_encode(array(array("Create" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"), |
|
118 | - array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/charges/periodiccharges_delete_multiple/") |
|
117 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"), |
|
118 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/charges/periodiccharges_delete_multiple/") |
|
119 | 119 | )); |
120 | 120 | return $buttons_json; |
121 | 121 | } |
@@ -123,15 +123,15 @@ discard block |
||
123 | 123 | function build_charges_list_for_customer($accountid, $accounttype) { |
124 | 124 | |
125 | 125 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
126 | - $currency_id=$account_info['currency_id']; |
|
127 | - $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
126 | + $currency_id = $account_info['currency_id']; |
|
127 | + $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
128 | 128 | |
129 | - $grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "","","true","center"), |
|
130 | - array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency","","true","right"), |
|
131 | - array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"), |
|
132 | - array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"), |
|
133 | - array("Created Date", "150", "creation_date", "", "", "","","true","center"), |
|
134 | - array("Modified Date", "150", "last_modified_date", "", "", "","","true","center"), |
|
129 | + $grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "", "", "true", "center"), |
|
130 | + array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency", "", "true", "right"), |
|
131 | + array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate", "", "true", "center"), |
|
132 | + array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name", "", "true", "center"), |
|
133 | + array("Created Date", "150", "creation_date", "", "", "", "", "true", "center"), |
|
134 | + array("Modified Date", "150", "last_modified_date", "", "", "", "", "true", "center"), |
|
135 | 135 | array("Action", "150", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_subscription_action/delete/$accountid/$accounttype/", "mode" => "single"))) |
136 | 136 | )); |
137 | 137 | return $grid_field_arr; |
@@ -28,24 +28,24 @@ discard block |
||
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 |
||
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 |
||
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", ''); |
@@ -39,8 +39,9 @@ discard block |
||
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 |
||
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 |
||
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', '', '', ''); |
@@ -24,579 +24,579 @@ |
||
24 | 24 | |
25 | 25 | class Summary extends MX_Controller { |
26 | 26 | |
27 | - function Summary() { |
|
28 | - parent::__construct(); |
|
27 | + function Summary() { |
|
28 | + parent::__construct(); |
|
29 | 29 | |
30 | - $this->load->helper('template_inheritance'); |
|
30 | + $this->load->helper('template_inheritance'); |
|
31 | 31 | |
32 | - $this->load->library('session'); |
|
33 | - $this->load->library('astpp/form'); |
|
34 | - $this->load->library("summary_form"); |
|
35 | - $this->load->model('summary_model'); |
|
36 | - $this->load->library('fpdf'); |
|
37 | - $this->load->library('pdf'); |
|
38 | - $this->fpdf = new PDF('P', 'pt'); |
|
39 | - $this->fpdf->initialize('P', 'mm', 'A4'); |
|
32 | + $this->load->library('session'); |
|
33 | + $this->load->library('astpp/form'); |
|
34 | + $this->load->library("summary_form"); |
|
35 | + $this->load->model('summary_model'); |
|
36 | + $this->load->library('fpdf'); |
|
37 | + $this->load->library('pdf'); |
|
38 | + $this->fpdf = new PDF('P', 'pt'); |
|
39 | + $this->fpdf->initialize('P', 'mm', 'A4'); |
|
40 | 40 | |
41 | - if ($this->session->userdata('user_login') == FALSE) |
|
42 | - redirect(base_url().'/astpp/login'); |
|
43 | - } |
|
44 | - function customer() { |
|
45 | - $data['page_title'] = 'Customer Summary Report'; |
|
46 | - $data['search_flag'] = true; |
|
47 | - $session_info = $this->session->userdata('customersummary_reports_search'); |
|
48 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
49 | - $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
50 | - $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array('reseller_id' => $reseller_id, "type" => "GLOBAL")); |
|
51 | - $data['accountlist'] = $accountlist; |
|
52 | - $data['session_info'] = $session_info; |
|
53 | - $data['search_string_type'] = $this->common->search_string_type(); |
|
54 | - $data['search_report'] = $this->common->search_report_in(); |
|
55 | - $new_column_arr = $this->summary_column_arr('customer'); |
|
56 | - $data['grid_fields'] = $this->summary_form->build_customersummary($new_column_arr); |
|
57 | - $data["grid_buttons"] = $this->summary_form->build_grid_buttons_customersummary(); |
|
58 | - $data['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
59 | - $data['groupby_time'] = $this->common->group_by_time(); |
|
60 | - $this->load->view('view_customersummary_report', $data); |
|
61 | - } |
|
41 | + if ($this->session->userdata('user_login') == FALSE) |
|
42 | + redirect(base_url().'/astpp/login'); |
|
43 | + } |
|
44 | + function customer() { |
|
45 | + $data['page_title'] = 'Customer Summary Report'; |
|
46 | + $data['search_flag'] = true; |
|
47 | + $session_info = $this->session->userdata('customersummary_reports_search'); |
|
48 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
49 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
50 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array('reseller_id' => $reseller_id, "type" => "GLOBAL")); |
|
51 | + $data['accountlist'] = $accountlist; |
|
52 | + $data['session_info'] = $session_info; |
|
53 | + $data['search_string_type'] = $this->common->search_string_type(); |
|
54 | + $data['search_report'] = $this->common->search_report_in(); |
|
55 | + $new_column_arr = $this->summary_column_arr('customer'); |
|
56 | + $data['grid_fields'] = $this->summary_form->build_customersummary($new_column_arr); |
|
57 | + $data["grid_buttons"] = $this->summary_form->build_grid_buttons_customersummary(); |
|
58 | + $data['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
59 | + $data['groupby_time'] = $this->common->group_by_time(); |
|
60 | + $this->load->view('view_customersummary_report', $data); |
|
61 | + } |
|
62 | 62 | |
63 | - function customer_json() { |
|
64 | - $search_arr = $this->summary_search_info('customer'); |
|
65 | - $count_all = $this->summary_model->get_customersummary_report_list(false, 0, 0, $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
66 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
67 | - $json_data = $paging_data["json_paging"]; |
|
68 | - $query = $this->summary_model->get_customersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
69 | - if ($query->num_rows() > 0) { |
|
70 | - $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'customer', 'grid'); |
|
71 | - } |
|
72 | - $this->session->set_userdata('customersummary_reports_export', $search_arr); |
|
73 | - echo json_encode($json_data); |
|
74 | - } |
|
63 | + function customer_json() { |
|
64 | + $search_arr = $this->summary_search_info('customer'); |
|
65 | + $count_all = $this->summary_model->get_customersummary_report_list(false, 0, 0, $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
66 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
67 | + $json_data = $paging_data["json_paging"]; |
|
68 | + $query = $this->summary_model->get_customersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
69 | + if ($query->num_rows() > 0) { |
|
70 | + $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'customer', 'grid'); |
|
71 | + } |
|
72 | + $this->session->set_userdata('customersummary_reports_export', $search_arr); |
|
73 | + echo json_encode($json_data); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @param string $entity |
|
78 | - */ |
|
79 | - function summary_column_arr($entity) { |
|
80 | - $new_column_arr = array(); |
|
81 | - $total_width = '322'; |
|
82 | - $column_name = 'accountid'; |
|
83 | - if ($this->session->userdata('advance_search') == '1') { |
|
84 | - $search_array = $this->session->userdata($entity.'summary_reports_search'); |
|
85 | - if (isset($search_array['time']) && ! empty($search_array['time'])) { |
|
86 | - $new_column_arr[] = array(ucfirst(strtolower($search_array['time'])), "58", $search_array['time']."(callstart)", "", "", ""); |
|
87 | - } |
|
88 | - if (isset($search_array['groupby_1']) && ! empty($search_array['groupby_1'])) { |
|
89 | - $first_column_groupby = $search_array['groupby_1']; |
|
76 | + /** |
|
77 | + * @param string $entity |
|
78 | + */ |
|
79 | + function summary_column_arr($entity) { |
|
80 | + $new_column_arr = array(); |
|
81 | + $total_width = '322'; |
|
82 | + $column_name = 'accountid'; |
|
83 | + if ($this->session->userdata('advance_search') == '1') { |
|
84 | + $search_array = $this->session->userdata($entity.'summary_reports_search'); |
|
85 | + if (isset($search_array['time']) && ! empty($search_array['time'])) { |
|
86 | + $new_column_arr[] = array(ucfirst(strtolower($search_array['time'])), "58", $search_array['time']."(callstart)", "", "", ""); |
|
87 | + } |
|
88 | + if (isset($search_array['groupby_1']) && ! empty($search_array['groupby_1'])) { |
|
89 | + $first_column_groupby = $search_array['groupby_1']; |
|
90 | 90 | |
91 | - if ($first_column_groupby == 'accountid') { |
|
92 | - $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
93 | - } elseif ($first_column_groupby == 'pattern') { |
|
94 | - $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
95 | - $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
96 | - } elseif ($first_column_groupby == 'package_id') { |
|
97 | - $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name"); |
|
98 | - } |
|
99 | - } |
|
100 | - if (isset($search_array['groupby_2']) && ! empty($search_array['groupby_2'])) { |
|
101 | - $third_column_groupby = $search_array['groupby_2']; |
|
102 | - if ($third_column_groupby == 'accountid') { |
|
103 | - $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
104 | - } elseif ($third_column_groupby == 'pattern') { |
|
105 | - $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
106 | - $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
107 | - } elseif ($third_column_groupby == 'package_id') { |
|
108 | - $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name"); |
|
109 | - } |
|
110 | - } |
|
111 | - if (isset($search_array['groupby_3']) && ! empty($search_array['groupby_3'])) { |
|
112 | - $fifth_column_groupby = $search_array['groupby_3']; |
|
113 | - if ($fifth_column_groupby == 'accountid') { |
|
114 | - $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
115 | - } elseif ($fifth_column_groupby == 'pattern') { |
|
116 | - $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
117 | - $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
118 | - } elseif ($fifth_column_groupby == 'package_id') { |
|
119 | - $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name"); |
|
120 | - } |
|
121 | - } |
|
122 | - if (empty($new_column_arr)) { |
|
123 | - $new_column_arr[] = array("Account", '322', 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
124 | - } |
|
125 | - } else { |
|
126 | - $new_column_arr[] = array("Account", '322', 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
127 | - } |
|
91 | + if ($first_column_groupby == 'accountid') { |
|
92 | + $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
93 | + } elseif ($first_column_groupby == 'pattern') { |
|
94 | + $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
95 | + $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
96 | + } elseif ($first_column_groupby == 'package_id') { |
|
97 | + $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name"); |
|
98 | + } |
|
99 | + } |
|
100 | + if (isset($search_array['groupby_2']) && ! empty($search_array['groupby_2'])) { |
|
101 | + $third_column_groupby = $search_array['groupby_2']; |
|
102 | + if ($third_column_groupby == 'accountid') { |
|
103 | + $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
104 | + } elseif ($third_column_groupby == 'pattern') { |
|
105 | + $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
106 | + $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
107 | + } elseif ($third_column_groupby == 'package_id') { |
|
108 | + $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name"); |
|
109 | + } |
|
110 | + } |
|
111 | + if (isset($search_array['groupby_3']) && ! empty($search_array['groupby_3'])) { |
|
112 | + $fifth_column_groupby = $search_array['groupby_3']; |
|
113 | + if ($fifth_column_groupby == 'accountid') { |
|
114 | + $new_column_arr[] = array("Account", "105", 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
115 | + } elseif ($fifth_column_groupby == 'pattern') { |
|
116 | + $new_column_arr[] = array("Code", "45", "pattern", "pattern", "", "get_only_numeric_val"); |
|
117 | + $new_column_arr[] = array("Destination", "59", "notes", "", "", ""); |
|
118 | + } elseif ($fifth_column_groupby == 'package_id') { |
|
119 | + $new_column_arr[] = array("Package", "105", 'package_id', "package_name", "packages", "get_field_name"); |
|
120 | + } |
|
121 | + } |
|
122 | + if (empty($new_column_arr)) { |
|
123 | + $new_column_arr[] = array("Account", '322', 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
124 | + } |
|
125 | + } else { |
|
126 | + $new_column_arr[] = array("Account", '322', 'accountid', "first_name,last_name,number", "accounts", "build_concat_string"); |
|
127 | + } |
|
128 | 128 | |
129 | - return $new_column_arr; |
|
130 | - } |
|
129 | + return $new_column_arr; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * @param string $entity |
|
134 | - * @param string $purpose |
|
135 | - */ |
|
136 | - function summary_report_grid($search_arr, $query, $entity, $purpose) { |
|
137 | - $export_arr = array(); |
|
138 | - $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
|
139 | - $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
140 | - $currency_info = $this->common->get_currency_info(); |
|
141 | - foreach ($query->result_array() as $row1) { |
|
142 | - $atmpt = $row1['attempts']; |
|
143 | - $cmplt = ($row1['completed'] != 0) ? $row1['completed'] : 0; |
|
144 | - $acd = ($row1['completed'] > 0) ? round($row1['billable'] / $row1['completed']) : 0; |
|
145 | - $mcd = $row1['mcd']; |
|
146 | - if ($show_seconds == 'minutes') { |
|
147 | - $avgsec = $acd > 0 ? sprintf('%02d', $acd / 60).":".sprintf('%02d', ($acd % 60)) : "00:00"; |
|
148 | - $maxsec = $mcd > 0 ? sprintf('%02d', $mcd / 60).":".sprintf('%02d', ($mcd % 60)) : "00:00"; |
|
149 | - $duration = ($row1['duration'] > 0) ? sprintf('%02d', $row1['duration'] / 60).":".sprintf('%02d', ($row1['duration'] % 60)) : "00:00"; |
|
150 | - $billsec = ($row1['billable'] > 0) ? sprintf('%02d', $row1['billable'] / 60).":".sprintf('%02d', ($row1['billable'] % 60)) : "00:00"; |
|
151 | - } else { |
|
152 | - $duration = sprintf('%02d', $row1['duration']); |
|
153 | - $avgsec = $acd; |
|
154 | - $maxsec = $mcd; |
|
155 | - $billsec = sprintf('%02d', $row1['billable']); |
|
156 | - } |
|
157 | - if ($entity != 'provider') { |
|
158 | - $profit = $this->common->calculate_currency_manually($currency_info, $row1['debit'] - $row1['cost'], false); |
|
159 | - $debit = $this->common->calculate_currency_manually($currency_info, $row1['debit'], false); |
|
160 | - } |
|
161 | - $cost = $this->common->calculate_currency_manually($currency_info, $row1['cost'], false); |
|
162 | - $asr = ($atmpt > 0) ? (round(($cmplt / $atmpt) * 100, 2)) : '0.00'; |
|
163 | - $new_arr = array(); |
|
164 | - if ($this->session->userdata('advance_search') == 1) { |
|
165 | - if ( ! empty($search_arr['groupby_time'])) { |
|
166 | - $time = $row1[$search_arr['groupby_time']]; |
|
167 | - if ($search_arr['groupby_time'] == "HOUR" || $search_arr['groupby_time'] == "DAY") { |
|
132 | + /** |
|
133 | + * @param string $entity |
|
134 | + * @param string $purpose |
|
135 | + */ |
|
136 | + function summary_report_grid($search_arr, $query, $entity, $purpose) { |
|
137 | + $export_arr = array(); |
|
138 | + $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
|
139 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
140 | + $currency_info = $this->common->get_currency_info(); |
|
141 | + foreach ($query->result_array() as $row1) { |
|
142 | + $atmpt = $row1['attempts']; |
|
143 | + $cmplt = ($row1['completed'] != 0) ? $row1['completed'] : 0; |
|
144 | + $acd = ($row1['completed'] > 0) ? round($row1['billable'] / $row1['completed']) : 0; |
|
145 | + $mcd = $row1['mcd']; |
|
146 | + if ($show_seconds == 'minutes') { |
|
147 | + $avgsec = $acd > 0 ? sprintf('%02d', $acd / 60).":".sprintf('%02d', ($acd % 60)) : "00:00"; |
|
148 | + $maxsec = $mcd > 0 ? sprintf('%02d', $mcd / 60).":".sprintf('%02d', ($mcd % 60)) : "00:00"; |
|
149 | + $duration = ($row1['duration'] > 0) ? sprintf('%02d', $row1['duration'] / 60).":".sprintf('%02d', ($row1['duration'] % 60)) : "00:00"; |
|
150 | + $billsec = ($row1['billable'] > 0) ? sprintf('%02d', $row1['billable'] / 60).":".sprintf('%02d', ($row1['billable'] % 60)) : "00:00"; |
|
151 | + } else { |
|
152 | + $duration = sprintf('%02d', $row1['duration']); |
|
153 | + $avgsec = $acd; |
|
154 | + $maxsec = $mcd; |
|
155 | + $billsec = sprintf('%02d', $row1['billable']); |
|
156 | + } |
|
157 | + if ($entity != 'provider') { |
|
158 | + $profit = $this->common->calculate_currency_manually($currency_info, $row1['debit'] - $row1['cost'], false); |
|
159 | + $debit = $this->common->calculate_currency_manually($currency_info, $row1['debit'], false); |
|
160 | + } |
|
161 | + $cost = $this->common->calculate_currency_manually($currency_info, $row1['cost'], false); |
|
162 | + $asr = ($atmpt > 0) ? (round(($cmplt / $atmpt) * 100, 2)) : '0.00'; |
|
163 | + $new_arr = array(); |
|
164 | + if ($this->session->userdata('advance_search') == 1) { |
|
165 | + if ( ! empty($search_arr['groupby_time'])) { |
|
166 | + $time = $row1[$search_arr['groupby_time']]; |
|
167 | + if ($search_arr['groupby_time'] == "HOUR" || $search_arr['groupby_time'] == "DAY") { |
|
168 | 168 | $time = sprintf('%02d', $time); |
169 | - } |
|
170 | - if ($search_arr['groupby_time'] == "MONTH") { |
|
169 | + } |
|
170 | + if ($search_arr['groupby_time'] == "MONTH") { |
|
171 | 171 | $dateObj = DateTime::createFromFormat('!m', $time); |
172 | 172 | $time = $dateObj->format('F'); |
173 | - } |
|
174 | - $new_arr[] = $time; |
|
175 | - } |
|
176 | - if ($search_arr['groupby_1'] == $db_field_name) { |
|
177 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
178 | - } elseif ($search_arr['groupby_1'] == 'pattern') { |
|
179 | - $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
180 | - $new_arr[] = $row1['notes']; |
|
181 | - } elseif ($search_arr['groupby_1'] == 'trunk_id') { |
|
182 | - $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
183 | - } elseif ($search_arr['groupby_1'] == 'package_id') { |
|
184 | - $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
185 | - } |
|
173 | + } |
|
174 | + $new_arr[] = $time; |
|
175 | + } |
|
176 | + if ($search_arr['groupby_1'] == $db_field_name) { |
|
177 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
178 | + } elseif ($search_arr['groupby_1'] == 'pattern') { |
|
179 | + $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
180 | + $new_arr[] = $row1['notes']; |
|
181 | + } elseif ($search_arr['groupby_1'] == 'trunk_id') { |
|
182 | + $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
183 | + } elseif ($search_arr['groupby_1'] == 'package_id') { |
|
184 | + $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
185 | + } |
|
186 | 186 | |
187 | - if ($search_arr['groupby_2'] == $db_field_name) { |
|
188 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
189 | - } elseif ($search_arr['groupby_2'] == 'pattern') { |
|
190 | - $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
191 | - $new_arr[] = $row1['notes']; |
|
192 | - } elseif ($search_arr['groupby_2'] == 'trunk_id') { |
|
193 | - $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
194 | - } elseif ($search_arr['groupby_2'] == 'package_id') { |
|
195 | - $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
196 | - } |
|
187 | + if ($search_arr['groupby_2'] == $db_field_name) { |
|
188 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
189 | + } elseif ($search_arr['groupby_2'] == 'pattern') { |
|
190 | + $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
191 | + $new_arr[] = $row1['notes']; |
|
192 | + } elseif ($search_arr['groupby_2'] == 'trunk_id') { |
|
193 | + $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
194 | + } elseif ($search_arr['groupby_2'] == 'package_id') { |
|
195 | + $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
196 | + } |
|
197 | 197 | |
198 | - if ($search_arr['groupby_3'] == $db_field_name) { |
|
199 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
200 | - } elseif ($search_arr['groupby_3'] == 'pattern') { |
|
201 | - $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
202 | - $new_arr[] = $row1['notes']; |
|
203 | - } elseif ($search_arr['groupby_3'] == 'trunk_id') { |
|
204 | - $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
205 | - } elseif ($search_arr['groupby_3'] == 'package_id') { |
|
206 | - $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
207 | - } |
|
208 | - if (empty($new_arr)) { |
|
209 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
210 | - } |
|
211 | - } else { |
|
212 | - $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
213 | - } |
|
214 | - if ($entity != 'provider') { |
|
215 | - $custom_array = array( |
|
216 | - $atmpt, |
|
217 | - $cmplt, |
|
218 | - $duration, |
|
219 | - round($asr, 2), |
|
220 | - $avgsec, |
|
221 | - $maxsec, |
|
222 | - $billsec, |
|
223 | - $debit, |
|
224 | - $cost, |
|
225 | - $profit); |
|
226 | - } else { |
|
227 | - $custom_array = array( |
|
228 | - $atmpt, |
|
229 | - $cmplt, |
|
230 | - $duration, |
|
231 | - round($asr, 2), |
|
232 | - $avgsec, |
|
233 | - $maxsec, |
|
234 | - $billsec, |
|
235 | - $cost |
|
236 | - ); |
|
237 | - } |
|
238 | - $final_array = array_merge($new_arr, $custom_array); |
|
239 | - $json_data[] = array('cell' => $final_array); |
|
240 | - $export_arr[] = $final_array; |
|
241 | - } |
|
242 | - $function_name = 'get_'.$entity.'summary_report_list'; |
|
243 | - $total_info = $this->summary_model->$function_name(true, '', '', '', $search_arr['select_str'], $search_arr['order_str'], true); |
|
244 | - $total_info = $total_info->result_array(); |
|
245 | - $total_info = $total_info[0]; |
|
246 | - $total_asr = ($total_info['attempts'] > 0) ? round(($total_info['completed'] / $total_info['attempts']) * 100, 2) : 0; |
|
247 | - $total_acd = ($total_info['completed'] > 0) ? round($total_info['billable'] / $total_info['completed']) : 0; |
|
248 | - if ($show_seconds == 'minutes') { |
|
249 | - $total_info['duration'] = $total_info['duration'] > 0 ? sprintf('%02d', $total_info['duration'] / 60).":".sprintf('%02d', ($total_info['duration'] % 60)) : "00:00"; |
|
250 | - $total_info['billable'] = $total_info['billable'] > 0 ? sprintf('%02d', $total_info['billable'] / 60).":".sprintf('%02d', ($total_info['billable'] % 60)) : "00:00"; |
|
251 | - $total_acd = $total_acd > 0 ? sprintf('%02d', $total_acd / 60).":".sprintf('%02d', ($total_acd % 60)) : "00:00"; |
|
252 | - $total_info['mcd'] = $total_info['mcd'] > 0 ? sprintf('%02d', $total_info['mcd'] / 60).":".sprintf('%02d', ($total_info['mcd'] % 60)) : "00:00"; |
|
253 | - } |
|
254 | - if ($entity != 'provider') { |
|
255 | - $total_profit = $this->common->calculate_currency_manually($currency_info, $total_info['debit'] - $total_info['cost'], false); |
|
256 | - $total_debit = $this->common->calculate_currency_manually($currency_info, $total_info['debit'], false); |
|
257 | - } |
|
258 | - $total_cost = $this->common->calculate_currency_manually($currency_info, $total_info['cost'], false); |
|
259 | - if ($entity != 'provider') { |
|
260 | - $last_array = array( |
|
261 | - "<b>".$total_info['attempts']."</b>", |
|
262 | - "<b>".$total_info['completed']."</b>", |
|
263 | - "<b>".$total_info['duration']."</b>", |
|
264 | - "<b>".$total_asr."</b>", |
|
198 | + if ($search_arr['groupby_3'] == $db_field_name) { |
|
199 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
200 | + } elseif ($search_arr['groupby_3'] == 'pattern') { |
|
201 | + $new_arr[] = filter_var($row1['pattern'], FILTER_SANITIZE_NUMBER_INT); |
|
202 | + $new_arr[] = $row1['notes']; |
|
203 | + } elseif ($search_arr['groupby_3'] == 'trunk_id') { |
|
204 | + $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
|
205 | + } elseif ($search_arr['groupby_3'] == 'package_id') { |
|
206 | + $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
|
207 | + } |
|
208 | + if (empty($new_arr)) { |
|
209 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
210 | + } |
|
211 | + } else { |
|
212 | + $new_arr[] = $this->common->build_concat_string("first_name,last_name,number", "accounts", $row1[$db_field_name]); |
|
213 | + } |
|
214 | + if ($entity != 'provider') { |
|
215 | + $custom_array = array( |
|
216 | + $atmpt, |
|
217 | + $cmplt, |
|
218 | + $duration, |
|
219 | + round($asr, 2), |
|
220 | + $avgsec, |
|
221 | + $maxsec, |
|
222 | + $billsec, |
|
223 | + $debit, |
|
224 | + $cost, |
|
225 | + $profit); |
|
226 | + } else { |
|
227 | + $custom_array = array( |
|
228 | + $atmpt, |
|
229 | + $cmplt, |
|
230 | + $duration, |
|
231 | + round($asr, 2), |
|
232 | + $avgsec, |
|
233 | + $maxsec, |
|
234 | + $billsec, |
|
235 | + $cost |
|
236 | + ); |
|
237 | + } |
|
238 | + $final_array = array_merge($new_arr, $custom_array); |
|
239 | + $json_data[] = array('cell' => $final_array); |
|
240 | + $export_arr[] = $final_array; |
|
241 | + } |
|
242 | + $function_name = 'get_'.$entity.'summary_report_list'; |
|
243 | + $total_info = $this->summary_model->$function_name(true, '', '', '', $search_arr['select_str'], $search_arr['order_str'], true); |
|
244 | + $total_info = $total_info->result_array(); |
|
245 | + $total_info = $total_info[0]; |
|
246 | + $total_asr = ($total_info['attempts'] > 0) ? round(($total_info['completed'] / $total_info['attempts']) * 100, 2) : 0; |
|
247 | + $total_acd = ($total_info['completed'] > 0) ? round($total_info['billable'] / $total_info['completed']) : 0; |
|
248 | + if ($show_seconds == 'minutes') { |
|
249 | + $total_info['duration'] = $total_info['duration'] > 0 ? sprintf('%02d', $total_info['duration'] / 60).":".sprintf('%02d', ($total_info['duration'] % 60)) : "00:00"; |
|
250 | + $total_info['billable'] = $total_info['billable'] > 0 ? sprintf('%02d', $total_info['billable'] / 60).":".sprintf('%02d', ($total_info['billable'] % 60)) : "00:00"; |
|
251 | + $total_acd = $total_acd > 0 ? sprintf('%02d', $total_acd / 60).":".sprintf('%02d', ($total_acd % 60)) : "00:00"; |
|
252 | + $total_info['mcd'] = $total_info['mcd'] > 0 ? sprintf('%02d', $total_info['mcd'] / 60).":".sprintf('%02d', ($total_info['mcd'] % 60)) : "00:00"; |
|
253 | + } |
|
254 | + if ($entity != 'provider') { |
|
255 | + $total_profit = $this->common->calculate_currency_manually($currency_info, $total_info['debit'] - $total_info['cost'], false); |
|
256 | + $total_debit = $this->common->calculate_currency_manually($currency_info, $total_info['debit'], false); |
|
257 | + } |
|
258 | + $total_cost = $this->common->calculate_currency_manually($currency_info, $total_info['cost'], false); |
|
259 | + if ($entity != 'provider') { |
|
260 | + $last_array = array( |
|
261 | + "<b>".$total_info['attempts']."</b>", |
|
262 | + "<b>".$total_info['completed']."</b>", |
|
263 | + "<b>".$total_info['duration']."</b>", |
|
264 | + "<b>".$total_asr."</b>", |
|
265 | 265 | "<b>".$total_acd."</b>", |
266 | 266 | "<b>".$total_info['mcd']."</b>", |
267 | 267 | "<b>".$total_info['billable']."</b>", |
268 | 268 | "<b>".$total_debit."</b>", |
269 | 269 | "<b>".$total_cost."</b>", |
270 | 270 | "<b>".$total_profit."</b>" |
271 | - ); |
|
272 | - } else { |
|
273 | - $last_array = array( |
|
274 | - "<b>".$total_info['attempts']."</b>", |
|
275 | - "<b>".$total_info['completed']."</b>", |
|
276 | - "<b>".$total_info['duration']."</b>", |
|
277 | - "<b>".$total_asr."</b>", |
|
278 | - "<b>".$total_acd."</b>", |
|
279 | - "<b>".$total_info['mcd']."</b>", |
|
280 | - "<b>".$total_info['billable']."</b>", |
|
281 | - "<b>".$total_cost."</b>", |
|
282 | - ); |
|
283 | - } |
|
284 | - if ($purpose == 'export') { |
|
285 | - $search_arr['custom_total_array'][0] = "Grand Total"; |
|
286 | - } |
|
287 | - $new_export_array = array(); |
|
288 | - foreach ($last_array as $key=>$value) { |
|
271 | + ); |
|
272 | + } else { |
|
273 | + $last_array = array( |
|
274 | + "<b>".$total_info['attempts']."</b>", |
|
275 | + "<b>".$total_info['completed']."</b>", |
|
276 | + "<b>".$total_info['duration']."</b>", |
|
277 | + "<b>".$total_asr."</b>", |
|
278 | + "<b>".$total_acd."</b>", |
|
279 | + "<b>".$total_info['mcd']."</b>", |
|
280 | + "<b>".$total_info['billable']."</b>", |
|
281 | + "<b>".$total_cost."</b>", |
|
282 | + ); |
|
283 | + } |
|
284 | + if ($purpose == 'export') { |
|
285 | + $search_arr['custom_total_array'][0] = "Grand Total"; |
|
286 | + } |
|
287 | + $new_export_array = array(); |
|
288 | + foreach ($last_array as $key=>$value) { |
|
289 | 289 | $value = str_replace("<b>", "", $value); |
290 | 290 | $value = str_replace("</b>", '', $value); |
291 | 291 | if ($key == 7 || $key == 8 || $key == 9) { |
292 | - $value = sprintf("%.".$currency_info['decimalpoints']."f", floatval(preg_replace('/[^\d.]/', '', $value))); |
|
292 | + $value = sprintf("%.".$currency_info['decimalpoints']."f", floatval(preg_replace('/[^\d.]/', '', $value))); |
|
293 | 293 | } |
294 | 294 | $new_export_array[$key] = $value; |
295 | - } |
|
296 | - $total_array = array_merge($search_arr['custom_total_array'], $last_array); |
|
297 | - $custom_export_arr = array_merge($search_arr['custom_total_array'], $new_export_array); |
|
298 | - $export_arr[] = $custom_export_arr; |
|
299 | - $json_data[] = array('cell' => $total_array); |
|
300 | - return $purpose == 'grid' ? $json_data : $export_arr; |
|
301 | - } |
|
295 | + } |
|
296 | + $total_array = array_merge($search_arr['custom_total_array'], $last_array); |
|
297 | + $custom_export_arr = array_merge($search_arr['custom_total_array'], $new_export_array); |
|
298 | + $export_arr[] = $custom_export_arr; |
|
299 | + $json_data[] = array('cell' => $total_array); |
|
300 | + return $purpose == 'grid' ? $json_data : $export_arr; |
|
301 | + } |
|
302 | 302 | |
303 | - function customer_export_csv() { |
|
303 | + function customer_export_csv() { |
|
304 | 304 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
305 | 305 | $currency_id = $account_info['currency_id']; |
306 | 306 | $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
307 | - $search_arr = $this->session->userdata('customersummary_reports_export'); |
|
308 | - $data_arr = array(); |
|
309 | - $query = $this->summary_model->get_customersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true); |
|
310 | - $search_header = explode(",", $search_arr['export_str']); |
|
311 | - ob_clean(); |
|
312 | - $fixed_header = array('Attempted Calls', 'Completed Calls', 'Duration', 'ASR', 'ACD', 'MCD', 'Billable', 'Debit('.$currency.')', 'Cost('.$currency.')', 'Profit'); |
|
313 | - $header_arr[] = array_merge($search_header, $fixed_header); |
|
314 | - if ($query->num_rows() > 0) { |
|
315 | - $data_arr = $this->summary_report_grid($search_arr, $query, 'customer', 'export'); |
|
316 | - } |
|
317 | - $customer_array = array_merge($header_arr, $data_arr); |
|
307 | + $search_arr = $this->session->userdata('customersummary_reports_export'); |
|
308 | + $data_arr = array(); |
|
309 | + $query = $this->summary_model->get_customersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true); |
|
310 | + $search_header = explode(",", $search_arr['export_str']); |
|
311 | + ob_clean(); |
|
312 | + $fixed_header = array('Attempted Calls', 'Completed Calls', 'Duration', 'ASR', 'ACD', 'MCD', 'Billable', 'Debit('.$currency.')', 'Cost('.$currency.')', 'Profit'); |
|
313 | + $header_arr[] = array_merge($search_header, $fixed_header); |
|
314 | + if ($query->num_rows() > 0) { |
|
315 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'customer', 'export'); |
|
316 | + } |
|
317 | + $customer_array = array_merge($header_arr, $data_arr); |
|
318 | 318 | |
319 | - $this->load->helper('csv'); |
|
320 | - array_to_csv($customer_array, 'Customer_Summary_Report_'.date("Y-m-d").'.csv'); |
|
321 | - } |
|
319 | + $this->load->helper('csv'); |
|
320 | + array_to_csv($customer_array, 'Customer_Summary_Report_'.date("Y-m-d").'.csv'); |
|
321 | + } |
|
322 | 322 | |
323 | - function customer_search() { |
|
324 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
325 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
326 | - unset($_POST['action']); |
|
327 | - unset($_POST['advance_search']); |
|
328 | - $this->session->set_userdata('customersummary_reports_search', $this->input->post()); |
|
329 | - } |
|
330 | - redirect(base_url() . 'summary/customer/'); |
|
331 | - } |
|
323 | + function customer_search() { |
|
324 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
325 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
326 | + unset($_POST['action']); |
|
327 | + unset($_POST['advance_search']); |
|
328 | + $this->session->set_userdata('customersummary_reports_search', $this->input->post()); |
|
329 | + } |
|
330 | + redirect(base_url() . 'summary/customer/'); |
|
331 | + } |
|
332 | 332 | |
333 | - function customer_clearsearchfilter() { |
|
334 | - $this->session->set_userdata('advance_search', 0); |
|
335 | - $this->session->set_userdata('customersummary_reports_search', ""); |
|
336 | - $this->session->set_userdata('customersummary_reports_export', ""); |
|
337 | - redirect(base_url() . 'summary/customer/'); |
|
338 | - } |
|
333 | + function customer_clearsearchfilter() { |
|
334 | + $this->session->set_userdata('advance_search', 0); |
|
335 | + $this->session->set_userdata('customersummary_reports_search', ""); |
|
336 | + $this->session->set_userdata('customersummary_reports_export', ""); |
|
337 | + redirect(base_url() . 'summary/customer/'); |
|
338 | + } |
|
339 | 339 | |
340 | - /** |
|
341 | - * @param string $entity |
|
342 | - */ |
|
343 | - function summary_search_info($entity) { |
|
344 | - $group_by_str = null; |
|
345 | - $select_str = null; |
|
346 | - $group_by_time=null; |
|
347 | - $group_by_1 = null; |
|
348 | - $group_by_2 = null; |
|
349 | - $group_by_3 = null; |
|
350 | - $order_str=null; |
|
351 | - $custom_total_array = array(); |
|
352 | - $custom_search = array(); |
|
353 | - $export_select_str = null; |
|
354 | - $new_arr['search_in'] = 'minutes'; |
|
355 | - $i = 0; |
|
356 | - $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
|
357 | - if ($this->session->userdata('advance_search') == 1) { |
|
358 | - $custom_search = $this->session->userdata($entity.'summary_reports_search'); |
|
359 | - if (isset($custom_search['time']) && ! empty($custom_search['time'])) { |
|
360 | - $group_by_str .= $custom_search['time']."(callstart),"; |
|
361 | - $select_str .= $custom_search['time']."(callstart) as ".$custom_search['time'].","; |
|
362 | - $order_str .= $custom_search['time'].","; |
|
363 | - $group_by_time = $custom_search['time']; |
|
364 | - $export_select_str .= $custom_search['time'].","; |
|
365 | - $custom_total_array[$i] = null; |
|
366 | - $i++; |
|
367 | - } |
|
368 | - if (isset($custom_search['groupby_1']) && ! empty($custom_search['groupby_1'])) { |
|
369 | - $group_by_str .= $custom_search['groupby_1'].","; |
|
370 | - $select_str .= $custom_search['groupby_1'].","; |
|
371 | - $order_str .= $custom_search['groupby_1'].","; |
|
372 | - $group_by_1 = $custom_search['groupby_1']; |
|
373 | - if ($custom_search['groupby_1'] == $db_field_name) { |
|
374 | - $export_select_str .= 'Account,'; |
|
375 | - } elseif ($custom_search['groupby_1'] == 'trunk_id') { |
|
376 | - $export_select_str .= 'Trunk,'; |
|
377 | - } elseif ($custom_search['groupby_1'] == 'pattern') { |
|
378 | - $select_str .= 'notes,'; |
|
379 | - $order_str .= 'notes,'; |
|
380 | - $export_select_str .= "Code,Destination,"; |
|
381 | - $custom_total_array[$i] = null; |
|
382 | - $i++; |
|
383 | - } elseif ($custom_search['groupby_1'] == 'package_id') { |
|
384 | - $export_select_str .= 'Package,'; |
|
385 | - } |
|
386 | - $custom_total_array[$i] = null; |
|
387 | - $i++; |
|
388 | - } |
|
340 | + /** |
|
341 | + * @param string $entity |
|
342 | + */ |
|
343 | + function summary_search_info($entity) { |
|
344 | + $group_by_str = null; |
|
345 | + $select_str = null; |
|
346 | + $group_by_time=null; |
|
347 | + $group_by_1 = null; |
|
348 | + $group_by_2 = null; |
|
349 | + $group_by_3 = null; |
|
350 | + $order_str=null; |
|
351 | + $custom_total_array = array(); |
|
352 | + $custom_search = array(); |
|
353 | + $export_select_str = null; |
|
354 | + $new_arr['search_in'] = 'minutes'; |
|
355 | + $i = 0; |
|
356 | + $db_field_name = $entity == 'provider' ? 'provider_id' : 'accountid'; |
|
357 | + if ($this->session->userdata('advance_search') == 1) { |
|
358 | + $custom_search = $this->session->userdata($entity.'summary_reports_search'); |
|
359 | + if (isset($custom_search['time']) && ! empty($custom_search['time'])) { |
|
360 | + $group_by_str .= $custom_search['time']."(callstart),"; |
|
361 | + $select_str .= $custom_search['time']."(callstart) as ".$custom_search['time'].","; |
|
362 | + $order_str .= $custom_search['time'].","; |
|
363 | + $group_by_time = $custom_search['time']; |
|
364 | + $export_select_str .= $custom_search['time'].","; |
|
365 | + $custom_total_array[$i] = null; |
|
366 | + $i++; |
|
367 | + } |
|
368 | + if (isset($custom_search['groupby_1']) && ! empty($custom_search['groupby_1'])) { |
|
369 | + $group_by_str .= $custom_search['groupby_1'].","; |
|
370 | + $select_str .= $custom_search['groupby_1'].","; |
|
371 | + $order_str .= $custom_search['groupby_1'].","; |
|
372 | + $group_by_1 = $custom_search['groupby_1']; |
|
373 | + if ($custom_search['groupby_1'] == $db_field_name) { |
|
374 | + $export_select_str .= 'Account,'; |
|
375 | + } elseif ($custom_search['groupby_1'] == 'trunk_id') { |
|
376 | + $export_select_str .= 'Trunk,'; |
|
377 | + } elseif ($custom_search['groupby_1'] == 'pattern') { |
|
378 | + $select_str .= 'notes,'; |
|
379 | + $order_str .= 'notes,'; |
|
380 | + $export_select_str .= "Code,Destination,"; |
|
381 | + $custom_total_array[$i] = null; |
|
382 | + $i++; |
|
383 | + } elseif ($custom_search['groupby_1'] == 'package_id') { |
|
384 | + $export_select_str .= 'Package,'; |
|
385 | + } |
|
386 | + $custom_total_array[$i] = null; |
|
387 | + $i++; |
|
388 | + } |
|
389 | 389 | |
390 | - if (isset($custom_search['groupby_2']) && ! empty($custom_search['groupby_2'])) { |
|
391 | - $group_by_str .= $custom_search['groupby_2'].","; |
|
392 | - $select_str .= $custom_search['groupby_2'].","; |
|
393 | - $order_str .= $custom_search['groupby_2'].","; |
|
394 | - $group_by_2 = $custom_search['groupby_2']; |
|
395 | - if ($custom_search['groupby_2'] == $db_field_name) { |
|
396 | - $export_select_str .= 'Account,'; |
|
397 | - } elseif ($custom_search['groupby_2'] == 'trunk_id') { |
|
398 | - $export_select_str .= 'Trunk,'; |
|
399 | - } elseif ($custom_search['groupby_2'] == 'pattern') { |
|
400 | - $select_str .= 'notes,'; |
|
401 | - $order_str .= 'notes,'; |
|
402 | - $export_select_str .= "Code,Destination,"; |
|
403 | - $custom_total_array[$i] = null; |
|
404 | - $i++; |
|
405 | - } elseif ($custom_search['groupby_2'] == 'package_id') { |
|
406 | - $export_select_str .= 'Package,'; |
|
407 | - } |
|
408 | - $custom_total_array[$i] = null; |
|
409 | - $i++; |
|
410 | - } |
|
390 | + if (isset($custom_search['groupby_2']) && ! empty($custom_search['groupby_2'])) { |
|
391 | + $group_by_str .= $custom_search['groupby_2'].","; |
|
392 | + $select_str .= $custom_search['groupby_2'].","; |
|
393 | + $order_str .= $custom_search['groupby_2'].","; |
|
394 | + $group_by_2 = $custom_search['groupby_2']; |
|
395 | + if ($custom_search['groupby_2'] == $db_field_name) { |
|
396 | + $export_select_str .= 'Account,'; |
|
397 | + } elseif ($custom_search['groupby_2'] == 'trunk_id') { |
|
398 | + $export_select_str .= 'Trunk,'; |
|
399 | + } elseif ($custom_search['groupby_2'] == 'pattern') { |
|
400 | + $select_str .= 'notes,'; |
|
401 | + $order_str .= 'notes,'; |
|
402 | + $export_select_str .= "Code,Destination,"; |
|
403 | + $custom_total_array[$i] = null; |
|
404 | + $i++; |
|
405 | + } elseif ($custom_search['groupby_2'] == 'package_id') { |
|
406 | + $export_select_str .= 'Package,'; |
|
407 | + } |
|
408 | + $custom_total_array[$i] = null; |
|
409 | + $i++; |
|
410 | + } |
|
411 | 411 | |
412 | - if (isset($custom_search['groupby_3']) && ! empty($custom_search['groupby_3'])) { |
|
413 | - $group_by_str .= $custom_search['groupby_3'].","; |
|
414 | - $select_str .= $custom_search['groupby_3'].","; |
|
415 | - $order_str .= $custom_search['groupby_3'].","; |
|
416 | - $group_by_3 = $custom_search['groupby_3']; |
|
417 | - if ($custom_search['groupby_3'] == 'accountid' || $custom_search['groupby_3'] == 'provider_id') { |
|
418 | - $export_select_str .= 'Account,'; |
|
419 | - } elseif ($custom_search['groupby_3'] == 'trunk_id') { |
|
420 | - $export_select_str .= 'Trunk,'; |
|
421 | - } elseif ($custom_search['groupby_3'] == 'pattern') { |
|
422 | - $select_str .= 'notes,'; |
|
423 | - $order_str .= 'notes,'; |
|
424 | - $export_select_str .= "Code,Destination,"; |
|
425 | - $custom_total_array[$i] = null; |
|
426 | - $i++; |
|
427 | - } elseif ($custom_search['groupby_3'] == 'package_id') { |
|
428 | - $export_select_str .= 'Package,'; |
|
429 | - } |
|
430 | - $custom_total_array[$i] = null; |
|
431 | - $i++; |
|
432 | - } |
|
433 | - $new_arr['search_in'] = (isset($custom_search['search_in']) && ! empty($custom_search['search_in'])) ? $custom_search['search_in'] : 'minutes'; |
|
434 | - unset($custom_search['groupby_1'], $custom_search['groupby_2'], $custom_search['groupby_3'], $custom_search['search_in']); |
|
435 | - $this->session->set_userdata('summary_'.$entity.'_search', $custom_search); |
|
436 | - } |
|
437 | - if ( ! empty($group_by_str)) { |
|
438 | - $group_by_str = rtrim($group_by_str, ","); |
|
439 | - $select_str = rtrim($select_str, ","); |
|
440 | - $order_str = rtrim($order_str, ","); |
|
441 | - $export_select_str = rtrim($export_select_str, ","); |
|
442 | - } else { |
|
443 | - $select_str = $db_field_name; |
|
444 | - $order_str = $db_field_name; |
|
445 | - $group_by_str = $db_field_name; |
|
446 | - $export_select_str = "Account"; |
|
447 | - } |
|
412 | + if (isset($custom_search['groupby_3']) && ! empty($custom_search['groupby_3'])) { |
|
413 | + $group_by_str .= $custom_search['groupby_3'].","; |
|
414 | + $select_str .= $custom_search['groupby_3'].","; |
|
415 | + $order_str .= $custom_search['groupby_3'].","; |
|
416 | + $group_by_3 = $custom_search['groupby_3']; |
|
417 | + if ($custom_search['groupby_3'] == 'accountid' || $custom_search['groupby_3'] == 'provider_id') { |
|
418 | + $export_select_str .= 'Account,'; |
|
419 | + } elseif ($custom_search['groupby_3'] == 'trunk_id') { |
|
420 | + $export_select_str .= 'Trunk,'; |
|
421 | + } elseif ($custom_search['groupby_3'] == 'pattern') { |
|
422 | + $select_str .= 'notes,'; |
|
423 | + $order_str .= 'notes,'; |
|
424 | + $export_select_str .= "Code,Destination,"; |
|
425 | + $custom_total_array[$i] = null; |
|
426 | + $i++; |
|
427 | + } elseif ($custom_search['groupby_3'] == 'package_id') { |
|
428 | + $export_select_str .= 'Package,'; |
|
429 | + } |
|
430 | + $custom_total_array[$i] = null; |
|
431 | + $i++; |
|
432 | + } |
|
433 | + $new_arr['search_in'] = (isset($custom_search['search_in']) && ! empty($custom_search['search_in'])) ? $custom_search['search_in'] : 'minutes'; |
|
434 | + unset($custom_search['groupby_1'], $custom_search['groupby_2'], $custom_search['groupby_3'], $custom_search['search_in']); |
|
435 | + $this->session->set_userdata('summary_'.$entity.'_search', $custom_search); |
|
436 | + } |
|
437 | + if ( ! empty($group_by_str)) { |
|
438 | + $group_by_str = rtrim($group_by_str, ","); |
|
439 | + $select_str = rtrim($select_str, ","); |
|
440 | + $order_str = rtrim($order_str, ","); |
|
441 | + $export_select_str = rtrim($export_select_str, ","); |
|
442 | + } else { |
|
443 | + $select_str = $db_field_name; |
|
444 | + $order_str = $db_field_name; |
|
445 | + $group_by_str = $db_field_name; |
|
446 | + $export_select_str = "Account"; |
|
447 | + } |
|
448 | 448 | |
449 | - array_pop($custom_total_array); |
|
450 | - array_unshift($custom_total_array, '<b>Grand Total</b>'); |
|
451 | - $new_arr['export_str'] = $export_select_str; |
|
452 | - $new_arr['select_str'] = $select_str; |
|
453 | - $new_arr['order_str'] = $order_str; |
|
454 | - $new_arr['group_by_str'] = $group_by_str; |
|
455 | - $new_arr['groupby_1'] = $group_by_1; |
|
456 | - $new_arr['groupby_2'] = $group_by_2; |
|
457 | - $new_arr['groupby_3'] = $group_by_3; |
|
458 | - $new_arr['groupby_time'] = $group_by_time; |
|
459 | - $new_arr['custom_total_array'] = $custom_total_array; |
|
460 | - return $new_arr; |
|
461 | - } |
|
449 | + array_pop($custom_total_array); |
|
450 | + array_unshift($custom_total_array, '<b>Grand Total</b>'); |
|
451 | + $new_arr['export_str'] = $export_select_str; |
|
452 | + $new_arr['select_str'] = $select_str; |
|
453 | + $new_arr['order_str'] = $order_str; |
|
454 | + $new_arr['group_by_str'] = $group_by_str; |
|
455 | + $new_arr['groupby_1'] = $group_by_1; |
|
456 | + $new_arr['groupby_2'] = $group_by_2; |
|
457 | + $new_arr['groupby_3'] = $group_by_3; |
|
458 | + $new_arr['groupby_time'] = $group_by_time; |
|
459 | + $new_arr['custom_total_array'] = $custom_total_array; |
|
460 | + return $new_arr; |
|
461 | + } |
|
462 | 462 | |
463 | - function provider() { |
|
464 | - $data['page_title'] = 'Provider Summary Report'; |
|
465 | - $data['search_flag'] = true; |
|
466 | - $session_info = $this->session->userdata('providersummary_reports_search'); |
|
467 | - $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array("type" => "3")); |
|
468 | - $trunklist = $this->db_model->build_dropdown('id,name', 'trunks', '', array()); |
|
469 | - $data['trunklist'] = $trunklist; |
|
470 | - $data['accountlist'] = $accountlist; |
|
471 | - $data['session_info'] = $session_info; |
|
472 | - $data['seconds'] = $this->session->userdata('provider_seconds'); |
|
473 | - $data['search_report'] = $this->common->search_report_in(); |
|
474 | - $data['grid_fields'] = $this->summary_form->build_providersummary(); |
|
475 | - $data["grid_buttons"] = $this->summary_form->build_grid_buttons_providersummary(); |
|
476 | - $data['search_string_type'] = $this->common->search_string_type(); |
|
477 | - $data['groupby_field'] = $this->common->set_summaryprovider_groupby(); |
|
478 | - $data['groupby_time'] = $this->common->group_by_time(); |
|
479 | - $this->load->view('view_providersummary_report', $data); |
|
480 | - } |
|
463 | + function provider() { |
|
464 | + $data['page_title'] = 'Provider Summary Report'; |
|
465 | + $data['search_flag'] = true; |
|
466 | + $session_info = $this->session->userdata('providersummary_reports_search'); |
|
467 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array("type" => "3")); |
|
468 | + $trunklist = $this->db_model->build_dropdown('id,name', 'trunks', '', array()); |
|
469 | + $data['trunklist'] = $trunklist; |
|
470 | + $data['accountlist'] = $accountlist; |
|
471 | + $data['session_info'] = $session_info; |
|
472 | + $data['seconds'] = $this->session->userdata('provider_seconds'); |
|
473 | + $data['search_report'] = $this->common->search_report_in(); |
|
474 | + $data['grid_fields'] = $this->summary_form->build_providersummary(); |
|
475 | + $data["grid_buttons"] = $this->summary_form->build_grid_buttons_providersummary(); |
|
476 | + $data['search_string_type'] = $this->common->search_string_type(); |
|
477 | + $data['groupby_field'] = $this->common->set_summaryprovider_groupby(); |
|
478 | + $data['groupby_time'] = $this->common->group_by_time(); |
|
479 | + $this->load->view('view_providersummary_report', $data); |
|
480 | + } |
|
481 | 481 | |
482 | - function provider_json() { |
|
483 | - $search_arr = $this->summary_search_info('provider'); |
|
484 | - $count_all = $this->summary_model->get_providersummary_report_list(false, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
485 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
486 | - $json_data = $paging_data["json_paging"]; |
|
487 | - $query = $this->summary_model->get_providersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
488 | - if ($query->num_rows() > 0) { |
|
489 | - $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'provider', 'grid'); |
|
490 | - } |
|
491 | - $this->session->set_userdata('providersummary_reports_export', $search_arr); |
|
492 | - echo json_encode($json_data); |
|
493 | - } |
|
482 | + function provider_json() { |
|
483 | + $search_arr = $this->summary_search_info('provider'); |
|
484 | + $count_all = $this->summary_model->get_providersummary_report_list(false, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
485 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
486 | + $json_data = $paging_data["json_paging"]; |
|
487 | + $query = $this->summary_model->get_providersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
488 | + if ($query->num_rows() > 0) { |
|
489 | + $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'provider', 'grid'); |
|
490 | + } |
|
491 | + $this->session->set_userdata('providersummary_reports_export', $search_arr); |
|
492 | + echo json_encode($json_data); |
|
493 | + } |
|
494 | 494 | |
495 | - function provider_export_csv() { |
|
495 | + function provider_export_csv() { |
|
496 | 496 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
497 | 497 | $currency_id = $account_info['currency_id']; |
498 | 498 | $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
499 | - $search_arr = $this->session->userdata('providersummary_reports_export'); |
|
500 | - $data_arr = array(); |
|
501 | - $query = $this->summary_model->get_providersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true); |
|
502 | - $search_header = explode(",", $search_arr['export_str']); |
|
503 | - ob_clean(); |
|
504 | - $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Cost($currency)"); |
|
505 | - $header_arr[] = array_merge($search_header, $fixed_header); |
|
506 | - if ($query->num_rows() > 0) { |
|
507 | - $data_arr = $this->summary_report_grid($search_arr, $query, 'provider', 'export'); |
|
508 | - } |
|
509 | - $provider_array = array_merge($header_arr, $data_arr); |
|
499 | + $search_arr = $this->session->userdata('providersummary_reports_export'); |
|
500 | + $data_arr = array(); |
|
501 | + $query = $this->summary_model->get_providersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true); |
|
502 | + $search_header = explode(",", $search_arr['export_str']); |
|
503 | + ob_clean(); |
|
504 | + $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Cost($currency)"); |
|
505 | + $header_arr[] = array_merge($search_header, $fixed_header); |
|
506 | + if ($query->num_rows() > 0) { |
|
507 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'provider', 'export'); |
|
508 | + } |
|
509 | + $provider_array = array_merge($header_arr, $data_arr); |
|
510 | 510 | |
511 | - $this->load->helper('csv'); |
|
512 | - array_to_csv($provider_array, 'Provider_Summary_Report_'.date("Y-m-d").'.csv'); |
|
513 | - } |
|
511 | + $this->load->helper('csv'); |
|
512 | + array_to_csv($provider_array, 'Provider_Summary_Report_'.date("Y-m-d").'.csv'); |
|
513 | + } |
|
514 | 514 | |
515 | - function provider_search() { |
|
516 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
517 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
518 | - unset($_POST['action'], $_POST['advance_search']); |
|
519 | - $this->session->set_userdata('providersummary_reports_search', $this->input->post()); |
|
520 | - } |
|
521 | - redirect(base_url().'summary/provider/'); |
|
522 | - } |
|
515 | + function provider_search() { |
|
516 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
517 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
518 | + unset($_POST['action'], $_POST['advance_search']); |
|
519 | + $this->session->set_userdata('providersummary_reports_search', $this->input->post()); |
|
520 | + } |
|
521 | + redirect(base_url().'summary/provider/'); |
|
522 | + } |
|
523 | 523 | |
524 | - function provider_clearsearchfilter() { |
|
525 | - $this->session->set_userdata('advance_search', 0); |
|
526 | - $this->session->set_userdata('providersummary_reports_search', ""); |
|
527 | - $this->session->set_userdata('providersummary_reports_export', ""); |
|
528 | - redirect(base_url()."summary/provider/"); |
|
529 | - } |
|
524 | + function provider_clearsearchfilter() { |
|
525 | + $this->session->set_userdata('advance_search', 0); |
|
526 | + $this->session->set_userdata('providersummary_reports_search', ""); |
|
527 | + $this->session->set_userdata('providersummary_reports_export', ""); |
|
528 | + redirect(base_url()."summary/provider/"); |
|
529 | + } |
|
530 | 530 | |
531 | - function reseller() { |
|
532 | - $data['username'] = $this->session->userdata('user_name'); |
|
533 | - $data['page_title'] = 'Reseller Summary Report'; |
|
534 | - $data['search_flag'] = true; |
|
535 | - $session_info = $this->session->userdata('resellersummary_reports_search'); |
|
536 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
537 | - $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
538 | - $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array('reseller_id' => $reseller_id, "type" => "1")); |
|
539 | - $data['accountlist'] = $accountlist; |
|
540 | - $data['seconds'] = $this->session->userdata('reseller_seconds'); |
|
541 | - $data['session_info'] = $session_info; |
|
542 | - $data['search_report'] = $this->common->search_report_in(); |
|
543 | - $data['search_string_type'] = $this->common->search_string_type(); |
|
544 | - $new_column_arr = $this->summary_column_arr('reseller'); |
|
545 | - $data['grid_fields'] = $this->summary_form->build_resellersummary($new_column_arr); |
|
546 | - $data["grid_buttons"] = $this->summary_form->build_grid_buttons_resellersummary(); |
|
547 | - $data['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
548 | - $data['groupby_time'] = $this->common->group_by_time(); |
|
549 | - $this->load->view('view_resellersummary_report', $data); |
|
550 | - } |
|
531 | + function reseller() { |
|
532 | + $data['username'] = $this->session->userdata('user_name'); |
|
533 | + $data['page_title'] = 'Reseller Summary Report'; |
|
534 | + $data['search_flag'] = true; |
|
535 | + $session_info = $this->session->userdata('resellersummary_reports_search'); |
|
536 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
537 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
538 | + $accountlist = $this->db_model->build_dropdown_deleted('id,IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'where_arr', array('reseller_id' => $reseller_id, "type" => "1")); |
|
539 | + $data['accountlist'] = $accountlist; |
|
540 | + $data['seconds'] = $this->session->userdata('reseller_seconds'); |
|
541 | + $data['session_info'] = $session_info; |
|
542 | + $data['search_report'] = $this->common->search_report_in(); |
|
543 | + $data['search_string_type'] = $this->common->search_string_type(); |
|
544 | + $new_column_arr = $this->summary_column_arr('reseller'); |
|
545 | + $data['grid_fields'] = $this->summary_form->build_resellersummary($new_column_arr); |
|
546 | + $data["grid_buttons"] = $this->summary_form->build_grid_buttons_resellersummary(); |
|
547 | + $data['groupby_field'] = $this->common->set_summarycustomer_groupby(); |
|
548 | + $data['groupby_time'] = $this->common->group_by_time(); |
|
549 | + $this->load->view('view_resellersummary_report', $data); |
|
550 | + } |
|
551 | 551 | |
552 | - function reseller_json() { |
|
553 | - $search_arr = $this->summary_search_info('reseller'); |
|
554 | - $count_all = $this->summary_model->get_resellersummary_report_list(false, 0, 0, $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
555 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
556 | - $json_data = $paging_data["json_paging"]; |
|
557 | - $query = $this->summary_model->get_resellersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
558 | - if ($query->num_rows() > 0) { |
|
559 | - $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'reseller', 'grid'); |
|
560 | - } |
|
561 | - $this->session->set_userdata('resellersummary_reports_export', $search_arr); |
|
562 | - echo json_encode($json_data); |
|
563 | - } |
|
552 | + function reseller_json() { |
|
553 | + $search_arr = $this->summary_search_info('reseller'); |
|
554 | + $count_all = $this->summary_model->get_resellersummary_report_list(false, 0, 0, $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
555 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
556 | + $json_data = $paging_data["json_paging"]; |
|
557 | + $query = $this->summary_model->get_resellersummary_report_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], false); |
|
558 | + if ($query->num_rows() > 0) { |
|
559 | + $json_data['rows'] = $this->summary_report_grid($search_arr, $query, 'reseller', 'grid'); |
|
560 | + } |
|
561 | + $this->session->set_userdata('resellersummary_reports_export', $search_arr); |
|
562 | + echo json_encode($json_data); |
|
563 | + } |
|
564 | 564 | |
565 | - function reseller_search() { |
|
566 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
567 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
568 | - unset($_POST['action'], $_POST['advance_search']); |
|
569 | - $this->session->set_userdata('resellersummary_reports_search', $this->input->post()); |
|
570 | - } |
|
571 | - redirect(base_url()."summary/reseller/"); |
|
572 | - } |
|
565 | + function reseller_search() { |
|
566 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
567 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
568 | + unset($_POST['action'], $_POST['advance_search']); |
|
569 | + $this->session->set_userdata('resellersummary_reports_search', $this->input->post()); |
|
570 | + } |
|
571 | + redirect(base_url()."summary/reseller/"); |
|
572 | + } |
|
573 | 573 | |
574 | - function reseller_clearsearchfilter() { |
|
575 | - $this->session->set_userdata('advance_search', 0); |
|
576 | - $this->session->set_userdata('resellersummary_reports_search', ""); |
|
577 | - $this->session->set_userdata('resellersummary_reports_export', ""); |
|
578 | - redirect(base_url()."summary/reseller/"); |
|
579 | - } |
|
574 | + function reseller_clearsearchfilter() { |
|
575 | + $this->session->set_userdata('advance_search', 0); |
|
576 | + $this->session->set_userdata('resellersummary_reports_search', ""); |
|
577 | + $this->session->set_userdata('resellersummary_reports_export', ""); |
|
578 | + redirect(base_url()."summary/reseller/"); |
|
579 | + } |
|
580 | 580 | |
581 | - function reseller_export_csv() { |
|
581 | + function reseller_export_csv() { |
|
582 | 582 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
583 | 583 | $currency_id = $account_info['currency_id']; |
584 | 584 | $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
585 | 585 | |
586 | - $search_arr = $this->session->userdata('resellersummary_reports_export'); |
|
587 | - $data_arr = array(); |
|
588 | - $query = $this->summary_model->get_resellersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true); |
|
589 | - $search_header = explode(",", $search_arr['export_str']); |
|
590 | - ob_clean(); |
|
591 | - $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Debit($currency)", "Cost($currency)", "Profit"); |
|
592 | - $header_arr[] = array_merge($search_header, $fixed_header); |
|
593 | - if ($query->num_rows() > 0) { |
|
594 | - $data_arr = $this->summary_report_grid($search_arr, $query, 'reseller', 'export'); |
|
595 | - } |
|
596 | - $reseller_array = array_merge($header_arr, $data_arr); |
|
597 | - $this->load->helper('csv'); |
|
598 | - array_to_csv($reseller_array, 'Reseller_Summary_Report_'.date("Y-m-d").'.csv'); |
|
599 | - } |
|
586 | + $search_arr = $this->session->userdata('resellersummary_reports_export'); |
|
587 | + $data_arr = array(); |
|
588 | + $query = $this->summary_model->get_resellersummary_report_list(true, '', '', $search_arr['group_by_str'], $search_arr['select_str'], $search_arr['order_str'], true); |
|
589 | + $search_header = explode(",", $search_arr['export_str']); |
|
590 | + ob_clean(); |
|
591 | + $fixed_header = array("Attempted Calls", "Completed Calls", "Duration", "ASR", "ACD", "MCD", "Billable", "Debit($currency)", "Cost($currency)", "Profit"); |
|
592 | + $header_arr[] = array_merge($search_header, $fixed_header); |
|
593 | + if ($query->num_rows() > 0) { |
|
594 | + $data_arr = $this->summary_report_grid($search_arr, $query, 'reseller', 'export'); |
|
595 | + } |
|
596 | + $reseller_array = array_merge($header_arr, $data_arr); |
|
597 | + $this->load->helper('csv'); |
|
598 | + array_to_csv($reseller_array, 'Reseller_Summary_Report_'.date("Y-m-d").'.csv'); |
|
599 | + } |
|
600 | 600 | |
601 | 601 | } |
602 | 602 | ?> |
@@ -327,14 +327,14 @@ discard block |
||
327 | 327 | unset($_POST['advance_search']); |
328 | 328 | $this->session->set_userdata('customersummary_reports_search', $this->input->post()); |
329 | 329 | } |
330 | - redirect(base_url() . 'summary/customer/'); |
|
330 | + redirect(base_url().'summary/customer/'); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | function customer_clearsearchfilter() { |
334 | 334 | $this->session->set_userdata('advance_search', 0); |
335 | 335 | $this->session->set_userdata('customersummary_reports_search', ""); |
336 | 336 | $this->session->set_userdata('customersummary_reports_export', ""); |
337 | - redirect(base_url() . 'summary/customer/'); |
|
337 | + redirect(base_url().'summary/customer/'); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | function summary_search_info($entity) { |
344 | 344 | $group_by_str = null; |
345 | 345 | $select_str = null; |
346 | - $group_by_time=null; |
|
346 | + $group_by_time = null; |
|
347 | 347 | $group_by_1 = null; |
348 | 348 | $group_by_2 = null; |
349 | 349 | $group_by_3 = null; |
350 | - $order_str=null; |
|
350 | + $order_str = null; |
|
351 | 351 | $custom_total_array = array(); |
352 | 352 | $custom_search = array(); |
353 | 353 | $export_select_str = null; |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | $this->fpdf = new PDF('P', 'pt'); |
39 | 39 | $this->fpdf->initialize('P', 'mm', 'A4'); |
40 | 40 | |
41 | - if ($this->session->userdata('user_login') == FALSE) |
|
42 | - redirect(base_url().'/astpp/login'); |
|
41 | + if ($this->session->userdata('user_login') == FALSE) { |
|
42 | + redirect(base_url().'/astpp/login'); |
|
43 | + } |
|
43 | 44 | } |
44 | 45 | function customer() { |
45 | 46 | $data['page_title'] = 'Customer Summary Report'; |
@@ -202,7 +203,7 @@ discard block |
||
202 | 203 | $new_arr[] = $row1['notes']; |
203 | 204 | } elseif ($search_arr['groupby_3'] == 'trunk_id') { |
204 | 205 | $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
205 | - } elseif ($search_arr['groupby_3'] == 'package_id') { |
|
206 | + } elseif ($search_arr['groupby_3'] == 'package_id') { |
|
206 | 207 | $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
207 | 208 | } |
208 | 209 | if (empty($new_arr)) { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/> |
21 | 21 | ############################################################################ |
22 | 22 | |
23 | -if (!defined('BASEPATH')) |
|
23 | +if ( ! defined('BASEPATH')) |
|
24 | 24 | exit('No direct script access allowed'); |
25 | 25 | |
26 | 26 | class Summary_form { |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | $form['Search'] = array( |
34 | 34 | array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
35 | 35 | array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
36 | - array('Account', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"3")), |
|
36 | + array('Account', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"3")), |
|
37 | 37 | array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`status`=2, concat(name,"","^"),name) as name', 'trunks', 'build_dropdown_deleted', '', array("status" => "1")), |
38 | - array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''), |
|
38 | + array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''), |
|
39 | 39 | array(' Code Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''), |
40 | 40 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
41 | 41 | array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
@@ -44,124 +44,124 @@ discard block |
||
44 | 44 | |
45 | 45 | return $form; |
46 | 46 | } |
47 | - function build_providersummary(){ |
|
47 | + function build_providersummary() { |
|
48 | 48 | |
49 | 49 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
50 | -$currency_id=$account_info['currency_id']; |
|
51 | -$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
50 | +$currency_id = $account_info['currency_id']; |
|
51 | +$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
52 | 52 | |
53 | - $new_arr=array(); |
|
54 | - if($this->CI->session->userdata('advance_search')=='1'){ |
|
55 | - $search_array=$this->CI->session->userdata('providersummary_reports_search'); |
|
56 | - if(isset($search_array['time']) && !empty($search_array['time'])){ |
|
57 | - $new_arr[]=array($search_array['time'], "151", $search_array['time']."(callstart)", "", "", ""); |
|
53 | + $new_arr = array(); |
|
54 | + if ($this->CI->session->userdata('advance_search') == '1') { |
|
55 | + $search_array = $this->CI->session->userdata('providersummary_reports_search'); |
|
56 | + if (isset($search_array['time']) && ! empty($search_array['time'])) { |
|
57 | + $new_arr[] = array($search_array['time'], "151", $search_array['time']."(callstart)", "", "", ""); |
|
58 | 58 | } |
59 | - if(isset($search_array['groupby_1']) && !empty($search_array['groupby_1'])){ |
|
60 | - $first_column_groupby=$search_array['groupby_1']; |
|
61 | - if($first_column_groupby == 'provider_id'){ |
|
62 | - $new_arr[]=array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
63 | - } elseif ($first_column_groupby =='pattern'){ |
|
64 | - $new_arr[]=array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val"); |
|
65 | - $new_arr[]=array("Destination", "85", "notes", "", "", ""); |
|
66 | - } elseif($first_column_groupby =='trunk_id'){ |
|
67 | - $new_arr[]=array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name"); |
|
68 | - } elseif($first_column_groupby == 'package_id'){ |
|
69 | - $new_arr[]=array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
59 | + if (isset($search_array['groupby_1']) && ! empty($search_array['groupby_1'])) { |
|
60 | + $first_column_groupby = $search_array['groupby_1']; |
|
61 | + if ($first_column_groupby == 'provider_id') { |
|
62 | + $new_arr[] = array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
63 | + } elseif ($first_column_groupby == 'pattern') { |
|
64 | + $new_arr[] = array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val"); |
|
65 | + $new_arr[] = array("Destination", "85", "notes", "", "", ""); |
|
66 | + } elseif ($first_column_groupby == 'trunk_id') { |
|
67 | + $new_arr[] = array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name"); |
|
68 | + } elseif ($first_column_groupby == 'package_id') { |
|
69 | + $new_arr[] = array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
70 | 70 | } |
71 | 71 | } |
72 | - if(isset($search_array['groupby_2']) && !empty($search_array['groupby_2'])){ |
|
73 | - $third_column_groupby=$search_array['groupby_2']; |
|
74 | - if($third_column_groupby == 'provider_id'){ |
|
75 | - $new_arr[]=array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
76 | - } elseif ($third_column_groupby =='pattern'){ |
|
77 | - $new_arr[]=array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val"); |
|
78 | - $new_arr[]=array("Destination", "85", "notes", "", "", ""); |
|
79 | - } elseif($third_column_groupby=='trunk_id'){ |
|
80 | - $new_arr[]=array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name"); |
|
81 | - } elseif($third_column_groupby == 'package_id'){ |
|
82 | - $new_arr[]=array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
72 | + if (isset($search_array['groupby_2']) && ! empty($search_array['groupby_2'])) { |
|
73 | + $third_column_groupby = $search_array['groupby_2']; |
|
74 | + if ($third_column_groupby == 'provider_id') { |
|
75 | + $new_arr[] = array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
76 | + } elseif ($third_column_groupby == 'pattern') { |
|
77 | + $new_arr[] = array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val"); |
|
78 | + $new_arr[] = array("Destination", "85", "notes", "", "", ""); |
|
79 | + } elseif ($third_column_groupby == 'trunk_id') { |
|
80 | + $new_arr[] = array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name"); |
|
81 | + } elseif ($third_column_groupby == 'package_id') { |
|
82 | + $new_arr[] = array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
83 | 83 | } |
84 | 84 | } |
85 | - if(isset($search_array['groupby_3']) && !empty($search_array['groupby_3'])){ |
|
86 | - $fifth_column_groupby=$search_array['groupby_3']; |
|
87 | - if($fifth_column_groupby == 'provider_id'){ |
|
88 | - $new_arr[]=array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
89 | - } elseif ($fifth_column_groupby =='pattern'){ |
|
90 | - $new_arr[]=array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val"); |
|
91 | - $new_arr[]=array("Destination", "85", "notes", "", "", ""); |
|
92 | - } elseif($fifth_column_groupby == 'trunk_id'){ |
|
93 | - $new_arr[]=array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name"); |
|
94 | - } elseif($fifth_column_groupby == 'package_id'){ |
|
95 | - $new_arr[]=array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
85 | + if (isset($search_array['groupby_3']) && ! empty($search_array['groupby_3'])) { |
|
86 | + $fifth_column_groupby = $search_array['groupby_3']; |
|
87 | + if ($fifth_column_groupby == 'provider_id') { |
|
88 | + $new_arr[] = array("Account", "151", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
89 | + } elseif ($fifth_column_groupby == 'pattern') { |
|
90 | + $new_arr[] = array("Code", "65", "pattern", "pattern", "", "get_only_numeric_val"); |
|
91 | + $new_arr[] = array("Destination", "85", "notes", "", "", ""); |
|
92 | + } elseif ($fifth_column_groupby == 'trunk_id') { |
|
93 | + $new_arr[] = array("Trunk", "151", "trunk_id", "name", "trunks", "get_field_name"); |
|
94 | + } elseif ($fifth_column_groupby == 'package_id') { |
|
95 | + $new_arr[] = array("Package", "151", "package_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
99 | - if(empty($new_arr)) |
|
100 | - $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
99 | + if (empty($new_arr)) |
|
100 | + $new_arr[] = array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
101 | 101 | $fixed_arr = array( |
102 | 102 | array("Attempted Calls", "130", "attempted_calls", "", "", ""), |
103 | 103 | array("Completed Calls", "130", "description", "", "", ""), |
104 | - array("Duration","85","billable",'','',''), |
|
105 | - array("ASR","83","asr",'','',''), |
|
106 | - array("ACD","83","acd ",'','',''), |
|
107 | - array("MCD","83","mcd",'','',''), |
|
108 | - array("Billable","102","billable",'','',''), |
|
109 | - array("Cost($currency)","117","cost",'','',''), |
|
104 | + array("Duration", "85", "billable", '', '', ''), |
|
105 | + array("ASR", "83", "asr", '', '', ''), |
|
106 | + array("ACD", "83", "acd ", '', '', ''), |
|
107 | + array("MCD", "83", "mcd", '', '', ''), |
|
108 | + array("Billable", "102", "billable", '', '', ''), |
|
109 | + array("Cost($currency)", "117", "cost", '', '', ''), |
|
110 | 110 | ); |
111 | - $grid_field_arr = json_encode(array_merge($new_arr,$fixed_arr)); |
|
111 | + $grid_field_arr = json_encode(array_merge($new_arr, $fixed_arr)); |
|
112 | 112 | return $grid_field_arr; |
113 | 113 | } |
114 | 114 | function build_grid_buttons_providersummary() { |
115 | - $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/summary/provider_export_csv/", 'single'))); |
|
115 | + $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/summary/provider_export_csv/", 'single'))); |
|
116 | 116 | return $buttons_json; |
117 | 117 | } |
118 | 118 | function get_resellersummary_search_form() { |
119 | - $form['forms'] = array("",array('id' => "resellersummary_search")); |
|
119 | + $form['forms'] = array("", array('id' => "resellersummary_search")); |
|
120 | 120 | $form['Search'] = array( |
121 | 121 | array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
122 | 122 | array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
123 | - array('Account', 'reseller_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"1")), |
|
123 | + array('Account', 'reseller_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"1")), |
|
124 | 124 | array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''), |
125 | 125 | array('Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''), |
126 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
126 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
127 | 127 | $form['button_search'] = array('name' => 'action', 'id' => "resellersummary_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
128 | 128 | $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'); |
129 | 129 | |
130 | 130 | return $form; |
131 | 131 | } |
132 | - function build_resellersummary($new_column_arr){ |
|
132 | + function build_resellersummary($new_column_arr) { |
|
133 | 133 | |
134 | 134 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
135 | -$currency_id=$account_info['currency_id']; |
|
136 | -$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
135 | +$currency_id = $account_info['currency_id']; |
|
136 | +$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
137 | 137 | |
138 | -$column_arr=array( |
|
139 | - array("Attempted Calls", "120", "attempted_calls", "", "", "","","true","center"), |
|
140 | - array("Completed Calls", "120", "description", "", "", "","","true","center"), |
|
141 | - array("Duration","91","billable",'','','',"","true","center"), |
|
142 | - array("ASR","78","asr",'','','',"","true","center"), |
|
143 | - array("ACD","78","acd ",'','','',"","true","center"), |
|
144 | - array("MCD","78","mcd",'','','',"","true","center"), |
|
145 | - array("Billable","80","billable",'','','',"","true","center"), |
|
146 | - array("Debit($currency)","100","cost",'','','',"","true","right"), |
|
147 | - array("Cost($currency)","100","price",'','','',"","true","right"), |
|
148 | - array("Profit($currency)", "100", "profit", "", "", "","","true","right"), |
|
138 | +$column_arr = array( |
|
139 | + array("Attempted Calls", "120", "attempted_calls", "", "", "", "", "true", "center"), |
|
140 | + array("Completed Calls", "120", "description", "", "", "", "", "true", "center"), |
|
141 | + array("Duration", "91", "billable", '', '', '', "", "true", "center"), |
|
142 | + array("ASR", "78", "asr", '', '', '', "", "true", "center"), |
|
143 | + array("ACD", "78", "acd ", '', '', '', "", "true", "center"), |
|
144 | + array("MCD", "78", "mcd", '', '', '', "", "true", "center"), |
|
145 | + array("Billable", "80", "billable", '', '', '', "", "true", "center"), |
|
146 | + array("Debit($currency)", "100", "cost", '', '', '', "", "true", "right"), |
|
147 | + array("Cost($currency)", "100", "price", '', '', '', "", "true", "right"), |
|
148 | + array("Profit($currency)", "100", "profit", "", "", "", "", "true", "right"), |
|
149 | 149 | ); |
150 | - $grid_field_arr = json_encode(array_merge($new_column_arr,$column_arr)); |
|
150 | + $grid_field_arr = json_encode(array_merge($new_column_arr, $column_arr)); |
|
151 | 151 | return $grid_field_arr; |
152 | 152 | } |
153 | 153 | function build_grid_buttons_resellersummary() { |
154 | - $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/summary/reseller_export_csv/", 'single'))); |
|
154 | + $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/summary/reseller_export_csv/", 'single'))); |
|
155 | 155 | return $buttons_json; |
156 | 156 | } |
157 | 157 | function get_customersummary_search_form() { |
158 | 158 | |
159 | - $form['forms'] = array(base_url() . 'summary/customer_search',array('id' => "customersummary_search","name"=>"customersummary_search")); |
|
159 | + $form['forms'] = array(base_url().'summary/customer_search', array('id' => "customersummary_search", "name"=>"customersummary_search")); |
|
160 | 160 | $form['Search'] = array( |
161 | 161 | array('From Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_from_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'start_date[start_date-date]'), |
162 | 162 | array('To Date', 'INPUT', array('name' => 'callstart[]', 'id' => 'customer_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'end_date[end_date-date]'), |
163 | - array('Accounts', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0","type"=>"GLOBAL")), |
|
164 | - array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''), |
|
163 | + array('Accounts', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => "0", "type"=>"GLOBAL")), |
|
164 | + array('Code ', 'INPUT', array('name' => 'pattern[pattern]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''), |
|
165 | 165 | array('Code Destination ', 'INPUT', array('name' => 'notes[notes]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'notes[notes-string]', '', '', '', 'search_string_type', ''), |
166 | 166 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
167 | 167 | array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
@@ -176,29 +176,29 @@ discard block |
||
176 | 176 | |
177 | 177 | return $form; |
178 | 178 | } |
179 | - function build_customersummary($new_column_arr){ |
|
179 | + function build_customersummary($new_column_arr) { |
|
180 | 180 | |
181 | 181 | $account_info = $accountinfo = $this->CI->session->userdata('accountinfo'); |
182 | -$currency_id=$account_info['currency_id']; |
|
183 | -$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
182 | +$currency_id = $account_info['currency_id']; |
|
183 | +$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id); |
|
184 | 184 | |
185 | - $column_arr=array( |
|
186 | - array("Attempted Calls", "120", "attempted_calls", "", "", "","","true","center"), |
|
187 | - array("Completed Calls", "120", "description", "", "", "","","true","center"), |
|
188 | - array("Duration","95","billable",'','','',"","true","center"), |
|
189 | - array("ASR","85","asr",'','','',"","true","center"), |
|
190 | - array("ACD","85","acd ",'','','',"","true","center"), |
|
191 | - array("MCD","85","mcd",'','','',"","true","center"), |
|
192 | - array("Billable","90","billable",'','','',"","true","right"), |
|
193 | - array("Debit($currency)","87","cost",'','','',"","true","right"), |
|
194 | - array("Cost($currency)","85","price",'','','',"","true","right"), |
|
195 | - array("Profit($currency)", "93", "profit", "", "", "","","true","right"), |
|
185 | + $column_arr = array( |
|
186 | + array("Attempted Calls", "120", "attempted_calls", "", "", "", "", "true", "center"), |
|
187 | + array("Completed Calls", "120", "description", "", "", "", "", "true", "center"), |
|
188 | + array("Duration", "95", "billable", '', '', '', "", "true", "center"), |
|
189 | + array("ASR", "85", "asr", '', '', '', "", "true", "center"), |
|
190 | + array("ACD", "85", "acd ", '', '', '', "", "true", "center"), |
|
191 | + array("MCD", "85", "mcd", '', '', '', "", "true", "center"), |
|
192 | + array("Billable", "90", "billable", '', '', '', "", "true", "right"), |
|
193 | + array("Debit($currency)", "87", "cost", '', '', '', "", "true", "right"), |
|
194 | + array("Cost($currency)", "85", "price", '', '', '', "", "true", "right"), |
|
195 | + array("Profit($currency)", "93", "profit", "", "", "", "", "true", "right"), |
|
196 | 196 | ); |
197 | - $grid_field_arr = json_encode(array_merge($new_column_arr,$column_arr)); |
|
197 | + $grid_field_arr = json_encode(array_merge($new_column_arr, $column_arr)); |
|
198 | 198 | return $grid_field_arr; |
199 | 199 | } |
200 | 200 | function build_grid_buttons_customersummary() { |
201 | - $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/summary/customer_export_csv/", 'single'))); |
|
201 | + $buttons_json = json_encode(array(array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/summary/customer_export_csv/", 'single'))); |
|
202 | 202 | return $buttons_json; |
203 | 203 | } |
204 | 204 |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/> |
21 | 21 | ############################################################################ |
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 Summary_form { |
27 | 28 | function __construct() { |
@@ -96,8 +97,9 @@ discard block |
||
96 | 97 | } |
97 | 98 | } |
98 | 99 | } |
99 | - if(empty($new_arr)) |
|
100 | - $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
100 | + if(empty($new_arr)) { |
|
101 | + $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
102 | + } |
|
101 | 103 | $fixed_arr = array( |
102 | 104 | array("Attempted Calls", "130", "attempted_calls", "", "", ""), |
103 | 105 | array("Completed Calls", "130", "description", "", "", ""), |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | <legend><b>Search</b></legend> |
39 | 39 | <div class="col-md-4 no-padding"> |
40 | 40 | <label class="search_label col-md-12 no-padding">From Date</label> |
41 | - <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][0]) ? $session_info['callstart'][0] : date("Y-m-d") . " 00:00:00"; ?>" id="reseller_from_date" size="20" class="col-md-5 form-control text field " /> |
|
41 | + <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][0]) ? $session_info['callstart'][0] : date("Y-m-d")." 00:00:00"; ?>" id="reseller_from_date" size="20" class="col-md-5 form-control text field " /> |
|
42 | 42 | </div> |
43 | 43 | <div class="col-md-4 no-padding"> |
44 | 44 | <label class="search_label col-md-12 no-padding">To Date</label> |
45 | - <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][1]) ? $session_info['callstart'][1] : date("Y-m-d") . " 23:59:59"; ?>" id="reseller_to_date" size="20" class="col-md-5 form-control text field " /> |
|
45 | + <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][1]) ? $session_info['callstart'][1] : date("Y-m-d")." 23:59:59"; ?>" id="reseller_to_date" size="20" class="col-md-5 form-control text field " /> |
|
46 | 46 | </div> |
47 | 47 | <div class="col-md-4 no-padding"> |
48 | 48 | <label class="search_label col-md-12 no-padding">Account</label> |
49 | 49 | |
50 | 50 | <select name="accountid" class='col-md-5 form-control selectpicker' data-live-search='true'> |
51 | 51 | <option value=''>--Select--</option> |
52 | - <?php if (!empty($accountlist)) { |
|
52 | + <?php if ( ! empty($accountlist)) { |
|
53 | 53 | foreach ($accountlist as $key => $value) { |
54 | 54 | ?> |
55 | 55 | <optgroup label="<?php echo $key ?>"> |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | </div> |
72 | 72 | <div class="col-md-4 no-padding"> |
73 | 73 | <label class="search_label col-md-12 no-padding">Code </label> |
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 "/> |
|
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)) { |
|
77 | + if ( ! empty($search_string_type)) { |
|
78 | 78 | foreach ($search_string_type as $key => $value) { |
79 | 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) { |
|
80 | + if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && ! empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) { |
|
81 | 81 | $selected = "selected"; |
82 | 82 | } |
83 | 83 | ?> |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | </div> |
90 | 90 | <div class="col-md-4 no-padding"> |
91 | 91 | <label class="search_label col-md-12 no-padding">Destination </label> |
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 " /> |
|
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)) { |
|
95 | + if ( ! empty($search_string_type)) { |
|
96 | 96 | foreach ($search_string_type as $key => $value) { |
97 | 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) { |
|
98 | + if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && ! empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) { |
|
99 | 99 | $selected = "selected"; |
100 | 100 | } |
101 | 101 | ?> |
@@ -120,10 +120,10 @@ 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)) { |
|
123 | + if ( ! empty($groupby_time)) { |
|
124 | 124 | foreach ($groupby_time as $key => $value) { |
125 | 125 | $selected = null; |
126 | - if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) { |
|
126 | + if (isset($session_info['time']) && ! empty($session_info['time']) && $session_info['time'] == $key) { |
|
127 | 127 | $selected = "selected"; |
128 | 128 | } |
129 | 129 | ?> |
@@ -137,10 +137,10 @@ discard block |
||
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)) { |
|
140 | + if ( ! empty($groupby_field)) { |
|
141 | 141 | foreach ($groupby_field as $key => $value) { |
142 | 142 | $selected = null; |
143 | - if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
143 | + if (isset($session_info['groupby_1']) && ! empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
144 | 144 | $selected = "selected"; |
145 | 145 | } |
146 | 146 | ?> |
@@ -154,10 +154,10 @@ discard block |
||
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)) { |
|
157 | + if ( ! empty($groupby_field)) { |
|
158 | 158 | foreach ($groupby_field as $key => $value) { |
159 | 159 | $selected = null; |
160 | - if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
160 | + if (isset($session_info['groupby_2']) && ! empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
161 | 161 | $selected = "selected"; |
162 | 162 | } |
163 | 163 | ?> |
@@ -171,10 +171,10 @@ discard block |
||
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)) { |
|
174 | + if ( ! empty($groupby_field)) { |
|
175 | 175 | foreach ($groupby_field as $key => $value) { |
176 | 176 | $selected = null; |
177 | - if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
177 | + if (isset($session_info['groupby_3']) && ! empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
178 | 178 | $selected = "selected"; |
179 | 179 | } |
180 | 180 | ?> |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | <label class="search_label col-md-6" style="font-size:17px;text-align:right;">Display records in </label> |
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 | -if (!empty($search_report)) { |
|
196 | +if ( ! empty($search_report)) { |
|
197 | 197 | foreach ($search_report as $key => $value) { |
198 | 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) { |
|
199 | + if (isset($session_info['search_in']) && isset($session_info['search_in']) && ! empty($session_info['search_in']) && $session_info['search_in'] == $key) { |
|
200 | 200 | //echo $key;exit; |
201 | 201 | $selected = "selected"; |
202 | 202 | } |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | <legend><b>Search</b></legend> |
39 | 39 | <div class="col-md-4 no-padding"> |
40 | 40 | <label class="search_label col-md-12 no-padding">From Date</label> |
41 | - <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][0]) ? $session_info['callstart'][0] : date("Y-m-d") . " 00:00:00"; ?>" id="customer_from_date" size="20" class="col-md-5 form-control text field " /> |
|
41 | + <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][0]) ? $session_info['callstart'][0] : date("Y-m-d")." 00:00:00"; ?>" id="customer_from_date" size="20" class="col-md-5 form-control text field " /> |
|
42 | 42 | </div> |
43 | 43 | <div class="col-md-4 no-padding"> |
44 | 44 | <label class="search_label col-md-12 no-padding">To Date</label> |
45 | - <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][1]) ? $session_info['callstart'][1] : date("Y-m-d") . " 23:59:59"; ?>" id="customer_to_date" size="20" class="col-md-5 form-control text field " /> |
|
45 | + <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][1]) ? $session_info['callstart'][1] : date("Y-m-d")." 23:59:59"; ?>" id="customer_to_date" size="20" class="col-md-5 form-control text field " /> |
|
46 | 46 | </div> |
47 | 47 | <div class="col-md-4 no-padding"> |
48 | 48 | <label class="search_label col-md-12 no-padding">Account</label> |
49 | 49 | |
50 | 50 | <select name="accountid" class='col-md-5 form-control selectpicker' data-live-search='true'> |
51 | 51 | <option value=''>--Select--</option> |
52 | - <?php if (!empty($accountlist)) { |
|
52 | + <?php if ( ! empty($accountlist)) { |
|
53 | 53 | foreach ($accountlist as $key => $value) { |
54 | 54 | ?> |
55 | 55 | <optgroup label="<?php echo $key ?>"> |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | </div> |
72 | 72 | <div class="col-md-4 no-padding"> |
73 | 73 | <label class="search_label col-md-12 no-padding">Code </label> |
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 "/> |
|
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)) { |
|
77 | + if ( ! empty($search_string_type)) { |
|
78 | 78 | foreach ($search_string_type as $key => $value) { |
79 | 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) { |
|
80 | + if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && ! empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) { |
|
81 | 81 | $selected = "selected"; |
82 | 82 | } |
83 | 83 | ?> |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | </div> |
90 | 90 | <div class="col-md-4 no-padding"> |
91 | 91 | <label class="search_label col-md-12 no-padding">Destination </label> |
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 " /> |
|
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)) { |
|
95 | + if ( ! empty($search_string_type)) { |
|
96 | 96 | foreach ($search_string_type as $key => $value) { |
97 | 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) { |
|
98 | + if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && ! empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) { |
|
99 | 99 | $selected = "selected"; |
100 | 100 | } |
101 | 101 | ?> |
@@ -120,10 +120,10 @@ 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)) { |
|
123 | + if ( ! empty($groupby_time)) { |
|
124 | 124 | foreach ($groupby_time as $key => $value) { |
125 | 125 | $selected = null; |
126 | - if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) { |
|
126 | + if (isset($session_info['time']) && ! empty($session_info['time']) && $session_info['time'] == $key) { |
|
127 | 127 | $selected = "selected"; |
128 | 128 | } |
129 | 129 | ?> |
@@ -137,10 +137,10 @@ discard block |
||
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)) { |
|
140 | + if ( ! empty($groupby_field)) { |
|
141 | 141 | foreach ($groupby_field as $key => $value) { |
142 | 142 | $selected = null; |
143 | - if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
143 | + if (isset($session_info['groupby_1']) && ! empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
144 | 144 | $selected = "selected"; |
145 | 145 | } |
146 | 146 | ?> |
@@ -154,10 +154,10 @@ discard block |
||
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)) { |
|
157 | + if ( ! empty($groupby_field)) { |
|
158 | 158 | foreach ($groupby_field as $key => $value) { |
159 | 159 | $selected = null; |
160 | - if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
160 | + if (isset($session_info['groupby_2']) && ! empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
161 | 161 | $selected = "selected"; |
162 | 162 | } |
163 | 163 | ?> |
@@ -171,10 +171,10 @@ discard block |
||
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)) { |
|
174 | + if ( ! empty($groupby_field)) { |
|
175 | 175 | foreach ($groupby_field as $key => $value) { |
176 | 176 | $selected = null; |
177 | - if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
177 | + if (isset($session_info['groupby_3']) && ! empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
178 | 178 | $selected = "selected"; |
179 | 179 | } |
180 | 180 | ?> |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | <label class="search_label col-md-6" style="font-size:17px;text-align:right;">Display records in </label> |
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 | -if (!empty($search_report)) { |
|
196 | +if ( ! empty($search_report)) { |
|
197 | 197 | foreach ($search_report as $key => $value) { |
198 | 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) { |
|
199 | + if (isset($session_info['search_in']) && isset($session_info['search_in']) && ! empty($session_info['search_in']) && $session_info['search_in'] == $key) { |
|
200 | 200 | //echo $key;exit; |
201 | 201 | $selected = "selected"; |
202 | 202 | } |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | <legend><b>Search</b></legend> |
39 | 39 | <div class="col-md-4 no-padding"> |
40 | 40 | <label class="search_label col-md-12 no-padding">From Date</label> |
41 | - <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][0]) ? $session_info['callstart'][0] : date("Y-m-d") . " 00:00:00"; ?>" id="provider_from_date" size="20" class="col-md-5 form-control text field " /> |
|
41 | + <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][0]) ? $session_info['callstart'][0] : date("Y-m-d")." 00:00:00"; ?>" id="provider_from_date" size="20" class="col-md-5 form-control text field " /> |
|
42 | 42 | </div> |
43 | 43 | <div class="col-md-4 no-padding"> |
44 | 44 | <label class="search_label col-md-12 no-padding">To Date</label> |
45 | - <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][1]) ? $session_info['callstart'][1] : date("Y-m-d") . " 23:59:59"; ?>" id="provider_to_date" size="20" class="col-md-5 form-control text field " /> |
|
45 | + <input type="text" name="callstart[]" value="<?php echo isset($session_info['callstart'][1]) ? $session_info['callstart'][1] : date("Y-m-d")." 23:59:59"; ?>" id="provider_to_date" size="20" class="col-md-5 form-control text field " /> |
|
46 | 46 | </div> |
47 | 47 | <div class="col-md-4 no-padding"> |
48 | 48 | <label class="search_label col-md-12 no-padding">Account</label> |
49 | 49 | |
50 | 50 | <select name="provider_id" class='col-md-5 form-control selectpicker' data-live-search='true'> |
51 | 51 | <option value=''>--Select--</option> |
52 | - <?php if (!empty($accountlist)) { |
|
52 | + <?php if ( ! empty($accountlist)) { |
|
53 | 53 | foreach ($accountlist as $key => $value) { |
54 | 54 | ?> |
55 | 55 | <optgroup label="<?php echo $key ?>"> |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | <select name="trunk_id" class='col-md-5 form-control selectpicker' data-live-search='true'> |
75 | 75 | <option value=''>--Select--</option> |
76 | 76 | <?php |
77 | - if (!empty($trunklist)) { |
|
77 | + if ( ! empty($trunklist)) { |
|
78 | 78 | foreach ($trunklist as $key => $value) { |
79 | 79 | $selected = null; |
80 | 80 | if (isset($session_info['trunk_id']) && $session_info['trunk_id'] > 0 && $key == $session_info['trunk_id']) { |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | </div> |
89 | 89 | <div class="col-md-4 no-padding"> |
90 | 90 | <label class="search_label col-md-12 no-padding">Code </label> |
91 | - <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 "/> |
|
91 | + <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 "/> |
|
92 | 92 | <select name="pattern[pattern-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
93 | 93 | <?php |
94 | - if (!empty($search_string_type)) { |
|
94 | + if ( ! empty($search_string_type)) { |
|
95 | 95 | foreach ($search_string_type as $key => $value) { |
96 | 96 | $selected = null; |
97 | - if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && !empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) { |
|
97 | + if (isset($session_info['pattern']) && isset($session_info['pattern']['pattern']) && ! empty($session_info['pattern']['pattern']) && $session_info['pattern']['pattern-string'] == $key) { |
|
98 | 98 | $selected = "selected"; |
99 | 99 | } |
100 | 100 | ?> |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | </div> |
107 | 107 | <div class="col-md-4 no-padding"> |
108 | 108 | <label class="search_label col-md-12 no-padding">Destination </label> |
109 | - <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 " /> |
|
109 | + <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 " /> |
|
110 | 110 | <select name="notes[notes-string]" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
111 | 111 | <?php |
112 | - if (!empty($search_string_type)) { |
|
112 | + if ( ! empty($search_string_type)) { |
|
113 | 113 | foreach ($search_string_type as $key => $value) { |
114 | 114 | $selected = null; |
115 | - if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && !empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) { |
|
115 | + if (isset($session_info['notes']) && isset($session_info['notes']['notes']) && ! empty($session_info['notes']['notes']) && $session_info['notes']['notes-string'] == $key) { |
|
116 | 116 | $selected = "selected"; |
117 | 117 | } |
118 | 118 | ?> |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | <label class="search_label col-md-12 no-padding">Group By #time</label> |
138 | 138 | <select name="time" class='col-md-5 form-control selectpicker' style='margin-left:5px;'data-live-search='true'> |
139 | 139 | <?php |
140 | - if (!empty($groupby_time)) { |
|
140 | + if ( ! empty($groupby_time)) { |
|
141 | 141 | foreach ($groupby_time as $key => $value) { |
142 | 142 | $selected = null; |
143 | - if (isset($session_info['time']) && !empty($session_info['time']) && $session_info['time'] == $key) { |
|
143 | + if (isset($session_info['time']) && ! empty($session_info['time']) && $session_info['time'] == $key) { |
|
144 | 144 | $selected = "selected"; |
145 | 145 | } |
146 | 146 | ?> |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | <label class="search_label col-md-12 no-padding">Group By #1</label> |
155 | 155 | <select name="groupby_1" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
156 | 156 | <?php |
157 | - if (!empty($groupby_field)) { |
|
157 | + if ( ! empty($groupby_field)) { |
|
158 | 158 | foreach ($groupby_field as $key => $value) { |
159 | 159 | $selected = null; |
160 | - if (isset($session_info['groupby_1']) && !empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
160 | + if (isset($session_info['groupby_1']) && ! empty($session_info['groupby_1']) && $session_info['groupby_1'] == $key) { |
|
161 | 161 | $selected = "selected"; |
162 | 162 | } |
163 | 163 | ?> |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | <label class="search_label col-md-12 no-padding">Group By #2</label> |
172 | 172 | <select name="groupby_2" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
173 | 173 | <?php |
174 | - if (!empty($groupby_field)) { |
|
174 | + if ( ! empty($groupby_field)) { |
|
175 | 175 | foreach ($groupby_field as $key => $value) { |
176 | 176 | $selected = null; |
177 | - if (isset($session_info['groupby_2']) && !empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
177 | + if (isset($session_info['groupby_2']) && ! empty($session_info['groupby_2']) && $session_info['groupby_2'] == $key) { |
|
178 | 178 | $selected = "selected"; |
179 | 179 | } |
180 | 180 | ?> |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | <label class="search_label col-md-12 no-padding">Group By #3</label> |
189 | 189 | <select name="groupby_3" class='col-md-5 form-control selectpicker' style='margin-left:5px;' data-live-search='true'> |
190 | 190 | <?php |
191 | - if (!empty($groupby_field)) { |
|
191 | + if ( ! empty($groupby_field)) { |
|
192 | 192 | foreach ($groupby_field as $key => $value) { |
193 | 193 | $selected = null; |
194 | - if (isset($session_info['groupby_3']) && !empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
194 | + if (isset($session_info['groupby_3']) && ! empty($session_info['groupby_3']) && $session_info['groupby_3'] == $key) { |
|
195 | 195 | $selected = "selected"; |
196 | 196 | } |
197 | 197 | ?> |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | <label class="search_label col-md-6" style="font-size:17px;text-align:right;">Display records in </label> |
211 | 211 | <select name="search_in" class='col-md-5 form-control selectpicker' style='background: #ddd; width: 23% !important;' data-live-search='true'> |
212 | 212 | <?php |
213 | -if (!empty($search_report)) { |
|
213 | +if ( ! empty($search_report)) { |
|
214 | 214 | foreach ($search_report as $key => $value) { |
215 | 215 | $selected = null; |
216 | - if (isset($session_info['search_in']) && isset($session_info['search_in']) && !empty($session_info['search_in']) && $session_info['search_in'] == $key) { |
|
216 | + if (isset($session_info['search_in']) && isset($session_info['search_in']) && ! empty($session_info['search_in']) && $session_info['search_in'] == $key) { |
|
217 | 217 | //echo $key;exit; |
218 | 218 | $selected = "selected"; |
219 | 219 | } |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | $value[] = $value1['id']; |
52 | 52 | } |
53 | 53 | //$this->db->where_in('accountid', $value); |
54 | - if(!empty($value)){ |
|
54 | + if ( ! empty($value)) { |
|
55 | 55 | $this->db->where_in('accountid', $value); |
56 | - } else{ |
|
56 | + } else { |
|
57 | 57 | $this->db->where_in('accountid', '0'); |
58 | 58 | } |
59 | 59 | } |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | ASTPP 3.0 |
63 | 63 | in customer login show ipmap (ACL) module |
64 | 64 | *******/ |
65 | - if( $accountinfo['type'] == '0'){ |
|
66 | - $where=array('accountid'=>$accountinfo['id']); |
|
67 | - }else{ |
|
68 | - $where=''; |
|
65 | + if ($accountinfo['type'] == '0') { |
|
66 | + $where = array('accountid'=>$accountinfo['id']); |
|
67 | + } else { |
|
68 | + $where = ''; |
|
69 | 69 | } |
70 | 70 | /**************************************************************************************************************/ |
71 | 71 | if ($flag) { |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | in customer login show ipmap (ACL) module |
94 | 94 | *******/ |
95 | 95 | $account_data = $this->session->userdata("accountinfo"); |
96 | - if($account_data['type'] == '0'){ |
|
96 | + if ($account_data['type'] == '0') { |
|
97 | 97 | $add_array['accountid'] = $account_data['id']; |
98 | 98 | } |
99 | 99 | /*******************************************************************/ |
100 | - $data = array('created_date'=>gmdate('Y-m-d H:i:s'),'name' => $add_array['name'], 'ip' => $add_array['ip'], 'prefix' => $add_array['prefix'], 'accountid' => $add_array['accountid'],'status' => $add_array['status'] ,'context' => 'default'); |
|
100 | + $data = array('created_date'=>gmdate('Y-m-d H:i:s'), 'name' => $add_array['name'], 'ip' => $add_array['ip'], 'prefix' => $add_array['prefix'], 'accountid' => $add_array['accountid'], 'status' => $add_array['status'], 'context' => 'default'); |
|
101 | 101 | $this->db->insert("ip_map", $data); |
102 | 102 | return $this->db->insert_id(); |
103 | 103 | } |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | in customer login show ipmap (ACL) module |
109 | 109 | *******/ |
110 | 110 | $account_data = $this->session->userdata("accountinfo"); |
111 | - if($account_data['type'] == '0'){ |
|
111 | + if ($account_data['type'] == '0') { |
|
112 | 112 | $add_array['accountid'] = $account_data['id']; |
113 | 113 | } |
114 | 114 | /************************************************************************************************/ |
115 | - $data = array('last_modified_date'=>gmdate('Y-m-d H:i:s'),'name' => $add_array['name'], 'ip' => $add_array['ip'], 'prefix' => $add_array['prefix'], 'accountid' => $add_array['accountid'],'status' => $add_array['status'] , 'context' => 'default'); |
|
115 | + $data = array('last_modified_date'=>gmdate('Y-m-d H:i:s'), 'name' => $add_array['name'], 'ip' => $add_array['ip'], 'prefix' => $add_array['prefix'], 'accountid' => $add_array['accountid'], 'status' => $add_array['status'], 'context' => 'default'); |
|
116 | 116 | $this->db->where("id", $id); |
117 | 117 | return $this->db->update("ip_map", $data); |
118 | 118 |
@@ -64,7 +64,7 @@ |
||
64 | 64 | *******/ |
65 | 65 | if( $accountinfo['type'] == '0'){ |
66 | 66 | $where=array('accountid'=>$accountinfo['id']); |
67 | - }else{ |
|
67 | + } else{ |
|
68 | 68 | $where=''; |
69 | 69 | } |
70 | 70 | /**************************************************************************************************************/ |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $this->load->library('astpp/form'); |
33 | 33 | $this->load->model('ipmap_model'); |
34 | 34 | if ($this->session->userdata('user_login') == FALSE) |
35 | - redirect(base_url() . '/astpp/login'); |
|
35 | + redirect(base_url().'/astpp/login'); |
|
36 | 36 | } |
37 | 37 | function ipmap_add() { |
38 | 38 | $data['username'] = $this->session->userdata('user_name'); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | ASTPP 3.0 |
53 | 53 | in customer login show ipmap (ACL) module |
54 | 54 | *****************************************/ |
55 | - $ip=explode("/",$value['ip']); |
|
55 | + $ip = explode("/", $value['ip']); |
|
56 | 56 | $edit_data = $value; |
57 | - $edit_data['ip']=$ip[0]; |
|
57 | + $edit_data['ip'] = $ip[0]; |
|
58 | 58 | } |
59 | 59 | /*************************************************************************************************/ |
60 | 60 | $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $edit_data); |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | function ipmap_save() { |
65 | 65 | $add_array = $this->input->post(); |
66 | 66 | $ip = $add_array['ip']; |
67 | - if (strpos($ip,'/') !== false) { |
|
68 | - $add_array['ip']=$add_array['ip']; |
|
67 | + if (strpos($ip, '/') !== false) { |
|
68 | + $add_array['ip'] = $add_array['ip']; |
|
69 | 69 | } |
70 | - else{ |
|
71 | - $add_array['ip']=$add_array['ip'].'/32'; |
|
70 | + else { |
|
71 | + $add_array['ip'] = $add_array['ip'].'/32'; |
|
72 | 72 | } |
73 | 73 | $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array); |
74 | 74 | if ($add_array['id'] != '') { |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | echo $data['validation_errors']; |
79 | 79 | exit; |
80 | 80 | } else { |
81 | - $ip_free= $this->ipmap_model->edit_ipmap($add_array, $add_array['id']); |
|
81 | + $ip_free = $this->ipmap_model->edit_ipmap($add_array, $add_array['id']); |
|
82 | 82 | if ($ip_free) { |
83 | 83 | $this->load->library('freeswitch_lib'); |
84 | 84 | $this->load->module('freeswitch/freeswitch'); |
85 | 85 | $command = "api reloadacl"; |
86 | 86 | $response = $this->freeswitch_model->reload_freeswitch($command); |
87 | - $this->session->set_userdata('astpp_notification',$response); |
|
87 | + $this->session->set_userdata('astpp_notification', $response); |
|
88 | 88 | } |
89 | 89 | echo json_encode(array("SUCCESS"=> " IP Map updated successfully!")); |
90 | 90 | exit; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $this->load->module('freeswitch/freeswitch'); |
103 | 103 | $command = "api reloadacl"; |
104 | 104 | $response = $this->freeswitch_model->reload_freeswitch($command); |
105 | - $this->session->set_userdata('astpp_notification',$response); |
|
105 | + $this->session->set_userdata('astpp_notification', $response); |
|
106 | 106 | } |
107 | 107 | echo json_encode(array("SUCCESS"=> " IP Map added successfully!")); |
108 | 108 | exit; |
@@ -110,24 +110,24 @@ discard block |
||
110 | 110 | } |
111 | 111 | } |
112 | 112 | function ipmap_delete($id) { |
113 | - $ip_free=$this->ipmap_model-> remove_ipmap($id); |
|
113 | + $ip_free = $this->ipmap_model-> remove_ipmap($id); |
|
114 | 114 | if ($ip_free) { |
115 | 115 | $this->load->library('freeswitch_lib'); |
116 | 116 | $this->load->module('freeswitch/freeswitch'); |
117 | 117 | $command = "api reloadacl"; |
118 | 118 | $response = $this->freeswitch_model->reload_freeswitch($command); |
119 | - $this->session->set_userdata('astpp_notification',$response); |
|
119 | + $this->session->set_userdata('astpp_notification', $response); |
|
120 | 120 | } |
121 | 121 | $this->session->set_flashdata('astpp_notification', 'IP Map removed successfully!'); |
122 | 122 | /********************* |
123 | 123 | ASTPP 3.0 |
124 | 124 | in customer login show ipmap (ACL) module |
125 | 125 | *****************************************/ |
126 | - $accountdata=$this->session->userdata['accountinfo']; |
|
127 | - if($accountdata['type'] == '0'){ |
|
128 | - redirect(base_url() . 'user/user_ipmap_detail/'); |
|
129 | - }else{ |
|
130 | - redirect(base_url() . 'ipmap/ipmap_detail/'); |
|
126 | + $accountdata = $this->session->userdata['accountinfo']; |
|
127 | + if ($accountdata['type'] == '0') { |
|
128 | + redirect(base_url().'user/user_ipmap_detail/'); |
|
129 | + } else { |
|
130 | + redirect(base_url().'ipmap/ipmap_detail/'); |
|
131 | 131 | } |
132 | 132 | /*********************************************************************/ |
133 | 133 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->session->set_userdata('ipmap_list_search', $action); |
143 | 143 | } |
144 | 144 | if (@$ajax_search != 1) { |
145 | - redirect(base_url() . 'ipmap/ipmap_list/'); |
|
145 | + redirect(base_url().'ipmap/ipmap_list/'); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
@@ -173,35 +173,35 @@ discard block |
||
173 | 173 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
174 | 174 | $json_data = $paging_data["json_paging"]; |
175 | 175 | $query = $this->ipmap_model->ipmap_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
176 | - $query =$query->result_array(); |
|
176 | + $query = $query->result_array(); |
|
177 | 177 | foreach ($query as $key => $value) { |
178 | - $ipmap_checkbox='<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>'; |
|
179 | - if($account_data['type'] == '0'){ |
|
180 | - $ret_url = '<a href="'. base_url() .'user/user_ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'. base_url() .'user/user_ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
181 | - $account_name=''; |
|
178 | + $ipmap_checkbox = '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value='.$value['id'].'><lable class="lbl"></lable>'; |
|
179 | + if ($account_data['type'] == '0') { |
|
180 | + $ret_url = '<a href="'.base_url().'user/user_ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'.base_url().'user/user_ipmap_delete/'.$value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
181 | + $account_name = ''; |
|
182 | 182 | $json_data['rows'][] = array('cell' => array( |
183 | 183 | $ipmap_checkbox, |
184 | 184 | $value['name'], |
185 | 185 | $value['ip'], |
186 | 186 | $value['prefix'], |
187 | - $this->common->get_status('status', 'ip_map',$value), |
|
188 | - $this->common->convert_GMT_to('','',$value['created_date']), |
|
189 | - $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
187 | + $this->common->get_status('status', 'ip_map', $value), |
|
188 | + $this->common->convert_GMT_to('', '', $value['created_date']), |
|
189 | + $this->common->convert_GMT_to('', '', $value['last_modified_date']), |
|
190 | 190 | $ret_url, |
191 | 191 | |
192 | 192 | )); |
193 | - }else{ |
|
194 | - $ret_url = '<a href="'. base_url() .'ipmap/ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'. base_url() .'ipmap/ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
195 | - $account_name =$this->common->build_concat_string("first_name,last_name,number", "accounts",$value['accountid']); |
|
193 | + } else { |
|
194 | + $ret_url = '<a href="'.base_url().'ipmap/ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'.base_url().'ipmap/ipmap_delete/'.$value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
195 | + $account_name = $this->common->build_concat_string("first_name,last_name,number", "accounts", $value['accountid']); |
|
196 | 196 | $json_data['rows'][] = array('cell' => array( |
197 | 197 | $ipmap_checkbox, |
198 | 198 | $account_name, |
199 | 199 | $value['name'], |
200 | 200 | $value['ip'], |
201 | 201 | $value['prefix'], |
202 | - $this->common->get_status('status', 'ip_map',$value), |
|
203 | - $this->common->convert_GMT_to('','',$value['created_date']), |
|
204 | - $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
202 | + $this->common->get_status('status', 'ip_map', $value), |
|
203 | + $this->common->convert_GMT_to('', '', $value['created_date']), |
|
204 | + $this->common->convert_GMT_to('', '', $value['last_modified_date']), |
|
205 | 205 | $ret_url, |
206 | 206 | |
207 | 207 | )); |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | $this->load->library("ipmap_form"); |
32 | 32 | $this->load->library('astpp/form'); |
33 | 33 | $this->load->model('ipmap_model'); |
34 | - if ($this->session->userdata('user_login') == FALSE) |
|
35 | - redirect(base_url() . '/astpp/login'); |
|
34 | + if ($this->session->userdata('user_login') == FALSE) { |
|
35 | + redirect(base_url() . '/astpp/login'); |
|
36 | + } |
|
36 | 37 | } |
37 | 38 | function ipmap_add() { |
38 | 39 | $data['username'] = $this->session->userdata('user_name'); |
@@ -66,8 +67,7 @@ discard block |
||
66 | 67 | $ip = $add_array['ip']; |
67 | 68 | if (strpos($ip,'/') !== false) { |
68 | 69 | $add_array['ip']=$add_array['ip']; |
69 | - } |
|
70 | - else{ |
|
70 | + } else{ |
|
71 | 71 | $add_array['ip']=$add_array['ip'].'/32'; |
72 | 72 | } |
73 | 73 | $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $accountdata=$this->session->userdata['accountinfo']; |
127 | 127 | if($accountdata['type'] == '0'){ |
128 | 128 | redirect(base_url() . 'user/user_ipmap_detail/'); |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | redirect(base_url() . 'ipmap/ipmap_detail/'); |
131 | 131 | } |
132 | 132 | /*********************************************************************/ |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $ret_url, |
191 | 191 | |
192 | 192 | )); |
193 | - }else{ |
|
193 | + } else{ |
|
194 | 194 | $ret_url = '<a href="'. base_url() .'ipmap/ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'. base_url() .'ipmap/ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
195 | 195 | $account_name =$this->common->build_concat_string("first_name,last_name,number", "accounts",$value['accountid']); |
196 | 196 | $json_data['rows'][] = array('cell' => array( |