<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> !-->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
    
    
    
<script>
$(document).ready(function(){
  $("#myInput").on("keyup", function() {
    var value = $(this).val().toLowerCase();
    $("#myTable tr").filter(function() {
      $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
    });
  });
});
</script>

 <script>
$(document).ready(function(){
  $("#myInput2").on("keyup", function() {
    var value = $(this).val().toLowerCase();
    $("#myTable2 tr").filter(function() {
      $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
    });
  });
});
</script>
<?php
//echo "<pre>";print_r($_SERVER);exit;
	//echo "<pre>";
	if(isset($_GET['roll_no'])){
				$i=0;
				$where="";
			if(isset($_GET["section"]) && $_GET["section"]!="")$where=" and section='".$_GET["section"]."'";
			$student=$db->getRows("select name,idno,fname from student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and issue_TC=0 and class='".$_GET["class"]."' $where order by name");
			//print_r($student);
			foreach($student as $stu){$i++;

				$reffarray=array('fincome'=>$i);

				$inup1=$db->updateAry("student",$reffarray," where session='".$_SESSION["admin"]["session"]."' and idno=".$stu["idno"]."");
			}
				$_SESSION['msg']="Roll No of class : ".$_GET['class']." generated successfully..!";

	 }
	 
	 if(isset($_POST['update_student_installment'])){
	     $allStudent = $_POST[idno];
	     foreach($allStudent as $stu){

	         $saveAry=array(
	                        "i1"=>$_POST[i1.$stu],
                            "i2"=>$_POST[i2.$stu],
                            "i3"=>$_POST[i3.$stu],
                            "i4"=>$_POST[i4.$stu],
                            "i5"=>$_POST[i5.$stu],
                            "i6"=>$_POST[i6.$stu],
                            "i7"=>$_POST[i7.$stu],
                            "i8"=>$_POST[i8.$stu],
                            "i9"=>$_POST[i9.$stu],
                            "i10"=>$_POST[i10.$stu],
                            "i11"=>$_POST[i11.$stu],
                            "i12"=>$_POST[i12.$stu],
        					);
 
          $flgInstall=$db->updateAry("installment",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu."'");
	     }
	     
	      if(!is_null($flgInstall))
 		{
 			$_SESSION['msg']='update Successfully';
 		}

	 }


	 if(isset($_POST['submit_admissionno'])){
				$i=0;
				$where="";
				//print_r($_POST[idno]); echo '<br>';
				//print_r($_POST[root]);die;
			if(isset($_GET["section"]) && $_GET["section"]!="")$where=" and section='".$_GET["section"]."'";
			$student=$db->getRows("select name,idno,fname from student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and issue_TC=0 and class='".$_GET["class"]."' $where order by name");
						
			//print_r($student);
			foreach($student as $stu){
						
			$admmno= $_POST[root][$i];
			if($admmno!=''){
			$idno1=$_POST[idno][$i];
				$reffarray=array('admissionno'=>$admmno);
						
				$inup1=$db->updateAry("student",$reffarray," where session='".$_SESSION["admin"]["session"]."' and idno=".$idno1."");
	 }
	 $i++;
	 }
				$_SESSION['msg']="Roll No of class : ".$_GET['class']." generated successfully..!";

	 }
	 
	 
if(isset($_POST["busroot"])){
	if(is_array($_POST["idno"]) && count($_POST["idno"])>0)
	
$resulr1=$_POST["root"];
$dataBus=array();
foreach($resulr1 as $x => $x_value) {
	
	if($_POST["root"][$x]=='0')
	{
	$saveAry=array("bus"=>'',


					);    
	    
	}
	else
	{
$saveAry=array("bus"=>$_POST["root"][$x],


					);
	}				
$flgUp=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'");

//echo $ss="student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'";
$busDetail=$db->getRow("select fee,installment from bus where school_id='".$_SESSION["admin"]["school_id"]."' and id='".$_POST["root"][$x]."'");
//echo $s="select fee,installment from bus where school_id='".$_SESSION["admin"]["school_id"]."' and id='".$_POST["root"][$x]."'";
 $totalFee=$busDetail["fee"];
 $installment=$busDetail["installment"];
$perFee=$totalFee/$installment;
if($totalFee>0 && $installment>0)
		{
for($ii=1;$ii<=$installment;$ii++)
				{
					
$dataBus["b".$ii]=number_format($perFee, 2, '.', '');;
$flgInstall=$db->updateAry("installment",$dataBus,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."'");

				}

$bustotal=array("bus"=>$totalFee,

					);	
$flgUp=$db->updateAry("installment",$bustotal,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'");
		}
//echo $ss="installment",$bustotal,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'";
	
}
if(!is_null($flgUp))
		{
			
			$_SESSION['msg']='update Successfully';
		}
}	 

if(isset($_POST["submihostel"])){

if(is_array($_POST["idno"]) && count($_POST["idno"])>0)
	
$resulr1=array_filter($_POST["root"]);
$dataBus=array();
foreach($resulr1 as $x => $x_value) {
	
	
$saveAry=array("hostel"=>$_POST["root"][$x],

					);			
$flgUp=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'");

//echo $ss="student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'";
$busDetail=$db->getRow("select fee,installment from hostel where school_id='".$_SESSION["admin"]["school_id"]."' and id='".$_POST["root"][$x]."'");
//echo $s="select fee,installment from bus where school_id='".$_SESSION["admin"]["school_id"]."' and id='".$_POST["root"][$x]."'";
 $totalFee=$busDetail["fee"];
 $installment=$busDetail["installment"];
$perFee=$totalFee/$installment;
if($totalFee>0 && $installment>0)
		{
for($ii=1;$ii<=$installment;$ii++)
				{
$dataBus["idno"]=$_POST["idno"][$x];
$dataBus["class"]=$_GET['class'];
$dataBus["session"]=$_SESSION["admin"]["session"];
$dataBus["hid"]=$_POST["root"][$x];
$dataBus["total"]=$totalFee;					
$dataBus["i".$ii]=number_format($perFee, 2, '.', '');
$dataBus["school_id"]=$_SESSION["admin"]["school_id"];
$dataBus["added_by"]=$_SESSION["admin"]["school_id"];
$dataBus["status"]=1;

	}
 $checkRoomHostel=$db->getVal("select idno from hostelinstallment where idno='".$_POST["idno"][$x]."' and  school_id='".$_SESSION["admin"]["school_id"]."'");
	if($checkRoomHostel>0)
	{		
$flgInstall=$db->updateAry("hostelinstallment",$dataBus,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."'");
	
	}
	else{
		
		$dataBus["discount"]=0;
	$flgInstall=$db->insertAry("hostelinstallment",$dataBus);
	}


$bustotal=array("hostel"=>$totalFee,
);			}

}
if(!is_null($flgUp))
		{
			
			$_SESSION['msg']='update Successfully';
		}
}	



if(isset($_POST["submit_roolno"])){

if(is_array($_POST["idno"]) && count($_POST["idno"])>0)
	
$resulr1=array_filter($_POST["root"]);
$dataBus=array();
foreach($resulr1 as $x => $x_value) {
	
	
$saveAry=array("fincome"=>$_POST["root"][$x],

					);			
$flgUp=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'");

//echo $ss="student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'";



}
if(!is_null($flgUp))
		{
			
			$_SESSION['msg']='update Successfully';
		}
}



if(isset($_POST["update_busroot"])){

if(is_array($_POST["idno"]) && count($_POST["idno"])>0)
$resulr1=$_POST["location"];
$dataBus=array($resulr1);

foreach($resulr1 as $x => $x_value) {

$saveAry=array(
                "location"=>$_POST["location"][$x],
                "old_school"=>$_POST["old_school"][$x]
					);
$flgUp=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."' and session='".$_SESSION["admin"]["session"]."'");

}
 if(!is_null($flgUp))
 		{
 			$_SESSION['msg']='update Successfully';
 		}
}



if(isset($_POST["inactive_students"])){

    foreach($_POST["idno"] as $i){
        if($_POST["sidno$i"]){
            $saveAry=array("status"=>3);
        } else {
            $saveAry=array("status"=>1);
        }

        $flgUp = $db->updateAry("student",$saveAry,"where idno='$i' and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."'");
    }
    
    if(!is_null($flgUp))
	{
		$_SESSION['msg']='update Successfully';
	}

}

if(isset($_POST["blocked_students"])){

    foreach($_POST["idno"] as $i){
        if($_POST["sidno$i"]){
            $saveAry=array("is_blocked"=>1);
        } else {
            $saveAry=array("is_blocked"=>0);
        }

        $flgUp = $db->updateAry("student",$saveAry,"where idno='$i' and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."'");
    }
    
    if(!is_null($flgUp))
	{
		$_SESSION['msg']='update Successfully';
	}

}



if(isset($_POST["back_dues_amount"])){

if(is_array($_POST["idno"]) && count($_POST["idno"])>0)
	
$resulr1=array_filter($_POST["dues"],'is_numeric');
$dataBus=array();

foreach($resulr1 as $x => $x_value) {
	

$saveAry=array("fee"=>$_POST["dues"][$x],
               "month"=>$_POST["root"][$x]
               

			);	
$student_id=$db->getVal("SELECT id FROM otherfee_structure WHERE school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and name='Back_dues' and otype='".$_POST["idno"][$x]."'");
$student_name=$db->getVal("SELECT name FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."'  and idno='".$_POST["idno"][$x]."'");
$student_class=$db->getVal("SELECT class FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."'   and idno='".$_POST["idno"][$x]."'");

  if($student_id)
  {


$flgUp=$db->updateAry("otherfee_structure",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and otype='".$_POST["idno"][$x]."' and name='Back_dues' and session='".$_SESSION["admin"]["session"]."'");

  
  }

else
{
  $saveinsert=array(
          "name"=>'Back_dues',
          "class"=>$student_class,
          "medium"=>'NULL',
          "fee"=>$_POST["dues"][$x],
          "otype"=>$_POST["idno"][$x],
          "month"=>$_POST["root"][$x],
          "school_id"=>$_SESSION["admin"]["school_id"],
          "session"=>$_SESSION["admin"]["session"],
          "added_by"=>1,
			);	  
    
$flgInstall=$db->insertAry("otherfee_structure",$saveinsert);   
   

}


}

if(!is_null($flgUp))
		{
			
			$_SESSION['msg']='update Successfully';
		}
}


if(isset($_POST['update_stu_info']))
{

    $resulr1=$_POST['idno'];

foreach($resulr1 as $x => $x_value) {
	

$saveAry=array("name"=>$_POST["name"][$x],
               "fname"=>$_POST["fname"][$x],
               "mname"=>$_POST["mname"][$x],
               "section"=>$_POST["section"][$x],
               "dob"=>$_POST["dob"][$x],
               "mobile"=>$_POST["mobile"][$x],
               "address"=>$_POST["address"][$x],
               "medium"=>$_POST["medium"][$x]
			);	
		
$flgUp=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST['idno'][$x]."' and session='".$_SESSION["admin"]["session"]."'");


    
}
    
}


if(isset($_POST['update_photos']))
{

    $resulr1=$_POST['idno'];
//print_r($resulr1);

foreach($resulr1 as $x => $x_value) {
	     $base_name= $_FILES['photo']['name'][$x];


     $lfilename = basename($base_name);
		 $lext = strtolower(substr($lfilename, strrpos($lfilename, '.')+1));
		 $lnewfile=md5(microtime()).".".$lext;
		if(move_uploaded_file($_FILES['photo']['tmp_name'][$x],"media/photo/".$lnewfile))
		
		{
		   
		$_POST["photo"]=$lnewfile;
		
		$saveAry=array("photo"=>$lnewfile,
              
			);	
//	print_r($saveAry);	
$flgUp=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST['idno'][$x]."' and session='".$_SESSION["admin"]["session"]."'");


		}
		
//	print_r($_POST["photo"]);
//echo $_FILES['photo']['name'][$x];

    
}
    
}



if(isset($_POST['update_install']))
{


//$resulr1=array_filter($_POST["dues"],'is_numeric'); 
   
    
    $no_inst=count($_POST['install']);
   
    $resulr1=$_POST['ins_amt'];

foreach($resulr1 as $x => $x_value) {
	

 $totalFee=$_POST["ins_amt"][$x];
 
 $installment=$no_inst;
 
$perFee=$totalFee/$installment;

if($totalFee>0 && $installment>0)
		{
	    
for($ii=0;$ii<=$installment;$ii++)
				{
 $inst=$_POST['install'][$ii];
 $datains[$inst]=number_format($perFee, 2, '.', '');;
 $datains["total"]=$totalFee;

$saveAry=array("feducation"=>$_POST["s_code"][$x]
              
			);	
//$flgInstall=$db->updateAry("installment",$datains,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."'");
 //echo $ss="installment",$datains,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST["idno"][$x]."'";
 
 $sql="UPDATE installment SET ".$_POST['install'][$ii]."=".$datains[$inst].",total='$totalFee' WHERE idno='".$_POST["idno"][$x]."'";

	 $db->query($sql);
	 
$flgUp=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST['idno'][$x]."' and session='".$_SESSION["admin"]["session"]."'");
	 
				}
		}
    
}
    
}




if(isset($_POST["sibling"])){


   $resulr1=$_POST['idno'];
//print_r($_POST['root']);
foreach($resulr1 as $x => $x_value) {
	

$saveAry=array("sibling"=>$_POST["root"][$x],
              );	
	
$flgUp=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_POST['idno'][$x]."' and session='".$_SESSION["admin"]["session"]."'");


$flgUp2=$db->updateAry("student",$saveAry,"where school_id='".$_SESSION["admin"]["school_id"]."' and sibling_id='".$_POST['root'][$x]."' and session='".$_SESSION["admin"]["session"]."'");

}



 if(!is_null($flgUp))
 		{
 			$_SESSION['msg']='update Successfully';
 		}
}


if(isset($_GET['sib_id']))
{
    


$aryList=$db->getRows("select idno from student where sibling_id='0' ORDER BY idno");
	//print_r($aryList);echo "total-".count($aryList);
	
	if(is_array($aryList) && count($aryList)>0)
	{	$i=$db->getVal("SELECT max(sibling_id) FROM student");
		foreach($aryList as $idList){$i++;
		  $reffarray=array('sibling_id'=>$i);
									//print_r($reffarray);
									$inup1=$db->updateAry("student",$reffarray," where idno=".$idList["idno"]." "
									);		
			}
	}
	
if(!is_null($inup1))
 		{
 			$_SESSION['msg']='update Successfully';
 		}	

}	 
?>

<style>.top-bar-minimize{display:none;}
thead, tfoot {display: table-header-group;}
.top-bar+.well,.accordion .accordion-heading+.accordion-body{display: inline-block !important;width: 100% !important;overflow: inherit !important;} 
</style>
<?php
$pgMod="roll_no";
$pgAct="view";

if(isset($_SESSION['msg']) && $_SESSION['msg']!="")
{
	?>
	<div class="alert alert-success">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-thumbs-up-alt"></i> <b>Notice</b><?php echo $_SESSION['msg'] ?></i>
	</div>
	<?php
	unset($_SESSION["msg"]);
}
if(is_array($alert_err) && count($alert_err)>0)
{
	?>
	<div class="alert alert-error">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>Notice</b> <?php echo $alert_err[0] ?></i>
	</div>
	<?php
}
	?>
    <form method="get" action="">
        <input type="hidden" name="src" value="Student" />
    <input type="hidden" name="page_id" value="<?php echo $pgMod; ?>" />
	<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Search Student Record</h3>
                    <div>
                         <button type="submit" name="update_photo" class="btn btn-primary"> Photo</button>
                         <button type="submit" name="update_installment" class="btn btn-primary">Update Installment</button>
                        <button type="submit" name="update_info" class="btn btn-primary">Update Student</button>
                        <button type="submit" name="update_root" class="btn btn-primary">Update Bus Root</button>
                        <button type="submit" name="back_dues1" class="btn btn-primary">Back Dues</button>
					    <button type="submit" name="rollno" class="btn btn-primary">Roll No</button>
						
						<button type="submit" name="admission_no" class="btn btn-primary">admission_no</button>
						
						<!--<button type="submit" name="back_dues" class="btn btn-primary">Back Dues</button>!-->
						
                    	<button type="submit" name="hostel" class="btn btn-primary">Hostel</button>
						<button type="submit" name="busroot" class="btn btn-primary"> Save Root</button>
						<button type="submit" name="roll_no" class="btn btn-primary">Generate Roll No</button>
						<button type="submit" name="student_installment" class="btn btn-primary">Student Installment</button>
						<button type="submit" name="sibling" class="btn btn-primary">Sibling update</button>
						<button type="submit" name="sibling_list" class="btn btn-primary">Sibling List</button>
						
						<button type="submit" name="inactive_list" class="btn btn-primary">Inactive Students</button>
						<button type="submit" name="blocked_list" class="btn btn-primary">Blocked Students</button>


					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
                        
                        <div class="control-group span4">
                            <label class="control-label" for="class">Class</label>
                            <div class="controls">
                                <select name="class" id="class">
                                    <option value="">Class</option>
                                    <?php 
                                        $class=$db->getRows("select * from class where school_id='".$_SESSION["admin"]["school_id"]."' ");
                                        foreach($class as $cla){
                                            ?>
                                            <option <?php if($cla["class"]==$_GET["class"])echo 'selected';?> value="<?php echo $cla["class"] ?>">
                                                <?php echo $cla["class"] ?>
                                            </option>
                                            <?php
                                        }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="control-group span4">
                            <label class="control-label" for="class">Section</label>
                            <div class="controls">
                         <select name="section" id="section" >
                <option value="">Section</option>
                <?php 
                    $class=$db->getRows("select * from section where school_id='".$_SESSION["admin"]["school_id"]."'");
                    foreach($class as $cla){
                        ?>
                        <option <?php if($cla["name"]==$_GET["section"])echo 'selected';?> value="<?php echo $cla["name"] ?>">
                            <?php echo $cla["name"] ?>
                        </option>
                        <?php
            
                    }
                ?>
            </select>
                            </div>
                        </div>
                       
                    </div>
                    <br>
				</div>
				<!-- / Forms: Content -->
			</div>
    </div>
    </form>
	<?php
	$where=array();
	$qry="";
		if(isset($_GET["busroot"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submit" name="busroot" class="btn btn-primary"> Save Root</button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		/*if(isset($_GET["medium"]) && $_GET["medium"]!="")
			$whereC[]=" medium='".$_GET["medium"]."' ";
		*/	
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		//$allcriteria=$db->getRows("select * from criteria where type='".$_GET["criteria"]."' and school_id='".$_SESSION["admin"]["school_id"]."'");
		//echo $ss="select * from criteria where type='".$_GET["criteria"]."' and school_id='".$_SESSION["admin"]["school_id"]."'";
		//echo $db->getLastQuery();
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			    <thead>
			<tr>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>Address</td><td>Bus Root</td>
       
            </tr>
            </thead>
            <tbody id="myTable">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
						<td><?php echo $stu["address"]; ?></td>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                    <?php
		        // $aryinstall=$db->getRow("SELECT bp1,bp2,bp3,bp4,bp5,bp6,bp7,bp8,bp9,bp10,bp11,bp12 FROM installment WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
				 
				$aryInstall=$db->getRow("select * from installment where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."' and session='".$_SESSION["admin"]["session"]."'");
				//echo $ss="select * from installment where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."' and session='".$_SESSION["admin"]["session"]."'";

				$totalbuspayfee=0;
				for($ii=1;$ii<=12;$ii++){
							
							$iip="bp".$ii;
							
								$totalbuspayfee+=$aryInstall[$iip];
								
							}
 $totalbuspayfee;  
						$aryForm=$db->getRow("SELECT bus FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");

						$class=$db->getRows("select * from bus where  school_id='".$_SESSION["admin"]["school_id"]."'");
							?>
							
						<?php if(empty($totalbuspayfee))
							{ ?>						
							<td><?php //echo $db->getLastQuery(); ?>
                            <select name="root[]">
                            	<option value="0">Select Grade</option>
                            	<?php if(is_array($class) && count($class)>0){
									foreach($class as $cla){
										?><option <?php if($cla["id"]==$aryForm["bus"])echo 'selected'; ?> value="<?php echo $cla["id"] ?>"><?php echo $cla["root"] ?></option><?php
									}
								}?>
                            </select>
                                                       
                            </td>
						<?php } 
						else
						{?>
						<td><?php //echo $db->getLastQuery(); ?>
                            <select name="root[]">
                            	
                            	<?php if(is_array($class) && count($class)>0){
									foreach($class as $cla){
										?><option <?php if($cla["id"]==$aryForm["bus"])echo 'selected';  ?>disabled value="<?php echo $cla["id"] ?>"><?php echo $cla["root"] ?></option><?php
									}
								}?>
                            </select>
                                                       
                            </td>	
							
					<?php	}
						
						?>
                </tr>
				<?php
			}
			?></tbody></table><?php
		}
		?></div></div></div></div></form><?php
	}
	// admisssion no start

		if(isset($_GET["admission_no"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submihostel" name="submit_admissionno" class="btn btn-primary"> Save Admission no </button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
				<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			    <thead>
			<tr>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>Admission No</td>
            </tr>
            </thead>
            <tbody id="myTable">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<?php 
					$aryForm=$db->getRow("SELECT admissionno FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                <td>
				
							
							<div class="controls">
								<input type="text" id="rollno" name="root[]" class="input-block-level" value="<?php echo $aryForm["admissionno"]; ?>" >
							</div>
				</td>
                </tr>
				<?php
			}
			?></tbody></table><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}
	
	// admission no end
	
	// back dues start
	
		if(isset($_GET["back_dues"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submihostel" name="submit_admissionno" class="btn btn-primary"> Save Admission no </button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			<tr>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>Admission No</td>
       
            </tr>
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<?php 
					$aryForm=$db->getRow("SELECT admissionno FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                <td>
				
							
							<div class="controls">
								<input type="text" id="rollno" name="root[]" class="input-block-level" value="<?php echo $aryForm["admissionno"]; ?>" >
							</div>
				</td>
                </tr>
				<?php
			}
			?></table><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}


		if(isset($_GET["update_info"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submihostel" name="update_stu_info" class="btn btn-primary"> Save </button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="container">
		<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table table-bordered table-striped">
			     
			 <thead>
			<tr>
            <th>SNo.</th>
            <th></th>
            <th>Student name</th>
            <th>Father Name</th>
            <th>Mother Name</th>
            <th>Section</th>
            <th>DOA</th>
            <th>Dob</th>
            <th>Mobile</th>
            <th>Address</th>
            <th>House</th>
            </tr>
             </thead>
              <tbody id="myTable">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
                	
                <td>
                	    
                           <div class="controls">
						  <input type="text" id="name" name="name[]" class="input-block-level" value="<?php echo $stu["name"]; ?>" >
							</div> 	    
                	    
                	</td>
					<td><div class="controls">
						  <input type="text" id="fname" name="fname[]" class="input-block-level" value="<?php echo $stu["fname"]; ?>" >
							</div> </td>
					<?php 
					$aryForm=$db->getRow("SELECT * FROM otherfee_structure WHERE school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and name='Back_dues' and otype='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                
            
                    <td>
                           <div class="controls">
						  <input type="text" id="mname" name="mname[]" class="input-block-level" value="<?php echo $stu["mname"]; ?>" >
							</div>        
                                                       
                    </td>
                    
                    <td>
                           <div class="controls">
                               
            <select name="section[]" id="section" class="input-block-level">
                <option value="">Section</option>
                <?php 
                    $class=$db->getRows("select * from section where school_id='".$_SESSION["admin"]["school_id"]."'");
                    foreach($class as $cla){
                        ?>
                        <option <?php if($cla["name"]==$stu["section"])echo 'selected';?> value="<?php echo $cla["name"] ?>">
                            <?php echo $cla["name"] ?>
                        </option>
                        <?php
            
                    }
                ?>
            </select>
                               
						  <!--<input type="text" id="section" name="section[]" class="input-block-level" value="<?php echo $stu["section"]; ?>" >-->
							</div>        
                                                       
                    </td>
                
                <td>
                    <div class="controls">
						<input type="date" id="doa" name="doa[]" class="input-block-level" style="width:135px;" value="<?php echo $stu["doa"]; ?>" >
						</div> 
                </td>
                
                <td>
				
						<div class="controls">	
						
						<input type="date" id="dob" name="dob[]" class="input-block-level" style="width:135px;" value="<?php echo $stu["dob"]; ?>" >
						</div> 	
						</td>
						<td>
			            <div class="controls">
						<input type="text" id="mobile" name="mobile[]" class="input-block-level" value="<?php echo $stu["mobile"]; ?>" >
						</div> 	
			 	    </td>
			 	    
    			 	<td>
			            <div class="controls">
    						<input type="text" id="address" name="address[]" class="input-block-level" value="<?php echo $stu["address"]; ?>" >
						</div>
			 	    </td>

        		 	<td>
			            <div class="controls">
							<select name="medium[]" id="medium">
							    <option value="">--Select House--</option>
							    <?php $house = $db->getRows("SELECT * FROM house "); 
							        foreach($house as $clist){ ?>
								    <option <?php if($clist['name']==$stu["medium"])echo 'selected';?> value="<?php echo $clist['name']; ?>" style="color:<?php echo $clist['color']; ?>;"><?php echo $clist['name']; ?></option>
                                <?php } ?>
							</select>
						</div>
			 	    </td>

			 	    
                </tr>
				<?php
			}
			?></table> </tbody><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}
	

	if(isset($_GET["update_photo"])){
		?><form method="post" action="" enctype="multipart/form-data">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submihostel" name="update_photos" class="btn btn-primary"> Save Roll No</button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		/*if(isset($_GET["medium"]) && $_GET["medium"]!="")
			$whereC[]=" medium='".$_GET["medium"]."' ";
		*/	
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		//$allcriteria=$db->getRows("select * from criteria where type='".$_GET["criteria"]."' and school_id='".$_SESSION["admin"]["school_id"]."'");
		//echo $ss="select * from criteria where type='".$_GET["criteria"]."' and school_id='".$_SESSION["admin"]["school_id"]."'";
		//echo $db->getLastQuery();
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			<tr>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>photo</td>
       
            </tr>
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<?php 
					$aryForm=$db->getRow("SELECT feducation FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                <td>
				
							
							<div class="controls">
								<input type="file" id="photo" name="photo[]" class="input-block-level" value="<?php echo $aryForm["photo"]; ?>" >
							</div>
				</td>
				
				<td>
				
							
							<div class="controls">
							<img src="media/photo/<?php echo $stu["photo"]; ?>" height="42" width="42" />
							</div>
				</td>
                </tr>
				<?php
			}
			?></table><?php
		}
		?></div></div></div></div></form><?php
	}
	
	if(isset($_GET["update_installment"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="update_installmen" name="update_install" class="btn btn-primary">Save </button>
					</div>
				</div>
			
                                   
					installment1<input type="checkbox" name="install[]" value="i1"> installment2<input type="checkbox" name="install[]" value="i2">installment3<input type="checkbox" name="install[]" value="i3">installment4<input type="checkbox" name="install[]" value="i4">
				    installment5<input type="checkbox" name="install[]" value="i5">installment6<input type="checkbox" name="install[]" value="i6">installment7<input type="checkbox" name="install[]" value="i7">installment8<input type="checkbox" name="install[]" value="i8">
				    installment9<input type="checkbox" name="install[]" value="i9">installment10<input type="checkbox" name="install[]" value="i10">installment11<input type="checkbox" name="install[]" value="i11">installment12<input type="checkbox" name="install[]" value="i12">
					 </div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		
		<?php
	
		
         $cls1=$db->getVal("SELECT GROUP_CONCAT('''',class,'''') FROM class");		
		
		$allstudent=$db->getRows("select * from student where  school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."'  and status=1 and issue_TC=0 ORDER BY FIELD(class,$cls1)");
		

		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			<tr>
            <td>SNo.</td><td>Student name</td><td>Father Name</td><td>class</td><td>Amount</td><td>s code</td>
       
            </tr>
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
             	    <td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<td><?php echo $stu["class"]; ?></td>
					<?php 
					$aryForm=$db->getRow("SELECT * FROM otherfee_structure WHERE school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and name='Back_dues' and otype='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                
            
                    <td>
                           <div class="controls">
						  <input type="text" id="ins_amt" name="ins_amt[]" class="input-block-level" value="<?php echo $stu["ins_amt"]; ?>" >
							</div>        
                                                       
                    </td>
              
			 	    <td>
                           <div class="controls">
						  <input type="text" id="s_code" name="s_code[]" class="input-block-level" value="<?php echo $stu["s_code"]; ?>" >
							</div>        
                                                       
                    </td>
                </tr>
				<?php
			}
			?></table><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}
	
	
	if(isset($_GET["inactive_list"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Inactive students</h3>
                    <div>
						<button type="submihostel" name="inactive_students" class="btn btn-primary"> Save </button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>		
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0  order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			    <thead>
			<tr>
            <td></td>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>Admission No.</td><td>Roll No.</td>
            </tr>
            </thead>
			<tbody  id="myTable">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>

				<tr>
				    <td>
    					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
				        <input type="checkbox" name="sidno<?php echo $stu['idno']; ?>" <?php if($stu['status']=='3')echo "checked"; ?> /> 
			        </td>
                	<td><?php echo $i; ?></td>
                	<td>
                	 <div class="controls"><?php echo $stu["name"]; ?>
					</div>
					<td>
        				 <div class="controls"><?php echo $stu["fname"]; ?>
						</div>
					</td>
					<td>
                        <div class="controls"><?php echo $stu["admissionno"]; ?>
						</div>
					</td>
					<td>
                        <div class="controls"><?php echo $stu["fincome"]; ?>
					</div>
					</td>

                </tr>
				<?php
			}
			?> </tbody> </table><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}

	if(isset($_GET["blocked_list"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Blocked students</h3>
                    <div>
						<button type="submihostel" name="blocked_students" class="btn btn-primary"> Save </button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0  order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			    <thead>
			<tr>
            <td></td>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>Admission No.</td><td>Roll No.</td>
            </tr>
            </thead>
			<tbody  id="myTable">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>

				<tr>
				    <td>
    					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
				        <input type="checkbox" name="sidno<?php echo $stu['idno']; ?>" <?php if($stu['is_blocked']=='1')echo "checked"; ?> /> 
			        </td>
                	<td><?php echo $i; ?></td>
                	<td>
                	 <div class="controls"><?php echo $stu["name"]; ?>
					</div>
					<td>
        				 <div class="controls"><?php echo $stu["fname"]; ?>
						</div>
					</td>
					<td>
                        <div class="controls"><?php echo $stu["admissionno"]; ?>
						</div>
					</td>
					<td>
                        <div class="controls"><?php echo $stu["fincome"]; ?>
					</div>
					</td>

                </tr>
				<?php
			}
			?> </tbody> </table><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}
	
	
	if(isset($_GET["back_dues1"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submihostel" name="back_dues_amount" class="btn btn-primary"> Save Back Dues</button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>		
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			    <thead>
			<tr>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>Admission No.</td><td>Roll No.</td><td>Month</td><td>Back Dues</td>
       
            </tr>
            </thead>
            				<tbody  id="myTable">
			<?php $i=0;
			
			foreach($allstudent as $stu){ $i++;
				?>

				<tr>
                	<td><?php echo $i; ?></td>
                	<td>
                	 <div class="controls"><?php echo $stu["name"]; ?>
						  <!--<input type="text" id="name" name="name[]" class="input-block-level" value="<?php echo $stu["name"]; ?>" readonly >-->
					</div>    
                	    
					<td>
				 <div class="controls"><?php echo $stu["fname"]; ?>
						  <!--<input type="text" id="fanme" name="fname[]" class="input-block-level" value="<?php echo $stu["fname"]; ?>" readonly >-->
							</div>	    
					    
					</td>
					
										<td>
				 <div class="controls"><?php echo $stu["admissionno"]; ?>
						  <!--<input type="text" id="fanme" name="admissionno[]" class="input-block-level" value="<?php echo $stu["admissionno"]; ?>" readonly >-->
							</div>	    
					    
					</td>
											<td>
				 <div class="controls"><?php echo $stu["fincome"]; ?>
						  <!--<input type="text" id="fanme" name="admissionno[]" class="input-block-level" value="<?php echo $stu["admissionno"]; ?>" readonly >-->
							</div>	    
					    
					</td>
					<?php 
					$aryForm=$db->getRow("SELECT * FROM otherfee_structure WHERE school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and name='Back_dues' and otype='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                
                
                <td>
                            <select name="root[]" >
                            	<option value="">Select Month</option>
                            
						
										<option <?php if($aryForm["month"]=='1')echo 'selected'; 'color: red;'  ?>  value="1">Apr</option>
										<option <?php if($aryForm["month"]=='2')echo 'selected'; ?> value="2">May</option>
										<option <?php if($aryForm["month"]=='3')echo 'selected'; ?> value="3">Jun</option>
										<option <?php if($aryForm["month"]=='4')echo 'selected'; ?>  value="4">Jul</option>
										<option <?php if($aryForm["month"]=='5')echo 'selected'; ?> value="5">Aug</option>
										<option <?php if($aryForm["month"]=='6')echo 'selected'; ?>  value="6">Sep</option>
										<option <?php if($aryForm["month"]=='7')echo 'selected'; ?> value="7">Oct</option>
										<option <?php if($aryForm["month"]=='8')echo 'selected'; ?> value="8">Nov</option>
										<option <?php if($aryForm["month"]=='9')echo 'selected'; ?>  value="9">Dec</option>
										<option <?php if($aryForm["month"]=='10')echo 'selected'; ?> value="10">Jan</option>
										<option <?php if($aryForm["month"]=='11')echo 'selected'; ?> value="11">Feb</option>
										<option <?php if($aryForm["month"]=='12')echo 'selected'; ?>  value="12">Mar</option>
									
							
                            </select>
                                                       
                            </td>
                
                <td>
				
							
							<div class="controls">
						<input type="text" id="rollno" name="dues[]" class="input-block-level" value="<?php echo $aryForm["fee"]; ?>" >
							</div>
				</td>
                </tr>
				<?php
			}
			?> </tbody> </table><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}	
	
	
	
		
if(isset($_GET["update_root"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submihostel" name="update_busroot" class="btn btn-primary"> Save</button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table table-bordered table-striped">
			    <thead> 
			<tr>
            <td>SNo.</td>
            <td>Student</td>
            <td>Father Name</td>
             <td>Address</td>
            <!--<td>Bus root</td> !-->
            <td>Location</td>
            <td>Driver</td>
            </tr>
            </thead>
            <tbody id="myTable">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
						<td><?php echo $stu["address"]; ?></td>
					
					<?php 
				
					$ary_bus=$db->getVal("SELECT bus FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."'  and idno='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />


            <?php
                $class=$db->getRows("select * from bus where  school_id='".$_SESSION["admin"]["school_id"]."'");
            ?>
                <!--<td>
                    <select name="root[]">
                    	<option value="">Select Bus</option>
                    	<?php if(is_array($class) && count($class)>0){
							foreach($class as $cla){
								?><option <?php if($cla["id"]==$ary_bus)echo 'selected'; ?>  value="<?php echo $cla["id"] ?>"><?php echo $cla["root"] ?></option><?php
							}
						} ?>
                    </select>
                </td>  !-->
               
               <?php
                	$locations=$db->getRows("select * from location where school_id='".$_SESSION["admin"]["school_id"]."'");
                	?>
               <td>
                    <select name="location[]">
                    	<option value="">Select Bus</option>
                    	<?php if(is_array($locations) && count($locations)>0){
							foreach($locations as $loc){
								?><option <?php if($loc["id"]==$stu["location"])echo 'selected'; ?>  value="<?php echo $loc["id"] ?>"><?php echo $loc["name"] ?></option><?php
							}
						} ?>
                    </select>
                </td>
                
                
                <?php
                	$drivers=$db->getRows("select * from bus_detail where school_id='".$_SESSION["admin"]["school_id"]."'");
                	?>
               <td>
                    <select name="old_school[]">
                    	<option value="">Select Bus</option>
                    	<?php if(is_array($drivers) && count($drivers)>0){
							foreach($drivers as $driver){
								?><option <?php if($driver["id"]==$stu["old_school"])echo 'selected'; ?>  value="<?php echo $driver["id"] ?>"><?php echo $driver["name"] ?></option><?php
							}
						} ?>
                    </select>
                </td>

				<!--<td>-->
				<!--    <select name="old_school[]">-->
    <!--                	<option value="">none</option>-->
						<?php /*
							$location=$db->getRows("select * from bus_detail where school_id='".$_SESSION["admin"]["school_id"]."'");
							if(is_array($location) && count($location)>0){
								foreach($location as $loc){
									?>
									<option <?php if($loc["id"]==$stu["old_school"])echo 'selected';?> value="<?php echo $loc["id"] ?>">
										<?php echo $loc["name"] ?>
									</option>
									<?php
								}
							}*/
						?>
				<!--	</select>-->
				<!--</td>-->

                </tr>
				<?php
			}
			?></tbody></table><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}
	
			
if(isset($_GET["sibling"])){
		?><div  >
<form method="get" action="" style="width:50%; float:left">
    <input type="hidden" name="src" value="Student" />
	    <input type="hidden" name="page_id" value="<?php echo $pgMod; ?>" />
           <input type="hidden" name="sibling" value="" />

           <input type="hidden" name="sib" value="" />

            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
                       <button type="submit_r" name="sib_id" class="btn btn-primary">Generate sibling ID</button> 

						<button type="submit_roolno" name="sib" class="btn btn-primary">Detail</button> 

					</div>
					
					
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
                        
                         <table><tr> <td>
                            <label class="control-label" for="class">Class</label>
                                <select name="class" id="class">
                                    <option value="">Class</option>
                                    <?php 
                                        $class=$db->getRows("select * from class where school_id='".$_SESSION["admin"]["school_id"]."' ");
                                        foreach($class as $cla){
                                            ?>
                                            <option <?php if($cla["class"]==$_GET["class"])echo 'selected';?> value="<?php echo $cla["class"] ?>">
                                                <?php echo $cla["class"] ?>
                                            </option>
                                            <?php
                                        }
                                    ?>
                                </select>
</td><td>
                       
                            <label class="control-label" for="class">Section</label>
                            
                         <select name="section" id="section" >
                <option value="">Section</option>
                <?php 
                    $class=$db->getRows("select * from section where school_id='".$_SESSION["admin"]["school_id"]."'");
                    foreach($class as $cla){
                        ?>
                        <option <?php if($cla["name"]==$_GET["section"])echo 'selected';?> value="<?php echo $cla["name"] ?>">
                            <?php echo $cla["name"] ?>
                        </option>
                        <?php
            
                    }
                ?>
            </select>
                           </td></tr></table>
                        		<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>

                    <?php	if(isset($_GET["sib"])){
	   	?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
         
				<div class="well no-padding">
                
		<?php
		$whereC=array();
					$conwhere="";

		if(isset($_GET["class"]) && $_GET["class"]!="")
		{
			$whereC[]=" class='".$_GET["class"]."' ";
		$conwhere.=" and class='".$_GET["class"]."' ";
		}

		if(isset($_GET["section"]) && $_GET["section"]!="")
		{
			$whereC[]=" section='".$_GET["section"]."' ";
		$conwhere.=" and section='".$_GET["section"]."' ";
		}

		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
			
		//	echo  $ss="select * from student  where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' $conwhere and issue_TC=0 and status=1 order by name ";
		
		$allstudent=$db->getRows("select * from student  where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' $conwhere and issue_TC=0 and status=1 order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			    <thead>
			<tr>
            <td>SNo.</td><td>sibling ID</td><td>Student</td><td>Father Name</td><td>class</td>
            </tr>
            </thead>
            <tbody id="myTable">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                		<td><?php echo $stu["sibling_id"]; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<td><?php echo $stu["class"]; ?></td>

					<?php 
					$aryForm=$db->getRow("SELECT admissionno FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="id[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
              
                </tr>
				<?php
			}
			?></tbody></table><?php
		}
		?></div></div></div></div></form>
		
		<?php } ?>
            </table>
            </form>   
                    </div>
                    <br>
				</div>
	
            <form method="post" action="" style="width:50%; float:right; margin-top:-20px;">
	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submit_roolno" name="sib2" class="btn btn-primary">Detail</button>  
						
					 <button type="submit_roolno" name="sibling" class="btn btn-primary">SAVE</button>  


					</div>
					
					
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
                        
                     <table><tr> <td>
                            <label class="control-label" for="class">Class</label>
                            
                                <select name="class" id="class">
                                    <option value="">Class</option>
                                    <?php 
                                        $class=$db->getRows("select * from class where school_id='".$_SESSION["admin"]["school_id"]."' ");
                                        foreach($class as $cla){
                                            ?>
                                            <option <?php if($cla["class"]==$_POST["class"])echo 'selected';?> value="<?php echo $cla["class"] ?>">
                                                <?php echo $cla["class"] ?>
                                            </option>
                                            <?php
                                        }
                                    ?>
                                </select>
                           
                       </td>
                           <td> <label class="control-label" for="class">Section</label>

                         <select name="section" id="section" >
                <option value="">Section</option>
                <?php 
                    $class=$db->getRows("select * from section where school_id='".$_SESSION["admin"]["school_id"]."'");
                    foreach($class as $cla){
                        ?>
                        <option <?php if($cla["name"]==$_POST["section"])echo 'selected';?> value="<?php echo $cla["name"] ?>">
                            <?php echo $cla["name"] ?>
                        </option>
                        <?php
            
                    }
                ?>
            </select>
                            </td></tr></table>
                        		<center><input class="form-control" id="myInput2" type="text" placeholder="Search.."></center>

                    <?php	if(isset($_POST["sib2"])){
	   	?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
         
				<div class="well no-padding">
                
		<?php
		$whereC=array();
		$conwhere="";

		if(isset($_POST["class"]) && $_POST["class"]!="")
		{
			$whereC[]=" class='".$_POST["class"]."' ";
			$conwhere.=" and class='".$_POST["class"]."' ";
		}

		
		if(isset($_POST["section"]) && $_POST["section"]!="")
		{
			$whereC[]=" section='".$_POST["section"]."' ";
			$conwhere.=" and section='".$_POST["section"]."' ";
		}

		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student  where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' $conwhere and issue_TC=0 and status=1 order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			    <thead>
			<tr>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>class</td><td>sibling ID</td>
            </tr>
            </thead>
            <tbody id="myTable2">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<td><?php echo $stu["class"]; ?></td>

					<?php 
					$aryForm=$db->getRow("SELECT admissionno FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                <td>
				
							
							<div class="controls">
								<input type="text" id="root" name="root[]" class="input-block-level" value="<?php echo $stu["sibling"]; ?>" >
							</div>
				</td>
                </tr>
				<?php
			}
			?></tbody></table><?php
		}
		?></div></div></div></div></form>
		
		<?php } ?>
            </table>
            </form>   
                    
	
</div><?php
	}	
	
	// back dues end
	
	if(isset($_GET["hostel"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submit_roolno" name="submihostel" class="btn btn-primary"> Save Hostel</button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		/*if(isset($_GET["medium"]) && $_GET["medium"]!="")
			$whereC[]=" medium='".$_GET["medium"]."' ";
		*/	
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		//$allcriteria=$db->getRows("select * from criteria where type='".$_GET["criteria"]."' and school_id='".$_SESSION["admin"]["school_id"]."'");
		//echo $ss="select * from criteria where type='".$_GET["criteria"]."' and school_id='".$_SESSION["admin"]["school_id"]."'";
		//echo $db->getLastQuery();
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			<tr>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>Hostel</td>
       
            </tr>
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                    <?php
		        // $aryinstall=$db->getRow("SELECT bp1,bp2,bp3,bp4,bp5,bp6,bp7,bp8,bp9,bp10,bp11,bp12 FROM installment WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
				 
				$aryInstall=$db->getRow("select * from hostelinstallment where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."' and session='".$_SESSION["admin"]["session"]."'");
				//echo $ss="select * from installment where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."' and session='".$_SESSION["admin"]["session"]."'";

				$totalbuspayfee=0;
				for($ii=1;$ii<=12;$ii++){
							
							$iip="ip".$ii;
							
								$totalbuspayfee+=$aryInstall[$iip];
								
							}
 $totalbuspayfee;  
						$aryForm=$db->getRow("SELECT hid FROM hostelinstallment WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
						
						//echo $ss="SELECT idno FROM hostelinstallment WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'";

						$hostel=$db->getRows("select * from hostel where  school_id='".$_SESSION["admin"]["school_id"]."'");
							?>
							
						<?php if(empty($totalbuspayfee))
							{ ?>						
							<td><?php //echo $db->getLastQuery(); ?>
                            <select name="root[]">
                            	<option value="">Select Grade</option>
                            	<?php if(is_array($hostel) && count($hostel)>0){
									foreach($hostel as $hos){
										?><option <?php if($hos["id"]==$aryForm["hid"])echo 'selected'; ?> value="<?php echo $hos["id"] ?>"><?php echo $hos["name"] ?></option><?php
									}
								}?>
                            </select>
                                                       
                            </td>
						<?php } 
						else
						{?>
						<td><?php //echo $db->getLastQuery(); ?>
                            <select name="root[]">
                            	
                            	<?php if(is_array($hostel) && count($hostel)>0){
									foreach($hostel as $hos){
										?><option <?php if($hos["id"]==$aryForm["hid"])echo 'selected';  ?>disabled value=""><?php echo $hos["name"] ?></option><?php
									}
								}?>
                            </select>
                                                       
                            </td>	
							
					<?php	}
						
						?>
                </tr>
                
				<?php
			}
			?></table><?php
		}
		?></div></div></div></div></form><?php
	}
	
		if(isset($_GET["sibling_list"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
				<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>
		<?php
		
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			    <thead>
			<tr>
            <td>SNo.</td><td>Student</td><td>father name</td><td>sibling</td>
            
            </tr>
            </thead>
            <tbody id="myTable">
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
	//	echo "select name,class from student where sibling='".$stu["sibling"]."' ";
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
                    <td><?php echo $stu["fname"]; ?></td>
				<td><?php  
				
			$detail=$db->getRows("select name,class from student where sibling='".$stu["sibling_id"]."' ");
				if(is_array($detail) && count($detail)>0){
				foreach($detail as $val) {   
				
			echo	$val['name']."(".$val['class']."),";
				
				} }
			else
			{
			
			$detail=$db->getRows("select name,class from student where sibling_id='".$stu["sibling"]."' ");
				if(is_array($detail) && count($detail)>0){
				foreach($detail as $val) {   
				
			echo	$val['name']."(".$val['class']."),";
				
				} }	
			    
			}
				
				
				?></td>

                </tr>
				<?php
			}
			?></tbody></table><?php
		}
		?></div></div></div></div></form>
		
		<?php
	}
	
	if(isset($_GET["rollno"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="submihostel" name="submit_roolno" class="btn btn-primary"> Save Roll No</button>
					</div>
				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
		
		<?php
		$whereC=array();
		if(isset($_GET["class"]) && $_GET["class"]!="")
			$whereC[]=" class='".$_GET["class"]."' ";
		/*if(isset($_GET["medium"]) && $_GET["medium"]!="")
			$whereC[]=" medium='".$_GET["medium"]."' ";
		*/	
		if(isset($_GET["section"]) && $_GET["section"]!="")
			$whereC[]=" section='".$_GET["section"]."' ";
		$whereM="";
		if(is_array($whereC) && count($whereC)>0)
			$whereM=" where ".implode(" and ",$whereC);
		
		$allstudent=$db->getRows("select * from student $whereM and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0 and status=1 order by name ");
		//$allcriteria=$db->getRows("select * from criteria where type='".$_GET["criteria"]."' and school_id='".$_SESSION["admin"]["school_id"]."'");
		//echo $ss="select * from criteria where type='".$_GET["criteria"]."' and school_id='".$_SESSION["admin"]["school_id"]."'";
		//echo $db->getLastQuery();
		if(is_array($allstudent) && count($allstudent)>0){
			?><table class="table">
			<tr>
            <td>SNo.</td><td>Student</td><td>Father Name</td><td>Roll No</td>
       
            </tr>
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<?php 
					$aryForm=$db->getRow("SELECT feducation FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />
                <td>
				
							
							<div class="controls">
								<input type="text" id="rollno" name="root[]" class="input-block-level" value="<?php echo $stu["fincome"]; ?>" >
							</div>
				</td>
                </tr>
				<?php
			}
			?></table><?php
		}
		?></div></div></div></div></form><?php
	}
	
	
	
	if(isset($_GET["student_installment"])){
		?><form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Add Result of students</h3>
                    <div>
						<button type="update_installmen" name="update_student_installment" class="btn btn-primary">Save </button>
					</div>
				</div>

					 </div>
				<div class="well no-padding">
                	<div class="controls controls-row" >
                	    
                	    <div style="overflow-x:scroll;width:100%;">

		<?php
         $cls1=$db->getVal("SELECT GROUP_CONCAT('''',class,'''') FROM class");
         
         $where = " session='".$_SESSION["admin"]["session"]."' ";
         
         if($_GET["class"]!=""){
             $where .= " and class='".$_GET["class"]."' ";
         }
         
          if($_GET["section"]!=""){
             $where .= " and section='".$_GET["section"]."' ";
         }

		$allstudent=$db->getRows("select * from student where $where and school_id='".$_SESSION["admin"]["school_id"]."'  and status=1 and issue_TC=0 ORDER BY FIELD(class,$cls1)");

		if(is_array($allstudent) && count($allstudent)>0){
			?>
			
			<table class="table" >
			<tr>
            <td>SNo.</td><td>Student name</td><td>Father Name</td><td>class</td><td>Install 1</td><td>Install 2</td>
            <td>Install 3</td><td>Install 4</td><td>Install 5</td><td>Install 6</td><td>Install 7</td>
            <td>Install 8</td><td>Install 9</td><td>Install 10</td><td>Install 11</td><td>Install 12</td>
            </tr>
			<?php $i=0;
			foreach($allstudent as $stu){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
             	    <td><?php echo $stu["name"]; ?></td>
					<td><?php echo $stu["fname"]; ?></td>
					<td><?php echo $stu["class"]; ?></td>
					<?php 
					//echo $stu[idno];
					$aryForm=$db->getRow("SELECT * FROM installment WHERE school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and idno='".$stu["idno"]."'");
                     ?>
					<input type="hidden" name="idno[]" required  value="<?php echo $stu["idno"] ?>" readonly="readonly" />

                    <td>
                       <div class="controls">
						  <input type="text" name="i1<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i1"]; ?>" style="width:80px;">
						</div>
                    </td>
              
			 	    <td>
                       <div class="controls">
						  <input type="text" name="i2<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i2"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i3<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i3"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i4<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i4"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i5<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i5"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i6<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i6"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i7<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i7"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i8<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i8"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i9<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i9"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i10<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i10"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i11<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i11"]; ?>" style="width:80px;">
						</div>
                    </td>
                    
                    <td>
                       <div class="controls">
						  <input type="text" name="i12<?php echo $stu["idno"] ?>" class="input-block-level" value="<?php echo $aryForm["i12"]; ?>" style="width:80px;">
						</div>
                    </td>

                </tr>
				<?php
			}
			?></table><?php
		}
		?>
		</div>
		</div></div></div></div></form>
		
		<?php
	}?>
</body>
</html>	
<script type="text/javascript">
// Material Select Initialization
$(document).ready(function() {
$('.mdb-select').materialSelect();
});
    
    
    
    function filterRecord(){
 alert();
 var classname = document.getElementById("class").value;
 var subject = document.getElementById("mySelect1").value;
 var subsubject = document.getElementById("subSubjectid").value;  
 var chapter = document.getElementById("chapter").value;   

  document.getElementById('filterdata').innerHTML = 'hee';

   // $.post( "Notice/ajax.php", { type: "filterRecord" ,classname: classname ,subject: subject ,subsubject: subsubject , chapter: chapter} , function( data ) {
//alert(data);
  //document.getElementById('filterdata').innerHTML = data;
  //  });
}

	//$(document).ready(function() {
    //$('#example').DataTable();
//} );

    </script>