<?php 	
    include_once('../../config.php');   	
    include_once(ABS_PATH.'/admin/login_check.php');     
    include ABS_PATH.'/admin/header.php';
    
                      if(isset($_POST['dateselect']))
                        {                                         
                            $originalDate = $_POST['dateselect'];
                            $newDate = date("d-M-Y", strtotime($originalDate)); 
                        }else
                            $newDate =  date("d-M-Y") ;
    
    
                                        
?>  

<script>
$(function() {
		$( "#dateselect" ).datepicker(); 
});

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>Special 100  Report </h3>
					        <h5>Date: <?php echo $newDate;?></h5>
					</div>
					
					 
					 <div align="left"> 
                        <form method="post" autocomplete="off">  
                        
                        <div class="col-sm-2">
                        <input name="dateselect" id="dateselect" class="form-control"   placeholder="Date"  > 
                        </div>  
                        
                        <input   class="btn btn-warning"  type="submit" value="Apply" name="filterSub"/> 
                        </form> 
					</div>   
					
					<div align="right">   
					</div>
					
				</div>
				
  				<div class="panel-body">
  					<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
						<thead>
							<tr>
								<th>Name</th>   
								<th>Values </th>   
							</tr>
						</thead>
						<tbody> 
						
					    	<?php 
					    	
						            $stmt=$conn->prepare("select  * from UI__Rgst   where sp100=1 ");  
                                    //$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 amount   from  UI__DailyROIGene where custId=:custId  and Tdate=:Tdate");
                                                $stmt->bindValue(':custId', $users->cuurentId  , PDO::PARAM_STR);  
                                                $stmt->bindValue(':Tdate',$newDate , PDO::PARAM_STR);  
                                                $stmt->execute();  
                                                $UI__DailyROIGeneCt = $stmt->fetch(PDO::FETCH_OBJ);
                                                 
                                                
                                                $Tamnt = 0;
                                                $Tamnt = $UI__DailyROIGeneCt->amount;  
                                                
                                                 
                                                
                                                $stmt=$conn->prepare("select reward   from  UI__Reward where cuurentId=:cuurentId  and Tdate=:Tdate");
                                                $stmt->bindValue(':cuurentId', $users->cuurentId  , PDO::PARAM_STR);  
                                                $stmt->bindValue(':Tdate', $newDate , PDO::PARAM_STR);  
                                                $stmt->execute();  
                                                $UI__reward = $stmt->fetch(PDO::FETCH_OBJ);  
							    
							?>
							
							<tr class="odd gradeX"> 
								<td> <?php echo $users->nm;?>  </td>    
								<td>  <?php echo ($Tamnt+$UI__reward->reward);?></td>    
							</tr>       
							
							<?php } ?>
						 
						</tbody>
					</table>
  				</div>
  			</div>



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

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