From 6dc0feffbe386ead1d18644929a7aa95f9b97740 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Thu, 8 Dec 2011 10:30:27 +0000 Subject: [PATCH] fix previous month bill view git-svn-id: http://www.observium.org/svn/observer/trunk@2770 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/bandwidth-graph.php | 4 ++-- html/pages/bills/pmonth.inc.php | 29 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/html/bandwidth-graph.php b/html/bandwidth-graph.php index dd90c69c7..dd6da5a1d 100644 --- a/html/bandwidth-graph.php +++ b/html/bandwidth-graph.php @@ -189,8 +189,8 @@ // Create the bar plots $barplot_tot = new BarPlot($tot_data); $barplot_tot->SetLegend("Traffic total"); - $barplot_tot->SetColor("darkred"); - $barplot_tot->SetFillColor("lightred@0.4"); + $barplot_tot->SetColor('darkgray'); + $barplot_tot->SetFillColor('lightgray@0.4'); $barplot_tot->value->Show(); $barplot_tot->value->SetFormatCallback('format_bytes_billing_short'); diff --git a/html/pages/bills/pmonth.inc.php b/html/pages/bills/pmonth.inc.php index ea512d635..c919aadd0 100644 --- a/html/pages/bills/pmonth.inc.php +++ b/html/pages/bills/pmonth.inc.php @@ -24,32 +24,31 @@ $day_data = getDates($bill['bill_day']); $datefrom = $day_data['2']; $dateto = $day_data['3']; -// foreach (dbFetchRows("SELECT * FROM `bill_hist` ORDER BY `bill_datefrom` AND `bill_dateto` DESC LIMIT 24") as $history) - foreach (dbFetchRows("SELECT * FROM `bill_hist` WHERE `bill_id` = ? AND `bill_datefrom` = ? AND `bill_dateto` = ? ORDER BY `bill_datefrom` AND `bill_dateto` LIMIT 1", array($bill['bill_id'], $datefrom, $dateto)) as $history) + foreach (dbFetchRows("SELECT * FROM `bill_history` WHERE `bill_id` = ? AND `bill_datefrom` = ? ORDER BY `bill_datefrom` LIMIT 1", array($bill['bill_id'], $datefrom, $dateto)) as $history) { unset($class); $type = $history['bill_type']; $percent = $history['bill_percent']; $dir_95th = $history['dir_95th']; - $rate_95th = formatRates($history['rate_95th'] * 1000); - $total_data = formatStorage($history['traf_total'] * 1000 * 1000); + $rate_95th = format_si($history['rate_95th'])."bps"; + $total_data = format_bytes_billing($history['traf_total']); $background = get_percentage_colours($percent); $row_colour = ((!is_integer($i/2)) ? $list_colour_a : $list_colour_b); if ($type == "CDR") { - $allowed = formatRates($history['bill_allowed'] * 1000); - $used = formatRates($history['rate_95th'] * 1000); - $in = formatRates($history['rate_95th_in'] * 1000); - $out = formatRates($history['rate_95th_out'] * 1000); - $overuse = (($history['bill_overuse'] <= 0) ? "-" : "".formatRates($history['bill_overuse'] * 1000).""); + $allowed = format_si($history['bill_allowed'])."bps"; + $used = format_si($history['rate_95th'])."bps"; + $in = format_si($history['rate_95th_in'])."bps"; + $out = format_si($history['rate_95th_out'])."bps"; + $overuse = (($history['bill_overuse'] <= 0) ? "-" : "".format_si($history['bill_overuse'])."bps"); } elseif ($type == "Quota") { - $allowed = formatStorage($history['bill_allowed'] * 1000 * 1000); - $used = formatStorage($history['total_data'] * 1000 * 1000); - $in = formatStorage($history['traf_in'] * 1000 * 1000); - $out = formatStorage($history['traf_out'] * 1000 * 1000); - $overuse = (($history['bill_overuse'] <= 0) ? "-" : "".formatStorage($history['bill_overuse'] * 1000 * 1000).""); + $allowed = format_bytes_billing($history['bill_allowed']); + $used = format_bytes_billing($history['total_data']); + $in = format_bytes_billing($history['traf_in']); + $out = format_bytes_billing($history['traf_out']); + $overuse = (($history['bill_overuse'] <= 0) ? "-" : "".format_bytes_billing($history['bill_overuse']).""); } $total_data = (($type == "Quota") ? "".$total_data."" : $total_data); @@ -58,7 +57,7 @@ echo(" - ".$bill['bill_name']."
from ".strftime("%x", strtotime($datefrom))." to ".strftime("%x", strtotime($dateto))." + "bill", 'bill_id' => $bill['bill_id']))."/\">".$bill['bill_name']."
from ".strftime("%x", strtotime($datefrom))." to ".strftime("%x", strtotime($dateto))." $type $allowed $in