<?php 	
        include_once('../../config.php');   	
		include_once(ABS_PATH.'/admin/login_check.php');      
        include ABS_PATH.'/admin/header.php';	
        
        
        
        
        
                    
                    $access_token = ''; 
                    $ch = curl_init('https://grappay.com/api/telecom/v1/check-balance?api_token=RdVFLtRb83jLrxM5mafitjRW6Gp4zbfiwYXfhr6FEg6n3w4RQXfC9pNkhEMd');                                             
                    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");                                                                     
                    curl_setopt($ch, CURLOPT_POSTFIELDS, $access_token);                                                                  
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
                    curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
                    'x-tera-tenant-region: IN', 
                    'Content-Type: application/json', 
                    'Content-Length: ' . strlen($access_token))                                                                       
                    );       																		 
                    $response = curl_exec($ch); 
                    $json_response = json_decode($response);   
                   
        
        
?>


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

	
	$("#product_frm").validate({
		
		errorElement:'div',
		rules:{ 
			userid:{
				required:true				 
			} 
			
			
			
		},
		messages:{				
			 
			 city:{
				required:"Enter city name"				 
			} 
		}
	});


	});
 


</script>



<script> 
$(document).ready(function()
{   
  
	
	    var URL = "<?php echo ROOTPATH; ?>";    
        $( "#userid" ).change(function() 
        {      
                   
                     
          $.ajax({	
                type: "POST",
                url: URL+"/ajax/validation.php",
                data: {userDatacheck:1,Data:$("#userid").val()},
                beforeSend: function(){ 
                },
                success: function(data)
                    {        
                        $("#AvailbleId").html("<span style='color:green;'>"+data+" &#x2713</span>");
                    }
                });   
        });
        
         $( "#useridA" ).change(function() 
        {      
                
                     
          $.ajax({	
                type: "POST",
                url: URL+"/ajax/validation.php",
                data: {userDatacheck:1,Data:$("#useridA").val()},
                beforeSend: function(){ 
                },
                success: function(data)
                    {        
                        
                        $("#AvailbleIdA").html("<span style='color:green;'>"+data+" &#x2713</span>");
                    }
                });   
        });
 
 
}); 

</script>    

		 
		 <div class="col-md-10"> 
	  			<div class="row">
	  				<div class="col-md-12">
	  					<div class="content-box-large">
							<div class="panel-heading">
								<div class="panel-title"> <h3> IMPS/UPI PAYOUT LIST - 2 </h3></div>    
								
								<div class="panel-options">  
								   <a class="btn btn-warning" href="impspaidUserpay2.php"> Paid User List</a> 
								   <a class="btn btn-warning" href="#">Balance : <?php  echo "Balance: Rs ".$json_response->balance->normal_balance;?></a>
								</div>  
								
							</div> 
							
			  				<div class="panel-body">      
			  				<?php 
			  				    if($myIdset==0) 
			  				    {
			  				?>
			  				
	  				    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
						<thead>
							<tr> 
							
								<th>Sr</th>
								<th>UserID</th>  
								<th>User Name</th>  	   
								<th>Amount</th>  	   
								<th>Account Holder Name</th>  	   
								<th>Account No</th>  
								<th>IFSC</th>   
								<th>Date</th>   
								<th>Action</th>
								<th>Status</th>
								<th>Type</th>
								<th>Rejection</th>
								<th>Update</th>
								
							</tr>
						</thead>
						<tbody>
							<?php
							
                                $stmt=$conn->prepare("select  * from  UI__TxnFailUsersPay2 where impnft = 1  and status!=1  order by id desc");  
                                //$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  nm from   UI__Rgst where cuurentId=:cuurentId   ");  
                                    $stmt->bindValue(':cuurentId', $users->custId ,  PDO::PARAM_STR);
                                    $stmt->execute();  
                                    $NM = $stmt->fetch(PDO::FETCH_OBJ);     
                                                                               
							?>
							<tr class="odd gradeX">
								<td><?php echo $sr++;?> </td>
								<td><?php echo $users->custId;?></td>
								<td><?php echo $NM->nm;?>  </td>   
								<td><?php echo $users->amt;?>  </td>   
								<td><?php echo $users->holder;?></td>
								<td><?php echo $users->accno;?></td>
								<td><?php echo $users->ifsc;?>  </td>   
								<td><?php echo $users->Tdate;?>  </td>    
								<td> <a href="customPay.php?PyId=<?php echo $users->id;?>&type=3">Pay</a>   </td>   
								<td><?php if($users->status==0)  { ?>  Unpaid  <?php } else if($users->status==2) echo "Failed"; else   {   echo "Paid"; } ?>  </td>    
								<td><?php if($users->rtype==0) echo "Fresh";else echo "Refunded"; ?>  </td>    
								<td> <a href="rejectImps.php?PyId=<?php echo $users->id;?>&serKy=jspdfpofnpprimv00nF">Reject</a> </td>    
								<td> <a href="updateIMPS.php?PyId=<?php echo $users->id;?>">Update</a> </td>    
							</tr>  
							<?php } ?>
						</tbody>
					</table>
					
					
					        
					 
								
			  				</div>
			  			</div>
			  			
			  			
			  			
			  			
			  			 
			  			
			  			<?php  } ?> 
						
						
						
						
						 
			  			
						
			  			
	  				</div> 
	  			</div>    
	  		<!--  Page content -->
		  </div>
		  
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	
    unset($_SESSION['userpanadhar']);
?>    