Example #1
0
            ?>
 of <?php 
            echo format_si($cdr) . 'bps (' . $percent . '%)';
            ?>
 (95th%ile)
        </td>
        <td style="width: 210px;">
            <?php 
            echo print_percentage_bar(200, 20, $percent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']);
            ?>
        </td>
        </tr>
        <tr>
            <td colspan="2">
<?php 
            echo 'Predicated usage: ' . format_bytes_billing(getPredictedUsage($bill_data['bill_day'], $bill_data['rate_95th']));
            ?>
            </td>

<?php 
        }
        //end if
        ?>
        </tr>
        </table>
    </div>
    </div>
    </div>

<?php 
        $lastmonth = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))');
Example #2
0
        $tmp_used = $bill['rate_95th'];
        $rate_95th = "<b>{$rate_95th}</b>";
    } elseif (strtolower($bill['bill_type']) == 'quota') {
        $type = 'Quota';
        $allowed = format_bytes_billing($bill['bill_allowed']);
        $in = format_bytes_billing($bill['traf_in']);
        $out = format_bytes_billing($bill['traf_out']);
        if (!$prev) {
            $percent = round($bill['total_data'] / $bill['bill_allowed'] * 100, 2);
            $overuse = $bill['total_data'] - $bill['bill_allowed'];
        }
        $overuse_formatted = format_bytes_billing($overuse);
        $used = $total_data;
        $tmp_used = $bill['total_data'];
        $total_data = "<b>{$total_data}</b>";
    }
    $background = get_percentage_colours($percent);
    $right_background = $background['right'];
    $left_background = $background['left'];
    $overuse_formatted = $overuse <= 0 ? '-' : "<span style='color: #{$background['left']}; font-weight: bold;'>{$overuse_formatted}</span>";
    $bill_name = "<a href='{$url}'><span style='font-weight: bold;' class='interface'>{$bill['bill_name']}</span></a><br />" . strftime('%F', strtotime($datefrom)) . " to " . strftime('%F', strtotime($dateto));
    $bar = print_percentage_bar(250, 20, $percent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']);
    $actions = "";
    if (!$prev && is_admin()) {
        $actions .= "<a href='" . generate_url(array('page' => 'bill', 'bill_id' => $bill['bill_id'], 'view' => 'edit')) . "'><img src='images/16/wrench.png' align=absmiddle alt='Edit'> Edit</a> ";
    }
    $predicted = format_bytes_billing(getPredictedUsage($bill['bill_day'], $tmp_used));
    $response[] = array('bill_name' => $bill_name, 'notes' => $notes, 'bill_type' => $type, 'bill_allowed' => $allowed, 'total_data_in' => $in, 'total_data_out' => $out, 'total_data' => $total_data, 'rate_95th' => $rate_95th, 'used' => $used, 'overusage' => $overuse_formatted, 'predicted' => $predicted, 'graph' => $bar, 'actions' => $actions);
}
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);