| 14 | 13 | getpost_ifset(array('current_page', 'fromstatsday_sday', 'fromstatsmonth_sday', 'days_compare', 'min_call', 'posted', 'dsttype', 'srctype', 'clidtype', 'channel', 'resulttype', 'stitle', 'atmenu', 'current_page', 'order', 'sens', 'dst', 'src', 'clid', 'userfieldtype', 'userfield', 'accountcodetype', 'accountcode', 'customer', 'entercustomer','entertariffgroup' ,'enterprovider', 'entertrunk', 'enterratecard')); |
|---|
| 15 | 14 | |
|---|
| 16 | 15 | |
|---|
| 66 | 46 | $FG_TABLE_COL[]=array (gettext("CalledNumber"), "calledstation", "15%", "center", "SORT", "30", "", "", "", "", "", "remove_prefix"); |
|---|
| 67 | 47 | $FG_TABLE_COL[]=array (gettext("Destination"), "destination", "15%", "center", "SORT", "30", "", "", "", "", "", "remove_prefix"); |
|---|
| 68 | | //$FG_TABLE_COL[]=array ("Country", "calledcountry", "10%", "center", "SORT", "30", "lie", "country", "countryname", "countrycode='%id'", "%1"); |
|---|
| 69 | | //$FG_TABLE_COL[]=array ("Site", "site_id", "7%", "center", "sort", "15", "lie", "site", "name", "id='%id'", "%1"); |
|---|
| 70 | | |
|---|
| 73 | 49 | $FG_TABLE_COL[]=array (gettext("CardUsed"), "username", "11%", "center", "SORT", "", "30", "", "", "", "", "linktocustomer"); |
|---|
| 74 | 50 | $FG_TABLE_COL[]=array (gettext("terminatecause"), "terminatecause", "10%", "center", "SORT", "30"); |
|---|
| 75 | 51 | $FG_TABLE_COL[]=array (gettext("IAX/SIP"), "sipiax", "6%", "center", "SORT", "", "list", $yesno); |
|---|
| 76 | | //$FG_TABLE_COL[]=array ("DestID", "destID", "12%", "center", "SORT", "30"); |
|---|
| 77 | | |
|---|
| 78 | | //if ($_SESSION["is_admin"]==1) $FG_TABLE_COL[]=array ("Con_charg", "connectcharge", "12%", "center", "SORT", "30"); |
|---|
| 79 | | //if ($_SESSION["is_admin"]==1) $FG_TABLE_COL[]=array ("Dis_charg", "disconnectcharge", "12%", "center", "SORT", "30"); |
|---|
| 80 | | //if ($_SESSION["is_admin"]==1) $FG_TABLE_COL[]=array ("Sec/mn", "secpermin", "12%", "center", "SORT", "30"); |
|---|
| 81 | | |
|---|
| 82 | | |
|---|
| 83 | | //if ($_SESSION["is_admin"]==1) $FG_TABLE_COL[]=array ("Buycosts", "buycosts", "12%", "center", "SORT", "30"); |
|---|
| 84 | 52 | $FG_TABLE_COL[]=array (gettext("InitialRate"), "calledrate", "10%", "center", "SORT", "30", "", "", "", "", "", "display_2dec"); |
|---|
| 85 | 53 | $FG_TABLE_COL[]=array (gettext("Cost"), "sessionbill", "10%", "center", "SORT", "30", "", "", "", "", "", "display_2bill"); |
|---|
| 133 | | if ($posted==1){ |
|---|
| 134 | | $SQLcmd = ''; |
|---|
| 135 | | |
|---|
| 136 | | //$SQLcmd = do_field($SQLcmd, 'src', 'source'); |
|---|
| 137 | | $SQLcmd = do_field($SQLcmd, 'dst', 'calledstation'); |
|---|
| 138 | | if ($_POST['before']) { |
|---|
| 139 | | if (strpos($SQLcmd, 'WHERE') > 0) { $SQLcmd = "$SQLcmd AND "; |
|---|
| 140 | | }else{ $SQLcmd = "$SQLcmd WHERE "; } |
|---|
| 141 | | $SQLcmd = "$SQLcmd t1.starttime <'".$_POST['before']."'"; |
|---|
| 142 | | } |
|---|
| 143 | | if ($_POST['after']) { if (strpos($SQLcmd, 'WHERE') > 0) { $SQLcmd = "$SQLcmd AND "; |
|---|
| 144 | | } else { $SQLcmd = "$SQLcmd WHERE "; } |
|---|
| 145 | | $SQLcmd = "$SQLcmd t1.starttime >'".$_POST['after']."'"; |
|---|
| 146 | | } |
|---|
| 147 | | |
|---|
| 148 | | } |
|---|
| 149 | | |
|---|
| 150 | | |
|---|
| 151 | | if (isset($customer) && ($customer>0)){ |
|---|
| | 97 | if ($posted==1) { |
|---|
| | 98 | $SQLcmd = ''; |
|---|
| | 99 | |
|---|
| | 100 | //$SQLcmd = do_field($SQLcmd, 'src', 'source'); |
|---|
| | 101 | $SQLcmd = do_field($SQLcmd, 'dst', 'calledstation'); |
|---|
| | 102 | if ($_POST['before']) { |
|---|
| | 103 | if (strpos($SQLcmd, 'WHERE') > 0) { |
|---|
| | 104 | $SQLcmd = "$SQLcmd AND "; |
|---|
| | 105 | }else{ |
|---|
| | 106 | $SQLcmd = "$SQLcmd WHERE "; |
|---|
| | 107 | } |
|---|
| | 108 | $SQLcmd = "$SQLcmd t1.starttime <'".$_POST['before']."'"; |
|---|
| | 109 | } |
|---|
| | 110 | if ($_POST['after']) { |
|---|
| | 111 | if (strpos($SQLcmd, 'WHERE') > 0) { |
|---|
| | 112 | $SQLcmd = "$SQLcmd AND "; |
|---|
| | 113 | } else { |
|---|
| | 114 | $SQLcmd = "$SQLcmd WHERE "; |
|---|
| | 115 | } |
|---|
| | 116 | $SQLcmd = "$SQLcmd t1.starttime >'".$_POST['after']."'"; |
|---|
| | 117 | } |
|---|
| | 118 | } |
|---|
| | 119 | |
|---|
| | 120 | |
|---|
| | 121 | if (isset($customer) && ($customer>0)) { |
|---|
| 162 | | if ($_SESSION["is_admin"] == 1) |
|---|
| 163 | | { |
|---|
| 164 | | if (isset($enterprovider) && $enterprovider > 0) { |
|---|
| 165 | | if (strlen($SQLcmd) > 0) $SQLcmd .= " AND "; else $SQLcmd .= " WHERE "; |
|---|
| 166 | | $SQLcmd .= " t3.id_provider = '$enterprovider' "; |
|---|
| 167 | | } |
|---|
| 168 | | if (isset($entertrunk) && $entertrunk > 0) { |
|---|
| 169 | | if (strlen($SQLcmd) > 0) $SQLcmd .= " AND "; else $SQLcmd .= " WHERE "; |
|---|
| 170 | | $SQLcmd .= " t3.id_trunk = '$entertrunk' "; |
|---|
| 171 | | } |
|---|
| 172 | | if (isset($entertariffgroup) && $entertariffgroup > 0) { |
|---|
| 173 | | if (strlen($SQLcmd) > 0) $SQLcmd .= " AND "; else $SQLcmd .= " WHERE "; |
|---|
| 174 | | $SQLcmd .= "t1.id_tariffgroup = '$entertariffgroup'"; |
|---|
| 175 | | } |
|---|
| 176 | | if (isset($enterratecard) && $enterratecard > 0) { |
|---|
| 177 | | if (strlen($SQLcmd) > 0) $SQLcmd .= " AND "; else $SQLcmd .= " WHERE "; |
|---|
| 178 | | $SQLcmd .= "t1.id_ratecard = '$enterratecard'"; |
|---|
| 179 | | } |
|---|
| 180 | | |
|---|
| | 132 | if ($_SESSION["is_admin"] == 1) { |
|---|
| | 133 | if (isset($enterprovider) && $enterprovider > 0) { |
|---|
| | 134 | if (strlen($SQLcmd) > 0) $SQLcmd .= " AND "; else $SQLcmd .= " WHERE "; |
|---|
| | 135 | $SQLcmd .= " t3.id_provider = '$enterprovider' "; |
|---|
| | 136 | } |
|---|
| | 137 | if (isset($entertrunk) && $entertrunk > 0) { |
|---|
| | 138 | if (strlen($SQLcmd) > 0) $SQLcmd .= " AND "; else $SQLcmd .= " WHERE "; |
|---|
| | 139 | $SQLcmd .= " t3.id_trunk = '$entertrunk' "; |
|---|
| | 140 | } |
|---|
| | 141 | if (isset($entertariffgroup) && $entertariffgroup > 0) { |
|---|
| | 142 | if (strlen($SQLcmd) > 0) $SQLcmd .= " AND "; else $SQLcmd .= " WHERE "; |
|---|
| | 143 | $SQLcmd .= "t1.id_tariffgroup = '$entertariffgroup'"; |
|---|
| | 144 | } |
|---|
| | 145 | if (isset($enterratecard) && $enterratecard > 0) { |
|---|
| | 146 | if (strlen($SQLcmd) > 0) $SQLcmd .= " AND "; else $SQLcmd .= " WHERE "; |
|---|
| | 147 | $SQLcmd .= "t1.id_ratecard = '$enterratecard'"; |
|---|
| | 148 | } |
|---|
| 189 | | $fromstatsday_sday = date("d"); |
|---|
| 190 | | $fromstatsmonth_sday = date("Y-m"); |
|---|
| 191 | | } |
|---|
| 192 | | |
|---|
| 193 | | |
|---|
| 194 | | |
|---|
| 195 | | //if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) $date_clause.=" AND calldate <= '$fromstatsmonth_sday-$fromstatsday_sday+23' AND calldate >= SUBDATE('$fromstatsmonth_sday-$fromstatsday_sday',INTERVAL $days_compare DAY)"; |
|---|
| 196 | | |
|---|
| 197 | | if (DB_TYPE == "postgres"){ |
|---|
| 198 | | if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) $date_clause.=" AND t1.starttime < date'$fromstatsmonth_sday-$fromstatsday_sday'+ INTERVAL '1 DAY' AND t1.starttime >= date'$fromstatsmonth_sday-$fromstatsday_sday'"; |
|---|
| 199 | | }else{ |
|---|
| 200 | | if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) $date_clause.=" AND t1.starttime < ADDDATE('$fromstatsmonth_sday-$fromstatsday_sday',INTERVAL 1 DAY) AND t1.starttime >= '$fromstatsmonth_sday-$fromstatsday_sday'"; |
|---|
| | 154 | $fromstatsday_sday = date("d"); |
|---|
| | 155 | $fromstatsmonth_sday = date("Y-m"); |
|---|
| | 156 | } |
|---|
| | 157 | |
|---|
| | 158 | if (DB_TYPE == "postgres") { |
|---|
| | 159 | if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) |
|---|
| | 160 | $date_clause.=" AND t1.starttime < date'$fromstatsmonth_sday-$fromstatsday_sday'+ INTERVAL '1 DAY' AND t1.starttime >= date'$fromstatsmonth_sday-$fromstatsday_sday'"; |
|---|
| | 161 | } else { |
|---|
| | 162 | if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) |
|---|
| | 163 | $date_clause.=" AND t1.starttime < ADDDATE('$fromstatsmonth_sday-$fromstatsday_sday',INTERVAL 1 DAY) AND t1.starttime >= '$fromstatsmonth_sday-$fromstatsday_sday'"; |
|---|
| 239 | | |
|---|
| 240 | | $instance_table_customer = new Table("cc_card", "id, username, lastname"); |
|---|
| 241 | | |
|---|
| 242 | | $FG_TABLE_CLAUSE = ""; |
|---|
| 243 | | /*if ($_SESSION["is_admin"]==0){ |
|---|
| 244 | | $FG_TABLE_CLAUSE =" IDmanager='".$_SESSION["pr_reseller_ID"]."'"; |
|---|
| 245 | | }*/ |
|---|
| 246 | | |
|---|
| 247 | | $list_customer = $instance_table_customer -> Get_list ($DBHandle, $FG_TABLE_CLAUSE, "id", "ASC", null, null, null, null); |
|---|
| 248 | | |
|---|
| 249 | | $nb_customer = count($list_customer); |
|---|
| 250 | | |
|---|
| 251 | | ?> |
|---|
| 252 | | |
|---|
| 253 | | <?php |
|---|
| 254 | | $smarty->display('main.tpl'); |
|---|
| | 199 | $smarty->display('main.tpl'); |
|---|
| | 200 | |
|---|