$paid_kb)
{
$over = $rate_95th - $paid_kb;
$bill_text = $over . "Kbit excess.";
$bill_color = "#cc0000";
}
else
{
$under = $paid_kb - $rate_95th;
$bill_text = $under . "Kbit headroom.";
$bill_color = "#0000cc";
}
$fromtext = dbFetchCell("SELECT DATE_FORMAT($datefrom, '%M %D %Y')");
$totext = dbFetchCell("SELECT DATE_FORMAT($dateto, '%M %D %Y')");
$unixfrom = dbFetchCell("SELECT UNIX_TIMESTAMP('$datefrom')");
$unixto = dbFetchCell("SELECT UNIX_TIMESTAMP('$dateto')");
$unix_prev_from = dbFetchCell("SELECT UNIX_TIMESTAMP('$lastfrom')");
$unix_prev_to = dbFetchCell("SELECT UNIX_TIMESTAMP('$lastto')");
# Speeds up loading for other included pages by setting it before progessing of mysql data!
$ports = dbFetchRows("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
WHERE B.bill_id = ? AND P.port_id = B.port_id
AND D.device_id = P.device_id", array($bill_id));
echo(" ".print_percentage_bar (350, 20, $perc, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right'])." ".print_percentage_bar (350, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right'])." Billing Period : " . $fromtext . " to " . $totext . "
Bill : " . $bill_data['bill_name'] . "
");
print_optionbar_start();
echo("Bill » ");
if (!$vars['view']) { $vars['view'] = "quick"; }
if ($vars['view'] == "quick") { echo(" "); }
echo(" | ");
if ($vars['view'] == "accurate") { echo(" "); }
echo(" | ");
if ($vars['view'] == "transfer") { echo(" "); }
echo(" | ");
if ($vars['view'] == "history") { echo(" "); }
if ($_SESSION['userlevel'] == "10")
{
echo(" | ");
if ($vars['view'] == "edit") { echo(" "); }
echo(" | ");
if ($vars['view'] == "delete") { echo(" "); }
echo(" | ");
if ($vars['view'] == "reset") { echo(" "); }
}
echo('');
print_optionbar_end();
if ($vars['view'] == "edit" && $_SESSION['userlevel'] == "10")
{
include("pages/bill/edit.inc.php");
}
elseif ($vars['view'] == "delete" && $_SESSION['userlevel'] == "10")
{
include("pages/bill/delete.inc.php");
}
elseif ($vars['view'] == "reset" && $_SESSION['userlevel'] == "10")
{
include("pages/bill/reset.inc.php");
}
elseif ($vars['view'] == "history")
{
include("pages/bill/history.inc.php");
}
elseif ($vars['view'] == "transfer")
{
include("pages/bill/transfer.inc.php");
}
elseif ($vars['view'] == "quick" || $vars['view'] == "accurate") {
echo("Billed Ports
");
### Collected Earlier
foreach ($ports as $port)
{
echo(generate_port_link($port) . " on " . generate_device_link($port) . "
");
}
echo("Bill Summary
");
if ($bill_data['bill_type'] == "quota")
{
// The Customer is billed based on a pre-paid quota with overage in xB
echo("Quota Bill
");
$percent = round(($total_data) / $bill_data['bill_quota'] * 100, 2);
$unit = "MB";
$total_data = round($total_data, 2);
echo("Billing Period from " . $fromtext . " to " . $totext);
echo("
Transferred ".format_bytes_billing($total_data)." of ".format_bytes_billing($bill_data['bill_quota'])." (".$percent."%)");
echo("
Average rate " . formatRates($rate_average));
$background = get_percentage_colours($percent);
echo("CDR / 95th Bill
");
$unit = "kbps";
$cdr = $bill_data['bill_cdr'];
$rate_95th = round($rate_95th, 2);
$percent = round(($rate_95th) / $cdr * 100, 2);
$type="&95th=yes";
echo("" . $fromtext . " to " . $totext . "
Measured ".format_si($rate_95th)."bps of ".format_si($cdr)."bps (".$percent."%) @ 95th %ile");
$background = get_percentage_colours($percent);
echo("
# " . $paidrate_text . "
# " . $total_data . "MB transfered in the current billing cycle.
# " . $rate_average . "Kbps Average during the current billing cycle.