From e291e397810598109270b1fd5efd53da5f8e082f Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Fri, 8 Apr 2011 11:25:13 +0000 Subject: [PATCH] hacks to billing (this shit needs rewritten so badly) git-svn-id: http://www.observium.org/svn/observer/trunk@2034 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/graphs/bill/auth.inc.php | 17 +++++++++++++---- html/includes/graphs/bill/bits.inc.php | 4 ++-- html/pages/bill.inc.php | 17 +++++++++++++++-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/html/includes/graphs/bill/auth.inc.php b/html/includes/graphs/bill/auth.inc.php index c9f1d1db26..ed6d17827b 100644 --- a/html/includes/graphs/bill/auth.inc.php +++ b/html/includes/graphs/bill/auth.inc.php @@ -9,9 +9,18 @@ if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || bill_permitted $bill_query = mysql_query("SELECT * FROM `bills` WHERE bill_id = '".mres($_GET['id'])."'"); $bill = mysql_fetch_assoc($bill_query); - $day_data = getDates($bill['bill_day']); - $datefrom = $day_data['0']; - $dateto = $day_data['1']; +# $day_data = getDates($bill['bill_day']); +# $datefrom = $day_data['0']; +# $dateto = $day_data['1']; + +#print_r($day_data); + + + $datefrom = date('YmdHis', $_GET['from']); + $dateto = date('YmdHis', $_GET['to']); + + + $rates = getRates($_GET['id'], $datefrom, $dateto); @@ -22,4 +31,4 @@ if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || bill_permitted $auth = TRUE; } -?> \ No newline at end of file +?> diff --git a/html/includes/graphs/bill/bits.inc.php b/html/includes/graphs/bill/bits.inc.php index d7b83c34e4..b73beeefc2 100644 --- a/html/includes/graphs/bill/bits.inc.php +++ b/html/includes/graphs/bill/bits.inc.php @@ -28,8 +28,8 @@ $rra_out = "OUTOCTETS"; if($bill['bill_type'] == "cdr") { $custom_graph = " COMMENT:'\\r' "; - $custom_graph .= " HRULE:" . $rates['rate_average'] * 1000 . "#cc0000:'95th %ile \: ".formatRates($rates['rate_95th']*1000)." (".$rates['dir_95th'].") (CDR\: ".formatRates($bill['bill_cdr']*1000).")'"; - $custom_graph .= " HRULE:" . $rates['rate_average'] * 1000 * -1 . "#cc0000"; + $custom_graph .= " HRULE:" . $rates['rate_95th'] * 1000 . "#cc0000:'95th %ile \: ".formatRates($rates['rate_95th']*1000)." (".$rates['dir_95th'].") (CDR\: ".formatRates($bill['bill_cdr']*1000).")'"; + $custom_graph .= " HRULE:" . $rates['rate_95th'] * 1000 * -1 . "#cc0000"; } elseif($bill['bill_type'] == "quota") { $custom_graph = " COMMENT:'\\r' "; $custom_graph .= " HRULE:" . $rates['rate_average'] * 1000 . "#cc0000:'Usage \: ".formatStorage($rates['total_data']*1024*1024)." (".formatRates($rates['rate_average']*1000).")'"; diff --git a/html/pages/bill.inc.php b/html/pages/bill.inc.php index e572ccb583..878d96474a 100644 --- a/html/pages/bill.inc.php +++ b/html/pages/bill.inc.php @@ -33,6 +33,8 @@ if (bill_permitted($bill_id)) $day_data = getDates($dayofmonth); $datefrom = $day_data['0']; $dateto = $day_data['1']; + $lastfrom = $day_data['2']; + $lastto = $day_data['3']; $rate_data = getRates($bill_id,$datefrom,$dateto); $rate_95th = $rate_data['rate_95th']; $dir_95th = $rate_data['dir_95th']; @@ -57,6 +59,9 @@ if (bill_permitted($bill_id)) $unixfrom = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$datefrom')"), 0); $unixto = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$dateto')"), 0); + $unix_prev_from = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$lastfrom')"), 0); + $unix_prev_to = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$lastto')"), 0); + echo("

Bill : " . $bill_name . "

"); @@ -186,6 +191,12 @@ if (bill_permitted($bill_id)) $yesterday = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))"), 0); $rightnow = date(U); + + $li = ""; + + # $di = ""; @@ -247,7 +258,9 @@ if (bill_permitted($bill_id)) } else { - echo("

Billing View

$bi

24 Hour View

$di"); + echo("

Billing View

$bi"); + echo("

Previous Bill View

$li"); + echo("

24 Hour View

$di"); echo("

Monthly View

$mi"); # echo("
Graph All Data (SLOW)"); } @@ -258,4 +271,4 @@ else include("includes/error-no-perm.inc.php"); } -?> \ No newline at end of file +?>