<?php 	include_once('../../config.php');   	
		include_once(ABS_PATH.'/admin/login_check.php');    
?>  
<?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>Customer History </h3></div>
					
					<div align="right">  <input type="button"    class="btn btn-warning" name="btnback" id="btnback" value=" BACK " onClick="javascript:location.href='registered_users.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>Time</th>  	  
								<th>Bid</th> 
								<th>Total Amount</th> 
								<th>Win</th>  
							</tr>
						</thead>
						<tbody>
							<?php
                                    $custId = $_REQUEST['cust_id'];
                                  
                                    $stmt=$conn->prepare("select  * from pw__RuningRecord where custId=:custId ");  
                                    $stmt->bindValue(':custId', $custId , PDO::PARAM_STR);
                                    $stmt->execute(); 
                                    $AllUsers = $stmt->fetchAll(PDO::FETCH_OBJ); 
                                    $sr = 1;
								  foreach($AllUsers as $users)
								  {   
							   
                                            $stmt=$conn->prepare("select  * from  pw__strln where Ttime=:Ttime ");  
                                            $stmt->bindValue(':Ttime',$users->Btime, PDO::PARAM_STR);
                                            $stmt->execute(); 
                                            $StatusR = $stmt->fetch(PDO::FETCH_OBJ); 
                                            
                                            $TT +=  $users->amt;
                                            
                                            if($StatusR->status==$users->bid_no)
                                                $tWIN += ($users->amt*10);
							?>
							<tr class="odd gradeX">
								<td><?php echo $sr++;?> </td>
								<td><?php echo $users->Btime;?></td>
								<td><?php echo $users->bid_no;?>  </td> 
								<td><?php echo $users->amt;?>  </td> 
								<td><?php if($StatusR->status==$users->bid_no) echo "Win : ".($users->amt*10); else echo 0; ?>  </td>  
							</tr>  
							<?php } ?>
							
							<tr class="odd gradeX">
								<td> <b>FINAL</b></td>
								<td>  <b>GRAND</b></td>
								<td>  <b>TOTAL</b></td> 
								<td><B><?php echo "Rs ".$TT;?></B>  </td> 
								<td><B><?php  echo "Rs ".$tWIN;?></B>  </td>  
							</tr>  
						</tbody>
					</table>
  				</div>
  			</div>



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

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