diff --git a/billing-calculate.php b/billing-calculate.php index b5f85bf1cf..87ab33196e 100755 --- a/billing-calculate.php +++ b/billing-calculate.php @@ -1,7 +1,7 @@ #!/usr/bin/env php $value) { - if ($value == "0" || $value != "" && strstr($var, "opt") === FALSE) + if ($value == "0" || $value != "" && strstr($var, "opt") === FALSE && is_numeric($var) === FALSE) { $url .= $var ."=".$value."/"; } diff --git a/html/pages/bills.inc.php b/html/pages/bills.inc.php index 83ca131292..c4589f1f9c 100644 --- a/html/pages/bills.inc.php +++ b/html/pages/bills.inc.php @@ -1,11 +1,12 @@ $_POST['bill_name'], 'bill_type' => $_POST['bill_type'], 'bill_cdr' => $_POST['bill_cdr'], 'bill_day' => $_POST['bill_day'], 'bill_quota' => $_POST['bill_quota'], 'bill_custid' => $_POST['bill_custid'], 'bill_ref' => $_POST['bill_ref'], 'bill_notes' => $_POST['bill_notes']); @@ -23,8 +24,8 @@ if ($_POST['addbill'] == "yes") } } -$pagetitle[] = "Billing"; +$pagetitle[] = "Billing"; echo(""); @@ -133,20 +134,20 @@ if(is_array($port)) if ($bill['bill_type'] == "cdr") { $type = "CDR"; - $allowed = formatRates($bill['bill_cdr'] * 1000); - $used = formatRates($rate_data['rate_95th'] * 1000); + $allowed = format_si($bill['bill_cdr'])."bps"; + $used = format_si($rate_data['rate_95th'])."bps"; $percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2); $background = get_percentage_colours($percent); $overuse = $rate_data['rate_95th'] - $bill['bill_cdr']; - $overuse = (($overuse <= 0) ? "-" : "".formatRates($overuse * 1000).""); + $overuse = (($overuse <= 0) ? "-" : "".format_si($overuse)."bps"); } elseif ($bill['bill_type'] == "quota") { $type = "Quota"; - $allowed = formatStorage($bill['bill_gb']* 1000 * 1000 * 1000); - $used = formatStorage($rate_data['total_data'] * 1000 * 1000); - $percent = round(($rate_data['total_data'] / ($bill['bill_gb'] * 1000)) * 100,2); + $allowed = format_bytes_billing($bill['bill_quota']); + $used = format_bytes_billing($rate_data['total_data']); + $percent = round(($rate_data['total_data'] / ($bill['bill_quota'])) * 100,2); $background = get_percentage_colours($percent); - $overuse = $rate_data['total_data'] - ($bill['bill_gb'] * 1000); - $overuse = (($overuse <= 0) ? "-" : "".formatStorage($overuse * 1000 * 1000).""); + $overuse = $rate_data['total_data'] - $bill['bill_quota']; + $overuse = (($overuse <= 0) ? "-" : "".format_bytes_billing($overuse).""); } $right_background = $background['right']; diff --git a/includes/billing.php b/includes/billing.php index 03930e6e46..06b26dd67e 100644 --- a/includes/billing.php +++ b/includes/billing.php @@ -19,11 +19,6 @@ function getDates($dayofmonth, $months=0) $year = date('Y'); $month = date('m'); - $dayofmonth = "03"; - $year = date('Y'); - $month = date('m'); - - if (date('d') > $dayofmonth) // Billing day is past, so it is next month { $date_end = date_create($year.'-'.$month.'-'.$dayofmonth);