<?php

require "../config.php";
$camp = @$_GET['camp'] != "" ? $_GET['camp'] : 'CS';
$data = new Campaign($camp);
$yday_start = mktime(0, 0, 0) - 24 * 3600;
$yday_end = mktime(23, 59, 59) - 24 * 3600;
$data->setTimePeriod($yday_start, $yday_end);
echo "<h1>Data For Campaign: " . $camp . "</h1>\n";
print_r($data->byInbound()->fetchCallTimes()->byQueue('BUYM_CS')->byAgent('lrobinson')->byDispo('XFER2S')->getAVGWaitTime());
<?php

require "../config.php";
$camp = @$_GET['camp'] != "" ? $_GET['camp'] : 'CS';
$data = new Campaign($camp);
$yday_start = mktime(0, 0, 0) - 24 * 3600;
$yday_end = mktime(23, 59, 59) - 24 * 3600;
$data->setTimePeriod($yday_start, $yday_end);
echo "<h1>Data For Campaign: " . $camp . "</h1>\n";
$queues = $data->byInbound()->queues;
if (($key = array_search("AGENTDIRECT", $queues)) !== false) {
    unset($queues[$key]);
}
foreach ($queues as $queue) {
    echo "<h2>Queue: " . $queue . "</h2>\n";
    ?>
<table border="1">
    <tr>
        <th>Dispo Name</th>
        <th>Total Calls</th>
        <th>Percentage of Total</th>
        <th>Average Talk Time</th>
        <th>Average Hold Time</th>
        <th>Average Dispo Time</th>
        <th>Average Dead Time</th>
        <th>Average Handle Time</th>
        <th>Average Wrap Time</th>
    </tr>
    <?php 
    $total = $data->byInbound()->byQueue($queue)->getTotalAnswered();
    foreach ($data->byInbound()->byQueue($queue)->getTotalByDispo() as $d => $c) {
    <tr>
        <th>Agent Name</th>
        <th>Calls Answered</th>
        <th>Average Talk Time</th>
        <th>Average Park Time</th>
        <th>Average Dispo Time</th>
        <th>Average Dead Time</th>
        <th>Average Handle Time</th>
        <th>Average Wrap Time</th>
    </tr>
<?php 
foreach ($data->fetchData()->getAgents() as $agent) {
    $data->setAgent($agent);
    echo "<tr>\n";
    echo "<td>" . $agent . "</td>\n";
    echo "<td>" . $data->byInbound()->byQueue($data->byInbound()->queues)->getTotalAnswered() . "</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGTalkTime()) . "</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGHoldTime()) . "</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGDispoTime()) . "</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGDeadTime()) . "</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGHandleTime()) . "</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGWrapTime()) . "</td>\n";
    echo "</tr>\n";
}
$data->setAgent(NULL);
echo "<tr>\n";
echo "<td><b>Total</b></td>\n";
echo "<td>" . $data->byInbound()->byQueue($data->byInbound()->queues)->getTotalAnswered() . "</td>\n";
echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGTalkTime()) . "</td>\n";
echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGHoldTime()) . "</td>\n";
echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->getAVGDispoTime()) . "</td>\n";
<?php

