<?php 	
    include_once('../../config.php');   	
    
    
                                                
                                                
                                                    
                                            if(isset($_REQUEST['Did']))
                                            {    
                                                
            							        $stmt=$conn->prepare("delete from  UI__UserInsetive where id=:id ");  
                                                $stmt->bindValue(':id',$_REQUEST['Did'] , PDO::PARAM_STR);
                                                $stmt->execute();    
                                                header("Location: Insentivies.php");
                                                die;  
                                            }
                                            
    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> User Insentive </h3></div>
					
					<div align="right">  <input type="button"    class="btn btn-warning" name="btnback" id="btnback" value=" Add New Insentive User " onClick="javascript:location.href='../wallet/addInsentive.php';" />
					</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>TopUp</th>  
								<th>Reg Date </th>  
								<th>Action</th> 
							</tr>
						</thead>
						<tbody>
							<?php
                                    $stmt=$conn->prepare("select  * from  UI__UserInsetive   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  * from  UI__Rgst where cuurentId=:cuurentId");  
                                    $stmt->bindValue(':cuurentId', $users->custId , PDO::PARAM_STR);
                                    $stmt->execute(); 
                                    $UI__Rgst = $stmt->fetch(PDO::FETCH_OBJ); 
                                    
							        $stmt=$conn->prepare("select  id from   UI__DChstr where Rid=:sId  and typ=1");  
                                    $stmt->bindValue(':sId', $users->custId , PDO::PARAM_STR);
                                    $stmt->execute();  
                                    $count = $stmt->rowCount(); 
                                        
                                         
							?>
							<tr class="odd gradeX">
								<td><?php echo $sr++;?> </td>
								<td><?php echo $UI__Rgst->nm;?> </td>
								<td><?php echo $UI__Rgst->cuurentId;?></td>
								<td><?php echo $UI__Rgst->refId;?></td>
								<td><?php echo $UI__Rgst->phm;?>  </td> 
		 
								<td> <?php  if($count > 0) echo "Active"; ?>  </td>      
								<td> <?php echo $UI__Rgst->RegOn;?> </td>    
								<td> <a href="Insentivies.php?Did=<?php echo $users->id?>" >  DELETE </a></td>  
							</tr>  
							<?php 
                                            
                                    }
								   
							?>
						</tbody>
					</table>
  				</div>
  			</div>



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

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