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

<script>
var URL  = '<?php echo ROOTPATH;?>';  
function del_record(val)
{

    
	var r = confirm("Do you really want to delete record !");
	if (r == true) {    
	$.ajax({
	type: 'POST',
	    url: URL+"/admin/ajax/default.php",
	//async: false,			 
	data: {PayTrading: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> Trading Income Details</h3></div>
					
					<div align="right"> 
					        <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='tradingIncome.php';" /> 
					        <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Export " onClick="javascript:location.href='TradingIncomeEexport.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>By</th> 
    							<th>Name</th> 
    							<th>Auto Withdraw</th> 
    							<th>Received</th> 
    							<th>Bank</th> 
    							<th>Account</th> 
    							<th>IFSC</th> 
    							<th>Date</th>    
    							<th>Pay</th>  
							</tr>
						</thead>
						<tbody>
							<?php
                                    $stmt=$conn->prepare("select  * from UI__DailyROIGene  where Tdate=:Tdate");  
                                    $stmt->bindValue(':Tdate', $_REQUEST['date'] , 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);    
                                        
                                        
                                         
                                        $_SESSION['level-exportT'][$key]['sr'] =  $sr;
                                        $_SESSION['level-exportT'][$key]['Rid'] =  $users->Rid;
                                        $_SESSION['level-exportT'][$key]['nm'] =  $UI__Rgst->nm;
                                        $_SESSION['level-exportT'][$key]['Tamt'] =  $users->amount;
                                        $_SESSION['level-exportT'][$key]['Tamtx'] =  ($users->amount)-(($users->amount*10)/100);
                                        $_SESSION['level-exportT'][$key]['Bname'] =  $UI__Rgst->Bname;
                                        $_SESSION['level-exportT'][$key]['Bnumber'] =  $users->Bnumber;
                                        $_SESSION['level-exportT'][$key]['Bifsc'] =  $users->Bifsc;
                                        $_SESSION['level-exportT'][$key]['PaidDate'] =  $users->PaidDate;
                                        $_SESSION['level-exportT'][0]['FetchDate'] =  $_REQUEST['date']; 
                                        
                                        
							?>
							<tr class="odd gradeX">
								<td><?php echo $sr++;?> </td>
								<td><?php echo $users->custId;?> </td>
								<td><?php echo $UI__Rgst->nm;?> </td>
								<td><?php echo $users->amount;?> </td>
								<td><?php echo ($users->amount)-(($users->amount*10)/100);?> </td>
								<td><?php echo $UI__Rgst->Bname;?> </td>
								<td><?php echo $UI__Rgst->Bnumber;?> </td>
								<td><?php echo $UI__Rgst->Bifsc;?> </td>
								<td><?php echo $users->PaidDate;?> </td> 
								<td> 
								    <?php if($users->paidStatus==1) { ?>
								            Paid 
								    <?php }else { ?>  
								        <a href="javascript:void(0);" onclick="del_record(<?php echo $users->id;?>)">Pay Now</a>
								    <?php }?>
								</td> 
							</tr>  
							<?php } ?>
						</tbody>
					</table>
  				</div>
  			</div>   
		  </div>
		</div>
    </div> 
<?php  include ABS_PATH.'/admin/footer.php';	?>    