<?php
include"initialize_page.php";

?>
<!DOCTYPE html>
<html lang="en">

<head>
  
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

	<title> Funds Transfer</title>

	<!-- Bootstrap core CSS -->
	<link rel="stylesheet" href="assets/css/bootstrap/bootstrap.css" /> 

	<!-- datatables Styling  -->
    <link rel="stylesheet" href="assets/css/plugins/datatables/jquery.dataTables.css" />
    
    <!-- Fonts  -->
    <link href='http://fonts.googleapis.com/css?family=Raleway:400,500,600,700,300' rel='stylesheet' type='text/css'>
    
    <!-- Base Styling  -->
    <link rel="stylesheet" href="assets/css/app/app.v1.css" />

	<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
		
	<script type="text/javascript">
		
		  function canceltransictionxx(id)
		  {
				var r=confirm("Are you sure to Cancel??");
				if(r==true)
				{
				$.post("controller.php", {id:id, q:"cancel_transaction_byadmin"} , function(data)
				{
				window.location.href='<?php   echo website_settingdata('x_weburl');   ?>admin/fund-transfers.php?<?php  echo md5(rand(00000,99999));  ?>';  
				});



				}
		  }
	</script>
   	<script type="text/javascript">
		
		function approve_thisfund(id)
		 {
			  var r = confirm("Are you sure to Approve??");
			  if(r==true)
			  {
			  $.post("controller.php", {id:id, q:"approve_incommiung_fundtransfer"} , function(data)
			  {
				//alert(data); 
				if(data == "lessamount")
				{
					alert("User not have sufficient balance....")
				}
				
				alert("Successfully...");
				window.location.href='<?php   echo website_settingdata('x_weburl');   ?>admin/fund-transfers.php?e7270f0688527c3e73963bbe3fc86d9e';  
			  });
			  
				
			  }
		 }
	</script>
   
   
</head>
<body>
<?php include"xleftmenu.php"; ?>
    
    <section class="content">
    	
         <?php  include"xheader.php";  ?>
        <!-- Header Ends -->
        
        
        <div class="warper container-fluid">
        	
            <div class="page-header"><h1> Funds Transfer <?php //echo time();  ?></h1></div>
           
                <div class="panel panel-default">
                  
                     
                   
                    <div class="row">
                    <div class="col-md-12">
                    <div class="panel-body">
                   
<table class="table table-striped table-bordered" id="basic-datatable" width="100%">
        <thead>
            <tr>
                <th>Reference No</th>
                <th>Amount</th>
                <th>Type</th>
                <th>Date</th>
                <th>View</th>
                <th>Approve</th>
                <th>Cancel</th>
            </tr>
        </thead>
        <tbody>
                            
            <?php
			  $sr=1;
			  $data_q=mysqli_query($con,"SELECT a.x_id,a.x_amount,a.x_trtype,a.x_trdate, b.x_currencyid FROM x_fundtransfer a INNER JOIN x_anotheracc b ON a.x_accountid = b.x_id WHERE x_step='C' ORDER by x_id ASC");  
			  while($data_array=mysqli_fetch_array($data_q))
			   {
				   $currency_id = $data_array["x_currencyid"];
				   $amount = $data_array['x_amount'];
				   $amount = number_format($amount,2);
			?>
                <tr class="odd gradeX">
                  <td>#<?php echo str_pad($data_array["x_id"], 5, "0", STR_PAD_LEFT);  ?></td>  
                  <td><?php echo currency_data('x_currencysymbol',$currency_id);?><?php echo $amount;  ?></td> 
                  <td><?php echo $data_array['x_trtype'];  ?></td>
                  <td><?php echo $data_array['x_trdate'];  ?></td>
                  <td><a href="<?php   echo website_settingdata('x_weburl');?>admin/view_fundt.php?id=<?php echo $data_array['x_id'];  ?>&currencyid=<?php echo $currency_id?>&ss=<?php  echo md5(rand(00000,99999));  ?>"><button class="btn btn-primary" >View</button></a></td>
                  <td><button class="btn btn-primary" onClick="approve_thisfund(<?php echo $data_array['x_id'];  ?>)">Approve</button></td>
                  <td><button class="btn btn-danger" onClick="canceltransictionxx(<?php echo $data_array['x_id'];  ?>)" >Cancel</button></td>
                </tr>
			<?php
              $sr++;
              }
            ?>  
</tbody>
</table>

</div></div>
</div></div>
</div>
<!-- Warper Ends Here (working area) -->



<footer class="container-fluid footer">
Copyright &copy; <?php    echo date('Y');  ?>
</footer>



</section>
<!-- Content Block Ends Here (right box)-->



<!-- JQuery v1.9.1 -->
			<script src="assets/js/jquery/jquery-1.9.1.min.js" type="text/javascript"></script>
            
            <!-- Bootstrap -->
            <script src="assets/js/bootstrap/bootstrap.min.js"></script>
            
            <!-- NanoScroll -->
            <script src="assets/js/plugins/nicescroll/jquery.nicescroll.min.js"></script>
            
            
            <!-- Data Table -->
            <script src="assets/js/plugins/datatables/jquery.dataTables.js"></script>
            <script src="assets/js/plugins/datatables/DT_bootstrap.js"></script>
            <script src="assets/js/plugins/datatables/jquery.dataTables-conf.js"></script>
            
            
            <!-- Custom JQuery -->
            <script src="assets/js/app/custom.js" type="text/javascript"></script>
            
            
            
            <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
            
            ga('create', 'UA-56821827-1', 'auto');
            ga('send', 'pageview');
            
            </script>
</body>
</html>
