= 1000000) { $paidrate_text = $paid_mb . "Mbps is the CDR."; } $day_data = getDates($dayofmonth); $datefrom = $day_data['0']; $dateto = $day_data['1']; $rate_data = getRates($bill_id,$datefrom,$dateto); $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 ($rate_95th > $paid_kb) { $over = $rate_95th - $paid_kb; $bill_text = $over . "Kbit excess."; $bill_color = "#cc0000"; } else { $under = $paid_kb - $rate_95th; $bill_text = $under . "Kbit headroom."; $bill_color = "#0000cc"; } $fromtext = mysql_result(mysql_query("SELECT DATE_FORMAT($datefrom, '%M %D %Y')"), 0); $totext = mysql_result(mysql_query("SELECT DATE_FORMAT($dateto, '%M %D %Y')"), 0); $unixfrom = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$datefrom')"), 0); $unixto = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$dateto')"), 0); echo("
" . $bill_name . ""); echo("Billed Ports"); $ports = mysql_query("SELECT * FROM interfaces AS I, devices AS D, bill_ports as B WHERE B.bill_id = '$bill_id' AND B.port_id = I.interface_id AND I.device_id = D.device_id"); while ($port = mysql_fetch_array($ports)) { echo(generateiflink($port) . " on " . generatedevicelink($port) . ""); } echo(" Bill Summary"); if($bill_data['bill_type'] == "quota") { // The Customer is billed based on a pre-paid quota $percent = round(($total_data / 1024) / $bill_data['bill_gb'] * 100, 2); $unit = "MB"; $total_data = round($total_data, 2); echo("Billing Period from " . $fromtext . " to " . $totext . "Transferred ".formatStorage($total_data * 1024 * 1024)." of ".formatStorage($bill_data['bill_gb'] * 1024 * 1024 * 1024)." (".$percent."%) Average rate " . formatRates($rate_average * 1000)); if ($percent > 100) { $percent = "100"; } echo(" Measured ".$rate_95th."$unit of ".$cdr."$unit (".$percent."%)"); if ($percent > 100) { $percent = "100"; } echo(" Billing Period : " . $fromtext . " to " . $totext . " | ![]() |