Skip to content
Snippets Groups Projects
Commit e04b4659 authored by Robert Anderson's avatar Robert Anderson
Browse files

Use same usage display calculations as admin interface

parent 0ef9f9d3
No related branches found
No related tags found
No related merge requests found
...@@ -237,11 +237,6 @@ function displayDetails() { ...@@ -237,11 +237,6 @@ function displayDetails() {
# Traffic topups # Traffic topups
if ($topup['Type'] == 1) { if ($topup['Type'] == 1) {
# Note this usage from previous topups as well
if (isset($topup['CurrentLimit'])) {
$totalTraffic += ($topup['Limit'] - $topup['CurrentLimit']);
}
# Topup not currently in use # Topup not currently in use
if ($excess <= 0) { if ($excess <= 0) {
$trafficRows[$i] = array(); $trafficRows[$i] = array();
...@@ -252,7 +247,7 @@ function displayDetails() { ...@@ -252,7 +247,7 @@ function displayDetails() {
$trafficRows[$i]['Expires'] = $topup['Expires']; $trafficRows[$i]['Expires'] = $topup['Expires'];
# Set total available topups # Set total available topups
$totalTrafficTopupsAvail += $topup['Limit']; $totalTrafficTopupsAvail += isset($topup['CurrentLimit']) ? $topup['CurrentLimit'] : $topup['Limit'];
$i++; $i++;
...@@ -288,7 +283,7 @@ function displayDetails() { ...@@ -288,7 +283,7 @@ function displayDetails() {
$trafficRows[$i]['Used'] = ($topup['Limit'] - $topup['CurrentLimit']) + $excess; $trafficRows[$i]['Used'] = ($topup['Limit'] - $topup['CurrentLimit']) + $excess;
# Set total available topups # Set total available topups
$totalTrafficTopupsAvail += $topup['Limit']; $totalTrafficTopupsAvail += $topup['CurrentLimit'];
# Set current topup # Set current topup
$currentTrafficTopup = array(); $currentTrafficTopup = array();
...@@ -309,11 +304,8 @@ function displayDetails() { ...@@ -309,11 +304,8 @@ function displayDetails() {
$trafficRows[$i]['ValidFrom'] = $topup['ValidFrom']; $trafficRows[$i]['ValidFrom'] = $topup['ValidFrom'];
$trafficRows[$i]['Expires'] = $topup['Expires']; $trafficRows[$i]['Expires'] = $topup['Expires'];
# Set total available topups
$totalTrafficTopupsAvail += $topup['Limit'];
# Subtract this topup from excess usage # Subtract this topup from excess usage
$excess -= $topup['Limit']; $excess -= isset($topup['CurrentLimit']) ? $topup['CurrentLimit'] : $topup['Limit'];
$i++; $i++;
} }
...@@ -341,11 +333,6 @@ function displayDetails() { ...@@ -341,11 +333,6 @@ function displayDetails() {
# Uptime topups # Uptime topups
if ($topup['Type'] == 2) { if ($topup['Type'] == 2) {
# Note this usage from previous topups as well
if (isset($topup['CurrentLimit'])) {
$totalUptime += ($topup['Limit'] - $topup['CurrentLimit']);
}
# Topup not currently in use # Topup not currently in use
if ($excess <= 0) { if ($excess <= 0) {
$uptimeRows[$i] = array(); $uptimeRows[$i] = array();
...@@ -356,7 +343,7 @@ function displayDetails() { ...@@ -356,7 +343,7 @@ function displayDetails() {
$uptimeRows[$i]['Expires'] = $topup['Expires']; $uptimeRows[$i]['Expires'] = $topup['Expires'];
# Set total available topups # Set total available topups
$totalUptimeTopupsAvail += $topup['Limit']; $totalUptimeTopupsAvail += isset($topup['CurrentLimit']) ? $topup['CurrentLimit'] : $topup['Limit'];
$i++; $i++;
...@@ -392,7 +379,7 @@ function displayDetails() { ...@@ -392,7 +379,7 @@ function displayDetails() {
$uptimeRows[$i]['Used'] = ($topup['Limit'] - $topup['CurrentLimit']) + $excess; $uptimeRows[$i]['Used'] = ($topup['Limit'] - $topup['CurrentLimit']) + $excess;
# Set total available topups # Set total available topups
$totalUptimeTopupsAvail += $topup['Limit']; $totalUptimeTopupsAvail += $topup['CurrentLimit'];
# Set current topup # Set current topup
$currentUptimeTopup = array(); $currentUptimeTopup = array();
...@@ -413,11 +400,8 @@ function displayDetails() { ...@@ -413,11 +400,8 @@ function displayDetails() {
$uptimeRows[$i]['ValidFrom'] = $topup['ValidFrom']; $uptimeRows[$i]['ValidFrom'] = $topup['ValidFrom'];
$uptimeRows[$i]['Expires'] = $topup['Expires']; $uptimeRows[$i]['Expires'] = $topup['Expires'];
# Set total available topups
$totalUptimeTopupsAvail += $topup['Limit'];
# Subtract this topup from excess usage # Subtract this topup from excess usage
$excess -= $topup['Limit']; $excess -= isset($topup['CurrentLimit']) ? $topup['CurrentLimit'] : $topup['Limit'];
$i++; $i++;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment