<?php include('header_dashboard.php'); ?>
<?php include('session.php'); ?>
    <body id="home">
		<?php include('navbar_student.php'); ?>
        <div class="container-fluid">
            <div class="row-fluid">
				<?php include('student_sidebar.php'); ?>	
                   <div class="span9" id="content">
                      <div class="row-fluid">
					     <?php $query= mysql_query("select * from student where student_id = '$session_id'")or die(mysql_error());
						   $row = mysql_fetch_array($query);
						 ?>	
				         <div class="col-lg-12">
                          <div class="alert alert-success alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                             <img id="avatar1" class="img-responsive" src="<?php echo $row['thumbnail']; ?>"><strong> Welcome!</strong> <?php echo $student_row['Name'];  ?>
                          </div>
                        </div>
					   				
					  <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <div class="muted pull-left"><i class="icon-dashboard">&nbsp;</i>Pay Fees </div>
								<div class="muted pull-right"><i class="icon-time"></i>&nbsp;<?php include('time.php'); ?></div>
                            </div>
                            <div class="block-content collapse in">
							     <form id="login_form1" class="form-signin" method="post">
				<h3 class="form-signin-heading">
					<i class="icon-lock"></i> Please Enter Bank Name and Slip Number
				</h3>
				<input type="text"      class="input-block-level"   id="username" name="bank_name" placeholder="Bank Name" required>
				<input type="text"  class="input-block-level"   id="password" name="slip_number" placeholder="Bank Slip Number" required>
				
				<button data-placement="center" title="Click Here to send" id="signin" name="send" class="btn btn-info" type="submit"><i class="icon-signin icon-large"></i> Send</button>
				<script type="text/javascript">
				$(document).ready(function(){
				$('#signin').tooltip('show');
				$('#signin').tooltip('hide');
				});
				</script>		
			</form>
		<?php
		
//	include('../bcon.php');	
		
if (isset($_POST['send'])){
$bank_name = $_POST['bank_name'];
$slip_number = $_POST['slip_number'];
		

		
$query_bank = mysql_query("SELECT * FROM fees WHERE slip_number ='$slip_number' ")or die(mysql_error());

$count = mysql_num_rows($query_bank);

if ($count > 0){ ?>
<script>
alert('The Serial is Already used. Visit the bank and pay you fee');
</script>
<?php 
}else{
	mysql_query("INSERT INTO fees ( fee_paid,slip_number,bank_name,balance,regno) SELECT Amount,slip_number,bank_name,balance,regno FROM bank WHERE slip_number='$slip_number' AND slip_number !='' ")or die(mysql_error());
	
	mysql_query("insert into activity_log (date,username,action) values(NOW(),'$student_fullname','paid fees')")or die(mysql_error());
		
?>

<script>
window.location = "reciept.php";
$.jGrowl("Fees successfuly paid", { header: 'successful' });
</script>
<?php
}
}
?>							
</div>
	
</div>	

</div>

 </body>
</html>