require "../config.php";
$camp = @$_GET['camp'] != "" ? $_GET['camp'] : 'CS';
$data = new Campaign($camp);
$yday_start = mktime(0, 0, 0) - 24 * 3600;
$yday_end = mktime(23, 59, 59) - 24 * 3600;
$data->setTimePeriod($yday_start, $yday_end);
echo "<h1>Data For Campaign: " . $camp . "</h1>\n";
foreach ($data->byInbound()->queues as $queue) {
    echo "<h2>Queue Data: " . $queue . "</h2>\n";
    echo "Total Calls: " . $data->byInbound()->byQueue($queue)->getTotal() . "<br />\n";
    echo "Total Direct Calls: " . $data->byInbound()->byQueue($queue)->getTotalDirect() . "<br />\n";
    echo "<br />\n";
    echo "Offered Calls: " . $data->byInbound()->byQueue($queue)->getTotalOffered() . "<br />\n";
    echo "Direct Offered Calls: " . $data->byInbound()->byQueue($queue)->getTotalDirectOffered() . "<br />\n";
    echo "<br />\n";
    echo "Calls Answered: " . $data->byInbound()->byQueue($queue)->getTotalAnswered() . "<br />\n";
    echo "Direct Calls Answered: " . $data->byInbound()->byQueue($queue)->getTotalDirectAnswered() . "<br />\n";
    echo "<br />\n";
    echo "Out of Hours: " . $data->byInbound()->byQueue($queue)->getTotalOOH() . "<br />\n";
    echo "Direct Out of Hours: " . $data->byInbound()->byQueue($queue)->getTotalDirectOOH() . "<br />\n";
    echo "<br />\n";
    echo "Dropped Calls: " . $data->byInbound()->byQueue($queue)->getTotalDrop() . "<br />\n";
    echo "Direct Calls Dropped: " . $data->byInbound()->byQueue($queue)->getTotalDirectDrop() . "<br />\n";
    echo "<br />\n";
    echo "<b>Calls By DISPO</b><br />\n";
    dispo_table($data->byInbound()->byQueue($queue)->getTotalByDispo());
    echo "<br />\n";
    echo "<b>Direct Calls By DISPO</b><br />\n";
    dispo_table($data->byInbound()->byQueue($queue)->getTotalDirectByDispo());
        <th>Calls Offered</th>
        <th>Direct Offered</th>
        <th>Direct %</th>
        <th>Calls Answered</th>
        <th>% Answered</th>
        <th>% SLA of Ans</th>
        <th>OOH</th>
        <th>% OOH</th>
        <th>Drop</th>
        <th>% Drop</th>
        <th>Avg Handle</th>
        <th>Avg Wait</th>
        <th>Avg Wrap</th>
    </tr>
    <?php 
foreach ($data->byInbound()->queues as $queue) {
    echo "<tr>\n";
    echo "<td>" . $data->fetchData()->getQueueName($queue) . "</td>\n";
    echo "<td>" . $data->byInbound()->byQueue($queue)->getTotalOffered() . "</td>\n";
    echo "<td>" . $data->byInbound()->byQueue($queue)->getTotalDirectOffered() . "</td>\n";
    echo "<td>" . @round($data->byInbound()->byQueue($queue)->getTotalDirectOffered() / $data->byInbound()->byQueue($queue)->getTotalOffered() * 100) . "%</td>\n";
    echo "<td>" . $data->byInbound()->byQueue($queue)->getTotalAnswered() . "</td>\n";
    echo "<td>" . @round($data->byInbound()->byQueue($queue)->getTotalAnswered() / $data->byInbound()->byQueue($queue)->getTotalOffered() * 100) . "%</td>\n";
    echo "<td>N/A</td>\n";
    echo "<td>" . $data->byInbound()->byQueue($queue)->getTotalOOH() . "</td>\n";
    echo "<td>" . @round($data->byInbound()->byQueue($queue)->getTotalOOH() / $data->byInbound()->byQueue($queue)->getTotal() * 100) . "%</td>\n";
    echo "<td>" . $data->byInbound()->byQueue($queue)->getTotalDrop() . "</td>\n";
    echo "<td>" . @round($data->byInbound()->byQueue($queue)->getTotalDrop() / $data->byInbound()->byQueue($queue)->getTotalOffered() * 100) . "%</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->byQueue($queue)->getAVGHandleTime()) . "</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->byQueue($queue)->getAVGWaitTime()) . "</td>\n";
    echo "<td>" . gmdate("H:i:s", (int) $data->byInbound()->fetchCallTimes()->byQueue($queue)->getAVGWrapTime()) . "</td>\n";