<?php 	
    include_once('../../config.php');   	
    include_once(ABS_PATH.'/admin/login_check.php');     
    
        
                                    
                                    if(isset($_POST['filterSub']))
                                    {          
                                    
                                    
                                    
                                    
                                    
                                    }
                                    
include ABS_PATH.'/admin/header.php';	        
?>  
        

<script>

    function DelteList(val)
    {
           
                    
                    var r = confirm("Do you really want to delete record !");
                    if (r == true) 
                    {    
                        $.ajax({
                        type: 'POST',
                        url: "../ajax/default.php",
                        //async: false,			 
                        data: {deleteTopup:1,val:val},	
                        success: function(ajaxresult){	     
                             
                            location.reload();	 	
                        },
                        error: function(XMLHttpRequest, textStatus, errorThrown) { 
                        alert('Error');
                        }
                        });
                    
                    }	  

              
    }
     
            
            function GetBalance(sr,Id)
            {
                
                    $.ajax({
                    type: 'POST',
                    url: "../../config.php",
                    //async: false,			 
                    data: {gtMybal:1,Id:Id,bYadmin:1},	  
                    success: function(ajaxresult)
                    {	      
                        $("#MyBal"+sr).html(ajaxresult);     
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) 
                    { 
                    
                            alert('Error');
                            
                    }
                    });
            
            }
	
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');
	}
	});
	
	}	  
	
}


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


$( document ).ready(function() 
{
    
   
    
    
    
    
     
});

var fruits = [];  
function ckkl(i)
    {
        
     
         $('#Chxk'+i).prop('checked', true); 
         fruits.push(i); 
         var  text = fruits.toString();    
         $("#idS").val(text);   
    }  
</script>
		 
		<div class="col-md-10">  
  			<div class="content-box-large">
  			    <form method="post" autocomplete="off"> 
  				<div class="panel-heading">
					<div class="panel-title"><h3> History List  </h3></div>
					
			          <div align="right">   
    					     
                            <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>
				
  				<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>Amount</th>  
								<th>Date</th>  
								<th>Type</th>   
								<th>Flow</th>  
								<th>Balance</th>  
								<th>By</th>  
							</tr>
						</thead>
						<tbody>
							<?php 
							
                                
                                
                                if(isset($_POST['dateselect']))   
                                    $_REQUEST['dt'] =  date("m-Y", strtotime($_POST['dateselect']));
                                
                                else
                                    $_REQUEST['dt'] =  date("m-Y");
                                    
                             
                                    
                                $originalDate = $_REQUEST['dt'];
                                $xpl = explode("-",$_REQUEST['dt']);  
                                
                                $monthNum  = $xpl[0];
                                $dateObj   = DateTime::createFromFormat('!m', $monthNum);
                                $monthName = $dateObj->format('M'); // March   
                                $date = $monthName."-".$xpl[1];
                                $stmt=$conn->prepare("select *   from  UI__DebitCredit  where custId =:userid and  Tdate like '%$date%' order by id desc   ");   
                                $stmt->bindValue(':userid',  $_REQUEST['cuurentId'] , PDO::PARAM_INT);  
                                $stmt->execute();  
                                $Result = $stmt->fetchAll(PDO::FETCH_OBJ);   
                                
                              
                                 $sr = 1;       
							  foreach($Result as $dmm)
							  {    
						           
							?>
							<tr class="odd gradeX">
                         
                                        <td><?php echo $sr++;?></td>
                                        <td <?php if($dmm->type==1) {?> style="color:green;" <?php } else {?> style="color:red;"<?php }?> >&#8377;<?php echo $dmm->addDel;?> </td>
                                        <td><?php echo $dmm->Tdate;?> </td>
                                        <td <?php if($dmm->type==1) {?> style="color:green;" <?php } else {?> style="color:red;"<?php }?> ><?php if($dmm->type==1) echo "Credit"; else echo "Debit";?></td> 
                                        <td><?php echo $dmm->Intype ?></td>
                                        <td> <?php echo  number_format((float)($dmm->availableBal), 2, '.', ''); ?></td>
                                        <td><?php echo $dmm->byw; ?></td> 
                                        
                                       
                                 </tr>
							<?php } ?>
						</tbody>
					</table>
  				</div>
  				
  				<input name="idS"   id="idS" type="hidden" /> 
  				</form>
  			</div>  
		  </div>
		  
		</div>
    </div>

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