Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1283 → Rev 1284

/asterisk-stats/trunk/template/cdr_detail.tpl
1,7 → 1,7
<div class="rval">Details for call ${CDR_ACCTID}</div>
<table class="stat cdr details">
<tr>
<th>Calldate</th>
<th>Call Date</th>
<td>${CDR_CALLDATE}&nbsp;</td>
</tr><tr>
<th>CLID</th>
29,10 → 29,10
<td>${CDR_LASTDATA}&nbsp;</td>
</tr><tr>
<th>Duration</th>
<td>${CDR_DURATION}&nbsp;</td>
<td>${CDR_DURATION_F} (${CDR_DURATION})&nbsp;</td>
</tr><tr>
<th>Billed Seconds</th>
<td>${CDR_BILLSEC}&nbsp;</td>
<th>Billed Duration</th>
<td>${CDR_BILLSEC_F} (${CDR_BILLSEC})&nbsp;</td>
</tr><tr>
<th>Disposition</th>
<td>${CDR_DISPOSITION}&nbsp;</td>
/asterisk-stats/trunk/template/summary.tpl
1,8 → 1,8
<table class="calls stat">
<tr>
<th>&nbsp;</th>
<th>calls</th>
<th>duration</th>
<th>Calls</th>
<th>Duration</th>
</tr><tr>
<td class="t"><a href=${HREF_CDR_LIST}=today>Today</a></td>
<td class="d"><a href=${HREF_CDR_LIST}=today>${CS_TODAY}</a></td>
/asterisk-stats/trunk/cdr.php
20,10 → 20,14
$cdr_detail = array();
$db->query_params('SELECT * FROM cdr WHERE acctid=$1', array($_GET['detail']));
$detail = $db->fetch_row();
 
for ($i=0;$i<$db->num_fields();$i++) {
$col = $db->get_field_name($i);
$cdr_detail['CDR_'.strtoupper($col)] = $detail[$col];
}
$cdr_detail['CDR_DURATION_F'] = Duration($detail['duration']);
$cdr_detail['CDR_BILLSEC_F'] = Duration($detail['billsec']);
 
$display->add_variables($cdr_detail);
$display->add_template('cdr_detail');
}
88,16 → 92,13
}
}
 
$list_query = "SELECT acctid,calldate,clid,src,dst,duration,billsec,disposition from cdr where 1=1"
$list_query = "SELECT acctid,calldate,src,dst,billsec,disposition"
. " from cdr where dstchannel != ''"
. $query . " ORDER BY calldate desc" . $query_limit;
$result = $db->query_params($list_query, $params);
 
$calls_number = $db->num_rows();
$header = array();
for ($hdr=0;$hdr<$db->num_fields();$hdr++) {
array_push($header, $db->get_field_name($hdr));
}
$cdr = new Table($header);
$cdr = new Table(array('ID', 'Call Date', 'Source', 'Destination', 'Duration', 'Disposition'));
$cdr->set_table_class('stat cdr list');
 
while ($line = $db->fetch_row()) {
104,12 → 105,10
$cdr->newrow();
$cdr->addcell($line['acctid']);
$cdr->addcell($line['calldate']);
$cdr->addcell($line['clid']);
$cdr->addcell($line['src']);
$cdr->addcell($line['dst']);
$cdr->addcell(Duration($line['duration']));
$cdr->addcell(Duration($line['billsec']));
$cdr->addcell($line['disposition']);
$cdr->addcell($line['disposition'] == 'ANSWERED' ? Duration($line['billsec']) : '');
$cdr->addcell(strtolower($line['disposition']));
$cdr->addcell(array('class' => 'link', 'html' =>
display_link($PHP_SELF.'?m=cdr&detail='.$line['acctid'], 'Details')));
}
116,7 → 115,7
$display->add_text($cdr->build());
// summary
$sum_query = "SELECT sum(duration) as dur, sum(billsec) as bill from cdr where 1=1" . $query;
$sum_query = "SELECT sum(duration) as dur, sum(billsec) as bill from cdr where dstchannel != ''" . $query;
$result = $db->query_params($sum_query, $params);
$line = $db->fetch_row();
$cdr = new Table();
/asterisk-stats/trunk/summary.php
16,23 → 16,23
die('Hacking attempt!');
}
$db->query('SELECT COUNT(acctid), SUM(duration) FROM cdr WHERE date(calldate) = current_date');
$db->query('SELECT COUNT(acctid), SUM(billsec) FROM cdr WHERE date(calldate) = current_date');
$db->fetch_row_idx();
$display->add_variables(array('CS_TODAY' => $db->get_field(0),
'CS_TODAY_DUR' => Duration($db->get_field(1))));
$db->query('SELECT COUNT(acctid), SUM(duration) FROM cdr WHERE calldate > (now() - (extract(dow from now()) || \' day\')::interval)');
$db->query('SELECT COUNT(acctid), SUM(billsec) FROM cdr WHERE calldate > (now() - (extract(dow from now()) || \' day\')::interval)');
$db->fetch_row_idx();
$display->add_variables(array('CS_WEEK' => $db->get_field(0),
'CS_WEEK_DUR' => Duration($db->get_field(1))));
$db->query('SELECT COUNT(acctid), SUM(duration) FROM cdr WHERE EXTRACT(month FROM calldate) = EXTRACT(month FROM now())');
$db->query('SELECT COUNT(acctid), SUM(billsec) FROM cdr WHERE EXTRACT(month FROM calldate) = EXTRACT(month FROM now())');
$db->fetch_row_idx();
$display->add_variables(array('CS_MONTH' => $db->get_field(0),
'CS_MONTH_DUR' => Duration($db->get_field(1))));
$db->query('SELECT COUNT(acctid), SUM(duration) FROM cdr WHERE calldate > (now() - (extract(month from now()) || \' months\')::interval)');
$db->query('SELECT COUNT(acctid), SUM(billsec) FROM cdr WHERE calldate > (now() - (extract(month from now()) || \' months\')::interval)');
$db->fetch_row_idx();
$display->add_variables(array('CS_YEAR' => $db->get_field(0),
'CS_YEAR_DUR' => Duration($db->get_field(1))));
$db->query('SELECT COUNT(acctid), SUM(duration) FROM cdr');
$db->query('SELECT COUNT(acctid), SUM(billsec) FROM cdr');
$db->fetch_row_idx();
$display->add_variables(array('CS_TOTAL' => $db->get_field(0),
'CS_TOTAL_DUR' => Duration($db->get_field(1))));