<?php require "_header.php";?>
<script language="javascript" type="text/javascript">
</script>
<style type="text/css">
	.attendance-table-report{
		font-family:Verdana, Geneva, sans-serif;
		font-size:12px;
		text-align:left;
		border-right:0px none;
		border-bottom:0px none;
	}
	.attendance-table-report tr{
		padding:0px 0px 0px 0px;
	}
	.attendance-table-report td{
		padding:5px;
		border-top:0px none;
		border-left:0px none;
	}
	.attendance-table-report th{
		padding:5px;
		font-weight:bold;
		text-align:left;
		border-top:0px none;
		border-left:0px none;
	}
</style>
<div id="main-report">
	<?php
	$condition1 = "";
	if($_REQUEST['day_date'] == "")
	{
		?>
		<script language="javascript" type="text/javascript">
			location.href='report-attendence-list.php';
		</script>
		<?php
	}
	elseif($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId']))
	{
		ob_start();
		$branch_id 		 = Escape($_REQUEST['branch_hidden']);
		$semester_id	   = Escape($_REQUEST['semester_hidden']);
		$year_id		= Escape($_REQUEST['year_hidden']);
		$branchyear_id		= Escape($_REQUEST['branchyear_hidden']);
		$branch_disp 	   = Escape($_REQUEST['branch_disp']);
		$semester_disp 	 = Escape($_REQUEST['semester_disp']);
		$date		  = Escape($_REQUEST['day_date']);
    
    if($_REQUEST["branch_hidden"]!="" && $_REQUEST["branch_hidden"]!=0){
			$condition1 .= " and branch_id= '".Escape($_REQUEST["branch_hidden"])."'";
		}
		?>
		<center><h4>Student Unfilled Attendance Detail</h4></center>
		<div>
			<div class="left"><b>Date</b> : <?php echo $_REQUEST['day_date'] ;?></div>
		</div>
		<?php
		  $objBranchMgmt = new BranchMgmt();	
		  $res_query = $objBranchMgmt->getAllRecords(0,0,$condition1,$order_field=' branch_name',$order_type=' ASC');
		  if(dbRows($res_query) > 0)
		  {
		  	while($rowBatch = dbArray($res_query)){
				?>
				  <table border="1" class="attendance-table-report" cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<th colspan="6" width="100%" style="text-align:center; background-color:skyblue;">Branch : <?php echo $rowBatch['branch_name']; ?></th>
					</tr>
					<tr style="text-align:center; background-color:#CEF6F5;">
						<th width="5%" style="text-align:center;">Sr</th>
						<th width="8%" style="text-align:center;">Course</th>
						<th width="5%" style="text-align:center;">Batch Year</th>
						<th width="5%" style="text-align:center;">Course name</th>
						<th width="8%" style="text-align:center;">Semester</th>
					
						<th width="6%" style="text-align:center;">Lecture</th>
					</tr>
				<?php
				$objPresentMasterMgmt = new PresentMasterMgmt();
				
				$condition = " AND pm.branch_id = ".$rowBatch['branch_id'];
		
				if($_REQUEST["year_hidden"]!="" && $_REQUEST["year_hidden"]!=0){
					$condition.= " and pm.year_id= '".Escape($_REQUEST["year_hidden"])."'";
				}
				
				if($_REQUEST["branchyear_hidden"]!="" && $_REQUEST["branchyear_hidden"]!=0){
					$condition.= " and pm.branchyear_id= '".Escape($_REQUEST["branchyear_hidden"])."'";
				}
				
				if($_REQUEST["semester_hidden"]!="" && $_REQUEST["semester_hidden"]!=0){
					$condition.= " and pm.semester_id= '".Escape($_REQUEST["semester_hidden"])."'";
				}
				
			
				
				$order_field = " pm.branch_id,  lec_id";
				$order_type = " ASC ";
				$j=0;
				$rs = $objPresentMasterMgmt->getAllabsentData($limit,$start,$condition,$order_field,$order_type);
				$total=dbRows($rs);
				$HeadData = array("count" => $total, "data" => array());
				if(dbRows($rs) > 0){
					while($row = dbArray($rs)){
						
						
						
							
							$branch_id = $row["branch_id"];
							$year_id = $row["year_id"];
							$branchyear_id = $row["branchyear_id"];
							$semester_id = $row["semester_id"];
							$lec_id = $row["lec_id"];
							$getDate = $date;
							
							
								//echo "AAAAAA ";
								$temparray["branch_name"]    = $row["branch_name"];
					      $temparray["semester_name"]  = $row["semester_name"];
					      $temparray["year_name"]         =$row["year_name"];
						  $temparray["branchyear_name"]         =$row["branchyear_name"];
					      $temparray["lec_name"]       = $row["lec_name"];
					      ?>
				        <tr>
									<td style="text-align:center;"><?php echo $j + 1; ?></td>
									<td style="text-align:center;"><?php echo $temparray["branch_name"]; ?></td>
									<td style="text-align:center;"><?php echo $temparray["year_name"]; ?></td>
									<td style="text-align:center;"><?php echo $temparray["branchyear_name"]; ?></td>
									<td style="text-align:center;"><?php echo $temparray["semester_name"]; ?></td>
									
									<td style="text-align:center;"><?php echo $temparray["lec_name"]; ?></td>
							  </tr>
					      <?php
								$j++;
							
						}
					
				}
				
				if($j == 0)
				{
					?>
					<tr>
						<td colspan='5' style="text-align:center;"><b style="color:red;"><?php echo $rowBatch['branch_name'].' Attendance Done'; ?></b></td>
				  </tr>
				  <?php
				}
				?>
					<br><br>
				<?php
		  }
	  }
		?>
    </table>
    <?php
		}
		$HtmlCode = ob_get_contents();
		ob_end_flush();
		$header_row_string="";
		$HtmlUrl = "unfilled-attendancelist-report.html";
		$HtmlPath =	"report/".$HtmlUrl;
		createHTMLReportPage($header_row_string,$HtmlUrl,$HtmlPath,$HtmlCode,false);
		?>
		<br/>
		<form name="frm" id="frm" action="" method="post">
			<input type="hidden"   name="txtFile" id="txtFile" value="<?php echo $HtmlUrl ;?>" />
			<input type="button"  name="btnPrint" id="btnPrint" value="Print" onClick="SetPageAction('PRINT');"/>
			<input type="button"  name="btnPdf" id="btnPdf" value="Create PDF" onClick="SetPageAction('PDF');"/>
			<input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onClick="SetPageAction('HTML');"/>
			<input type="button" name="btnWord" id="btnWord" value="Create WORD" onClick="SetPageAction('WORD');"/>
			<input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onClick="SetPageAction('Excel');"/>
		</form>
		<script language="javascript" type="text/javascript">
			function SetPageAction(varAction) {
				if(varAction=="PRINT"){
					document.frm.action="print/create-print.php";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if(varAction=="PDF"){
					document.frm.action="convertpdf/create-pdf.php";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if(varAction=="HTML"){
					document.frm.action="<?php echo $HtmlPath ;?>";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if(varAction=="WORD"){
					document.frm.action="convertword/create-word.php";
					document.frm.target="_blank";
					document.frm.submit();
				}
				else if(varAction=="Excel"){
					document.frm.action="convertword/create-excel.php";
					document.frm.target="_blank";
					document.frm.submit();
				}
			}
		</script>
	</div>
	<?php
	require "_footer.php";
	?>
