nothing, 1 => sql result, 2 => boucle checking, 3 other value checking) $FG_DEBUG = 0; // The variable FG_TABLE_NAME define the table name to use $FG_TABLE_NAME=DB_TABLENAME; // THIS VARIABLE DEFINE THE COLOR OF THE HEAD TABLE $FG_TABLE_HEAD_COLOR = "#D1D9E7"; $FG_TABLE_EXTERN_COLOR = "#7F99CC"; //#CC0033 (Rouge) $FG_TABLE_INTERN_COLOR = "#EDF3FF"; //#FFEAFF (Rose) // THIS VARIABLE DEFINE THE COLOR OF THE HEAD TABLE $FG_TABLE_ALTERNATE_ROW_COLOR[] = "#FFFFFF"; $FG_TABLE_ALTERNATE_ROW_COLOR[] = "#F2F8FF"; $FG_TABLE_ALTERNATE_ROW_COLOR[] = "#FFC0CB"; $FG_MIN_BILLING_SEC = "3"; //Set this to the number of seconds you want to turn the rows pink to show a short call. //$link = DbConnect(); $DBHandle = DbConnect(); // The variable Var_col would define the col that we want show in your table // First Name of the column in the html page, second name of the field $FG_TABLE_COL = array(); /******* Calldate Clid Src Dst Dcontext Channel Dstchannel Lastapp Lastdata Duration Billsec Disposition Amaflags Accountcode Uniqueid Serverid *******/ $FG_TABLE_COL[]=array ("Calldate", "calldate", "18%", "center", "SORT", "19"); $FG_TABLE_COL[]=array ("Channel", "channel", "13%", "center", "", "30", "", "", "", "", "", "display_acronym"); $FG_TABLE_COL[]=array ("Source", "src", "10%", "center", "", "30"); $FG_TABLE_COL[]=array ("Clid", "clid", "12%", "center", "", "30"); $FG_TABLE_COL[]=array ("Lastapp", "lastapp", "8%", "center", "", "30"); $FG_TABLE_COL[]=array ("Lastdata", "lastdata", "12%", "center", "", "30"); $FG_TABLE_COL[]=array ("Dst", "dst", "9%", "center", "SORT", "30"); $FG_TABLE_COL[]=array ("APP", "dst", "9%", "center", "", "30","list", $appli_list); //$FG_TABLE_COL[]=array ("Serverid", "serverid", "7%", "center", "", "30"); $FG_TABLE_COL[]=array ("Disposition", "disposition", "9%", "center", "", "30"); if ((!isset($resulttype)) || ($resulttype=="min")) $minute_function= "display_minute"; $FG_TABLE_COL[]=array ("Duration", "duration", "6%", "center", "SORT", "30", "", "", "", "", "", "$minute_function"); $FG_TABLE_COL[]=array ("Userfield", "userfield", "8%", "center", "", "20"); $FG_TABLE_COL[]=array ("Accountcode", "accountcode", "8%", "center", "", "20"); $FG_TABLE_DEFAULT_ORDER = "calldate"; $FG_TABLE_DEFAULT_SENS = "DESC"; // This Variable store the argument for the SQL query //$FG_COL_QUERY='calldate, channel, src, clid, lastapp, lastdata, dst, dst, serverid, disposition, duration'; //$FG_COL_QUERY='calldate, channel, src, clid, lastapp, lastdata, dst, dst, disposition, duration, userfield, accountcode'; $FG_COL_QUERY='calldate, channel, src, clid, lastapp, lastdata, dst, dst, disposition, billsec, userfield, accountcode'; //$FG_COL_QUERY_GRAPH='calldate, duration'; $FG_COL_QUERY_GRAPH='calldate, billsec'; // The variable LIMITE_DISPLAY define the limit of record to display by page $FG_LIMITE_DISPLAY=25; //Total number of results returned from the SQL query, used if there are less than 25 results. $FG_TOTAL_RES=''; // Number of column in the html table $FG_NB_TABLE_COL=count($FG_TABLE_COL); // The variable $FG_EDITION define if you want process to the edition of the database record $FG_EDITION=true; //This variable will store the total number of column $FG_TOTAL_TABLE_COL = $FG_NB_TABLE_COL; if ($FG_DELETION || $FG_EDITION) $FG_TOTAL_TABLE_COL++; //This variable define the Title of the HTML table $FG_HTML_TABLE_TITLE=" - Call Logs - "; //This variable define the width of the HTML table $FG_HTML_TABLE_WIDTH="100%"; //Default number to check against for incoming calls. Essentially, an incoming call is 7 digits long, or more. Therefore, 999999 would be the last 6 digit number, one that can be used internally. //Anything above 6 digits can be used internally. So we just check to see if src number is greater than 6. $FG_INCOMING_CALL_LIMIT=6; if ($FG_DEBUG == 3) echo "
Table : $FG_TABLE_NAME - Col_query : $FG_COL_QUERY"; $instance_table = new Table($FG_TABLE_NAME, $FG_COL_QUERY); $instance_table_graph = new Table($FG_TABLE_NAME, $FG_COL_QUERY_GRAPH); if ( is_null ($order) || is_null($sens) ){ $order = $FG_TABLE_DEFAULT_ORDER; $sens = $FG_TABLE_DEFAULT_SENS; } if ($posted==1){ function do_field_duration($sql,$fld, $fldsql){ $fldtype = $fld.'type'; global $$fld; global $$fldtype; if (isset($$fld) && ($$fld!='')){ if (strpos($sql,'WHERE') > 0){ $sql = "$sql AND "; }else{ $sql = "$sql WHERE "; } $sql = "$sql $fldsql"; if (isset ($$fldtype)){ switch ($$fldtype) { case 1: $sql = "$sql ='".$$fld."'"; break; case 2: $sql = "$sql <= '".$$fld."'"; break; case 3: $sql = "$sql < '".$$fld."'"; break; case 4: $sql = "$sql > '".$$fld."'"; break; case 5: $sql = "$sql >= '".$$fld."'"; break; } }else{ $sql = "$sql = '".$$fld."'"; } } return $sql; } function do_field($sql,$fld){ $fldtype = $fld.'type'; global $$fld; global $$fldtype; if (isset($$fld) && ($$fld!='')){ if (strpos($sql,'WHERE') > 0){ $sql = "$sql AND "; }else{ $sql = "$sql WHERE "; } $sql = "$sql $fld"; if (isset ($$fldtype)){ switch ($$fldtype) { case 1: $sql = "$sql='".$$fld."'"; break; case 2: $sql = "$sql LIKE '".$$fld."%'"; break; case 3: $sql = "$sql LIKE '%".$$fld."%'"; break; case 4: $sql = "$sql LIKE '%".$$fld."'"; } }else{ $sql = "$sql LIKE '%".$$fld."%'"; } } return $sql; } $SQLcmd = ''; $SQLcmd = do_field($SQLcmd, 'clid'); $SQLcmd = do_field($SQLcmd, 'src'); $SQLcmd = do_field($SQLcmd, 'dst'); $SQLcmd = do_field($SQLcmd, 'userfield'); $SQLcmd = do_field($SQLcmd, 'accountcode'); $SQLcmd = do_field($SQLcmd, 'channel'); $SQLcmd = do_field_duration($SQLcmd, 'duration1', 'duration'); $SQLcmd = do_field_duration($SQLcmd, 'duration2', 'duration'); } $date_clause=''; // Period (Month-Day) if (DB_TYPE == "postgres"){ $UNIX_TIMESTAMP = ""; }else{ $UNIX_TIMESTAMP = "UNIX_TIMESTAMP"; } if ($Period=="Month"){ if ($frommonth && isset($fromstatsmonth)) $date_clause.=" AND $UNIX_TIMESTAMP(calldate) >= $UNIX_TIMESTAMP('$fromstatsmonth-01')"; if ($tomonth && isset($tostatsmonth)) $date_clause.=" AND $UNIX_TIMESTAMP(calldate) <= $UNIX_TIMESTAMP('$tostatsmonth-31 23:59:59')"; }else{ if ($fromday && isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) $date_clause.=" AND $UNIX_TIMESTAMP(calldate) >= $UNIX_TIMESTAMP('$fromstatsmonth_sday-$fromstatsday_sday')"; if ($today && isset($tostatsday_sday) && isset($tostatsmonth_sday)) $date_clause.=" AND $UNIX_TIMESTAMP(calldate) <= $UNIX_TIMESTAMP('$tostatsmonth_sday-".sprintf("%02d",intval($tostatsday_sday)/*+1*/)." 23:59:59')"; } if ($disposition=='1') { //Show only Answered calls. $filteranswer = ' AND Disposition = "ANSWERED" '; } if ($disposition=='2') { //Show only Not Answered calls. $filteranswer = ' AND Disposition = "NO ANSWER" '; } if ($inout=='2') { //Show only incoming calls. Use .= to concatenate our previous answer, if DISPOSITION is used. $filteranswer .= ' AND LENGTH(src) > '.$FG_INCOMING_CALL_LIMIT.' '; } if ($inout=='3') { //Show only outgoing calls. $filteranswer .= ' AND LENGTH(src) <= '.$FG_INCOMING_CALL_LIMIT.' '; } //echo "
$date_clause
"; /* Month fromday today frommonth tomonth (true) fromstatsmonth tostatsmonth fromstatsday_sday fromstatsmonth_sday tostatsday_sday tostatsmonth_sday */ if (strpos($SQLcmd, 'WHERE') > 0) { $FG_TABLE_CLAUSE = substr($SQLcmd,6).$date_clause; }elseif (strpos($date_clause, 'AND') > 0){ $FG_TABLE_CLAUSE = substr($date_clause,5); } if (!isset ($FG_TABLE_CLAUSE) || strlen($FG_TABLE_CLAUSE)==0){ $cc_yearmonth = sprintf("%04d-%02d",date("Y"),date("n")); $FG_TABLE_CLAUSE=" $UNIX_TIMESTAMP(calldate) >= $UNIX_TIMESTAMP('$cc_yearmonth-01')"; } //--$list_total = $instance_table_graph -> Get_list ($FG_TABLE_CLAUSE, null, null, null, null, null, null); if ($posted==1){ $FG_TABLE_CLAUSE .= $filteranswer; //Concatenate our disposition (Answered/Not answered) to the table clause. //> function Get_list ($clause=null, $order=null, $sens=null, $field_order_letter=null, $letters = null, $limite=null, $current_record = NULL) $list = $instance_table -> Get_list ($FG_TABLE_CLAUSE, $order, $sens, null, null, $FG_LIMITE_DISPLAY, $current_page*$FG_LIMITE_DISPLAY); $_SESSION["pr_sql_export"]="SELECT $FG_COL_QUERY FROM $FG_TABLE_NAME WHERE $FG_TABLE_CLAUSE"; /************************/ $QUERY = "SELECT substring(calldate,1,10) AS day, sum(duration) AS calltime, count(*) as nbcall FROM cdr WHERE ".$FG_TABLE_CLAUSE."GROUP BY substring(calldate,1,10)"; //extract(DAY from calldate) //echo "$QUERY"; $res = $DBHandle -> query($QUERY); $num = $DBHandle -> num_rows(); $FG_TOTAL_RES=$num; for($i=0;$i<$num;$i++) { $DBHandle -> next_record(); $list_total_day [] =$DBHandle -> Record; } if ($FG_DEBUG == 3) echo "
Clause : $FG_TABLE_CLAUSE"; $nb_record = $instance_table -> Table_count ($FG_TABLE_CLAUSE); } //$nb_record = count($list_total); if ($FG_DEBUG >= 1) var_dump ($list); if ($nb_record<=$FG_LIMITE_DISPLAY){ $nb_record_max=1; }else{ if ($nb_record % $FG_LIMITE_DISPLAY == 0){ $nb_record_max=(intval($nb_record/$FG_LIMITE_DISPLAY)); }else{ $nb_record_max=(intval($nb_record/$FG_LIMITE_DISPLAY)+1); } } if ($FG_DEBUG == 3) echo "
Nb_record : $nb_record"; if ($FG_DEBUG == 3) echo "
Nb_record_max : $nb_record_max"; ?>
checked="checked" > Selection of the day
checked> From :    checked> To :
  SOURCE
  USERFIELD
  CHANNEL
  DISPOSITION


