<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>
<?php


if($_REQUEST['from']!=" " && $_REQUEST['from']!=NULL ) {
$from=date("Y-m-d",strtotime($_REQUEST['from']));  

}else {
$from=date("Y-m-01");  
}

if($_REQUEST['to']!=" " && $_REQUEST['to']!=NULL   ) {
$to=date("Y-m-d",strtotime($_REQUEST['to']));
}else {
$to=date("Y-m-t");  
} 


?>

<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>Opening Balances | EduPortal</title>
    <?php include('RootMe/css_links.php');?>
   
  </head>
  
<script type="text/javascript">



function getAccountLedger(str)
{
  //alert(str);

var from=document.getElementById("from").value;
var to=document.getElementById("to").value;


var ajx;  // The variable that makes Ajax possible!

if(window.XMLHttpRequest)
ajx=new XMLHttpRequest();
ajx.onreadystatechange = function()
{

if(ajx.readyState == 4)
{
//alert(ajx.responseText); 
document.getElementById("inActiveStudents").innerHTML= ajx.responseText;
document.getElementById("inActiveStudents").style.display="block";
document.getElementById("msg").style.display="none";

}
}
ajx.open("GET", "get_ledger_report_against_account.php?account="+str+"&from="+from+"&to="+to,true);
ajx.send(); 

}


</script>
  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
     
            <?php include('RootMe/sidebar.php');?>

              <?php include('RootMe/header.php');?>
     
        <!-- page content -->
          <div class="right_col" role="main">
          <div class="" style="background-color: white;">

      <a href="<?php echo $_SESSION['dashboard'];?>">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
    
         <a href="#">Ledger Reports </a> 

          <br><br>

            
    <section class="add_sub_agent" id="table_sub_agent">
  <div class="container">

 <div class="" style="margin-top:10px;">
     
      <div class="clearfix"></div>
    </div>


      
   
<div class="col-md-3 col-xs-12" style="padding: 8px;">
<div class="form-group ">
<label class="required">From Date</label>
<input name="from"  id="from" value="<?php echo $from;?>" type="date" class="form-control"  >
</div>
</div>


<div class="col-md-3 col-xs-12" style="padding: 8px;">
<div class="form-group ">
<label class="required">To Date</label>
<input name="to" id="to" value="<?php echo $to;?>" type="date" class="form-control"  >
</div>
</div>  


<div class="col-md-3 col-xs-12" style="padding: 8px;">
<div class="form-group ">
<label class="required">Accounts Name</label>
<select name="accountId" id="accountId" class="form-control" onChange="getAccountLedger(this.value)">

<option value="">Select Account</option>
<?php
$m->where("all_data", "ALL"); 
$secondLevel = $m->get("eduportal_chart_of_accounts");

foreach($secondLevel as $secondLevel_val)
{ ?>
<option <?php if($_REQUEST['subgroup']==$secondLevel_val['coa_id']){echo "selected";} ?> value="<?php echo $secondLevel_val['coa_id']; ?>"><?php echo trim(utf8_encode_all($secondLevel_val['account_title'])); ?></option>

<?php }   ?>
</select> 
</div>
</div>
  <br><br><br><br>
<div class="alert alert-danger" id="msg">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>Danger!</strong> Please choose Account Name for view records......
</div>

<div class="col-md-12" id="inActiveStudents" style="display: none;">

</div>



</div>

    <br><br>


  </div>
  <div class="clearfix"></div>
</section>

           
          </div>
        </div>

            </div>
          </div>
        </div>
        <!-- /page content -->
      
  <?php include('RootMe/js_linksscript.php');?>

  </body>
</html>
