<?php

include("include/dbconnect.php");

extract($_REQUEST);




?>

<!DOCTYPE html>   
<html lang="en">   
<head>   
<meta charset="utf-8">   
<title>Example of Employee Table with twitter bootstrap</title>   
<meta name="description" content="Creating a Employee table with Twitter Bootstrap. Learn with example of a Employee Table with Twitter Bootstrap.">  
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">   
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css"></style>
<script type="text/javascript" src="http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</head>  
<body style="margin:20px auto">  
<div class="container">
<div class="row header" style="text-align:center;color:green">
<h3>Bootstrap Table With sorting,searching and paging using dataTable.js (Responsive)</h3>
</div>
  <form name="form1" action="new.php" method="POST">
					<div class="row">
<script type="text/javascript">



function validate()
{
	if(document.form1.fromdate.value=="")
	{
	alert("Enter the From Date");
	document.form1.fromdate.focus();
	return false;
	}
	if(document.form1.todate.value=="")
	{
	alert("Enter the To Date");
	document.form1.todate.focus();
	return false;
	}
	
	
return true;	
}	





</script>
				<div class="col-md-2">
                        <div class="form-group">
                           <label>From Date</label>
                        
                        </div>
                         </div>
                         
                         <div class="col-md-2">
                        <div class="form-group">
                          
                        <input class="form-control form-control-name" name="fromdate" id="fromdate" placeholder="YYYY-MM-DD" type="text" required>
                        </div>
                         </div>
                          <div class="col-md-2">
                        <div class="form-group">
                           <label>To Date</label>
                        
                        </div>
                         </div>
                         
                         <div class="col-md-2">
                        <div class="form-group">
                          
                        <input class="form-control form-control-name" name="todate" id="todate" placeholder="YYYY-MM-DD" type="text" required>
                        </div>
                         </div>
                         <!-- <div class="col-md-2">
                         <div class="text-left">
				  <input name="btn" type="submit"  class="btn btn-warning"  style="width:150px" id="btn" value="View">                     
                  </div>
                         </div>-->
                          <div class="col-md-2">
                         <div class="text-left">
				  <input name="exbtn" type="submit"  class="btn btn-primary" onclick="return validate()" style="width:100%;background-color:#f33155;" id="exbtn" value="Export">                     
                  </div>
                         </div>
						 </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="white-box">
                            <h3 class="box-title"></h3>
                    
                            <div class="table-responsive">
                                <table id="myTable" class="table table-striped table-bordered table-sm" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
										
										
                                            <th class="border-top-0">S.NO</th>
											<th class="border-top-0">Date</th>
											 <th class="border-top-0">Batch</th>
                                            <th class="border-top-0">Name</th>
                                            <th class="border-top-0">College Name</th>
                                            <th class="border-top-0">Contct No</th>
                                            <th class="border-top-0">Course</th>
											  <th class="border-top-0">Total </th>
											    <th class="border-top-0">Paid</th>
												 <th class="border-top-0">Balance</th>
												 
                                        </tr>
                                    </thead>
                                    <tbody>
									 <?php
									 if(isset($exbtn))
	 {
		  $date_field         = date('Y-m-d',strtotime($_POST['fromdate']));
      $todate_field         = date('Y-m-d',strtotime($_POST['todate']));
				$q1=mysql_query("select * from studenttbl where (date_format(str_to_date(rdate, '%d-%m-%Y'), '%Y-%m-%d')>='$date_field' and  date_format(str_to_date(rdate, '%d-%m-%Y'), '%Y-%m-%d')<='$todate_field') order by id desc");					 
	$i=0;
	while($r1=mysql_fetch_array($q1))
	{
	$i++;
	?>
                                        <tr>
										  
                                            <td><?php echo $i; ?></td>
											<td><?php echo $r1['rdate']; ?></td>
											<td><?php echo $r1['batchCode']; ?></td>
                                            <td><?php echo $r1['name']; ?></td>
                                            <td><?php echo $r1['collegeName']; ?></td>
                                            <td><?php echo $r1['contactNo']; ?></td>
                                            <td><?php echo $r1['courseName']; ?></td>
											<td><?php echo $r1['totalAmount']; ?></td>
                                            <td><?php echo $r1['paidAmount']; ?></td>
                                            <td><?php echo $r1['baalanceAmount']; ?></td>
											  
                                        </tr>
                                       
                                    </tbody>
									 <?php
	}
	 }
	?>
                                </table>
								   <script>
  
        // Initialize the DataTable
        $(document).ready(function () {
            $('#myTable').dataTable({
  
                // Enable the searching
                // of the DataTable
                searching: true
            });
        });
    </script>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- ============================================================== -->
                <!-- End PAge Content -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Right sidebar -->
                <!-- ============================================================== -->
                <!-- .right-sidebar -->
                <!-- ============================================================== -->
                <!-- End Right sidebar -->
                <!-- ============================================================== -->
				</form>
</body>  

</html>  
