<?php 	
    include_once('../../config.php');   	
    include_once(ABS_PATH.'/admin/login_check.php');     
    include ABS_PATH.'/admin/header.php';	
    ?>  

<script>
function del_record(val)
{

	var r = confirm("Do you really want to delete record !");
	if (r == true) {    
	$.ajax({
	type: 'POST',
	url: "../ajax/default.php",
	//async: false,			 
	data: {del_city_names:1,val:val},	  
	success: function(ajaxresult){	     
		location.reload();	 	
	},
	error: function(XMLHttpRequest, textStatus, errorThrown) { 
	alert('Error');
	}
	});
	
	}	
	
}

</script>
		 
		<div class="col-md-10">  
  			<div class="content-box-large">
  				<div class="panel-heading">
					<div class="panel-title"><h3>IMPS Users List </h3></div>
					
					<!--div align="right">  <input type="button"    class="btn btn-warning" name="btnback" id="btnback" value=" Add New User " onClick="javascript:location.href='#';" />
					</div-->
					
				</div>
				
  				<div class="panel-body">
  					<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
						<thead>
							<tr>
								<th>Sr</th>
								<th>Name</th>  	  
								<th>UserID</th>  
								<th>Ref Id</th>  
								<th>Phone</th> 
 
								<th>Log Pin</th> 
								<th>CustId</th> 
								<th>Wallet</th>  
								<th>TopUp</th>  
								<th>Reg Date </th>
								<th>Trading</th>
								 
								<th>Action</th> 
							</tr>
						</thead>
						<tbody>
							<?php
                                    $stmt=$conn->prepare("select  * from  UI__Rgst where is_active = 1 and cuurentId!='DP112233'  order by id");  
                                    //$stmt->bindValue(':Ttime', $InTime , PDO::PARAM_STR);
                                    $stmt->execute(); 
                                    $AllUsers = $stmt->fetchAll(PDO::FETCH_OBJ); 
                                    $sr = 1;
								  foreach($AllUsers as $users)
								  {    
							          
							        $stmt=$conn->prepare("select  id from   UI__DChstr where Rid=:sId  and typ=1");  
                                    $stmt->bindValue(':sId', $users->cuurentId , PDO::PARAM_STR);
                                    $stmt->execute();  
                                    $count = $stmt->rowCount();
                                    
                                    
                                    $stmt=$conn->prepare("select Mnnnt  from   UI__Mnt where sId=:sId ");  
                                    $stmt->bindValue(':sId', $users->custId , PDO::PARAM_STR);
                                    $stmt->execute();  
                                    $Mnnnt = $stmt->fetch(PDO::FETCH_OBJ);    
                                    
                                    
                                    /*
                                                                        
                                        $stmt=$conn->prepare("select *  from UI__DailyROIGene    where custId=:sId     ");   
                                        $stmt->bindValue(':sId',  $users->cuurentId , PDO::PARAM_INT);  
                                        $stmt->execute(); 
                                        $XUI__DailyROIGene = $stmt->fetchAll(PDO::FETCH_OBJ);  
                                        
                                        $Tamnt = 0;
                                        foreach($XUI__DailyROIGene as $xx)
                                        {
                                            $Tamnt +=$xx->amount;
                                        }      
                                        
                                        
                                         $stmt=$conn->prepare("select *  from UI__Bns    where Rid =:sId   ");   
                                            $stmt->bindValue(':sId',   $users->cuurentId , PDO::PARAM_INT);  
                                            $stmt->execute(); 
                                            $UI__Bns = $stmt->fetchAll(PDO::FETCH_OBJ); 
                                            
                                             $LevelI = 0;
                                             foreach($UI__Bns as $dddm)
                                             {
                                                 $LevelI +=$dddm->Tamt;
                                             }
                                             
                                     
                                                $stmt=$conn->prepare("select Amt   from UI__Tpm where TopUpId=:refId   ");   
                                                $stmt->bindValue(':refId',   $users->cuurentId , PDO::PARAM_INT);  
                                                $stmt->execute(); 
                                                $MdirectB = $stmt->fetchAll(PDO::FETCH_OBJ);  
                                                
                                                $directIncome = 0;
                                                foreach($MdirectB as $dmm)
                                                    $directIncome += $dmm->Amt;                
                                            
                                            
                                        
                                        
                                        $stmt=$conn->prepare("select *  from UI__WithDraw    where userid=:sId and (accept=1 ||accept=2)  ");   
                                        $stmt->bindValue(':sId',   $users->cuurentId , PDO::PARAM_INT);  
                                        $stmt->execute(); 
                                        $UI__WithDraw = $stmt->fetchAll(PDO::FETCH_OBJ); 
                                        
                                        
                                        $totalWithdrwa = 0;
                                        foreach($UI__WithDraw as $tl)
                                        {
                                        $totalWithdrwa +=$tl->amt;
                                        }
                                        
                                        
                                        
                                        
                                        $stmt=$conn->prepare("select availableFund from UI__Fundtransfer  where  userid=:userid  order by id desc  ");   
                                        $stmt->bindValue(':userid',   $users->cuurentId , PDO::PARAM_INT);  
                                        $stmt->execute(); 
                                        $UI__Fundtransfer = $stmt->fetch(PDO::FETCH_OBJ);      
                                    
                                        $PAYWAllet =  ($Tamnt+$LevelI+$directIncome+$UI__Fundtransfer->availableFund)-($totalWithdrwa);*/
                                        
                                        if($users->impsStats==0) {
							?>
							<tr class="odd gradeX">
								<td><?php echo $sr++;?> </td>
								<td><?php echo $users->nm;?> <a target="_blank" href="<?php echo ROOTPATH;?>/login/directlogin.php?cudtId=<?php echo $users->cuurentId;?>">Login</a></td>
								<td><?php echo $users->cuurentId;?></td>
								<td><?php echo $users->refId;?></td>
								<td><?php echo $users->phm;?>  </td> 
								  
								<td><?php echo $users->UserPin;?>  </td> 
								<td><?php echo $users->custId;?>  </td> 
								<td> <?php //echo $PAYWAllet;?>  </td>   
								<td> <?php  if($count > 0) echo "Active"; ?>  </td>      
								<td> <?php echo $users->RegOn;?> </td>  
								<td> <a href="tradingPay.php?id=<?php echo $users->cuurentId;?>">Pay</a></td>  
								 
								<td><?php if ($users->is_active==1) echo "Active"; else echo "Deactive";?> / <a href="edit-details.php?id=<?php echo $users->id;?>" target="_blank">  Edit </a></td> 
								
							</tr>  
							<?php 
                                            
                                        }
								  }
							?>
						</tbody>
					</table>
  				</div>
  			</div>



		  </div>
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	?>    