Billing name Type Allowed Inbound Outbound Total 95 percentile Overusage "); foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill) { if (bill_permitted($bill['bill_id'])) { $day_data = getDates($bill['bill_day']); $datefrom = $day_data['2']; $dateto = $day_data['3']; // foreach (dbFetchRows("SELECT * FROM `bill_history` ORDER BY `bill_datefrom` AND `bill_dateto` DESC LIMIT 24") as $history) foreach (dbFetchRows("SELECT * FROM `bill_history` WHERE `bill_id` = ? AND `bill_datefrom` = ? AND `bill_dateto` = ? ORDER BY `bill_datefrom` AND `bill_dateto` LIMIT 1", array($bill['bill_id'], $datefrom, $dateto)) as $history) { unset($class); $type = $history['bill_type']; $percent = $history['bill_percent']; $dir_95th = $history['dir_95th']; $rate_95th = formatRates($history['rate_95th'] * 1000); $total_data = formatStorage($history['traf_total'] * 1024 * 1024); $background = get_percentage_colours($percent); $row_colour = ((!is_integer($i/2)) ? $list_colour_a : $list_colour_b); if ($type == "CDR") { $allowed = formatRates($history['bill_allowed'] * 1000); $used = formatRates($history['rate_95th'] * 1000); $in = formatRates($history['rate_95th_in'] * 1000); $out = formatRates($history['rate_95th_out'] * 1000); $overuse = (($history['bill_overuse'] <= 0) ? "-" : "".formatRates($history['bill_overuse'] * 1000).""); } elseif ($type == "Quota") { $allowed = formatStorage($history['bill_allowed'] * 1024 * 1024); $used = formatStorage($history['total_data'] * 1024 * 1024); $in = formatStorage($history['traf_in'] * 1024 * 1024); $out = formatStorage($history['traf_out'] * 1024 * 1024); $overuse = (($history['bill_overuse'] <= 0) ? "-" : "".formatStorage($history['bill_overuse'] * 1024 * 1024).""); } $total_data = (($type == "Quota") ? "".$total_data."" : $total_data); $rate_95th = (($type == "CDR") ? "".$rate_95th."" : $rate_95th); echo(" ".$bill['bill_name']."
from ".strftime("%x", strtotime($datefrom))." to ".strftime("%x", strtotime($dateto))." $type $allowed $in $out $total_data $rate_95th $overuse ".print_percentage_bar (250, 20, $perc, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right'])." "); $i++; } ### PERMITTED } } echo(""); ?>