diff --git a/html/bandwidth-graph.php b/html/bandwidth-graph.php index 7cab8cec0d..73f467cc0f 100644 --- a/html/bandwidth-graph.php +++ b/html/bandwidth-graph.php @@ -47,7 +47,7 @@ // $dur = $end - $start; // $datefrom = date('Ymthis', $start); // $dateto = date('Ymthis', $end); - $imgtype = (isset($_GET['imgtype']) ? $_GET['imgtype'] : "historical" ); + $imgtype = (isset($_GET['type']) ? $_GET['type'] : "historical" ); $imgbill = (isset($_GET['imgbill']) ? $_GET['imgbill'] : false); $yaxistitle = "Bytes"; @@ -218,7 +218,7 @@ $gbplot = new GroupBarPlot(array($barplot_in, $barplot_tot, $barplot_out, $barplot_over)); } else { $lineplot_allow = new LinePlot($ave_data); - $lineplot_allow->SetLegend("Average per day"); + $lineplot_allow->SetLegend("Average per ".$imgtype); $lineplot_allow->SetColor('black'); $lineplot_allow->SetWeight(1); diff --git a/html/pages/bill.inc.php b/html/pages/bill.inc.php index 63e7c9e91c..92ce40e11d 100644 --- a/html/pages/bill.inc.php +++ b/html/pages/bill.inc.php @@ -278,22 +278,29 @@ if (bill_permitted($bill_id)) if ($_GET['optb'] == "details") { - $bi = ""; + $bi = ""; + $li = ""; + $di = ""; + $mi = ""; + $gbconvert = $config['billing']['base']; - echo($img); + $img['his'] = ""; + + echo($img['his']); + + function showDetails($id, $imgtype, $from, $to, $bittype = "Quota") + { + if ($imgtype == "bitrate") { + $res = ""; + return $res; + } echo(" - + @@ -21,7 +48,7 @@ - + "); foreach (dbFetchRows("SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY `bill_datefrom` AND `bill_dateto` DESC LIMIT 24", array($bill_id)) as $history) @@ -35,7 +62,7 @@ $percent = $history['bill_percent']; $dir_95th = $history['dir_95th']; $rate_95th = formatRates($history['rate_95th'] * 1000); - $total_data = formatStorage($history['traf_total'] * 1024 * 1024); + $total_data = formatStorage($history['traf_total'] * $gbconvert * $gbconvert); $background = get_percentage_colours($percent); $row_colour = ((!is_integer($i/2)) ? $list_colour_a : $list_colour_b); @@ -48,18 +75,18 @@ $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).""); + $allowed = formatStorage($history['bill_allowed'] * $gbconvert * $gbconvert); + $used = formatStorage($history['total_data'] * $gbconvert * $gbconvert); + $in = formatStorage($history['traf_in'] * $gbconvert * $gbconvert); + $out = formatStorage($history['traf_out'] * $gbconvert * $gbconvert); + $overuse = (($history['bill_overuse'] <= 0) ? "-" : "".formatStorage($history['bill_overuse'] * $gbconvert * $gbconvert).""); } $total_data = (($type == "Quota") ? "".$total_data."" : $total_data); $rate_95th = (($type == "CDR") ? "".$rate_95th."" : $rate_95th); echo(" - + @@ -69,9 +96,30 @@ - + + "); + if ($detail == ($i+1) || $detail == "all") { + $img['bitrate'] = showDetails($history['bill_id'], "bitrate", strtotime($datefrom), strtotime($dateto), $type); + $img['bw_day'] = showDetails($history['bill_id'], "day", strtotime($datefrom), strtotime($dateto)); + $img['bw_hour'] = showDetails($history['bill_id'], "hour", strtotime($datefrom), strtotime($dateto)); + echo(" + + + "); + } + $i++; } ### PERMITTED } diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 39c2e68c05..3cb13c0922 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -173,6 +173,7 @@ $config['enable_billing'] = 0; # Enable Billing $config['billing']['customer_autoadd'] = 0; # Enable Auto-add bill per customer $config['billing']['circuit_autoadd'] = 0; # Enable Auto-add bill per circuit_id $config['billing']['bill_autoadd'] = 0; # Enable Auto-add bill per bill_id +$config['billing']['base'] = 1000; # Set the base to divider bytes to kb, mb, gb ,... (this only works for the text based conversion and not for the graphs) ### External Integration
PeriodPeriod Type Allowed InboundTotal 95 percentile Overusage\"Show Show all details
".strftime("%Y-%m-%d", strtotime($datefrom))." -> ".strftime("%Y-%m-%d", strtotime($dateto))." $type$total_data $rate_95th $overuse".print_percentage_bar(250, 20, $perc, NULL, "ffffff", $background['left'], $percent."%", "ffffff", $background['right'])."".print_percentage_bar(250, 20, $perc, NULL, "ffffff", $background['left'], $percent."%", "ffffff", $background['right'])." + \"Show + \"PDF +
+ + ".$img['bitrate']."
+ + ".$img['bw_day']."
+ + ".$img['bw_hour']." +