diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index b706f7e4..53d111e3 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -251,19 +251,19 @@ class Transaction extends Base { $this->debug->append("STA " . __METHOD__, 4); $stmt = $this->mysqli->prepare(" SELECT - ROUND(( + IFNULL(ROUND(( SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= ? ) OR t.type = 'Credit_PPS', t.amount, 0 ) ) - SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) - SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= ? ) OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) ) - ), 8) AS confirmed, - ROUND(( + ), 8), 0) AS confirmed, + IFNULL(ROUND(( SUM( IF( t.type IN ('Credit','Bonus') AND b.confirmations < ? AND b.confirmations >= 0, t.amount, 0 ) ) - SUM( IF( t.type IN ('Donation','Fee') AND b.confirmations < ? AND b.confirmations >= 0, t.amount, 0 ) ) - ), 8) AS unconfirmed, - ROUND(( + ), 8), 0) AS unconfirmed, + IFNULL(ROUND(( SUM( IF( t.type IN ('Credit','Bonus') AND b.confirmations = -1, t.amount, 0) ) - SUM( IF( t.type IN ('Donation','Fee') AND b.confirmations = -1, t.amount, 0) ) - ), 8) AS orphaned + ), 8), 0) AS orphaned FROM $this->table AS t LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id diff --git a/public/include/pages/api/getdashboarddata.inc.php b/public/include/pages/api/getdashboarddata.inc.php index e4c8e48c..9eac5d46 100644 --- a/public/include/pages/api/getdashboarddata.inc.php +++ b/public/include/pages/api/getdashboarddata.inc.php @@ -46,7 +46,7 @@ $dNetworkHashrateAdjusted = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier // Output JSON format $data = array( 'raw' => array( 'personal' => array( 'hashrate' => $dPersonalHashrate ), 'pool' => array( 'hashrate' => $dPoolHashrate ), 'network' => array( 'hashrate' => $dNetworkHashrate / 1000 ) ), - 'personal' => array ( 'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate, 'shares' => $aUserRoundShares), + 'personal' => array ( 'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate, 'shares' => $aUserRoundShares, 'balance' => $transaction->getBalance($user_id)), 'pool' => array( 'hashrate' => $dPoolHashrateAdjusted, 'shares' => $aRoundShares ), 'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ), ); diff --git a/public/templates/test/dashboard/account_data.tpl b/public/templates/test/dashboard/account_data.tpl new file mode 100644 index 00000000..112c7f42 --- /dev/null +++ b/public/templates/test/dashboard/account_data.tpl @@ -0,0 +1,16 @@ +
+

Account Information

+
+ + + + + + + + + + +
{$GLOBAL.config.currency} Account Balance
Confirmed
Unconfirmed
+
+
diff --git a/public/templates/test/dashboard/default.tpl b/public/templates/test/dashboard/default.tpl index 5313395b..2869f8b4 100644 --- a/public/templates/test/dashboard/default.tpl +++ b/public/templates/test/dashboard/default.tpl @@ -2,6 +2,7 @@ {assign var=payout_system value=$GLOBAL.config.payout_system} {include file="dashboard/overview.tpl"} {include file="dashboard/round_data.tpl"} + {include file="dashboard/account_data.tpl"} {include file="dashboard/default_$payout_system.tpl"} {include file="dashboard/js.tpl"} {/if} diff --git a/public/templates/test/dashboard/default_prop.tpl b/public/templates/test/dashboard/default_prop.tpl index 35d97f37..3b299e77 100644 --- a/public/templates/test/dashboard/default_prop.tpl +++ b/public/templates/test/dashboard/default_prop.tpl @@ -46,9 +46,6 @@ {$GLOBAL.userdata.est_payout|number_format:"8"}   - {$GLOBAL.config.currency} Account Balance - Confirmed{$GLOBAL.userdata.balance.confirmed|default:"0"} - Unconfirmed{$GLOBAL.userdata.balance.unconfirmed|default:"0"} diff --git a/public/templates/test/dashboard/js.tpl b/public/templates/test/dashboard/js.tpl index b4270759..cf55f3fc 100644 --- a/public/templates/test/dashboard/js.tpl +++ b/public/templates/test/dashboard/js.tpl @@ -77,8 +77,8 @@ $(document).ready(function(){ ], legend: { show: true, location: 'ne', renderer: $.jqplot.EnhancedLegendRenderer, rendererOptions: { seriesToggleReplot: { resetAxes: true } } }, axes: { - yaxis: { tickOptions: { angle: -90 }, ticks: [ 'invalid', 'valid' ], renderer: $.jqplot.CategoryAxisRenderer }, - xaxis: { tickOptions: { angle: -15 }, pointLabels: { show: true } } + yaxis: { tickOptions: { angle: -90 }, ticks: [ 'valid', 'invalid' ], renderer: $.jqplot.CategoryAxisRenderer }, + xaxis: { tickOptions: { angle: -17 }, pointLabels: { show: true } } } }; @@ -132,6 +132,11 @@ $(document).ready(function(){ success: function (data) { initGauges(data); } }); + function refreshStaticData(data) { + $('#b-confirmed').html(data.getdashboarddata.data.personal.balance.confirmed); + $('#b-unconfirmed').html(data.getdashboarddata.data.personal.balance.unconfirmed); + } + // Our worker process to keep gauges and graph updated (function worker() { $.ajax({ @@ -139,6 +144,7 @@ $(document).ready(function(){ dataType: 'json', success: function(data) { refreshInformation(data); + refreshStaticData(data); }, complete: function() { setTimeout(worker, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"10000"}{literal})