Number of calls : 0){ echo $nb_record; }else{echo "0";}?>
Back to Top
0){ for($i=0;$i<$FG_NB_TABLE_COL;$i++){ //$FG_TABLE_COL[$i][1]; //$FG_TABLE_COL[]=array ("Name", "name", "20%"); ?> Get_list ($sub_clause, null, null, null, null, null, null); $field_list_sun = split(',',$FG_TABLE_COL[$i][8]); $record_display = $FG_TABLE_COL[$i][10]; //echo $record_display; for ($l=1;$l<=count($field_list_sun);$l++){ $record_display = str_replace("%$l", $select_list[0][$l-1], $record_display); } }elseif ($FG_TABLE_COL[$i][6]=="list"){ $select_list = $FG_TABLE_COL[$i][7]; $record_display = $select_list[$recordset[$i]][0]; }else{ $record_display = $recordset[$i]; } if ( is_numeric($FG_TABLE_COL[$i][5]) && (strlen($record_display) > $FG_TABLE_COL[$i][5]) ){ $record_display = substr($record_display, 0, $FG_TABLE_COL[$i][5]-3).""; } ?>
">    
height=1>
1){ call_user_func($FG_TABLE_COL[$i][11], $record_display); }else{ echo stripslashes($record_display); } ?>
   
>
>
0){?> "> Previous - / - "> Next


0){ /*if (is_array($list) && count($list)>0){ $table_graph=array(); $numm=0; foreach ($list_total as $recordset){ $numm++; $mydate= substr($recordset[0],0,10); //echo "$mydate
"; if (is_array($table_graph[$mydate])){ $table_graph[$mydate][0]++; $table_graph[$mydate][1]=$table_graph[$mydate][1]+$recordset[1]; }else{ $table_graph[$mydate][0]=1; $table_graph[$mydate][1]=$recordset[1]; } }*/ $mmax=0; $totalcall==0; $totalminutes=0; foreach ($list_total_day as $data){ if ($mmax < $data[1]) $mmax=$data[1]; $totalcall+=$data[2]; $totalminutes+=$data[1]; } //echo "
$totalcall-$totalminutes"; /*foreach ($table_graph as $tkey => $data){ if ($mmax < $data[1]) $mmax=$data[1]; $totalcall+=$data[0]; $totalminutes+=$data[1]; }*/ //print_r($table_graph); ?>
TOTAL
ASTERISK MINUTES
DATE DURATION GRAPHIC CALLS ACT
TOTAL

Export PDF file Export CSV file

No calls in your selection.