mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add bill from device/port, some billing changes
git-svn-id: http://www.observium.org/svn/observer/trunk@2756 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -7,10 +7,17 @@ if ($_POST['addbill'] == "yes")
|
||||
$insert = array('bill_name' => $_POST['bill_name'], 'bill_type' => $_POST['bill_type'], 'bill_cdr' => $_POST['bill_cdr'], 'bill_day' => $_POST['bill_day'], 'bill_gb' => $_POST['bill_quota'],
|
||||
'bill_custid' => $_POST['bill_custid'], 'bill_ref' => $_POST['bill_ref'], 'bill_notes' => $_POST['bill_notes']);
|
||||
|
||||
$affected = dbInsert($insert, 'bills');
|
||||
$bill_id = dbInsert($insert, 'bills');
|
||||
|
||||
$message .= $message_break . "Bill ".mres($_POST['bill_name'])." added!";
|
||||
$message .= $message_break . "Bill ".mres($_POST['bill_name'])." (".$bill_id.") added!";
|
||||
$message_break .= "<br />";
|
||||
|
||||
if (is_numeric($bill_id) && is_numeric($_POST['port']))
|
||||
{
|
||||
dbInsert(array('bill_id' => $bill_id, 'port_id' => $_POST['port']), 'bill_ports');
|
||||
$message .= $message_break . "Port ".mres($_POST['port'])." added!";
|
||||
$message_break .= "<br />";
|
||||
}
|
||||
}
|
||||
|
||||
$pagetitle[] = "Billing";
|
||||
@ -25,19 +32,33 @@ if ($_GET['opta'] == "history")
|
||||
}
|
||||
elseif ($_GET['opta'] == "add")
|
||||
{
|
||||
if(is_numeric($vars['port']))
|
||||
{
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS P, `devices` AS D WHERE `interface_id` = ? AND D.device_id = P.device_id", array($vars['port']));
|
||||
}
|
||||
|
||||
?>
|
||||
<div style='padding:10px;font-size:20px; font-weight: bold;'>Add Bill</div>
|
||||
|
||||
<div style='padding:10px;font-size:20px; font-weight: bold;'>Add Bill</div>
|
||||
<form name="form1" method="post" action="bills/">
|
||||
|
||||
<input type=hidden name=addbill value=yes>
|
||||
<?php
|
||||
|
||||
if(is_array($port))
|
||||
{
|
||||
echo("<h3>Ports</h3>");
|
||||
echo(generate_port_link($port) . " on " . generate_device_link($port) . "<br />");
|
||||
echo("<input type=hidden name=port value=".$port['interface_id'].">");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<input type=hidden name=addbill value=yes>
|
||||
<div style="padding: 10px; background: #f0f0f0;">
|
||||
<table cellpadding=2px width=400px>
|
||||
<tr>
|
||||
<td><strong>Description</strong></td>
|
||||
<td><input type="text" name="bill_name" size="32"></td>
|
||||
<td><input type="text" name="bill_name" size="32" value="<?php echo($port['port_descr_descr']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Billing Type</strong></td>
|
||||
@ -58,11 +79,11 @@ elseif ($_GET['opta'] == "add")
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Billing Reference</strong></td>
|
||||
<td><input type="text" name="bill_ref" size="32"></td>
|
||||
<td><input type="text" name="bill_ref" size="32" value="<?php echo($port['port_descr_circuit']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Notes</strong></td>
|
||||
<td><input type="textarea" name="bill_notes" size="32"></td>
|
||||
<td><input type="textarea" name="bill_notes" size="32" value="<?php echo($port['port_descr_speed']); ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -137,6 +137,11 @@ if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE interface_id = '".$port['i
|
||||
if ($vars['view'] == "junose-atm-vp" && $vars['graph'] == "bits") { echo("</span>"); }
|
||||
}
|
||||
|
||||
if ($_SESSION['userlevel'] == '10')
|
||||
{
|
||||
echo("<span style='float: right;'><a href='bills/add/port=".$port['interface_id']."/'><img src='images/16/money.png' border='0' align='absmiddle'> Create Bill</a></span>");
|
||||
}
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
echo("<div style='margin: 5px;'>");
|
||||
|
@ -103,7 +103,6 @@ function getLastPortCounter($port_id,$inout)
|
||||
} else {
|
||||
$return[state] = "failed";
|
||||
}
|
||||
|
||||
return($return);
|
||||
}
|
||||
|
||||
|
@ -22,20 +22,19 @@ function CollectData($bill_id)
|
||||
{
|
||||
foreach (dbFetchRows("SELECT * FROM `bill_ports` as P, `ports` as I, `devices` as D WHERE P.bill_id=? AND I.interface_id = P.port_id AND D.device_id = I.device_id", array($bill_id)) as $port_data)
|
||||
{
|
||||
|
||||
$port_id = $port_data['port_id'];
|
||||
$host = $port_data['hostname'];
|
||||
$port = $port_data['port'];
|
||||
|
||||
echo("\nPolling ".$port_data['ifDescr']." on ".$port_data['hostname']."\n");
|
||||
|
||||
$port_data['in_measurement'] = getValue($host, $port, $port_data['ifIndex'], "In");
|
||||
$port_data['out_measurement'] = getValue($host, $port, $port_data['ifIndex'], "Out");
|
||||
$port_data['in_measurement'] = getValue($port_data['hostname'], $port_data['port'], $port_data['ifIndex'], "In");
|
||||
$port_data['out_measurement'] = getValue($port_data['hostname'], $port_data['port'], $port_data['ifIndex'], "Out");
|
||||
|
||||
$now = dbFetchCell("SELECT NOW()");
|
||||
|
||||
$last_data = getLastPortCounter($port_id,in);
|
||||
if ($last_data[state] == "ok")
|
||||
if ($last_data['state'] == "ok")
|
||||
{
|
||||
$port_data['last_in_measurement'] = $last_data[counter];
|
||||
$port_data['last_in_delta'] = $last_data[delta];
|
||||
|
Reference in New Issue
Block a user