1,38 → 1,3 |
<?php |
|
include_once('includes/common.php'); |
Prolog('Summary'); |
|
function add_summary($count_name, $dur_name, $interval, $diff = NULL) |
{ |
global $db, $g_display; |
|
$query = "select count(acctid), sum(billsec) from cdr where" . CdrBaseQueryWhere() |
. ($interval ? " and date_trunc('" . $interval . "', calldate)" |
. ($diff ? " + interval '$diff $interval'" : "") . " = date_trunc('" |
. $interval . "', current_date)" : ""); |
$db->query($query); |
$db->fetch_row_idx(); |
$g_display->add_variables(array($count_name => $db->get_field(0), |
$dur_name => FormatDuration($db->get_field(1)))); |
} |
|
# active calls |
$db->query("select count(acctid), sum(extract(epoch from date_trunc('second',current_timestamp-linkdate)))" |
. " from activecalls where" . CdrBaseQueryWhere() . " and duration is null"); |
$db->fetch_row_idx(); |
$g_display->add_variables(array('CS_ACTIVE' => $db->get_field(0), |
'CS_ACTIVE_DUR' => FormatDuration($db->get_field(1)))); |
|
add_summary('CS_TODAY', 'CS_TODAY_DUR', 'day'); |
add_summary('CS_WEEK', 'CS_WEEK_DUR', 'week'); |
add_summary('CS_LAST_WEEK', 'CS_LAST_WEEK_DUR', 'week', 1); |
add_summary('CS_MONTH', 'CS_MONTH_DUR', 'month'); |
add_summary('CS_YEAR', 'CS_YEAR_DUR', 'year'); |
add_summary('CS_TOTAL', 'CS_TOTAL_DUR', null); |
|
$g_display->add_template('index'); |
|
Epilog(); |
|
header('Location: astweb.php'); |
?> |
Property changes: |
Deleted: svn:mergeinfo |