<?php require "_header.php";?>
<script language="javascript" type="text/javascript">
document.getElementById("main-content").style.display = 'none';
</script>
<style type="text/css">
	.table-report{
		font-family:Verdana, Geneva, sans-serif;
		font-size:12px;
		text-align:left;
		border-right:0px none;
		border-bottom:0px none;
	}
	.table-report-inner{
		font-family:Verdana, Geneva, sans-serif;
		font-size:12px;
	}
	.table-report tr{
		padding:2px 2px 2px 2px;
	}
	.table-report td{
		padding:2px 2px 2px 2px;
		border-top:0px none;
		border-left:0px none;
	}
	.table-report th{
		padding:2px 2px 2px 2px;
		font-weight:bold;
		text-align:left;
		border-top:0px none;
		border-left:0px none;
	}	
	.college_name{
		font-family:QTAbbie;
		font-size:22px;	
		font-weight:bold;
		padding:2px 2px 2px 2px;
		text-align:center;
	}
	.college_address{
		font-family:Tahoma, Geneva, sans-serif;
		font-size:11px;	
		text-align:center;
		padding:2px 2px 2px 2px;
	}
	.break { page-break-before: always; }
</style>
<div id="main-report">
<?php
if($_REQUEST['inquiry_startdate'] == "" && $_REQUEST['inquiry_enddate'] == "")
{
?>
	<script language="javascript" type="text/javascript">
		location.href='view_inquiry_form';
	</script>
<?php
}
elseif($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])) 
{ 
	ob_start();
	$inquiry_startdate 		= Escape($_REQUEST['inquiry_startdate']);
	$inquiry_enddate	  = Escape($_REQUEST['inquiry_enddate']);
	
	//echo $inquiry_startdate;
//	echo $inquiry_enddate;

	
	
	$order_by = $_REQUEST['hid_orderby'];
	$SQL_CONDITION  = "";
	
	$SQL_STUDENT = "
		SELECT 
			si.*,
			branch.branch_name
		FROM
			cms_studentmasterinquiry si,
			
			cms_branchmaster branch
		WHERE 
			
			si.branch_id = branch.branch_id ";
	
	
/*	if($semester_id != "" && $semester_id != "undefined"){
		$SQL_CONDITION .= " AND sd.cur_semesterid = ".$semester_id;
	}
	
*/	
	
	$SQL_CONDITION .= " ORDER BY si.student_inquiry_id ";
	
	
	
	if($SQL_CONDITION != ""){
		$SQL_STUDENT .= $SQL_CONDITION;
	}
	/*echo $SQL_STUDENT;
	exit;*/
	$RES_STUDENT = dbQuery($SQL_STUDENT);
	
	if(dbRows($RES_STUDENT)>0){?>
		<div class="college_name"><?php echo $_SESSION["VedantnrCollegeName"]; ?></div>
                    <div class="college_address"><?php echo $_SESSION["VedantnrCollegeAddress"]; ?></div>
                    <div class="college_address">
                        Web Site: <?php echo $_SESSION["VedantnrCollegeUrl"] ;?> 
                        &nbsp;&nbsp; 
                        Email: <?php echo $_SESSION["VedantnrCollegeEmail"] ;?> 
                        &nbsp;&nbsp; 
                        Phone: <?php echo $_SESSION["VedantnrCollegePhone"] ;?> 
        </div>
		
        <center><h4>Student Inquiry List</h4></center>
       
		<table class="table-report" border="1" cellpadding="0" cellspacing="0" width="100%">
        <tr>
        	<th style="text-align:center;" width="5%">Sr</th>
            <th style="text-align:center;" width="10%">Inquiry Date</th>
            <th style="text-align:center;" width="10%">Branch</th>
			<th style="text-align:center;" width="19%">Student Name</th>
            <th style="text-align:center;" width="13%">Address</th>
            <th style="text-align:center;"   width="7%">Phone</th>
            <th style="text-align:center;" width="5%">Birth Date</th>
            <th style="text-align:center;" width="10%" >Twelve Percentage</th>
            <th style="text-align:center;" width="10%">Gujcet Percentage</th>
            <th style="text-align:center;" width="5%">JEE Percentage</th>
			<th style="text-align:center;" width="5%">Reference</th>
			<th style="text-align:center;" width="5%">Forward To</th>
			
		
        </tr>
		<?php
		$i = 1;
		$temp = "";
		$temp1="";
		$temp2="";
		while($REC_STUDENT = dbArray($RES_STUDENT)){
		
		

		
				if((date('Y-m-d',strtotime($REC_STUDENT['createdon'])) >= $inquiry_startdate) && (date('Y-m-d',strtotime($REC_STUDENT['createdon'])) <= $inquiry_enddate))
				{	
			?>
            <tr>
			
				<td style="text-align:center;">&nbsp;<?php echo $i++; ?></td> 
                <td style="text-align:center;">&nbsp;<?php echo date('d-m-Y H:i:s',strtotime($REC_STUDENT['createdon'])) ?></td>
                <td style="text-align:center;">&nbsp;<?php 
				$cats = explode(',', $REC_STUDENT['branch_id'] );
				foreach($cats as $cat) {
				if($cat == 1)
				{
					echo 'Civil , ';
				}
				if($cat == 2)
				{
					echo 'Computer , ';
				}
				if($cat == 3)
				{
					echo 'Electrical , 	';
				}
				if($cat == 4)
				{
					echo 'E.C , ';
				}
				if($cat == 5)
				{
					echo 'Mechanical , ';
				}
				
				if($cat == 7)
				{
					echo 'M.C.A , ';
				}
				}
				?></td>
				<td style="text-align:left;">&nbsp;<?php echo $REC_STUDENT['student_surname'].' '.$REC_STUDENT['student_firstname'].' '.$REC_STUDENT['student_lastname']; ?></td>
                <!--<td style="text-align:center;">&nbsp;<?php //echo $REC_STUDENT['student_gender']; ?></td>-->
                <td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['student_address']; ?></td>
                <td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['student_phoneo'].' '.$REC_STUDENT['student_phoner']; ?></td>
                <td><?php echo date("d-m-Y",strtotime($REC_STUDENT['student_birthdate'])); ?></td>
                <td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['twle_percentage']; ?></td>
				<td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['gujcet_percentage']; ?></td>
				<td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['jee_percentage']; ?></td>
				<td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['reference']; ?></td>
				 
				<td><a href="edit_inquiry.php?student_inquiry_id=<?php echo $REC_STUDENT['student_inquiry_id'];?>">Forward To</a></td>
				
				
				
       		</tr>
       			<?php
				}
		}
		?>
	<!--	<tr>
                    <td colspan="9" >
                    <table class="table-report-footer" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td align="left" style="border:solid 0px red; padding:0px;" width="70%">Created by <b><?php echo $_SESSION["VedantnrUserName"]; ?></b> </td>
                            <td align="right" style="border:solid 0px red; padding:0px;" width="30%">Developed By <b>Aum Imagineering Pvt.Ltd.</b></td>
                        </tr>
                    </table>
                    </td>        
					</tr>                           
		-->	
		</table>
		<?php
	}
	else{
		echo "NO DATA FOUND!";	
	}
	
?>

<?php
	$HtmlCode = ob_get_contents();
	ob_end_flush();
	$header_row_string="";
	$HtmlUrl = "studentlist-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>
<?php } ?>
</div>
<?php 
	require "_footer.php";
?>
