Properly format 95th CDR as SI Mbps in billing (#10444)

This commit is contained in:
CirnoT 2019-07-24 06:47:05 +02:00 committed by Tony Murray
parent 77d94a458b
commit 2b13072ff0
2 changed files with 7 additions and 3 deletions

View File

@ -191,7 +191,7 @@ if ($vars['view'] == 'edit' && LegacyAuth::user()->hasGlobalAdmin()) {
$type = '&95th=yes';
?>
<td>
<?php echo format_si($rate_95th) ?> of <?php echo format_si($cdr).'bps ('.$percent.'%)' ?> (95th%ile)
<?php echo format_si($rate_95th).'bps' ?> of <?php echo format_si($cdr).'bps ('.$percent.'%)' ?> (95th%ile)
</td>
<td style="width: 210px;">
<?php echo print_percentage_bar(200, 20, $percent, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']) ?>
@ -200,7 +200,7 @@ if ($vars['view'] == 'edit' && LegacyAuth::user()->hasGlobalAdmin()) {
<tr>
<td colspan="2">
<?php
echo 'Predicted usage: ' . format_bytes_billing(getPredictedUsage($bill_data['bill_day'], $bill_data['rate_95th']));
echo 'Predicted usage: ' . format_si(getPredictedUsage($bill_data['bill_day'], $bill_data['rate_95th'])).'bps';
?>
</td>

View File

@ -151,7 +151,11 @@ foreach (dbFetchRows($sql, $param) as $bill) {
$actions .= "<a href='" . generate_url(array('page' => 'bill', 'bill_id' => $bill['bill_id'], 'view' => 'edit')) .
"'><i class='fa fa-pencil fa-lg icon-theme' title='Edit' aria-hidden='true'></i> Edit</a> ";
}
$predicted = format_bytes_billing(getPredictedUsage($bill['bill_day'], $tmp_used));
if (strtolower($bill['bill_type']) == 'cdr') {
$predicted = format_si(getPredictedUsage($bill['bill_day'], $tmp_used)).'bps';
} elseif (strtolower($bill['bill_type']) == 'quota') {
$predicted = format_bytes_billing(getPredictedUsage($bill['bill_day'], $tmp_used));
}
$response[] = array(
'bill_name' => $bill_name,