MOON
Server: Apache
System: Linux 54-179-220-51.cprapid.com 3.10.0-1160.144.1.el7.tuxcare.els4.x86_64 #1 SMP Tue Apr 7 08:40:40 UTC 2026 x86_64
User: thehunarfound (1001)
PHP: 7.4.29
Disabled: NONE
Upload Files
File: /home/thehunarfound/www/sms/formative-assesment-report.php_
 <?php
include('lib/config.php');
$batch=$db->GetSingleRecord("Select batch from course where id ='".$_GET['id']."'");
$campus=$db->GetSingleRecord("Select campus from course where id ='".$_GET['id']."'");
$student_name=$db->GetSingleRecord("Select student_name from attendance where s_id ='".$_GET['id']."'");
$enrollment_no=$db->GetSingleRecord("Select attendance from attendance  where s_id ='".$_GET['id']."'");

?>
<script>
function doSingleDelete(did)
	{
		
		if(confirm("Are you sure you want to delete"))
		{
			
			location.href='<?php 'course-plan-report.php'; ?>?DID='+did;
		}
		
	}
</script>
  <!DOCTYPE html>
<html lang="en">

   <head>
      <!-- head scripts -->
      <?php include('includes/head-scripts.php')?>
   </head>
   
   
   <body>
      <div id="sb-site">
	  
	     <!-- chat sidebar -->
         <?php include('includes/chat-drawer.php')?>
		 
         <div id="loading">
            <div class="svg-icon-loader">
			  <img src="https://agileui.com/demo/delight/assets/images/svg-loaders/bars.svg" width="40" alt=""></div>
         </div>
	 <!-- page-wrapper -->
         <div id="page-wrapper">
            <div id="mobile-navigation"><button id="nav-toggle" class="collapsed" data-toggle="collapse" data-target="#page-sidebar"><span></span></button>
            </div>
			<!-- Left NAV  -->
            <?php include('includes/sidebar.php'); ?>
		<!-- Right Content Area  -->
            <div id="page-content-wrapper">
               <div id="page-content">
			    <!-- Header -->
			      <?php include('includes/header.php'); ?>
				 <!-- initial query --->
                  <div id="page-title">
                     <h2>Program Information</h2>
                  </div>
				      
				  <!-- /initial query --->
				  
								 
								     
				        <div class="panel">
                     <div class="panel-body">
											  <div class="example-box-wrapper">	
																 <div id="datatable-responsive_wrapper" class="dataTables_wrapper form-inline">
								<div class="row">
								   <div class="col-sm-6">
									  <div class="dataTables_length" id="datatable-responsive_length">
										 <label>
											<select name="datatable-responsive_length" aria-controls="datatable-responsive" class="form-control">
											   <option value="10">10</option>
											   <option value="25">25</option>
											   <option value="50">50</option>
											   <option value="100">100</option>
											</select>
											records per page
	  <form class="form-horizontal" action="" method="post" name="upload_excel" enctype="multipart/form-data">
			 <input type="submit" name="Export" class="btn btn-lg btn-primary srhBTN" value="Download Excel File"/>
			</form>
<!-- <button type="submit" class="btn btn-lg btn-primary srhBTN">Download Excel File</button>										 -->
											</label>
									  </div>
								   </div>
								   <div class="col-sm-6">
										 
										</div>
										 <br />
 <form  method="get">

<div id="datatable-responsive_filter" class="dataTables_filter">
	<label>
		<input type="hidden" name="id" value="<?=$_GET['id']?>">
<input type="search" class="form-control" placeholder="Search by Trade and Student name" name="search" aria-controls="datatable-responsive">
	<button type="submit" class="btn btn-lg btn-primary srhBTN">Search</button>
 </form>
									  </label>
										</div>
								   </div>
								</div>
										<table id="datatable-responsive" class="table table-striped table-bordered responsive no-wrap dataTable dtr-inline" cellspacing="0" width="100%" role="grid" aria-describedby="datatable-responsive_info" style="width: 100%;">
								   <thead>
										 <tr class="dem2">
											  <th  style="background:white;" colspan="8" ></th>
											  <th class="thead-color" style="text-align:center; background: #1c6571; color:white;" tabindex="0" aria-controls="datatable-responsive" colspan="2" >COMMULATIVE</th>
										 </tr>
										 <tr>
											 <td colspan="8" class="text-right">Working Days. >></td>
											 <td colspan="2" class="text-right"</td>
						         </tr>
									  <tr role="row"  class="thead-color">
										  <th  class="" tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1" >SNo.</th>
										  <th style="width:210px;" class="" tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1">Registration No.</th>
										  <th	class="" tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1" >Student Name</th>
										 	<th style="width:117px;" class="" tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1" >Trade</th>
											<th class="" tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1" >Shift</th>
											<th style="width:136px;" class="" tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1" >Sponsor1</th>
												<th style="width:136px;" class="" tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1" >Sponsor2</th>
											<th   tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1">Status</th>
										  <th  tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1">P</th>
											<th  tabindex="0" aria-controls="datatable-responsive" rowspan="1" colspan="1">%</th>
										 </tr>
								   </thead>
									<tbody>
										                                                                                                                                                                                                                                                   
								<?php		
		$numrows = $db->GetSingleRecord("SELECT COUNT(*) from Students s INNER JOIN enrollment_report er ON s.form_no = er.form_no 
		INNER JOIN interview_data intd ON intd.form_no = s.form_no where s.campus='".$campus."' AND 
		s.batch_no ='".$batch."' AND (s.trade like '%".$_GET['search']."%' OR s.Student_name like '%".$_GET['search']."%')");
		// number of rows to show per page
		$rowsperpage = 10;
		// find out total pages
		$totalpages = ceil($numrows / $rowsperpage);
		// get the current page or set a default
		if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
			 // cast var as int
			 $currentpage = (int) $_GET['currentpage'];
		} else {
			 // default page num
			 $currentpage = 1;
		} // end if
		// if current page is greater than total pages...
		if ($currentpage > $totalpages) {
			 // set current page to last page
			 $currentpage = $totalpages;
		} // end if
		// if current page is less than first page...
		if ($currentpage < 1) {
			 // set current page to first page
			 $currentpage = 1;
		} // end if

		// the offset of the list, based on current page 
		$offset = ($currentpage - 1) * $rowsperpage;
										
								$sql =  "SELECT er.`enrollment_no`, s.`Student_name`,s.`trade`, intd.`sel_shift` ,s.`sponsor_name1`,s.`sponsor_name2`, s.`fee_status`, s.`form_no` from Students s INNER JOIN enrollment_report er ON s.form_no = er.form_no INNER JOIN interview_data intd ON intd.form_no = s.form_no where campus='".$campus."' AND s.batch_no ='".$batch."' AND (s.Student_name like '%".$_GET['search']."%' OR s.trade like '%".$_GET['search']."%') order by s.id DESC LIMIT ".$offset.", ".$rowsperpage;
								$res = $db->ExecuteQuery($sql);
