<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;} 
.barn{/*border-right: 3px solid #000;  height: 100%;  position: relative;*/}
.barn{border-right: 3px solid #000;  height: 100%;  position: absolute; left:0; height:20px;}
.progress.progress-mini {position: relative;}
</style>
<script type="text/javascript">
function findStudent(t){
	var cls=$("#class").val();
	var section=$("#section").val();
	$.post( "ExamCBSE/ajax.php", { type: "findStudent" ,cls: cls, section: section } , function( data ) {
	  	$("#findStudent").html(data);
	});
}
</script>
<?php
$pgMod="junior_finalmarksheet";
$pgAct="view";
if(isset($_GET['action']) && trim($_GET['action'])!='')
		$pgAct=strtolower($_GET['action']);
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
}?><div class="well no-padding">
    <form method="get" action="">
    <input type="hidden" name="src" value="ExamCBSE" />
    <input type="hidden" name="page_id" value="<?php echo $pgMod; ?>" />
    <input type="hidden" name="term" value="<?php echo $_GET["term"]; ?>" />
    
	<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
                <h3><i class="icon-cog"></i>Exam Report Section  </h3>
				</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 onchange="findStudent()" 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="section">Section</label>
                            <div class="controls" id="Section-div">
                                <select name="section" onchange="findStudent()" id="section">
                                    <option value="">Section</option>
                                    <?php 
                                        $section=$db->getRows("select * from section where school_id='".$_SESSION["admin"]["school_id"]."' ");
                                        foreach($section 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 class="control-group span4">
                        <label class="control-label" for="section">Student</label>
                            <div class="controls span3" id="findStudent">
                              <select  name="idno" id="idno">
                               <option value="">All Student</option>
                              </select>
                            </div>
         			   </div> 
                       
                    </div>
                    <div class="controls controls-row">
                     <div class="control-group span12">
                        	<input type="submit" value="Get Result" name="result" class="btn-classic">
                            <input type="submit" value="Get Grade" name="grade" class="btn-classic">
                            <input type="submit" value="Get Sheet" name="sheet" class="btn-classic">
                             <?php if($_GET["term"]=="final"){
								?><input type="submit" value="Get Performance" name="performance" class="btn-classic"><?php
							}elseif($_GET["term"]=="term1"){
								?><input type="submit" value="Term1 Performance" name="performance_term1" class="btn-classic"><?php
							}elseif($_GET["term"]=="term2"){
								?><input type="submit" value="Term2 Performance" name="performance_term2" class="btn-classic"><?php
							}?>
                            <button type="button" style="float:right" name="fee" onClick="printDivNoHeader('printableDiv')" class="btn btn-primary"> Print</button>
                        </div>
                        </div>
                    <br>
				</div>
                
				<!-- / Forms: Content -->

			</div>
    </div>
    </form>
	</div>
 <div id="printableDiv">
<?php
if(isset($_GET['class']) && trim($_GET['class']) !='' && isset($_GET['result']))
{
	$subjects=$db->getRows("select * from subject where class='".$_GET["class"]."'");
	$where="";
	if(isset($_GET["section"]) && $_GET["section"]!="")$where=" and section='".$_GET["section"]."'";
	$student=$db->getRows("select name,idno from student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and class='".$_GET["class"]."' $where order by name");
	if(is_array($student) && count($student)>0){
		$slidt=array();$Finalava=0;$FinalobtainNow=0; 
		foreach($student as $ss)$slidt[]=$ss["idno"]
		?>
         
          <div class="headPrint hide" style="border: none;">
        	  <div style="text-align:center;"> <h1 style="font-size:45px;margin:5px 0px 0px 0px;color: #EC1E1E;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h1>  </div> 
               <div style="height:73px;width:100%;background: #F1E3E3;color: #0743D2;font-weight: 800;">
                  <ul style="padding-right: 10px;width:100%;">
                  <li style="float:left;width:66%"> MM : Indicates maximum marks</li>
                  <li style="float:left;width:34%">Class : <?php echo $_GET['class']; if(isset($_GET["section"]) && $_GET["section"]!="") echo "-".$_GET['section']; ?></li>
                  <li style="float:left;width:65%">Att : Indicates Attendance</li>
                 
                  <li style="float:left;width:33%;padding-left:10px;">Term : <?php echo $_GET["term"]." , ".$_SESSION["admin"]["session"]; ?></li>
                  <li style="float:left;width:10%"><div class='leftpoint'>&nbsp;</div><i style="margin-left:5px;">Lowest</i></li>
                  <li style="float:left;width:10%"><div class='midpoint'>&nbsp;</div><i style="margin-left:5px;">Average</i></li>
                  <li style="float:left;width:34%"><div class='rightpoint'>&nbsp;</div><i style="margin-left:5px;">Highest</i></li>
                 
                  <li style="float:left;width:41%;text-align:center;">No of working days : <?php if($_GET['term']=="term1")echo $LinksDetails['term1_all_day'];elseif($_GET['term']=="term2")echo $LinksDetails['term2_all_day'];elseif($_GET['term']=="final")echo $LinksDetails['overallday'];  ?></li>
                  </ul>
          
     		 	</div>
      	   </div>
      <!--<div style="width:100%;background:#999;color:#000;">
          <ul style="width:100%;">
          <li style="float:left;">MM  Indicates maximum marks</li>
          <li style="float:right;">Class : <?php echo $_GET['class']; ?></li>
          <li style="float:left;">Att  Indicates Attendance</li>
          <li style="float:right;">Term : Final, <?php echo $_SESSION["admin"]["session"] ?></li>
          <li style="float:right;">No of working days : 111</li>
          </ul>
          <div>
            <div class='leftpoint'>&nbsp;</div><div class='rightpoint'>&nbsp;</div><div class='midpoint'>&nbsp;</div>
          </div>
      </div>-->
        <table class="table">
		<thead class="table_head">
        	<tr>
                <th style="font-weight: 800;vertical-align:middle;border: 2px solid #FF0E1F;"><span class='tmark'>STUDENT</span>
               <!-- <span class="mini">Roll no</span>-->
                <span class="maxi">Att</span>
                </th>
                <?php 
				foreach($subjects as $sub){
					echo "<th style='font-weight: 800;border: 2px solid #FF0E1F;'><span class='tmark'>".ucwords($sub["subject"])."</span>";
					$sumall="";
				 	if($_GET["term"]=="final"){ $sumall=$db->getVal("select SUM(obtain) from exammarks where subject='".$sub["subject"]."' and type in ('FA1','FA2','SA1','SA2','FA3','FA4') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")"); }
					elseif($_GET["term"]=="term1"){ $sumall=$db->getVal("select SUM(obtain) from exammarks where subject='".$sub["subject"]."' and type in ('FA1','FA2','SA1') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")"); }
					elseif($_GET["term"]=="term2"){ $sumall=$db->getVal("select SUM(obtain) from exammarks where subject='".$sub["subject"]."' and type in ('SA2','FA3','FA4') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")"); }
					$obtainNow=$sumall;$ava=$obtainNow/count($student); 
					$FinalobtainNow+=$ava;
				 	echo "<div class='tmark tmark".$sub["id"]."'>MM:</div><div class='topbar'><div class='leftpoint'>&nbsp;</div><div class='rightpoint'>&nbsp;</div><div class='midpoint'>&nbsp;</div><span class='mini min".$sub["id"]."'></span><span class='maxi1 max".$sub["id"]."'></span><span class='mid'>".number_format($ava,1)."</span></div>";
				 ?><script>$(document).ready(function(e) {
					 $(".tmark<?php echo $sub["id"]; ?>").html("MM:"+$(".total<?php echo $sub["id"]; ?>").html());
                   minMaxId('.ontain<?php echo $sub["id"]; ?>','min','.min<?php echo $sub["id"]; ?>'); 
				   minMaxId('.ontain<?php echo $sub["id"]; ?>','max','.max<?php echo $sub["id"]; ?>'); 
                });</script>
				</th>
				<?php } ?>
                <script>$(document).ready(function(e) {
					 $(".tmarkTot").html("MM:"+$(".totalTot").html());
                   minMaxId('.ontainTot','min','.minTot'); 
				   minMaxId('.ontainTot','max','.maxTot'); 
                });</script>
                <th style="font-weight: 800;border: 2px solid #FF0E1F;"><span class="tmark">TOTAL</span><?php echo "<div class='tmarkTot'></div><div class='topbar'><div class='leftpoint'>&nbsp;</div><div class='rightpoint'>&nbsp;</div><div class='midpoint'>&nbsp;</div>
				<span class='mini minTot'></span><span class='maxi1 maxTot'></span><span class='mid'>".number_format($FinalobtainNow,1)."</span></div>"; ?>
                
                </th>
            </tr>
        </thead>
        <tbody>
		<?php
		$i=0;
		foreach($student as $s){$i++;
			echo "<tr>";$Finaltot="";$Finalobt="";
			
			$attr=$db->getRow("select * from allattandence where idno='".$s["idno"]."'");
				$att="";
				if(is_array($attr)){ $att=0;
					if($_GET["term"]=="final")$att=$attr['term1_att']+$attr['term2_att'];
					elseif($_GET["term"]=="term1")$att=$attr['term1_att'];
					elseif($_GET["term"]=="term2")$att=$attr['term2_att'];
				}
			echo "<td class='tdata' style='font-size:12px;border-top: 0px solid #ddd;'>".$i." ".$s["name"]."<span class='maxi'>".$att."</span></td>";
			$j=0;
			foreach($subjects as $sub){ $j++;
				$fa1=$db->getRow("select total,obtain from exammarks where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='FA1' and session='".$_SESSION["admin"]["session"]."'");
				$fa2=$db->getRow("select total,obtain from exammarks where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='FA2' and session='".$_SESSION["admin"]["session"]."'");
				$sa1=$db->getRow("select total,obtain from exammarks where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='SA1' and session='".$_SESSION["admin"]["session"]."'");
				$fa3=$db->getRow("select total,obtain from exammarks where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='FA3' and session='".$_SESSION["admin"]["session"]."'");
				$fa4=$db->getRow("select total,obtain from exammarks where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='FA4' and session='".$_SESSION["admin"]["session"]."'");
				$sa2=$db->getRow("select total,obtain from exammarks where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='SA2' and session='".$_SESSION["admin"]["session"]."'");
                ?><td style="font-size:12px;"><?php 
				//echo $db->getLastQuery();
				if($_GET["term"]=="final"){
					$obtain=$fa1["obtain"]+$fa2["obtain"]+$fa3["obtain"]+$fa4["obtain"]+$sa1["obtain"]+$sa2["obtain"]; 
					$total=$fa1["total"]+$fa2["total"]+$fa3["total"]+$fa4["total"]+$sa1["total"]+$sa2["total"];
				}elseif($_GET["term"]=="term1"){
					$obtain=$fa1["obtain"]+$fa2["obtain"]+$sa1["obtain"]; 
					$total=$fa1["total"]+$fa2["total"]+$sa1["total"];
				}elseif($_GET["term"]=="term2"){
					$obtain=$fa3["obtain"]+$fa4["obtain"]+$sa2["obtain"]; 
					$total=$fa3["total"]+$fa4["total"]+$sa2["total"];
				}
					$per=($obtain*100)/$total;
					$Finalobt+=$obtain;
					$Finaltot+=$total;
				?><script>$(document).ready(function(e) {
					 var min = $(".min<?php echo $sub["id"]; ?>").html();
					 var max = $(".max<?php echo $sub["id"]; ?>").html();
				     var obtain = <?php echo json_encode($obtain) ?>;
					
					 $(".l<?php echo $sub["id"].$i; ?>").hide();
					 $(".r<?php echo $sub["id"].$i; ?>").hide();
					 if(obtain==min){
						$(".l<?php echo $sub["id"].$i; ?>").show(); 
					 }
					 else if(obtain==max){
						 $(".r<?php echo $sub["id"].$i; ?>").show(); 
					 }
					
					 var tmin = $(".minTot").html();
					 var tmax = $(".maxTot").html();
					 var tobtain = <?php echo json_encode($Finalobt) ?>;
					 $(".tl<?php echo $i; ?>").hide();
					 $(".tr<?php echo $i; ?>").hide();  
					 if(tobtain==tmin){
						$(".tl<?php echo $i; ?>").show(); 
					 }
					 else if(tobtain==tmax){
						 $(".tr<?php echo $i; ?>").show(); 
					 }
				});
             </script>
             
			   <!-- <input type="hidden" name="vmin<?php echo $sub["id"]; ?>" class="vmin<?php echo $sub["id"]; ?>" value=""/>
    			<input type="hidden" name="vmax<?php echo $sub["id"]; ?>" class="vmax<?php echo $sub["id"]; ?>" value="" />-->
              
			  
                <span style="display:none" class="total<?php echo $sub["id"]?>"><?php echo $total ?></span>
                <span class="ontain<?php echo $sub["id"]?>" style="float:left;width:15px;margin-right:2px;color:#F12249;font-weight: 800;"><?php echo $obtain; ?></span>
              
					<div style="width:90px;background: #ACADA7;" class="progress progress-mini">
						<div class="bar <?php if($j==1) echo "greenbar"; elseif($j==2) echo "bluebar";elseif($j==3) echo "redbar";elseif($j==4) echo "yellowbar";elseif($j==5) echo "greenbar";elseif($j==6) echo "bluebar";elseif($j==7) echo "redbar";elseif($j==8) echo "yellowbar";?>" style="width:<?php echo $per?>%;"></div>
                        <div class='leftpoint l<?php echo $sub["id"].$i; ?>'>&nbsp;</div>
                        <div class='rightpoint r<?php echo $sub["id"].$i; ?>'>&nbsp;</div>
                        <div class="barn" style="width:<?php echo ($ava*100)/$total?>%"></div>
                        
					</div>
				</td><?php
			}
			$dinalPer=($Finalobt*100)/$Finaltot;
			echo '<td><span style="display:none" class="totalTot">'.$Finaltot.'</span><span class="ontainTot" style="float:left;width:12px;margin-right:5px;color:#F12249;font-weight: 800;">'.$Finalobt.'</span>
			<div style="width:90px;background: #ACADA7;" class="progress progress-mini"><div class="bar totbar" style="width: '.$dinalPer.'%;"></div>
			<div style="display:none;" class="leftpoint tl'.$i.'">&nbsp;</div>
            <div style="display:none;" class="rightpoint tr'.$i.'">&nbsp;</div>
			<div class="barn" style="width:'.($FinalobtainNow*100)/$Finaltot.'%"></div></div></td>';
			echo "</tr>";
		}
		?></tbody></table><?php
	}else{
		echo '<div class="alert alert-error">
			  <a class="close" data-dismiss="alert">×</a>
			  <i class="icon icon-warning-sign"></i> <b>Notice</b> No record found. click <a href="?src=ExamCBSE&page_id=finalmarksheet&term='.$_GET["term"].'">here</a> to search again</i>
			</div>';
	}
}elseif(isset($_GET['class']) && trim($_GET['class']) !='' && isset($_GET['grade']))
{
	$subjects=$db->getRows("select * from subject where class='".$_GET["class"]."' order by id");
	//echo $db->getLastQuery();
	$where="";$result=array();
	if(isset($_GET["section"]) && $_GET["section"]!="")$where=" and section='".$_GET["section"]."'";
	$student=$db->getRows("select name,idno from student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and class='".$_GET["class"]."' $where order by name");
	$examgrade=$db->getRows("SELECT * FROM examgrade WHERE school_id='".$_SESSION["admin"]["school_id"]."' ORDER BY `grade` ASC");
	if(is_array($student) && count($student)>0){
		foreach($student as $stu){
			if(is_array($examgrade) && count($examgrade)>0){
				foreach($examgrade as $grade){
					$ubjhectList=array();
					if(is_array($subjects) && count($subjects)>0){
						foreach($subjects as $sub){
							$ubjhectList[]=$sub["subject"];
							$gr=$grade["grade"];
							$sname=$sub["subject"];
							$idno=$stu["idno"];
							$studentname='<span style="display:none">'.$idno.'</span>'.$stu["name"];
							$sql="";
							if($_REQUEST["term"]=="final"){
								$sql="select SUM(obtain) as obt,SUM(total) as tot from exammarks where subject='".$sname."' and type in ('FA1','FA2','SA1','SA2','FA3','FA4') and session='".$_SESSION["admin"]["session"]."' and idno=".$idno;
							}elseif($_REQUEST["term"]=="term1"){
								$sql="select SUM(obtain) as obt,SUM(total) as tot from exammarks where subject='".$sname."' and type in ('FA1','FA2','SA1') and session='".$_SESSION["admin"]["session"]."' and idno=".$idno;
							}elseif($_REQUEST["term"]=="term2"){
								$sql="select SUM(obtain) as obt,SUM(total) as tot from exammarks where subject='".$sname."' and type in ('SA2','FA3','FA4') and session='".$_SESSION["admin"]["session"]."' and idno=".$idno;
							}
							$mark=$db->getRow($sql);
							$avg=round(($mark["obt"]*100)/$mark["tot"]);
							if($avg>=$grade["minrange"] && $avg<=$grade["maxrange"]){
								$result[$sname][$gr][$studentname]=$mark["obt"];
								/*$result[$sname][$gr][$studentname]["obtain"]=$mark["obt"];
								$result[$sname][$gr][$studentname]["tottal"]=$mark["tot"];
								$result[$sname][$gr][$studentname]["average"]=$avg;*/
							}
							//echo $db->getLastQuery()." - ".$grade["maxrange"]." ".$grade["minrange"]."<br />";
						}
						//print_r($result);
						$sql="";
						if($_REQUEST["term"]=="final"){
							$sql="select SUM(obtain) as obt,SUM(total) as tot from exammarks where subject in ('".implode("','",$ubjhectList)."') and type in ('FA1','FA2','SA1','SA2','FA3','FA4') and session='".$_SESSION["admin"]["session"]."' and idno=".$idno;
						}elseif($_REQUEST["term"]=="term1"){
							$sql="select SUM(obtain) as obt,SUM(total) as tot from exammarks where subject in ('".implode("','",$ubjhectList)."') and type in ('FA1','FA2','SA1') and session='".$_SESSION["admin"]["session"]."' and idno=".$idno;
						}
						elseif($_REQUEST["term"]=="term2"){
							$sql="select SUM(obtain) as obt,SUM(total) as tot from exammarks where subject in ('".implode("','",$ubjhectList)."') and type in ('SA2','FA3','FA4') and session='".$_SESSION["admin"]["session"]."' and idno=".$idno;
						}
						$mark=$db->getRow($sql);
						$avg=round(($mark["obt"]*100)/$mark["tot"]);
						if($avg>=$grade["minrange"] && $avg<=$grade["maxrange"]){
							$result["total"][$gr][$studentname]=$mark["obt"];
						}
					}
				}
			}
		}
		//echo "<pre>";print_r($result);echo "</pre>";
		
	}else{
		echo '<div class="alert alert-error">
			  <a class="close" data-dismiss="alert">×</a>
			  <i class="icon icon-warning-sign"></i> <b>Notice</b> No record found. click <a href="?src=ExamCBSE&page_id=finalmarksheet&term='.$_GET["term"].'">here</a> to search again</i>
			</div>';
	}
	function random_color_part() {
		return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
	}
	
	function random_color() {
		return random_color_part() . random_color_part() . random_color_part();
	}
	
	ksort($result);
	if(is_array($result) && count($result)>0){	?>
        <div class="headPrint hide" style="border: none;">
        	  <div style="text-align:center;"> <h1 style="font-size:45px;margin:5px 0px 0px 0px;color: #EC1E1E;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h1>  </div>
              <div style="height:20px;width:100%;background: #F1E3E3;color: #0743D2;font-weight: 800;">
                  <ul style="padding: 1px 5px;width:100%;">
                 
                  <li style="float:left;width:33%">Class : <?php echo $_GET['class']; ?></li>
                  <li style="float:left;width:33%;padding-left:10px;">Term : <?php echo $_GET['term'].' , '.$_SESSION["admin"]["session"] ?></li>
                  <li style="float:left;width:30%;text-align:center;">No of working days : <?php if($_GET['term']=="term1")echo $LinksDetails['term1_all_day'];elseif($_GET['term']=="term2")echo $LinksDetails['term2_all_day'];elseif($_GET['term']=="final")echo $LinksDetails['overallday'];  ?></li>
                  </ul>
               </div>
               <ul style="padding: 1px 5px;width:100%;font-size:11px;color:#fff;font-weight:800;">
                  <li style="float:left;width:10%;background:#2938FF;margin-right: 2px; padding: 5px 1px 5px 5px;">A1 : 91 - 100%</li> 
                  <li style="float:left;width:10%;background:#EC0D2E;margin-right: 2px; padding: 5px 1px 5px 5px;">A2 : 81 - 90%</li> 
                  <li style="float:left;width:10%;background:#07B714;margin-right: 2px; padding: 5px 1px 5px 5px;">B1 : 71 - 80%</li> 
                  <li style="float:left;width:10%;background:#11AEE4;margin-right: 2px; padding: 5px 1px 5px 5px;">B2 : 61 - 70%</li> 
                  <li style="float:left;width:10%;background:#B214D6;margin-right: 2px; padding: 5px 2px 5px 5px;">C1 : 51 - 60%</li>  
                  <li style="float:left;width:10%;background:#D614B2;margin-right: 2px; padding: 5px 3px 5px 5px;">C2 : 41 - 50%</li>
                  <li style="float:left;width:10%;background:#FF5C3F;margin-right: 2px; padding: 5px 3px 5px 5px;">D : 33 - 40%</li> 
                  <li style="float:left;width:10%;background:#1D880A;margin-right: 2px; padding: 5px 3px 5px 5px;">E1 : 21 - 32%</li>
                  <li style="float:left;width:11%;background:#09CAE2;margin-right: 2px; padding: 5px 3px 5px 5px;">E2 : 0 - 20%</li>
               </ul> 
        </div>     
   		 <table class="nnnn" cellpadding="0" cellspacing="0"><tr><?php $ij=0;
			foreach($result as $key=>$val){$ij++;
				/*if($i==1){?> <ul style="padding: 1px 5px;width:100%;font-size:11px;color:#000;font-weight:800;"><?php } ?>
                  <li style="float:left;width:10%;background:#B6E60D;margin-right: 2px; padding: 8px 2px 8px 5px;"><?php echo ucfirst($key); ?></li>
                <?php if($i==1){?> </ul> <?php }*/ ?>
                <td width="<?php if($key=="total") echo "11%"; else echo "11%";?>">
                <table style="font-weight:800;color: blue; font-size:10px;border-right: 1px solid #FF0808;" cellpadding="0" cellspacing="0">
                    <tr style="line-height:30px;background-color: #FF940E;color: #000;">
                        <th><?php echo ucfirst($key); ?></th>
                    </tr>
                <?php //530A77 EC0D2E 07B714 11AEE4 B214D6 D614B2
                if(is_array($examgrade) && count($examgrade)>0){
					$i=0;
					foreach($examgrade as $grade){$i++;
					?>
					<tr style="color:#fff;background-color:#<?php if($i==1) echo "2938FF";elseif($i==2) echo "EC0D2E";elseif($i==3) echo "07B714";elseif($i==4) echo "11AEE4"; elseif($i==5) echo "B214D6";elseif($i==6) echo "D614B2";elseif($i==7) echo "FF5C3F";elseif($i==8) echo "1D880A";elseif($i==9) echo "09CAE2";
					?>"><td ><?php echo $g=$grade["grade"] ?>
                    <span style="float:right"><?php echo $cnts=count($result[$key][$g]) ?>/<?php echo count($student) ?></span>
                    </td></tr>
                    <?php 
					if($cnts>0){
						foreach($result[$key][$g] as $k=>$v){
							?><tr><td><?php echo $k ?><span style="float:right"><?php echo $v ?></span></td></tr><?php
						}
					}?>
                    
					<?php
					}
				}
				?>
                </table>
                </td><?php
			}
			?></tr></table><?php
		}
	//echo "<pre>";print_r($result);
}
elseif(isset($_GET['class']) && trim($_GET['class']) !='' && isset($_GET['sheet'])){
	
	$subjects=$db->getRows("select * from sub_junior where class='".$_GET["class"]."' order by id");
	$where="";$stsearch="";
	if(isset($_GET["section"]) && $_GET["section"]!="")$where=" and section='".$_GET["section"]."'";
	if(isset($_GET["idno"]) && $_GET["idno"]!="")
	$stsearch=" and idno='".$_GET["idno"]."'";
	$studentSection=$db->getRows("select name,idno,fname from student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and class='".$_GET["class"]."' $where order by name");
	
	$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 class='".$_GET["class"]."' order by name");
	//echo $db->getLastQuery();exit;
	$examgrade=$db->getRows("SELECT * FROM examgrade WHERE school_id='".$_SESSION["admin"]["school_id"]."' ORDER BY `grade` ASC");
	$totalAllClass="";$obtainAllClass="";$obtainMainClass="";
	$obtainSectionClass="";$totalSectionClass="";$totalmaxArray=array();
	$totalClass="";
	if(is_array($student) && count($student)>0){
		$slidt=array();$Finalava=0;$FinalobtainNow=0;
		foreach($subjects as $sub)$subAry[]=$sub["subject"];
		foreach($student as $ss){
			$slidt[]=$ss["idno"];
			if($_GET["term"]=="final"){ 
				$sumSuball[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('1st Semester','2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			}
			elseif($_GET["term"]=="term1"){ 
				$sumSuball[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			}
			elseif($_GET["term"]=="term2"){ 
			$sumSuball[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			}
			//print_r($sumSuball);exit;
			if(is_array($subjects) && count($subjects)>0){
				foreach($subjects as $sub){
					$subname=$sub["subject"];
					if($_GET["term"]=="final"){ 
						$sumallsub[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester','2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno = ".$ss["idno"]);
					}
					elseif($_GET["term"]=="term1"){ 
						$sumallsub[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]); 
					}
					elseif($_GET["term"]=="term2"){ 
						$sumallsub[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]); 
					}
				}
			}
		}//print_r($sumallsub[$subname]);echo $db->getLastQuery();exit;
		foreach($studentSection as $ss){
			$slidtSection[]=$ss["idno"];
			if($_GET["term"]=="final"){ 
				$sumSuballSection[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('1st Semester','2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			}
			elseif($_GET["term"]=="term1"){ 
				$sumSuballSection[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			}
			elseif($_GET["term"]=="term2"){ 
			$sumSuballSection[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			}
			if(is_array($subjects) && count($subjects)>0){
				foreach($subjects as $sub){
					$subname=$sub["subject"];
					if($_GET["term"]=="final"){ 
						$sumallsubSection[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester','2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno = ".$ss["idno"]);
					}
					elseif($_GET["term"]=="term1"){ 
						$sumallsubSection[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]); 
					}
					elseif($_GET["term"]=="term2"){ 
						$sumallsubSection[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]); 
					}
				}
			}
		}
		$he=0;
		foreach($studentSection as $s){$he++;?>
        <div style="height:1028px;margin-bottom:20px;">
        <div style="height:960px;<?php if($he!=1) echo "padding-top:10px;" ?>">
            <div class="headPrint hide" style="border: none;">
        	  <div style="text-align:center;background: #F5FFD9;"> 
              <h1 style="font-size:33px;margin:0px 0px 0px 0px;color: #EC1E1E;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h1>  </div> 
               <div style="height:42px;width:100%;background: #B5F5BE;color: #0743D2;font-weight: 800;BORDER-TOP: 2PX SOLID RED;font-size:12px;">
                  <ul style="padding-right: 10px;width:100%;margin-top:1px;">
                  <li style="float:left;width:66%"> Name : <?php echo $s["name"];?></li>
                  <li style="float:left;width:34%">Class : <?php echo $_GET['class'];if(isset($_GET["section"]) && $_GET["section"]!="") echo "-".$_GET['section']; ?></li>
                  <li style="float:left;width:65%">Father's Name : <?php echo $s["fname"];?></li>
                  <li style="float:left;width:33%;padding-left:10px;">Term : <?php if($_GET['term']=="term1") echo "1st Semester";elseif($_GET['term']=="term2") echo "2nd Semester"; else echo "Final" ?></li>
                  </ul>
            	</div>
                <p style="text-align:center;background:#FFFF36;color:blue;font-weight:800;margin:0;BORDER-TOP:2PX SOLID RED;BORDER-BOTTOM:2PX SOLID RED;font-size:14px;">ANALYTICAL PROGRESS REPORT(<?php echo $_SESSION["admin"]["session"] ?>)</p>           
                <p style="text-align:center;color:#FB007D;font-weight: 800;margin: 0;background: #F5FFD9;font-size:14px;"> GRAPH DESCRIPTION </p>
              <div style="height:58px;width:100%;background:#B5F5BE;color:#0743D2;font-weight: 800;BORDER-TOP: 2PX SOLID RED;BORDER-BOTTOM:2PX SOLID RED;">
              
                 <ul style="padding-right: 10px;width:100%;margin-top:5px;font-size:12px;list-style:none;">
                  <li style="float:left;width:8%"><div class="bar" style="width:100%;background:#FFD2F8;height:15px;"></div></li>
                  <li style="float:left;width:91%;padding-left:5px;">Lines drawn on this rectangular bar are related to this standard(<?php echo $_GET['class']; ?>)</li>
                  <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?>
                  <li style="float:left;width:8%"><div class="bar" style="width: 100%;background:#D0D5FF;height:15px;margin-top:4px;"></div></li>
                  <li style="float:left;width:91%;padding-left:5px;margin-top:4px;">Lines drawn on this rectangular bar are related to this class(<?php echo $_GET['class']."-".$_GET['section']; ?>)</li>
                  <?php } ?>
                  <li style="float:left;width:10%;margin-left:60px;"><div class='midpoint' style="background:#000;">&nbsp;</div><b style="margin-left:3px;">Average</b></li>
                  <li style="float:left;width:10%"><div class='midpoint' style="background:#0DC314;">&nbsp;</div><b style="margin-left:3px;">Highest</b></li>
                  <li style="float:left;width:34%"><div class='rightpoint' style="background:#FFF">&nbsp;</div><b style="margin-left:3px;">Grade Obtained</b></li>
                 </ul>
          
     		 	</div>
      	   </div>
			<table width="95%" cellpadding="0" cellspacing="0" style="margin-top:10px;font-weight:800;"><?php
			$gr="";$avgrade="";$ij=0;
			if(is_array($subjects) && count($subjects)>0){
				foreach($subjects as $sub){$ij++;
					$Sem1st=$db->getRow("select sum(total),sum(obtain) from exammarks_junior where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='1st Semester' and session='".$_SESSION["admin"]["session"]."'");
					$Sem2nd=$db->getRow("select sum(total),sum(obtain) from exammarks_junior where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='2nd Semester' and session='".$_SESSION["admin"]["session"]."'");
					//print_r($Sem1st);echo $db->getLastQuery();exit;
					if($_GET["term"]=="final"){
						$obtain=$Sem1st["sum(obtain)"]+$Sem2nd["sum(obtain)"]; 
						$total=$Sem1st["sum(total)"]+$Sem2nd["sum(total)"];
						$totalAllClass+=$total;
						$obtainMainClass+=$obtain;
					}elseif($_GET["term"]=="term1"){
						$obtain=$Sem1st["sum(obtain)"];
						$total=$Sem1st["sum(total)"];
						$totalAllClass+=$total;
						$obtainMainClass+=$obtain;
					}elseif($_GET["term"]=="term2"){
						$obtain=$Sem2nd["sum(obtain)"];
						$total=$Sem2nd["sum(total)"];
						$totalAllClass+=$total;
						$obtainMainClass+=$obtain;
					}
					$per=round(($obtain*100)/$total);
					//echo $obtain.$total.$per;exit;
					if($_GET["term"]=="final"){ 
						$sumall=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester','2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")");
						//echo $db->getLastQuery();
						$sumallSection=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester','2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidtSection).")");	
						$obtainAllClass+=$sumall;
						$obtainSectionClass+=$sumallSection;
					}
					elseif($_GET["term"]=="term1"){ 
						$sumall=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")");
						$sumallSection=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidtSection).")"); 
						$obtainAllClass+=$sumall;
						$obtainSectionClass+=$sumallSection;
					}
					elseif($_GET["term"]=="term2"){ 
						$sumall=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")"); 
						$sumallSection=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidtSection).")"); 
						$obtainAllClass+=$sumall;
						$obtainSectionClass+=$sumallSection;
					}
					//echo $sumall."s".$db->getErMsg();
					$subname=$sub["subject"];
					$maxall=max($sumallsub[$subname]);
					$maxallSection=max($sumallsubSection[$subname]);
					$avg=round(($sumall/count($student)*100)/$total);
					$avgSection=round(($sumallSection/count($studentSection)*100)/$total);
					$avgMAX=round(($maxall*100)/$total);
					$avgMAXSection=round(($maxallSection*100)/$total);
					//echo $sumall."-".$avg."-".count($student);exit;
					$maxall1=max($sumallsub[$subname]);
					$maxallSection1=max($sumallsubSection[$subname]);
					$avg1=round($sumall/count($student));
					$avgSection1=round($sumallSection/count($studentSection));
					$avgMAX1=round($maxall);
					$avgMAXSection1=round($maxallSection);
					/*foreach($examgrade as $grade){
						if($per>=$grade["minrange"] && $per<=$grade["maxrange"])
							$gr=$grade["grade"];
						if($avg>=$grade["minrange"] && $avg<=$grade["maxrange"])
							$avgrade=$grade["grade"];
						if($avgSection>=$grade["minrange"] && $avgSection<=$grade["maxrange"])
							$avgradeSection=$grade["grade"];
						if($avgMAX>=$grade["minrange"] && $avgMAX<=$grade["maxrange"])
							$avMAXgrade=$grade["grade"];
						if($avgMAXSection>=$grade["minrange"] && $avgMAXSection<=$grade["maxrange"])
							$avMAXgradeSection=$grade["grade"];
					}*/
					if($ij==1){?>
                     <tr>
                    <td style="border-right:3px solid #000;height:5px;" ></td><td>&nbsp;</td>
                   
                    </tr>
					<tr>
                    <?php  } ?>
                    <td style="border-right:1px solid #000; width:100px; text-align:right;color:<?php if($ij==1)echo "blue";elseif($ij==2)echo "green";elseif($ij==3)echo "#FFC808";elseif($ij==4)echo "red";elseif($ij==5)echo "#6BE00E";elseif($ij==6)echo "#0285FF";elseif($ij==7)echo "#C90AFF";elseif($ij==8)echo "#770606";elseif($ij==9)echo "#FFC808";else echo "#0285FF";?>;padding-right:6px;"><?php echo $sub["subject"]?></td>
                    <td>
                       <div class="progress progress-mini" style="width: 100%;min-height:18px;background:#FFD2F8;"></div>
                    		
            				<div class="barn barn2" style="position:relative !important;width:<?php echo $avg; ?>%;margin-top:-29px;text-align:right;border-right: 3px solid #040404 !important;"><span class="hid"><?php echo $avg1; ?></span></div>
            				<div class="barn barn2" style="position:relative !important;width:<?php echo $avgMAX; ?>%;margin-top:-29px;text-align:right;border-right:3px solid #38E023 !important;<?php if($avgMAX==100) echo "margin-left:-5px";?>;"><span class="hid"><?php echo $avgMAX1; ?></span></div>
            				

                   <!-- <div style="width:100%;min-height:22px;margin-bottom:0px;margin-top:0px;border: 2px solid #07D026;background: #D0C9C9;" class="progress progress-mini">-->
						<div class="progress progress-mini" style="margin-top:-11px;margin-bottom:0px;min-height:22px;width: <?php echo $per; ?>%;background:<?php if($ij==1)echo "blue";elseif($ij==2)echo "green";elseif($ij==3)echo "#FFC808";elseif($ij==4)echo "red";elseif($ij==5)echo "#6BE00E";elseif($ij==6)echo "#0285FF";elseif($ij==7)echo "#C90AFF";elseif($ij==8)echo "#770606";elseif($ij==9)echo "#FFC808";else echo "#0285FF";?>;font-size:17px;font-weight:bold;"><span style="float:left;border-radius: 50%;background-color: #fff; color:#000; padding: 0px 3px;margin: 2px 2px;position:absolute;z-index:1;"><?php echo $obtain?></span></div>
                     	<!--</div>-->
                        <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?>
                        <div class="progress progress-mini" style="width: 100%;min-height:18px;background:#FFD2F8;"></div>
                    		
            				<div class="barn barn2" style="position:relative !important;width:<?php echo $avgSection; ?>%;margin-top:-29px;text-align:right;border-right: 3px solid #040404 !important;"><span class="hid"><?php echo $avgSection1; ?></span></div>
            				<div class="barn barn2" style="position:relative !important;width:<?php echo $avgMAXSection; ?>%;margin-top:-29px;text-align:right;border-right:3px solid #38E023 !important;<?php if($avgMAXSection==100) echo "margin-left:-5px";?>;"><span class="hid"><?php echo $avgMAXSection1; ?></span></div>
                    <!--<div style="width:100%;height:17px;margin-bottom:0px;position:relative;" class="progress progress-mini">
						<div class="bar" style="width: 100%;background:#D0D5FF;"></div>
                        <div class="barn2" style="margin-top:15px;margin-left:<?php echo $avgSection;?>%;"><?php echo $avgSection1; ?></div>
                        <div class="barn2" style="margin-top:15px;margin-left:<?php echo $avgMAXSection;?>%;"><?php echo $avgMAXSection1; ?></div>
                        <div class="barn barn2" style="width:<?php echo $avgSection; ?>%; text-align:right;border-right: 3px solid #040404 !important;<?php if($avgSection==100) echo "margin-left:-25px";?>;"><span class="hid"><?php echo $avgSection1; ?></span></div>
                        <div class="barn barn2" style="width:<?php echo $avgMAXSection; ?>%; text-align:right;<?php if($avgMAXSection<95) echo "margin-left:20px";?>;border-right:3px solid #38E023 !important;<?php if($avgMAXSection==100) echo "margin-left:-5px";?>"><span class="hid"><?php echo $avgMAXSection1; ?></span></div>
                    </div>-->
                    <?php } ?>
                    </td>
                    </tr>
                   <tr>
                    <td style="border-right:3px solid #000;height:70px;" ></td><td>&nbsp;</td>
                    </tr>
					<?php
				}
				?><!--<tr>
                <td style="border-right:1px solid #000; width:100px; text-align:right;padding-right:6px;color:blue;">Total</td>
                <td>
                <?php 
				$AvgAllClass=$obtainAllClass/count($student);
				$graAllClass=round(($AvgAllClass*100)/$totalAllClass);
				$obtainMainClassAll=round(($obtainMainClass*100)/$totalAllClass);
				$maxallTotal=max($sumSuball);
				$maxsectionTotal=max($sumSuballSection);
				$avgMAX=($maxallTotal*100)/$totalAllClass;
				$avgMAXSection=($maxsectionTotal*100)/$totalAllClass;
				
				$avgSection=($obtainSectionClass/count($studentSection)*100)/$totalAllClass;
				
				foreach($examgrade as $grade){
					if($graAllClass>=$grade["minrange"] && $graAllClass<=$grade["maxrange"])
						$agAllClass=$grade["grade"];
					if($obtainMainClassAll>=$grade["minrange"] && $obtainMainClassAll<=$grade["maxrange"])
						$obtainMainClassAllgr=$grade["grade"];
					if($avgMAX>=$grade["minrange"] && $avgMAX<=$grade["maxrange"])
						$avMAXgrade=$grade["grade"];
					if($avgMAXSection>=$grade["minrange"] && $avgMAXSection<=$grade["maxrange"])
						$avMAXgradeSection=$grade["grade"];
					if($avgSection>=$grade["minrange"] && $avgSection<=$grade["maxrange"])
						$avgradeSection=$grade["grade"];
				} ?>
                <div style="width:100%;height:17px;margin-bottom:0px;position:relative;" class="progress progress-mini">
						<div class="bar" style="width: 100%;background:#FFD2F8;"></div>
                        <div class="barn2" style="margin-top:-16px;margin-left:<?php echo $graAllClass;?>%;"><?php echo $agAllClass; ?></div>
                        <div class="barn2" style="margin-top:-16px;margin-left:<?php echo $avgMAX;?>%;"><?php echo $avMAXgrade; ?></div>
                        <div class="barn barn2" style="width:<?php echo $graAllClass; ?>%;text-align:right;border-right: 3px solid #040404 !important;"><span class="hid"><?php echo $agAllClass; ?></span></div>
                        <div class="barn barn2" style="width:<?php echo $avgMAX; ?>%;text-align:right;<?php if($avgMAXSection<100) echo "margin-left:25px";?>;border-right:3px solid #38E023 !important;"><span class="hid"><?php echo $avMAXgrade; ?></span></div>
					</div>
               
                <div style="width:100%;height:22px;margin-bottom:0px;" class="progress progress-mini">
						<div class="bar" style="width: <?php echo $obtainMainClassAll; ?>%;background:#FFC808;font-size:17px;font-weight:bold;"><span style="float:left;border-radius: 50%;background-color: #fff; color:#000; padding: 0px 3px;margin: 2px 2px;"><?php echo $obtainMainClassAllgr?></span></div>
					</div>
               
                 <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?>
                    <div style="width:100%;height:17px;margin-bottom:0px;position:relative;" class="progress progress-mini">
						<div class="bar" style="width: 100%;background:#D0D5FF;"></div>
                        <div class="barn2" style="margin-top:15px;margin-left:<?php echo $avgSection;?>%;"><?php echo $avgradeSection; ?></div>
                        <div class="barn2" style="margin-top:15px;margin-left:<?php echo $avgMAXSection;?>%;"><?php echo $avMAXgradeSection; ?></div>
                        <div class="barn barn2" style="width:<?php echo $avgSection; ?>%; text-align:right;border-right: 3px solid #040404 !important;"><span class="hid"><?php echo $avgradeSection; ?></span></div>
                        <div class="barn barn2" style="width:<?php echo $avgMAXSection; ?>%; text-align:right;<?php if($avgMAXSection<100) echo "margin-left:25px";?>;border-right:3px solid #38E023 !important;"><span class="hid"><?php echo $avMAXgradeSection; ?></span></div>
                   </div>
                    <?php } 
				$obtainMainClass=0;$totalAllClass=0;$AvgAllClass=0;$obtainAllClass=0;$obtainSectionClass=0; ?>
                </td>
                </tr>-->
               <tr>
                    <td  style="border-right:3px solid #000;height:5px;" ></td><td style="BORDER-BOTTOM: 2PX SOLID #101010;">&nbsp;</td>
                    </tr>
<?php		}
			?></table>
			</div></div>
			<?php
		}
	}
	
}
elseif(isset($_GET['class']) && trim($_GET['class']) !='' && isset($_GET['performance'])){
	$subjects=$db->getRows("select * from sub_junior where class='".$_GET["class"]."'");
	$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 class='".$_GET["class"]."' $where order by name");
	//$examgrade=$db->getRows("SELECT * FROM examgrade WHERE school_id='".$_SESSION["admin"]["school_id"]."' ORDER BY `grade` ASC");
	if(is_array($student) && count($student)>0){$he=0;
		foreach($student as $s){$he++;
			?>
			<div style="height:1030px;margin-bottom:20px;">
        <div style="height:960px;<?php if($he!=1)echo "padding-top:10px;" ?>">
            <div class="headPrint hide" style="border: none;">
        	  <div style="text-align:center;background: #F5FFD9;"> 
              <h1 style="font-size:33px;margin:0px 0px 0px 0px;color: #EC1E1E;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h1>  </div> 
               <div style="height:42px;width:100%;background: #B5F5BE;color: #0743D2;font-weight: 800;BORDER-TOP: 2PX SOLID RED;font-size:12px;">
                  <ul style="padding-right: 10px;width:100%;margin-top:1px;">
                  <li style="float:left;width:66%"> Name : <?php echo $s["name"];?></li>
                  <li style="float:left;width:34%">Class : <?php echo $_GET['class'];if(isset($_GET["section"]) && $_GET["section"]!="") echo "-".$_GET['section']; ?></li>
                  <li style="float:left;width:65%">Father's Name : <?php echo $s["fname"];?></li>
                  <li style="float:left;width:33%;padding-left:10px;">Term : <?php if($_GET['term']=="term1") echo "1st Semester";elseif($_GET['term']=="term2") echo "2nd Semester"; else echo "Final" ?></li>
                  </ul>
            	</div>
                <p style="text-align:center;background:#FFFF36;color:blue;font-weight:800;margin:0;BORDER-TOP:2PX SOLID RED;BORDER-BOTTOM:2PX SOLID RED;font-size:14px;">EXAM WISE PERFORMANCE ACROSS THE SUBJECTS ON PERCENTAGE BASIS(<?php echo $_SESSION["admin"]["session"] ?>)</p>           
               <p style="text-align:center;color:#FB007D;font-weight: 800;margin: 0;background: #F5FFD9;font-size:14px;"> GRAPH DESCRIPTION </p>
                <div style="height:25px;width:100%;background:#B5F5BE;color:#0743D2;font-weight: 800;BORDER-TOP: 2PX SOLID RED;">
                  <ul style="padding-right: 10px;width:100%;margin-top:5px;font-size:12px;list-style:none;">
                     <li style="float:left;width:34%"><div class='rightpoint' style="background:#FFFF36">&nbsp;</div><b style="margin-left:3px;">Grade Obtained</b></li>
                  </ul>
          
     		 	</div>
      	   </div>
           
			<table class="table_per" width="100%" cellpadding="0" cellspacing="0">
            	<tbody>
                <tr>
                    <td  style="border-right:3px solid #000;height:5px;border-top:none;" ></td>
                 </tr>
            	<?php $ij=0; foreach($subjects as $sub){ $ij++;
				$fa1=$db->getRow("select sum(total),sum(obtain) from exammarks_junior where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='1st Semester' and session='".$_SESSION["admin"]["session"]."'");
					$fa2=$db->getRow("select sum(total),sum(obtain) from exammarks_junior where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='2nd Semester' and session='".$_SESSION["admin"]["session"]."'");
				//sprint_r($fa1);
				
						$obtainFA1=$fa1[1];
						$totalFA1=$fa1[0];
						$obtainFA2=$fa2[1];
						$totalFA2=$fa2[0];
				?>
                 
            	<tr>
                	<td class="sub" style="border-right:3px solid #000;width:100px;font-size:15px;VERTICAL-align:middle;text-align: center;color:<?php if($ij==1)echo "blue";elseif($ij==2)echo "green";elseif($ij==3)echo "#FFC808";elseif($ij==4)echo "red";elseif($ij==5)echo "#6BE00E";elseif($ij==6)echo "#0285FF";elseif($ij==7)echo "#C90AFF";elseif($ij==8)echo "#770606";elseif($ij==9)echo "#FFC808";else echo "#0285FF";?>;font-weight:800;"><?php echo $sub["subject"] ?></td>
                    <td valign="bottom">
					<div style="height:120px; position:relative;border-right:3px solid red;background:#E0DEFF;">
					<?php
                    $per_fa1=round(($obtainFA1*100)/$totalFA1);
					echo '<div style="height:'.$per_fa1.'%;position: absolute;bottom: 0;left: 50%;">';
					
							?><div style="border-radius: 50%;font-size:13px;background-color: #FFFF36;padding: 5px;<?php if($per_fa1<25)echo "margin-top: -22px;" ?>"><?php echo $obtainFA1;?></div> <?php 
						
					echo '</div>';
					?>
                    </div>
                    </td>
                    <td>
					<div style="height:120px; position:relative;border-right:3px solid red;background:#FFDEFA;">
					<?php
                    $per_fa2=round(($obtainFA2*100)/$totalFA2);
					echo '<div style="height:'.$per_fa2.'%;position: absolute;bottom: 0;left: 50%;">';
					
						
							?><div style="border-radius: 50%;font-size:13px;background-color: #FFFF36;padding: 5px;<?php if($per_fa2<25)echo "margin-top: -22px;" ?>"><?php echo $obtainFA2;?></div> <?php 
						
					
					echo '</div>';
					?>
                    </div>
                    </td>
                   
                </tr>
				<?php }?>
                <tr style="border-top:3px solid #000">
                	<td class="sub"></td>
                    
                    <td style="border-top: 3px solid #000;font-size: 15px;color: #0CA518;">1st Semester</td>
                    <td style="border-top: 3px solid #000;font-size: 15px;color: #0CA518;">2nd Semester</td>
                    
                </tr>
                </tbody>
            </table>
		</div>
        </div>	
			<?php
		}
	}
}
elseif(isset($_GET['class']) && trim($_GET['class']) !='' && isset($_GET['performance_term1'])){
	$subjects=$db->getRows("select * from sub_junior where class='".$_GET["class"]."'");
	$where="";
	if(isset($_GET["section"]) && $_GET["section"]!="")$where=" and section='".$_GET["section"]."'";
	$studentSection=$db->getRows("select name,idno,fname from student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and class='".$_GET["class"]."' $where order by name");
	
	$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 class='".$_GET["class"]."' order by name");
	$examgrade=$db->getRows("SELECT * FROM examgrade WHERE school_id='".$_SESSION["admin"]["school_id"]."' ORDER BY `grade` ASC");
	$totalAllClass="";$obtainAllClass="";$obtainMainClass="";
	$obtainSectionClass="";$totalSectionClass="";$totalmaxArray=array();
	$totalClass="";
	if(is_array($student) && count($student)>0){
		$slidt=array();$Finalava=0;$FinalobtainNow=0;
		foreach($subjects as $sub)$subAry[]=$sub["subject"];
		foreach($student as $ss){
			
			$slidt[]=$ss["idno"];
				$sumSuballFA1[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type = ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			
			if(is_array($subjects) && count($subjects)>0){
				foreach($subjects as $sub){
					$subname=$sub["subject"];
					
						$sumallsubFA1[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type = ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno = ".$ss["idno"]);
					
				}
			}
		}
		foreach($studentSection as $ss){
			$slidtSection[]=$ss["idno"];
			
				$sumSuballSectionFA1[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type = ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			
			if(is_array($subjects) && count($subjects)>0){
				foreach($subjects as $sub){
					$subname=$sub["subject"];
					
						$sumallsubSectionFA1[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type = ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno = ".$ss["idno"]);
					
				}
			}
		}$he=0;
		foreach($studentSection as $s){$he++;
			?>
			<div style="height:1030px;margin-bottom:20px;">
        <div style="height:960px;font-weight:800;<?php if($he!=1)echo "padding-top:10px;" ?>">
			 	  <div class="headPrint hide" style="border: none;">
        	  <div style="text-align:center;background: #F5FFD9;"> 
              <h1 style="font-size:33px;margin:0px 0px 0px 0px;color: #EC1E1E;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h1>  </div> 
               <div style="height:42px;width:100%;background: #B5F5BE;color: #0743D2;font-weight: 800;BORDER-TOP: 2PX SOLID RED;font-size:12px;">
                  <ul style="padding-right: 10px;width:100%;margin-top:1px;">
                  <li style="float:left;width:66%"> Name : <?php echo $s["name"];?></li>
                  <li style="float:left;width:34%">Class : <?php echo $_GET['class'];if(isset($_GET["section"]) && $_GET["section"]!="") echo "-".$_GET['section']; ?></li>
                  <li style="float:left;width:65%">Father's Name : <?php echo $s["fname"];?></li>
                  <li style="float:left;width:33%;padding-left:10px;">Term : <?php if($_GET['term']=="term1") echo "1st Semester";elseif($_GET['term']=="term2") echo "2nd Semester"; else echo "Final" ?></li>
                  </ul>
            	</div>
                <p style="text-align:center;background:#FFFF36;color:blue;font-weight:800;margin:0;BORDER-TOP:2PX SOLID RED;BORDER-BOTTOM:2PX SOLID RED;font-size:14px;">EXAM WISE PERFORMANCE ACROSS THE SUBJECTS ON PERCENTAGE BASIS(<?php echo $_SESSION["admin"]["session"] ?>)</p>           
               <p style="text-align:center;color:#FB007D;font-weight: 800;margin: 0;background: #F5FFD9;font-size:14px;"> GRAPH DESCRIPTION </p>
                <div style="height:25px;width:100%;background:#B5F5BE;color:#0743D2;font-weight: 800;BORDER-TOP: 2PX SOLID RED;">
                  <ul style="padding-right: 10px;width:100%;margin-top:5px;font-size:12px;list-style:none;">
                     <li style="float:left;width:20%"><div class='rightpoint' style="background:#FF5757">&nbsp;</div><b style="margin-left:3px;">Highest</b></li>
                      <li style="float:left;width:20%"><div class='rightpoint' style="background:#000">&nbsp;</div><b style="margin-left:3px;">Average</b></li>
                       <li style="float:left;width:40%"><div class='rightpoint' style="background:#FFFF36">&nbsp;</div><b style="margin-left:3px;">Grade Obtained</b></li>
                  </ul>
          
     		 	</div>
      	   </div>
           
            <table width="100%" cellpadding="0" cellspacing="0">
            	 <tr>
                    <td  style="border-right:3px solid #000;height:15px;border-top:none;" ></td>
                     <td>
                         <table class="table_per" width="100%" cellpadding="0" cellspacing="0">
                        <tr><td colspan="2">Class</td><td></td> <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?><td colspan="2">Section</td><?php }?></tr></table>
                    </td>
                    
                 </tr>
			<?php
			$gr="";$avgrade="";$ij=0;
			if(is_array($subjects) && count($subjects)>0){
				
				foreach($subjects as $sub){$ij++;
					$fa1=$db->getRow("select sum(total),sum(obtain) from exammarks_junior where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='1st Semester' and session='".$_SESSION["admin"]["session"]."'");
					
					//if($_GET["term"]=="final"){
						$obtainFA1=$fa1["sum(obtain)"];
						$totalFA1=$fa1["sum(total)"];
						$totalAllClassFA1+=$totalFA1;
						$obtainMainClassFA1+=$obtainFA1;
					//}elseif($_GET["term"]=="term1"){
						
					//}
					$perFA1=round(($obtainFA1*100)/$totalFA1);
					
				 	//if($_GET["term"]=="final"){ 
						$sumallFA1=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type = ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")");
						$sumallSectionFA1=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type = ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidtSection).")");	
						$obtainAllClassFA1+=$sumallFA1;
						$obtainSectionClassFA1+=$sumallSectionFA1;
					
					//value for the FA1
					$subnameFA1=$sub["subject"];
					//echo "<pre>";print_r($sumallsubFA1[$subnameFA1]);echo "</pre>";
					$maxallFA1=max($sumallsubFA1[$subnameFA1]);
					//echo $maxallFA1."<hr/>";
					$maxallSectionFA1=max($sumallsubSectionFA1[$subnameFA1]);
					$avgFA1=round(($sumallFA1/count($student)*100)/$totalFA1);
					$avgSectionFA1=round(($sumallSectionFA1/count($studentSection)*100)/$totalFA1);
					$avgMAXFA1=round(($maxallFA1*100)/$totalFA1);
					$avgMAXSectionFA1=round(($maxallSectionFA1*100)/$totalFA1);
					
					$maxallsem=max($sumallsubFA1[$subnameFA1]);
					//echo $maxallFA1."<hr/>";
					$maxallSectionsem=max($sumallsubSectionFA1[$subnameFA1]);
					$avgsem=round($sumallFA1/count($student));
					$avgSectionsem=round($sumallSectionFA1/count($studentSection));
					$avgMAXsem=round($maxallFA1);
					$avgMAXSectionsem=round($maxallSectionFA1);
					?>
					<tr>
                    <td class="sub" width="20%" style="border-right:3px solid #000;width:100px;font-size:15px;VERTICAL-align:middle;text-align: center;color:<?php if($ij==1)echo "blue";elseif($ij==2)echo "green";elseif($ij==3)echo "#FFC808";elseif($ij==4)echo "red";elseif($ij==5)echo "#6BE00E";elseif($ij==6)echo "#0285FF";elseif($ij==7)echo "#C90AFF";elseif($ij==8)echo "#770606";elseif($ij==9)echo "#FFC808";else echo "#0285FF";?>;font-weight:800;"><?php echo $sub["subject"] ?></td>
                    <td width="80%">
                     <table class="table_per" width="100%" cellpadding="0" cellspacing="0">
                    <tr><td width="17%" bgcolor="#B9B9B9">
                   <div style="height:120px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $avgFA1; ?>%;position: absolute;bottom: 0;left: 20%;">
                        	<div style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;font-size:13px;<?php if($avgFA1<25) echo "margin-top:-20px;";?>"><?php echo $avgsem; ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#B9B9B9">
                    <div style="height:120px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $avgMAXFA1; ?>%;position: absolute;bottom: 0;left: 20%;">
                        	<div style="border-radius: 50%;background-color: #FF5757; color:#fff; padding: 5px;font-size:13px;<?php if($avgMAXFA1<25) echo "margin-top:-20px;";?>"><?php echo $avgMAXsem ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:120px; position:relative;border-right:1px solid red;background:#A599FF;">
                        <div style="height:<?php echo $perFA1; ?>%;position: absolute;bottom: 0;left: 20%;">
                        	<div style="border-radius: 50%;font-size:13px;background-color:#FFFF36;padding: 5px;<?php if($perFA1<25) echo "margin-top:-20px;";?>"><?php echo $obtainFA1?></div>
                           <?php // background-color: #FFFF36;padding: 5px;<?php if($per_fa1==0)echo "margin-top: -22px;" ?>
                        </div>
                    </div>
                    <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:120px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgSectionFA1; ?>%;position: absolute;bottom: 0;left: 20%;">
                        	<div style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;font-size:13px;<?php if($avgSectionFA1<25) echo "margin-top:-20px;";?>"><?php echo $avgSectionsem; ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:120px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgMAXSectionFA1; ?>%;position: absolute;bottom: 0;left: 20%;">
                        	<div style="border-radius: 50%;background-color: #FF5757; color:#fff; padding: 5px;font-size:13px;<?php if($avgMAXSectionFA1<25) echo "margin-top:-20px;";?>"><?php echo $avgMAXSectionsem ?></div>
                        </div>
                    </div>
                    <?php }?>
                    </td></tr></table>
                    </td>
                    
                    </tr>
                    
					<?php
					
				}
				?>
                         
				
                <tr style="border-top:3px solid #000;text-align:center">
                <td class="sub"></td>
                    
                    <td style="border-top: 3px solid #000;font-size: 15px;color: #0CA518;">1st Semester</td>
                    
                </tr>
                <?php
				$obtainMainClassFA1=0;$totalAllClassFA1=0;$AvgAllClassFA1=0;$obtainAllClassFA1=0;$obtainSectionClassFA1=0;
				$obtainMainClassFA2=0;$totalAllClassFA2=0;$AvgAllClassFA2=0;$obtainAllClassFA2=0;$obtainSectionClassFA2=0;
				$obtainMainClassSA1=0;$totalAllClassSA1=0;$AvgAllClassSA1=0;$obtainAllClassSA1=0;$obtainSectionClassSA1=0;
			}
			?></table></div></div><?php
		}
		
	}
	
}
elseif(isset($_GET['class']) && trim($_GET['class']) !='' && isset($_GET['performance_term2']))
{
	$subjects=$db->getRows("select * from sub_junior where class='".$_GET["class"]."'");
	$where="";
	if(isset($_GET["section"]) && $_GET["section"]!="")$where=" and section='".$_GET["section"]."'";
	$studentSection=$db->getRows("select name,idno,fname from student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and class='".$_GET["class"]."' $where order by name");
	
	$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 class='".$_GET["class"]."' order by name");
	//$examgrade=$db->getRows("SELECT * FROM examgrade WHERE school_id='".$_SESSION["admin"]["school_id"]."' ORDER BY `grade` ASC");
	$totalAllClass="";$obtainAllClass="";$obtainMainClass="";
	$obtainSectionClass="";$totalSectionClass="";$totalmaxArray=array();
	$totalClass="";
	if(is_array($student) && count($student)>0){
		$slidt=array();$Finalava=0;$FinalobtainNow=0;
		foreach($subjects as $sub)$subAry[]=$sub["subject"];
		foreach($student as $ss){
			$slidt[]=$ss["idno"];
			//if($_GET["term"]=="final"){ 
				$sumSuballFA1[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
				$sumSuballFA2[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
				
			if(is_array($subjects) && count($subjects)>0){
				foreach($subjects as $sub){
					$subname=$sub["subject"];
					//if($_GET["term"]=="final"){ 
						$sumallsubFA1[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno = ".$ss["idno"]);
						$sumallsubFA2[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno = ".$ss["idno"]);
				}
			}
		}
		foreach($studentSection as $ss){
			$slidtSection[]=$ss["idno"];
			//if($_GET["term"]=="final"){ 
				$sumSuballSectionFA1[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
				$sumSuballSectionFA2[]=$db->getVal("select SUM(obtain) from exammarks_junior where subject in ('".implode("','",$subAry)."') and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno =".$ss["idno"]."");
			
			if(is_array($subjects) && count($subjects)>0){
				foreach($subjects as $sub){
					$subname=$sub["subject"];
					//if($_GET["term"]=="final"){ 
						$sumallsubSectionFA1[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno = ".$ss["idno"]);
						$sumallsubSectionFA2[$subname][]=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno = ".$ss["idno"]);
				}
			}
		}
		foreach($studentSection as $s){$he++;
			?>
			<div style="height:1030px;margin-bottom:20px;">
        <div style="height:960px;font-weight:800;<?php if($he!=1)echo "padding-top:10px;" ?>">
          			  <div class="headPrint hide" style="border: none;">
        	  <div style="text-align:center;background: #F5FFD9;"> 
              <h1 style="font-size:33px;margin:0px 0px 0px 0px;color: #EC1E1E;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h1>  </div> 
               <div style="height:42px;width:100%;background: #B5F5BE;color: #0743D2;font-weight: 800;BORDER-TOP: 2PX SOLID RED;font-size:12px;">
                  <ul style="padding-right: 10px;width:100%;margin-top:1px;">
                  <li style="float:left;width:66%"> Name : <?php echo $s["name"];?></li>
                  <li style="float:left;width:34%">Class : <?php echo $_GET['class'];if(isset($_GET["section"]) && $_GET["section"]!="") echo "-".$_GET['section']; ?></li>
                  <li style="float:left;width:65%">Father's Name : <?php echo $s["fname"];?></li>
                  <li style="float:left;width:33%;padding-left:10px;">Term : <?php echo $_GET["term"]; ?></li>
                  </ul>
            	</div>
                <p style="text-align:center;background:#FFFF36;color:blue;font-weight:800;margin:0;BORDER-TOP:2PX SOLID RED;BORDER-BOTTOM:2PX SOLID RED;font-size:14px;">EXAM WISE PERFORMANCE ACROSS THE SUBJECTS ON PERCENTAGE BASIS(<?php echo $_SESSION["admin"]["session"] ?>)</p>           
               <p style="text-align:center;color:#FB007D;font-weight: 800;margin: 0;background: #F5FFD9;font-size:14px;"> GRAPH DESCRIPTION </p>
                <div style="height:25px;width:100%;background:#B5F5BE;color:#0743D2;font-weight: 800;BORDER-TOP: 2PX SOLID RED;">
                  <ul style="padding-right: 10px;width:100%;margin-top:5px;font-size:12px;list-style:none;">
                     <li style="float:left;width:20%"><div class='rightpoint' style="background:#FF5757">&nbsp;</div><b style="margin-left:3px;">Highest</b></li>
                      <li style="float:left;width:20%"><div class='rightpoint' style="background:#000">&nbsp;</div><b style="margin-left:3px;">Average</b></li>
                       <li style="float:left;width:40%"><div class='rightpoint' style="background:#FFFF36">&nbsp;</div><b style="margin-left:3px;">Grade Obtained</b></li>
                  </ul>
          
     		 	</div>
      	   </div>
           
            <table width="100%" cellpadding="0" cellspacing="0">
				<tr>
                    <td  style="border-right:3px solid #000;height:15px;border-top:none;" ></td>
                     <td>
                         <table class="table_per" width="100%" cellpadding="0" cellspacing="0">
                        <tr><td colspan="2">Class</td><td></td> <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?><td colspan="2">Section</td><?php }?></tr></table>
                    </td>
                     <td>
                         <table class="table_per" width="100%" cellpadding="0" cellspacing="0">
                        <tr><td colspan="2">Class</td><td></td><?php if(isset($_GET["section"]) && $_GET["section"]!=""){?><td colspan="2">Section</td><?php }?></tr></table>
                    </td>
                     
                 </tr>
			<?php
			$gr="";$avgrade="";$ij=0;
			if(is_array($subjects) && count($subjects)>0){
				
				foreach($subjects as $sub){$ij++;
					$fa1=$db->getRow("select sum(total),sum(obtain) from exammarks_junior where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='1st Semester' and session='".$_SESSION["admin"]["session"]."'");
					$fa2=$db->getRow("select sum(total),sum(obtain) from exammarks_junior where subject='".$sub["subject"]."' and idno='".$s["idno"]."' and type='2nd Semester' and session='".$_SESSION["admin"]["session"]."'");
					
					//if($_GET["term"]=="final"){
						$obtainFA1=$fa1["sum(obtain)"];
						$totalFA1=$fa1["sum(total)"];
						$totalAllClassFA1+=$totalFA1;
						$obtainMainClassFA1+=$obtainFA1;
					//}elseif($_GET["term"]=="term1"){
						$obtainFA2=$fa2["sum(obtain)"];
						$totalFA2=$fa2["sum(total)"];
						$totalAllClassFA2+=$totalFA2;
						$obtainMainClassFA2+=$obtainFA2;
					//}
					$perFA1=round(($obtainFA1*100)/$totalFA1);
					$perFA2=round(($obtainFA2*100)/$totalFA2);
				 	//if($_GET["term"]=="final"){ 
						$sumallFA1=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")");
						$sumallSectionFA1=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('1st Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidtSection).")");	
						$obtainAllClassFA1+=$sumallFA1;
						$obtainSectionClassFA1+=$sumallSectionFA1;
					//}
					//elseif($_GET["term"]=="term1"){ 
						$sumallFA2=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidt).")");
						$sumallSectionFA2=$db->getVal("select SUM(obtain) from exammarks_junior where subject='".$sub["subject"]."' and type in ('2nd Semester') and session='".$_SESSION["admin"]["session"]."' and idno in (".implode(",",$slidtSection).")"); 
						$obtainAllClassFA2+=$sumallFA2;
						$obtainSectionClassFA2+=$sumallSectionFA2;
					//}
					
					
					//value for the FA1
					$subnameFA1=$sub["subject"];
					$maxallFA1=max($sumallsubFA1[$subnameFA1]);
					$maxallSectionFA1=max($sumallsubSectionFA1[$subnameFA1]);
					$avgFA1=round(($sumallFA1/count($student)*100)/$totalFA1);
					$avgSectionFA1=round(($sumallSectionFA1/count($studentSection)*100)/$totalFA1);
					$avgMAXFA1=round(($maxallFA1*100)/$totalFA1);
					$avgMAXSectionFA1=round(($maxallSectionFA1*100)/$totalFA1);
					
					//echo 
					$maxallFA1sem=max($sumallsubFA1[$subnameFA1]);
					$maxallSectionFA1sem=max($sumallsubSectionFA1[$subnameFA1]);
					$avgFA1sem=round($sumallFA1/count($student));
					$avgSectionFA1sem=round($sumallSectionFA1/count($studentSection));
					$avgMAXFA1sem=round($maxallFA1);
					$avgMAXSectionFA1sem=round($maxallSectionFA1);
					//value for the FA2
					$subnameFA2=$sub["subject"];
					$maxallFA2=max($sumallsubFA2[$subnameFA2]);
					$maxallSectionFA2=max($sumallsubSectionFA2[$subnameFA2]);
					$avgFA2=round(($sumallFA2/count($student)*100)/$totalFA2);
					$avgSectionFA2=round(($sumallSectionFA2/count($studentSection)*100)/$totalFA2);
					$avgMAXFA2=round(($maxallFA2*100)/$totalFA2);
					$avgMAXSectionFA2=round(($maxallSectionFA2*100)/$totalFA2);
					
					$maxallFA2sem=max($sumallsubFA2[$subnameFA2]);
					$maxallSectionFA2sem=max($sumallsubSectionFA2[$subnameFA2]);
					$avgFA2sem=round($sumallFA2/count($student));
					$avgSectionFA2sem=round($sumallSectionFA2/count($studentSection));
					$avgMAXFA2sem=round($maxallFA2);
					$avgMAXSectionFA2sem=round($maxallSectionFA2);
										
					?>
					<tr>
                    <td width="10%" class="sub" style="border-right:3px solid #000;width:100px;font-size:15px;VERTICAL-align:middle;text-align: center;color:<?php if($ij==1)echo "blue";elseif($ij==2)echo "green";elseif($ij==3)echo "#FFC808";elseif($ij==4)echo "red";elseif($ij==5)echo "#6BE00E";elseif($ij==6)echo "#0285FF";elseif($ij==7)echo "#C90AFF";elseif($ij==8)echo "#770606";elseif($ij==9)echo "#FFC808";else echo "#0285FF";?>;font-weight:800;"><?php echo $sub["subject"] ?></td>
                    <td width="45%">
                    <table class="table_per" width="100%" cellpadding="0" cellspacing="0">
                    <tr><td width="17%" bgcolor="#B9B9B9">
                   <div style="height:120px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $avgFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;font-size:13px;<?php if($avgFA1<25) echo "margin-top:-20px;";?>"><?php echo $avgFA1sem; ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#B9B9B9">
                     <div style="height:120px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $avgMAXFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                           <div style="border-radius: 50%;background-color: #FF5757; color:#fff; padding: 5px;font-size:13px;<?php if($avgMAXFA1<25) echo "margin-top:-20px;";?>"><?php echo $avgMAXFA1sem ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:120px; position:relative;border-right:1px solid red;background:#A599FF;">
                        <div style="height:<?php echo $perFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius: 50%;background-color: #FFFF36;padding: 5px;font-size:13px;<?php if($perFA1<25) echo "margin-top:-20px;";?>"><?php echo $obtainFA1?></div>
                        </div>
                    </div>
                    <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?>
                    </td><td width="17%" bgcolor="#F9EEE3">
                   <div style="height:120px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgSectionFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;font-size:13px;<?php if($avgSectionFA1<25) echo "margin-top:-20px;";?>"><?php echo $avgSectionFA1sem; ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:120px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgMAXSectionFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius: 50%;background-color: #FF5757; color:#fff; padding: 5px;font-size:13px;<?php if($avgMAXSectionFA1<25) echo "margin-top:-20px;";?>"><?php echo $avgMAXSectionFA1sem ?></div>
                        </div>
                    </div>
                    <?php }?>
                    </td><td width="15%" style="background:#fff;border-top: none;"></td></tr></table>
                    </td>
                    <td width="40%">
                    <table class="table_per" width="100%" cellpadding="0" cellspacing="0">
                    <tr><td width="17%" bgcolor="#B9B9B9">
                     <div style="height:120px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $avgFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;font-size:13px;<?php if($avgFA2<20) echo "margin-top:-22px;";?>"><?php echo $avgFA2sem; ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#B9B9B9">
                     <div style="height:120px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $avgMAXFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius:50%;background-color:#FF5757;color:#fff;padding: 5px;font-size:13px;<?php if($avgMAXFA2<20) echo "margin-top:-22px;";?>"><?php echo $avgMAXFA2sem ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:120px; position:relative;border-right:1px solid red;background:#A599FF;">
                        <div style="height:<?php echo $perFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius: 50%;background-color: #FFFF36;padding: 5px;font-size:13px;<?php if($perFA2<20) echo "margin-top:-22px;";?>"><?php echo $obtainFA2?></div>
                        </div>
                    </div>
                    <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:120px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgSectionFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;font-size:13px;<?php if($avgSectionFA2<20) echo "margin-top:-22px;";?>"><?php echo $avgSectionFA2sem; ?></div>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                     <div style="height:120px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgMAXSectionFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<div style="border-radius: 50%;background-color: #FF5757; color:#fff; padding: 5px;font-size:13px;<?php if($avgMAXSectionFA2<20) echo "margin-top:-22px;";?>"><?php echo $avgMAXSectionFA2sem ?></div>
                        </div>
                    </div>
                    <?php }?>
                    </td></tr></table>
                    </td>
                    </tr>
                    <?php
                    /*
					$obtainMainClassFA1=0;$totalAllClassFA1=0;$AvgAllClassFA1=0;$obtainAllClassFA1=0;$obtainSectionClassFA1=0;
					$obtainMainClassFA2=0;$totalAllClassFA2=0;$AvgAllClassFA2=0;$obtainAllClassFA2=0;$obtainSectionClassFA2=0;*/
				}
				?>
                <!--<tr>
                <td class="sub" style="border-right:3px solid #000;width:100px;font-size:15px;VERTICAL-align:middle;text-align:center;color:#F00">Total</td>
                <td>
                <?php 
				//value for the FA1
				$AvgAllClassFA1=$obtainAllClassFA1/count($student);
				$graAllClassFA1=round(($AvgAllClassFA1*100)/$totalAllClassFA1);
				$obtainMainClassAllFA1=round(($obtainMainClassFA1*100)/$totalAllClassFA1);
				$maxallTotalFA1=max($sumSuballFA1);
				$maxsectionTotalFA1=max($sumSuballSectionFA1);
				$avgMAXFA1=round(($maxallTotalFA1*100)/$totalAllClassFA1);
				$avgMAXSectionFA1=round(($maxsectionTotalFA1*100)/$totalAllClassFA1);
				
				$avgSectionFA1=round(($obtainSectionClassFA1/count($studentSection)*100)/$totalAllClassFA1);
				
				foreach($examgrade as $grade){
					if($graAllClassFA1>=$grade["minrange"] && $graAllClassFA1<=$grade["maxrange"])
						$agAllClassFA1=$grade["grade"];
					if($obtainMainClassAllFA1>=$grade["minrange"] && $obtainMainClassAllFA1<=$grade["maxrange"])
						$obtainMainClassAllgrFA1=$grade["grade"];
					if($avgMAXFA1>=$grade["minrange"] && $avgMAXFA1<=$grade["maxrange"])
						$avMAXgradeFA1=$grade["grade"];
					if($avgMAXSectionFA1>=$grade["minrange"] && $avgMAXSectionFA1<=$grade["maxrange"])
						$avMAXgradeSectionFA1=$grade["grade"];
					if($avgSectionFA1>=$grade["minrange"] && $avgSectionFA1<=$grade["maxrange"])
						$avgradeSectionFA1=$grade["grade"];
				}
				//value for the FA2
				$AvgAllClassFA2=$obtainAllClassFA2/count($student);
				$graAllClassFA2=round(($AvgAllClassFA2*100)/$totalAllClassFA2);
				$obtainMainClassAllFA2=round(($obtainMainClassFA2*100)/$totalAllClassFA2);
				$maxallTotalFA2=max($sumSuballFA2);
				$maxsectionTotalFA2=max($sumSuballSectionFA2);
				$avgMAXFA2=round(($maxallTotalFA2*100)/$totalAllClassFA2);
				$avgMAXSectionFA2=round(($maxsectionTotalFA2*100)/$totalAllClassFA2);
				
				$avgSectionFA2=round(($obtainSectionClassFA2/count($studentSection)*100)/$totalAllClassFA2);
				
				foreach($examgrade as $grade){
					if($graAllClassFA2>=$grade["minrange"] && $graAllClassFA2<=$grade["maxrange"])
						$agAllClassFA2=$grade["grade"];
					if($obtainMainClassAllFA2>=$grade["minrange"] && $obtainMainClassAllFA2<=$grade["maxrange"])
						$obtainMainClassAllgrFA2=$grade["grade"];
					if($avgMAXFA2>=$grade["minrange"] && $avgMAXFA2<=$grade["maxrange"])
						$avMAXgradeFA2=$grade["grade"];
					if($avgMAXSectionFA2>=$grade["minrange"] && $avgMAXSectionFA2<=$grade["maxrange"])
						$avMAXgradeSectionFA2=$grade["grade"];
					if($avgSectionFA2>=$grade["minrange"] && $avgSectionFA2<=$grade["maxrange"])
						$avgradeSectionFA2=$grade["grade"];
				}
				
				 ?>
                <table class="table_per" width="100%" cellpadding="0" cellspacing="0">
                  <tr><td width="17%" bgcolor="#fff">
                   <div style="height:90px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $graAllClassFA1 ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;"><?php echo $agAllClassFA1; ?></span>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#B9B9B9">
                    <div style="height:90px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $avgMAXFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #060; color:#fff; padding: 5px;"><?php echo $avMAXgradeFA1 ?></span>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:90px; position:relative;border-right:1px solid red;background:#A599FF;">
                        <div style="height:<?php echo $obtainMainClassAllFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #FFFF36;padding: 5px;"><?php echo $obtainMainClassAllgrFA1; ?></span>
                        </div>
                    </div>
                    <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?>
                    </td><td width="17%" bgcolor="#F9EEE3">
                     <div style="height:85px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgSectionFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;"><?php echo $avgradeSectionFA1; ?></span>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                     <div style="height:85px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgMAXSectionFA1; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #060; color:#fff; padding: 5px;"><?php echo $avMAXgradeSectionFA1 ?></span>
                        </div>
                    </div>
                    <?php }?>
                    </td><td width="15%" style="background:#fff;border-top: none;"></td></tr></table>
                </td>
                <td><table class="table_per" width="100%" cellpadding="0" cellspacing="0">
                  <tr><td width="17%" bgcolor="#fff">
                   <div style="height:90px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $graAllClassFA2 ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;"><?php echo $agAllClassFA2; ?></span>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#B9B9B9">
                    <div style="height:90px; position:relative;border-right:1px solid red;background:#E0DEFF;">
                        <div style="height:<?php echo $avgMAXFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #060; color:#fff; padding: 5px;"><?php echo $avMAXgradeFA2 ?></span>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                   <div style="height:90px; position:relative;border-right:1px solid red;background:#A599FF;">
                        <div style="height:<?php echo $obtainMainClassAllFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #FFFF36;padding: 5px;"><?php echo $obtainMainClassAllgrFA2; ?></span>
                        </div>
                    </div>
                    <?php if(isset($_GET["section"]) && $_GET["section"]!=""){?>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:85px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgSectionFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #000; color:#fff; padding: 5px;"><?php echo $avgradeSectionFA2; ?></span>
                        </div>
                    </div>
                    </td><td width="17%" bgcolor="#F9EEE3">
                    <div style="height:85px; position:relative;border-right:1px solid red;background:#FFDEFA;">
                        <div style="height:<?php echo $avgMAXSectionFA2; ?>%;position: absolute;bottom: 0;left: 10%;">
                        	<span style="border-radius: 50%;background-color: #060; color:#fff; padding: 5px;"><?php echo $avMAXgradeSectionFA2 ?></span>
                        </div>
                    </div>
                    <?php }?>
                    </td></tr></table></td>
                </tr>-->
                <tr style="border-top:3px solid #000;text-align:center">
               		 <td class="sub"></td>
                    
                    <th style="border-top: 3px solid #000;font-size: 15px;color: #0CA518;">1st Semester</th>
                    <th style="border-top: 3px solid #000;font-size: 15px;color: #0CA518;">2nd Semester</th>
               </tr>
                
                <?php
				$obtainMainClassFA1=0;$totalAllClassFA1=0;$AvgAllClassFA1=0;$obtainAllClassFA1=0;$obtainSectionClassFA1=0;
				$obtainMainClassFA2=0;$totalAllClassFA2=0;$AvgAllClassFA2=0;$obtainAllClassFA2=0;$obtainSectionClassFA2=0;
			}
			?></table></div></div><?php
		}
		
	}
	
}
?>
</div>
</div></div>
<!-- / Forms -->
<script>
function minMaxId(selector,type,output) {
    var min=null, max=null;
	prices = []
    $(selector).each(function() {
        var price = parseFloat($(this).html());
    	prices.push(price);
    });
    if(type=='min')
        $(output).html(Math.min.apply(Math,prices));
    else
        $(output).html(Math.max.apply(Math,prices));
}
</script>
<style>
.topbar{border-top: 3px solid #0808DE;}
.mid {
  text-align: center;
  display: inherit;
}
.maxi {
  float: right;
  text-align: right;
  color: #0A980F;
  font-weight: 800;
}
.maxi1{
	float:right;
}
.mini {
  float: left;
  text-align: left;
}
.tmark, .tmarkTot {
  width: 100%;
  display: block;
  text-align: center;
  margin-bottom: 5px;
}
table.nnnn table td {
  padding: 5px 2px;
}
table.nnnn, table.nnnn table{
	width:100% !important;
}
.topbar .leftpoint{
	float: left;
    width: 12px;
    background: #0EFFDB;
    margin-top: -8px;
    border-radius: 10px;
}
.topbar .rightpoint{
	float: right;
    width: 12px;
    background: #FF0EE4;
    margin-top: -8px;
    margin-bottom: 20px;
    border-radius: 10px;
}
.topbar .midpoint{
	width: 5px;
    background: #000000;
    margin: -8px 0px 0px 52px;
   }
ul li .leftpoint{
	float: left;
    width: 18px;
    background: #0EFFDB;
    border-radius: 10px;
}
ul li .rightpoint{
	width: 18px;
    background: #FF0EE4;
    border-radius: 10px;
    float: left;
}
ul li .midpoint{
	width: 5px;
    background: #000;
    border-radius: 10px;
    float: left
}
.progress .leftpoint{
	float: left;
    width: 12px;
    background: #0EFFDB;
    border-radius: 10px;
	margin-top: -1px;
}
.progress .rightpoint{
	width: 12px;
    background: #FF0EE4;
    border-radius: 10px;
    float: left;
	margin-top:-11px;
    margin-left: 70px;
}
.barn2{position: absolute !important;float: left;height:15px !important;}
.table_per td{border-top: 2px solid red;font-size:12px;color: blue;font-weight: 800;text-align:center;}
.table_per .sub{border-top: none;}
</style>