<?php 	
    include_once('../../config.php');   	
    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>Daily Deposite </h3></div>
					
					<!--div align="right">  <input type="button"    class="btn btn-warning" name="btnback" id="btnback" value=" Add New User " onClick="javascript:location.href='#';" />
					</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>Date</th>   
								<th>Total Topup</th>    
								<th>Total Credit</th>    
							</tr>
						</thead>
						<tbody>
							<?php
							
							
							        
							        
							        $stmt=$conn->prepare("select  Tdate from  UI__DailyROIGene  group by Tdate ");
                                    //$stmt->bindValue(':Ttime', $InTime , PDO::PARAM_STR);
                                    $stmt->execute(); 
                                    $UI__DailyROIGene = $stmt->fetchAll(PDO::FETCH_OBJ);
                                    
                                    foreach($UI__DailyROIGene as $K=>$mpp)
                                    { 
                                         
                                        $dp = '%'.$mpp->Tdate.'%'; 
                                        $stmt=$conn->prepare("select  * from  UI__DebitCredit  where Tdate like '".$dp."'  and (type=1)");  
                                        //$stmt->bindValue(':Ttime', $InTime , PDO::PARAM_STR);
                                        $stmt->execute(); 
                                        $AllUsers = $stmt->fetchAll(PDO::FETCH_OBJ); 
                                         
                                        
                                        $dpBal = 0;
                                        foreach($AllUsers as $pp)
                                            $dpBal +=$pp->addDel;
                                        
                                        $stmt=$conn->prepare("select  * from  UI__DebitCredit  where Tdate like '".$dp."'  and (type=3)");  
                                        //$stmt->bindValue(':Ttime', $InTime , PDO::PARAM_STR);
                                        $stmt->execute(); 
                                        $AllUsers = $stmt->fetchAll(PDO::FETCH_OBJ); 
                                        $tpVal = 0;
                                        foreach($AllUsers as $pp) {
                                            $dpBal +=$pp->addDel;
                                            $tpVal +=$pp->addDel;
                                        }
                                        
                                        $ary[$K]['Tdate'] = $mpp->Tdate; 
                                        $ary[$K]['TpVal'] = $tpVal;
                                        $ary[$K]['Bal'] = $dpBal;
                                    }
                                    
                                     
                                    
                                    
                                    $sr = 1;
								  foreach($ary as $users)
								  {       
                                            
							?>
							<tr class="odd gradeX">
								<td><?php echo $sr++;?> </td>   
								<td><?php echo $users['Tdate'];?></td> 
								<td><?php echo $users['TpVal'];?></td> 
								<td><?php echo $users['Bal'];?></td> 
								 
								
							</tr>  
							<?php } ?>
						</tbody>
					</table>
  				</div>
  			</div>



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

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