end; $coin_id = getiparam('id'); $saveSort = $coin_id ? 'false' : 'true'; showTableSorter('maintable', "{ tableClass: 'dataGrid', widgets: ['zebra','filter','Storage','saveSort'], textExtraction: { 6: function(node, table, n) { return $(node).attr('data'); }, 7: function(node, table, n) { return $(node).attr('data'); } }, widgetOptions: { saveSort: {$saveSort}, filter_saveFilters: {$saveSort}, filter_external: '.search', filter_columnFilters: false, filter_childRows : true, filter_ignoreCase: true } }"); echo << Coin Address Quantity BTC Block Status Sent Actions end; $coin_id = getiparam('id'); $sqlFilter = $coin_id ? "AND coinid={$coin_id}": ''; $limit = $coin_id ? '' : 'LIMIT 1500'; $earnings = getdbolist('db_earnings', "status!=2 $sqlFilter ORDER BY create_time DESC $limit"); $total = 0.; $total_btc = 0.; $totalimmat = 0.; $totalfees = 0.; $totalstake = 0.; foreach($earnings as $earning) { // if(!$earning) debuglog($earning); $coin = getdbo('db_coins', $earning->coinid); if(!$coin) continue; $user = getdbo('db_accounts', $earning->userid); if(!$user) continue; $block = getdbo('db_blocks', $earning->blockid); if(!$block) continue; $t1 = datetoa2($earning->create_time). ' ago'; $t2 = datetoa2($earning->mature_time); if ($t2) $t2 = '+'.$t2; $coinimg = CHtml::image($coin->image, $coin->symbol, array('width'=>'16')); $coinlink = CHtml::link($coin->name, '/site/coin?id='.$coin->id); echo ''; echo "$coinimg"; echo "$coinlink ($coin->symbol_show)"; echo ''.$user->username.''; echo ''.bitcoinvaluetoa($earning->amount).''; echo ''.bitcoinvaluetoa($earning->amount * $earning->price).''; echo ''.$block->height.''; echo ''."$block->category ($block->confirmations)"; echo ''."$t1 $t2"; echo ''; echo 'clear '; echo 'delete'; echo ''; // echo "$earning->tx"; echo ""; // if($block->category == 'generate' && $earning->status == 0) // { // $earning->status = 1; // $earning->mature_time = time()-100*60; // $earning->save(); // } if($block->category == 'immature') { $total += (double) $earning->amount; $total_btc += (double) $earning->amount * $earning->price; $totalimmat += (double) $earning->amount; } if($block->category == 'generate') { $total += (double) $earning->amount; // "Exchange" state $total_btc += (double) $earning->amount * $earning->price; } else if($block->category == 'stake' || $block->category == 'generated') { $totalstake += (double) $earning->amount; } } echo ''; echo ''; echo count($earnings).' records'; if (count($earnings) >= 1000) echo " ($limit)"; echo ''; echo ''; if ($coin_id) { $coin = getdbo('db_coins', $coin_id); if (!$coin) exit; $symbol = $coin->symbol; $feepct = yaamp_fee($coin->algo); $totalfees = ($total / ((100 - $feepct) / 100.)) - $total; $cleared = dboscalar("SELECT SUM(balance) FROM accounts WHERE coinid={$coin->id}"); echo '
'; echo ''; echo '"; echo '"; //echo '"; echo '"; if ($coin->rpcencoding == 'POS') echo '"; echo '
Immature'.bitcoinvaluetoa($totalimmat)." $symbol
Total owed'.bitcoinvaluetoa($total)." $symbol
Total BTC'.bitcoinvaluetoa($total_btc)." BTC
Pool Fees '.round($feepct,1).'%'.bitcoinvaluetoa($totalfees)." $symbol
Stake'.bitcoinvaluetoa($totalstake)." $symbol
'; echo ''; echo '"; echo '"; $exchange = $total - $totalimmat; echo ''; echo '"; echo '
Balance'.bitcoinvaluetoa($coin->balance)." $symbol
Cleared'.bitcoinvaluetoa($cleared)." $symbol
Available'.bitcoinvaluetoa($coin->balance - $exchange - $cleared)." $symbol
'; echo '
'; }