function computeGameResult($game_id, $bi_id, $commission, $total_coins) { $data = array(); $temp = array(); //$total_coins = 0; $bets = getAllBetsByBiId($game_id, $bi_id); foreach ($bets as $bet) { $total_coins_this_bet += $bet['ub_coins']; $temp[$bet['user_id']] = 1; } $percentage = $total_coins_this_bet / $total_coins; // percentage of this bet $total_winners = count($temp); $total_comm = $commission / 100 * $total_coins; $sub_total = $total_coins - $total_comm; $coin_div = $sub_total / ($percentage * 100); $data['status'] = 'success'; $data['total_coins'] = $total_coins; $data['total_commission'] = $total_comm; $data['sub_total'] = $sub_total; $data['total_winners'] = $total_winners; $data['coin_dividend'] = number_format($coin_div, 2); $data['winner_name'] = getBetItemName($bi_id); return $data; }
?> </div> </div> </div> <div class="box-header"> <h3 class="box-title"><?php echo $ag['g_title' . $suff]; ?> </h3> </div> <div class="box-body"> <?php $total_bet = 0; foreach ($info_per_bet_item as $ipbi) { $bet_name = getBetItemName($ipbi['bi_id'], $suff); $total_bet += $ipbi['placed_coins']; $coins_ratio = number_format($ipbi['coins_ratio'], 2); if ($coins_ratio > 0) { $progress_color = 'progress-bar-red'; } if ($coins_ratio > 24) { $progress_color = 'progress-bar-yello'; } if ($coins_ratio > 49) { $progress_color = 'progress-bar-aqua'; } if ($coins_ratio > 75) { $progress_color = 'progress-bar-green'; } ?>