mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fixes
git-svn-id: http://www.observium.org/svn/observer/trunk@2762 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
#$debug=1;
|
$debug=1;
|
||||||
|
|
||||||
include("includes/defaults.inc.php");
|
include("includes/defaults.inc.php");
|
||||||
include("config.php");
|
include("config.php");
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function generate_url($vars, $new_vars = array())
|
|||||||
|
|
||||||
foreach ($vars as $var => $value)
|
foreach ($vars as $var => $value)
|
||||||
{
|
{
|
||||||
if ($value == "0" || $value != "" && strstr($var, "opt") === FALSE)
|
if ($value == "0" || $value != "" && strstr($var, "opt") === FALSE && is_numeric($var) === FALSE)
|
||||||
{
|
{
|
||||||
$url .= $var ."=".$value."/";
|
$url .= $var ."=".$value."/";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
if ($_POST['addbill'] == "yes")
|
if ($_POST['addbill'] == "yes")
|
||||||
{
|
{
|
||||||
$updated = '1';
|
$updated = '1';
|
||||||
|
|
||||||
### Multiply bill_quota by base twice for now, as we know it's in GB. Later we should allow different measurements.
|
### Multiply bill_quota by base twice for now, as we know it's in GB. Later we should allow different measurements.
|
||||||
if(is_numeric($_POST['bill_quota']) { $_POST['bill_quota'] * $config['billing']['base'] * $config['billing']['base']; }
|
if(is_numeric($_POST['bill_quota'])) { $_POST['bill_quota'] * $config['billing']['base'] * $config['billing']['base']; }
|
||||||
|
|
||||||
$insert = array('bill_name' => $_POST['bill_name'], 'bill_type' => $_POST['bill_type'], 'bill_cdr' => $_POST['bill_cdr'], 'bill_day' => $_POST['bill_day'], 'bill_quota' => $_POST['bill_quota'],
|
$insert = array('bill_name' => $_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']);
|
'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("<meta http-equiv='refresh' content='10000'>");
|
echo("<meta http-equiv='refresh' content='10000'>");
|
||||||
|
|
||||||
@@ -133,20 +134,20 @@ if(is_array($port))
|
|||||||
if ($bill['bill_type'] == "cdr")
|
if ($bill['bill_type'] == "cdr")
|
||||||
{
|
{
|
||||||
$type = "CDR";
|
$type = "CDR";
|
||||||
$allowed = formatRates($bill['bill_cdr'] * 1000);
|
$allowed = format_si($bill['bill_cdr'])."bps";
|
||||||
$used = formatRates($rate_data['rate_95th'] * 1000);
|
$used = format_si($rate_data['rate_95th'])."bps";
|
||||||
$percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2);
|
$percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2);
|
||||||
$background = get_percentage_colours($percent);
|
$background = get_percentage_colours($percent);
|
||||||
$overuse = $rate_data['rate_95th'] - $bill['bill_cdr'];
|
$overuse = $rate_data['rate_95th'] - $bill['bill_cdr'];
|
||||||
$overuse = (($overuse <= 0) ? "-" : "<span style=\"color: #".$background['left']."; font-weight: bold;\">".formatRates($overuse * 1000)."</span>");
|
$overuse = (($overuse <= 0) ? "-" : "<span style=\"color: #".$background['left']."; font-weight: bold;\">".format_si($overuse)."bps</span>");
|
||||||
} elseif ($bill['bill_type'] == "quota") {
|
} elseif ($bill['bill_type'] == "quota") {
|
||||||
$type = "Quota";
|
$type = "Quota";
|
||||||
$allowed = formatStorage($bill['bill_gb']* 1000 * 1000 * 1000);
|
$allowed = format_bytes_billing($bill['bill_quota']);
|
||||||
$used = formatStorage($rate_data['total_data'] * 1000 * 1000);
|
$used = format_bytes_billing($rate_data['total_data']);
|
||||||
$percent = round(($rate_data['total_data'] / ($bill['bill_gb'] * 1000)) * 100,2);
|
$percent = round(($rate_data['total_data'] / ($bill['bill_quota'])) * 100,2);
|
||||||
$background = get_percentage_colours($percent);
|
$background = get_percentage_colours($percent);
|
||||||
$overuse = $rate_data['total_data'] - ($bill['bill_gb'] * 1000);
|
$overuse = $rate_data['total_data'] - $bill['bill_quota'];
|
||||||
$overuse = (($overuse <= 0) ? "-" : "<span style=\"color: #".$background['left']."; font-weight: bold;\">".formatStorage($overuse * 1000 * 1000)."</span>");
|
$overuse = (($overuse <= 0) ? "-" : "<span style=\"color: #".$background['left']."; font-weight: bold;\">".format_bytes_billing($overuse)."</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
$right_background = $background['right'];
|
$right_background = $background['right'];
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ function getDates($dayofmonth, $months=0)
|
|||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
$month = date('m');
|
$month = date('m');
|
||||||
|
|
||||||
$dayofmonth = "03";
|
|
||||||
$year = date('Y');
|
|
||||||
$month = date('m');
|
|
||||||
|
|
||||||
|
|
||||||
if (date('d') > $dayofmonth) // Billing day is past, so it is next month
|
if (date('d') > $dayofmonth) // Billing day is past, so it is next month
|
||||||
{
|
{
|
||||||
$date_end = date_create($year.'-'.$month.'-'.$dayofmonth);
|
$date_end = date_create($year.'-'.$month.'-'.$dayofmonth);
|
||||||
|
|||||||
Reference in New Issue
Block a user