// 										echo $student_name;
										$sno=0;
								while(list($enrollment_no,$Student_name,$trade,$sel_shift,$sponsor_name1,$sponsor_name2,$fee_status,$form_no) = $res->FetchAsArray())
									{ 
										 ?>
										<tr role="row" class="odd">
										<td class=""><?=$sno+=1;?></td>
										<td class=""><?=$enrollment_no?></td>
										<td class=""><?=$Student_name?></td>
										<td class=""><?=$trade?></td>
										<td class=""><?=$sel_shift?></td>
										<td class=""><?=$sponsor_name1?></td>
										<td class=""><?=$sponsor_name2?></td>
										<td class="" ><?php if($fee_status == 0){ echo 'Inactive';} else { echo 'active';}?></td>
										<?php
											$pnum = 0;
											$anum = 0;
											$sqll="SELECT student_name,enroll_num,attendance,num,attendance_date,form_no FROM attendance where form_no ='".$form_no."'";
											$ress = $db->ExecuteQuery($sqll);
											while(list($student_name,$enroll_num,$attendance,$num,$attendance_date,$form_no) = $ress->FetchAsArray()){
												$attendances = explode(",",$attendance);
												$attendance_dates = explode(",",$attendance_date);
												foreach($attendances as $at){
													if($at == "P"){
														$pnum++;
													}
													if($at == "A"){
														$anum++;
													}
												}
											}
										?>
										<td class="" ><?=$pnum?></td>
										<td class="" ><?=round(($pnum/($pnum+$anum))*100)?></td>
								
									  </tr>
										 <?php } ?>	
									</tbody>
								</table>
																	 	<div class="row"><br>
								   <div class="col-sm-6">
									  <div class="dataTables_info" aria-live="polite">Showing <?=$offset+1?> to <?php if($currentpage == $totalpages) { echo $numrows; }else{ echo $currentpage*$rowsperpage; }?> of <?=$numrows?> entries</div>
								   </div>
								   
								   <div class="col-sm-6">
									  <div class="dataTables_paginate paging_bootstrap" id="datatable-responsive_paginate">
										 <ul class="pagination">
											 <?php
											 $range = 3;
											// if not on page 1, don't show back links
											if ($currentpage > 1) {
												 $prevpage = $currentpage - 1;
											 ?>
											<li class="previous"><a href="<?php echo $_SERVER['SCRIPT_URI'].'?currentpage.='.$prevpage; ?>">Previous</a></li>
											 <?php }else{ ?>
											<li class="previous disabled"><a href="<?php echo $_SERVER['SCRIPT_URI'].'?currentpage.=1'; ?>">Previous</a></li>
											 <?php }
											 // loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
	// if it's a valid page number...
   if (($x > 0) && ($x <= $totalpages)) {
      // if we're on current page...
      if ($x == $currentpage) {
         // 'highlight' it but don't make a link
         echo '<li class="active"><a href="javascript:void(0);">'.$x.'</a></li>';
      // if not current page...
      } else {
         // make it a link
         echo '<li><a href="'.$_SERVER['SCRIPT_URI'].'?currentpage='.$x.'">'.$x.'</a></li>';
      } // end else
   } // end if 
} // end f
											 // if not on last page, show forward and last page links        
if ($currentpage != $totalpages) {
   // get next page
   $nextpage = $currentpage + 1;
    // echo forward link for next page 
   echo "<li class='next'><a href='".$_SERVER['SCRIPT_URI']."?currentpage=".$nextpage."'>Next</a></li>";
   // echo forward link for lastpage
   //echo " <a href='".$_SERVER['SCRIPT_URI']."?currentpage=".$totalpages."'>>></a> ";
} // end if
											 ?>
										 </ul>
									  </div>
								   </div>
								</div>
							
											 </div>
  								 </div>
               </div>
				 	</div>
			<!-- Right Content Area  -->
			 </div>
			
		 <!-- page-wrapper -->
		 
		 
		 <!-- foot Scripts -->
         <?php include('includes/foot-scripts.php')?>
		 
		 
      </div>
   </body>
</html>