<?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>Account Details</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 actiononuser(id,action1,accid,defaultvalue)
		             {
                        action=action1.value;
					   var r=confirm("Do you want to "+action+" this user??");
  if(r==true)
  { 
               if(action=="Inactive")
			     {
				action="N";	 
				 }
                  else if(action=="Active")
				  {
					action="Y";  
				  }
   $.post("controller.php", { id:id, q:"user_account_action", action:action ,accid:accid} , function(data)
  {
	window.location.href='<?php   echo website_settingdata('x_weburl');   ?>admin/view_user_accounts.php?id='+id;  
  });
  
  
  

		}
        else{
            if(defaultvalue=="N")
                 {
                defaultvalue="Inactive";  
                 }
                  else if(defaultvalue=="Y")
                  {
                    defaultvalue="Active";  
                  }
                  action1.value=defaultvalue;
        }	 
						 
		}
		
		</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>Account Details <?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>Sr.</th>
                <th>Account No</th>
                <th>Balance</th>
                <th>Account Type</th>
                <th>Status</th>
                <th>Statement</th>
            </tr>
        </thead>
        <tbody>  
                       <?php
						  $sr=1;
						  if(isset($_REQUEST['id'])&&$_REQUEST['id']!="")
						   {
							   $id = $_REQUEST['id'];
								$data_q = mysqli_query($con,"SELECT * FROM x_anotheracc WHERE x_userid='$id'");   
						   }
							   
		               	while($data_array=mysqli_fetch_array($data_q))
			             {
							  $currencyid = $data_array['x_currencyid'];
							  $total_balance = $data_array['x_totalbalance'];
							  $total_balance =  number_format($total_balance,2);
				
			          ?>
                <tr class="odd gradeX">
                <td><?php echo $sr; ?></td>
            
                <td><a href="<?php   echo website_settingdata('x_weburl');?>admin/credit-debit-to-account.php?accid=<?php echo $data_array['x_id'];  ?>&userid=<?php echo $data_array['x_userid'];?>"><?php echo $data_array['x_time'];  ?></a></td>
				 
                 <td> <?php echo $currency_bank = currency_data("x_currencysymbol",$currencyid);?> <?php echo  $total_balance ;?></td>
                  <td><?php echo $data_array['x_actype'];  ?></td>
                   
              
                <td>
                <select onchange="actiononuser('<?php echo $data_array['x_userid'];  ?>',this,'<?php echo $data_array['x_id'];  ?>','<?php echo $data_array['x_status'];  ?>')">
                    <option value="Active" <?php if($data_array['x_status']=="Y") { echo "selected"; }?>>Active</option>
                    <option value="Inactive" <?php if($data_array['x_status']=="N") { echo "selected"; }?>>Inactive</option>
                    <option value="Restricted" <?php if($data_array['x_status']=="Restricted") { echo "selected"; }?>>Restricted</option>
                    <option value="Dormant" <?php if($data_array['x_status']=="Dormant") { echo "selected"; }?>>Dormant</option>
                </select>
                    <?php if($data_array['x_status']!="Y" && $data_array['x_status']!="N" && $data_array['x_status']!="Restricted" && $data_array['x_status']!="Dormant")
                      {
                        echo "Deleted";  
                      }
                    ?>
                    <!-- <?php if($data_array['x_status']=="Y") { ?>  <button class="btn btn-green" onClick="actiononuser('<?php echo $data_array['x_userid'];  ?>','Inactive','<?php echo $data_array['x_id'];  ?>')">Active</button>
                
                <?php  } else {   
				  if($data_array['x_status']=="N")
				     {
						 ?>
			
            
            		<button class="btn btn-green" onClick="actiononuser('<?php echo $data_array['x_userid'];  ?>','Active','<?php echo $data_array['x_id'];  ?>')">Inactive</button>
			<?php		 }
				      else
					  {
						echo "Deleted";  
					  }
				  }  ?> --></td>
                
               <td><a href="<?php   echo website_settingdata('x_weburl');   ?>admin/account-statement.php?id=<?php echo $data_array['x_userid'];  ?>&ss=<?php  echo md5(rand(00000,99999));?>&accid=<?php echo $data_array['x_id']; ?>&currencyid=<?php echo $currencyid;?>"><button class="btn btn-primary">Statement</button></a></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>
