<?php
if (basename($_SERVER['SCRIPT_FILENAME']) == basename(__FILE__)){
echo "<p align=center><br><br><br><br><br><br><font size=\"6\" color=\"#FF0000\">ILLEGAL ACCESS !!";
echo "<meta http-equiv=\"refresh\" content=\"2; url=../index.php\">";
exit();} 
?>
 <div class="row">
            <div class="col-md-12">
                <h1 class="page-header">
                    <img src="../themes/img/transaction.png" alt="Profits" class="header-icon" width="30">
                    Profits
                </h1>
            </div>
        </div>
        
 <?php
$totkom = total_profit_member($user_session);
    $twdne = total_wdprofit_member($user_session);
	
	$tarik = $totkom - $twdne;

if($tarik > 0){
$tarikane = rupiah($tarik);
}else{
$tarikane = "0";
}
?> 
<?php
if($db->dataku("status", $user_session) == 0 || $db->dataku("blokir", $user_session) == 1) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["status0"]."</div>";
}else{
?>

<div class="row">
            	<div class="col-md-12">
                	
                    
                   <div class="panel panel-inverse">
                        <div class="panel-heading bg-grey">
                            <h4 class="text-white">Profits</h4>
                        </div>
                        
                        <div class="panel-body">
                        
                        
                        
                        
                        
                                                          
                                    <table id="data-table" class="table table-bordered" cellspacing="0" width="100%">
                    
                    
              <thead>
                <tr>
                <th width="20%" align="center"><?php echo $LANG["prof_date"]?></th> 
                        <th width="19%" align="center"><?php echo $LANG["prof_code"]?></th> 
                        <th width="30%" align="center"><?php echo $LANG["prof_type"]?></th> 
                        <th width="22%" align="center"><?php echo $LANG["amount"]?></th>
                </tr>
              </thead>
              <tbody>
<?

	$db->select("id, username, bayar, tglbayar, status, total, jenis, dari, kode", "komisi", "jenis='komshare' and username='$user_session'", "tglbayar desc");
	
		while($row=$db->fetch_row()) {
			if(is_odd($nom) == 0) {
				$class = "even";
			} else {
				$class = "odd";
			} 	
			
		$user=$row[7];
		$namaspon = "SELECT * FROM member WHERE username='$user'"; 
	 
        $resultnamaspon = mysql_query($namaspon);


$rownamaspon = mysql_fetch_array($resultnamaspon);
$namaspone = $rownamaspon['nama'];	

$ttprof = total_profit_member($user_session);
if($ttprof > 0){
$ttprofit = rupiah($ttprof);
}else{
$ttprofit = "0";
}
?>				
				
				
                             
                       <tr> 
                            <td align="center"><?php echo formatgl($row[3]); ?></td>
                            <td align="center"><?php echo $row[8]; ?></td>
                            <td align="center"><?php echo $row[7]; ?></td>
                            <td align="right"><?php echo rupiah($row[2]); ?></td>
                        </tr>
                                                                    
             <?
		}
	?>
              </tbody>
            </table>
                        </div>
                    </div>
                </div>
			</div>
			<!-- END PAGE CONTENT -->                       



                     
<?php } ?>





