$_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'); $message .= $message_break . "Bill ".mres($_POST['bill_name'])." added!"; $message_break .= "
"; } $pagetitle[] = "Billing"; echo(""); if ($_GET['opta'] == "history") { include("pages/bills/search.inc.php"); include("pages/bills/pmonth.inc.php"); } elseif ($_GET['opta'] == "add") { ?>
Add Bill
Description
Billing Type CDR 95th: KBps
Quota: GB
Billing Day

Optional Information

Customer Reference
Billing Reference
Notes
Billing name Type Allowed Used Overusage "); foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill) { if (bill_permitted($bill['bill_id'])) { unset($class); $day_data = getDates($bill['bill_day']); $datefrom = $day_data['0']; $dateto = $day_data['1']; # $rate_data = getRates($bill['bill_id'],$datefrom,$dateto); $rate_data = $bill; $rate_95th = $rate_data['rate_95th']; $dir_95th = $rate_data['dir_95th']; $total_data = $rate_data['total_data']; $rate_average = $rate_data['rate_average']; if ($bill['bill_type'] == "cdr") { $type = "CDR"; $allowed = formatRates($bill['bill_cdr'] * 1000); $used = formatRates($rate_data['rate_95th'] * 1000); $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).""); } elseif ($bill['bill_type'] == "quota") { $type = "Quota"; $allowed = formatStorage($bill['bill_gb']* 1024 * 1024 * 1024); $used = formatStorage($rate_data['total_data'] * 1024 * 1024); $percent = round(($rate_data['total_data'] / ($bill['bill_gb'] * 1024)) * 100,2); $background = get_percentage_colours($percent); $overuse = $rate_data['total_data'] - ($bill['bill_gb'] * 1024); $overuse = (($overuse <= 0) ? "-" : "".formatStorage($overuse * 1024 * 1024).""); } $right_background = $background['right']; $left_background = $background['left']; if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } echo(" ".$bill['bill_name']."
".strftime("%F", strtotime($datefrom))." to ".strftime("%F", strtotime($dateto))." $notes $type $allowed $used $overuse ".print_percentage_bar (250, 20, $perc, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right'])." Edit Edit "); $i++; } ### PERMITTED } echo(""); } echo(""); ?>