<?php require "_header.php"; ?>
<script language="javascript" type="text/javascript">
document.getElementById("main-content").style.display = 'none';
</script>
<div id="main-report" align="center">
<style>
	.table-report{
		font-family:Verdana, Geneva, sans-serif;
		font-size:11px;
		text-align:left;
		border-right:0px none;
		border-bottom:0px none;
	}
	.table-report-inner{
		font-family:Verdana, Geneva, sans-serif;
		font-size:11px;
	}
	.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:26px;	
		font-weight:bold;
		padding:2px 2px 2px 2px;
		text-align:center;
		height: 30px;
	}
	.college_address{
		font-family:Tahoma, Geneva, sans-serif;
		font-size:14px;	
		text-align:center;
		padding:2px 2px 2px 2px;
		height: 16px;
	}
	.report_name{
		font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
		font-size:13px;	
		background-color:#CCC;
		text-align:center;
		font-weight:bold;
		padding:2px 2px 2px 2px;
	}
li{
	padding-bottom:5px;
}
</style>
<?php 
	//$header_row_string="Present Notice Report";
	
	$type 		   = Escape($_REQUEST['report_type']);
	$branch_id 	  = Escape($_REQUEST['branch_hidden']);
	$semester_id 	= Escape($_REQUEST['semester_hidden']);
	$div_id		 = Escape($_REQUEST['division_id']);
	$student_id 	 = Escape($_REQUEST['student_hidden']); 
	$batch_id 	   = Escape($_REQUEST['batch_idhidden']);
	$branch_name    = Escape($_REQUEST['branch_disp']);
	$semester_name  = Escape($_REQUEST['semester_disp']);
	
	$date 		   = Escape($_REQUEST['date']); 
	$refno 		  = Escape($_REQUEST['refno']);
	$subject		= $_REQUEST['subject'];
	$signature 	  = Escape($_REQUEST['signature']);
	$content 	    = $_REQUEST['content'];
	
	
		 
	if($branch_id == "" && $semester_id == ""){?>
		<script language="javascript" type="text/javascript">
			location.href='report-custom-letter.php';
		</script><?php
	}
	elseif($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])){
		ob_start();
		$i=1;
		
		dbquery("SET group_concat_max_len = 102400");
	

		/* START STUDENT CODE */
		$sql_student = "
					SELECT
						sm.student_id,
						CONCAT(sm.student_surname,' ',sm.student_firstname,' ',sm.student_lastname) AS student_name,
						sd.batch_id,
						student_address,
						student_pincode,
						student_gturegno
					FROM
						cms_studentmaster sm,
						cms_studentdetail sd
					WHERE
						sm.student_id = sd.student_id AND
						
						sm.student_active = 1 AND
						sd.year_id = ".$_SESSION["VedantnrYearId"];
		$where = "";
		if($student_id != 0)
			$where .= " AND sm.student_id = $student_id "; 
		if($_REQUEST['batch_idhidden'] != '0')
			$where .= " AND sd.batch_id = '".$_REQUEST['batch_idhidden']."'"; 
		if($branch_id != "")
			$where .= " AND sd.cur_branchid = $branch_id ";
		if($semester_id != "")
			$where .= " AND sd.cur_semesterid = $semester_id ";
		if($div_id != ""){
			$where .= " AND sd.cur_divison = '".$div_id."'"; 
			}
		if($where != "")
		$sql_student .= $where;	
		$sql_student .= " ORDER BY sm.student_gturegno ASC ";	
		$res_student = dbQuery($sql_student);
		/* END STUDENT CODE */
		
		if(dbRows($res_student)>0){
			while($rec_student = dbArray($res_student)){
				$student_id = $rec_student['student_id'];	
				$batch_id = $rec_student['batch_id'];
		?>

	<table width="100%" border="0" cellpadding="2" cellspacing="2" style="font-size:12px; color:#000;">
	<tr>
    	<td colspan="2" align="center"><div class="college_name" style="height:30px;padding:0px">ઇમેજ એન્જીનીયરીંગ એન્ડ ટેકનીકલ ઇન્સ્ટીટ્યુટ</div></td>
    </tr>
    <tr>
    	<td colspan="2" align="center">
        	<div class="college_address" style="height:16px;padding:0px">વાલુકાંસ ચોકડી પાસે, માતર-તારાપુર રોડ, ગામ-અસલાલી, તા. માતર, જિ. ખેડા પીન-૩૮૭૫૩૦</div>
        </td>
	</tr>
	<tr>
    	<td colspan="2" align="center">
			<div class="college_address" style="height:16px;border-bottom: 4px double #000; margin-bottom:10px;">
                                   Phone : 02694-291261 : +91-9978900474/86  URL : www.image.ac.in
			</div>
        </td>
	</tr>
	<tr>
		<td colspan="2"><b>Ref.No.: <?php echo $refno;?></b></td>
	</tr>
    <tr>
		<td width="78%" align="left">
        	<textarea rows="5" cols="40" style="padding:2px;border:1px solid #000;"><?php echo "To,\n".$rec_student['student_name']."\n".str_replace("'","",$rec_student['student_address'])." Pin: ".$rec_student['student_pincode'];if($rec_student['student_mobilestudents']!="")echo "\n".$rec_student['student_mobilestudents'] ?>
            </textarea>
		</td>
        <td width="22%" style="text-align:right;padding-right:5px;vertical-align:top;"><?php echo 'Date :&nbsp;'.$date; ?></td>
	</tr>
	<tr>
		<td colspan="2" align="center" style="font-weight:bold; font-size:18px"><br />
        Subject : <span style=" border-bottom: 1px solid #000;"><?php echo $subject;?></span><br /></td>
	</tr>
    <!--<tr>
    	<td colspan="2" style="text-align:justify;">સુજ્ઞ વાલીગણ - <br /></td>
	</tr>-->
	<tr>
    	<td col colspan="2" style="text-align:justify;line-height: 22px;font-size:13px">
        <pre ><?php echo $content;?></pre>
        </td>
	</tr>
	<tr>
		<td colspan="2">
        	<div style="float:left;margin-bottom:5px;">
				<div style="border:double; border-width:thin; padding:5px;float:left"><?php echo $signature;?></div>
            </div>
		</td>
 	</tr>
	</table>
    <br />
    <div class="break">&nbsp;</div> 
<?php
/*}*/
			}
			$HtmlCode= ob_get_contents();
			ob_end_flush();
			$HtmlUrl  =	"parents-meet-report.html";
			$HtmlPath =	"report/".$HtmlUrl;
			createHTMLReportPage($header_row_string,$HtmlUrl,$HtmlPath,$HtmlCode);
		?>
		<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
		}
		else{
			echo "No data found for selected criteria.";	
		}		
	}  
   	else{
      	echo "Session Expired";      
   	}
?>
</div>
<?php require "_footer.php";?>