<?php require "_header.php";
 include("Numbers/Words.php");
	 $nw = new Numbers_Words();
 global $SiteBaseUrl;
?>
<div id="main-report" align="center">
<style>
	.table-report{
		border:1px solid #000;	
		font-family:Verdana, Geneva, sans-serif;
		font-size:11px;
		text-align:left;
	}
	.table-report-inner{
		font-family:Verdana, Geneva, sans-serif;
		font-size:11px;
	}
	.table-report-footer{
		font-family:Verdana, Geneva, sans-serif;
		font-size:10px;
	}
	.table-report tr{
		padding:1px 1px 1px 1px;
	}
	.table-report td{
		padding:1px 1px 1px 1px;
	}
	.table-report th{
		padding:1px 1px 1px 1px;
		font-weight:bold;
		text-align:left;
	}	
	.college_name{
		font-family:QTAbbie;
		font-size:22px;	
		font-weight:bold;
		padding:1px 1px 1px 1px;
		text-align:center;
		vertical-align:top;
	}
	.college_address{
		font-family:Tahoma, Geneva, sans-serif;
		font-size:11px;	
		text-align:center;
		padding:1px 1px 1px 1px;
		vertical-align:top;
	}
	.break{
		page-break-after:always;
				
	}
</style>
<center><h4>Student Cheque Fees Receipt</h4></center>
<div style="float:left">
<a href="addedit-chequerecepit.php">&laquo;&nbsp;Back to Fee Recive</a>
</div>
<br/>
<br/>
<?php 
	$header_row_string="";
	
	//$receipt_no = $_REQUEST['receipt_no'];
	$branch_id = $_REQUEST["branch_id"];
	$semester_id = $_REQUEST["semester_id"];
	$receipt_no = $_REQUEST["receipt_no"];

	if($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])){
		ob_start();
		$sql_receipt = "
			SELECT 
				frm.*,
				bm.*,
				sm.*
			FROM
				cms_branchmaster bm,
				cms_semestermaster sm,
				cms_chequefeereceive frm
			
			WHERE
				frm.branch_id = bm.branch_id  AND
				frm.semester_id = sm.semester_id AND
				frm.receipt_no = $receipt_no AND
				frm.semester_id = $semester_id AND
				frm.receipt_no = $receipt_no AND
				frm.year_id = ".$_SESSION["VedantnrYearId"];
					
		$res_receipt = dbQuery($sql_receipt);
	
		if(dbRows($res_receipt)>0){
			while($rec_receipt = dbArray($res_receipt))
			{
				$branch_id = $rec_receipt['branch_id'];
				$semester_id = $rec_receipt['semester_id'];
				$receipt_no = $rec_receipt['receipt_no'];
				$student_id = $rec_receipt['student_id'];
				$receipt_date = $rec_receipt['receipt_date'];
				
				$cheque_no = $rec_receipt['cheque_no'];
				$bank_name = $rec_receipt['bank_name'];
				
			//	$fees_amount = $rec_receipt['fees_amount'];
				$createdon = date('YmdHis',strtotime($rec_receipt['receipt_date']));

				$sql_fees = "
					SELECT frm.*
					FROM
						cms_chequefeereceive frm 
					WHERE 1 = 1 AND	
						frm.receipt_no = $receipt_no AND
						frm.semester_id = $semester_id AND
						frm.receipt_no = $receipt_no AND
						frm.year_id = ".$_SESSION["VedantnrYearId"]."";
				$res_fees = dbQuery($sql_fees);		
			$rec_fees = dbArray($res_fees);
				if(dbRows($res_fees) > 0){
				?>
                	<br/><br/><br/>
					<table  class="table-report" width="100%" cellpadding="0" cellspacing="0" border="1" style="font-size:10px;">
					<tr>
					<td>
						<table class="table-report" width="100%" cellpadding="0" cellspacing="0" border="1">
						<tr>
							  <td colspan="2" class="college_name"><?php echo $_SESSION["VedantnrCollegeName"]; ?></td>
						</tr>
						<tr style="line-height:40px;">
							  <td colspan="2" style="text-align:right;padding-right:50px;">Office Copy</td>
						</tr>
						<tr style="line-height:40px;">
							  <td >&nbsp;&nbsp;Receipt No :  <?php echo $receipt_no; ?></td>
							   <td >&nbsp;&nbsp;Exam Type : ATKT</td>
						</tr>
						<tr style="line-height:40px;">
							  <td colspan="2">&nbsp;&nbsp;Name :  <?php echo $rec_receipt['student_name']?></td>
							  
						</tr>
						<tr style="line-height:40px;">
							  <td width="40%">&nbsp;&nbsp;Class :  <?php echo $rec_receipt['branch_name']." - ".$rec_receipt['semester_name']; ?></td>
							   <td width="60%" >&nbsp;&nbsp;Roll No : 0</td>
						</tr>
						<tr style="line-height:40px;">
							  <td >&nbsp;&nbsp;Exam Fee :  <?php echo $rec_receipt['receive_amt'];?></td>
							   <td >&nbsp;&nbsp;Degree Fee : 0</td>
						</tr>
						<tr style="line-height:40px;">
							  <td colspan="2">&nbsp;&nbsp;Late Fee :  <?php echo $rec_receipt['latefee'];?></td>
							  
						</tr>
						<tr style="line-height:40px;">
							  <td >&nbsp;&nbsp;Received Rs  :  <?php echo $rec_receipt['receive_amt']+$rec_receipt['latefee'];?></td>
							  <?php $amount = $rec_receipt['receive_amt']+$rec_receipt['latefee']?>
							  <td >&nbsp;<?php echo strtoupper($nw->toWords($amount)." Rs"); ?></td >
						</tr>
						<tr>
							<td colspan="2" style="padding-top:50px;">
							<table class="table-report" width="100%" cellpadding="0" cellspacing="0" border="0">
										
										<td valign="top" width="65%" style="text-align:left;">
										&nbsp;&nbsp;For Date : <?php print date($SiteDateFormat,strtotime($rec_receipt['receipt_date'])); ?> 
										</td>
										<td valign="top" width="15%"><center>
										 _________________</br>
											 Principal																
										<center></td>
										</table>	
							</td>
						</tr>
						</table>
					</td>
					<td>
							<table class="table-report" width="100%" cellpadding="0" cellspacing="0" border="1">
						<tr>
							  <td colspan="2" class="college_name"><?php echo $_SESSION["VedantnrCollegeName"]; ?></td>
						</tr>
						<tr style="line-height:40px;">
							  <td colspan="2" style="text-align:right;padding-right:50px;">Student Copy</td>
						</tr>
						<tr style="line-height:40px;">
							  <td >&nbsp;&nbsp;Receipt No :  <?php echo $receipt_no; ?></td>
							   <td >&nbsp;&nbsp;Exam Type : ATKT</td>
						</tr>
						<tr style="line-height:40px;">
							  <td colspan="2">&nbsp;&nbsp;Name :  <?php echo $rec_receipt['student_name']?></td>
							  
						</tr>
						<tr style="line-height:40px;">
							  <td width="40%">&nbsp;&nbsp;Class :  <?php echo $rec_receipt['branch_name']." - ".$rec_receipt['semester_name']; ?></td>
							   <td width="60%" >&nbsp;&nbsp;Roll No : 0</td>
						</tr>
						<tr style="line-height:40px;">
							  <td >&nbsp;&nbsp;Exam Fee :  <?php echo $rec_receipt['receive_amt'];?></td>
							   <td >&nbsp;&nbsp;Degree Fee : 0</td>
						</tr>
						<tr style="line-height:40px;">
							  <td colspan="2">&nbsp;&nbsp;Late Fee :  <?php echo $rec_receipt['latefee'];?></td>
							  
						</tr>
						<tr style="line-height:40px;">
							  <td >&nbsp;&nbsp;Received Rs  :  <?php echo $rec_receipt['receive_amt']+$rec_receipt['latefee'];?></td>
							  <?php $amount = $rec_receipt['receive_amt']+$rec_receipt['latefee']?>
							  <td >&nbsp;<?php echo strtoupper($nw->toWords($amount)." Rs"); ?></td >
						</tr>
						<tr>
							<td colspan="2" style="padding-top:50px;">
							<table class="table-report" width="100%" cellpadding="0" cellspacing="0" border="0">
										
										<td valign="top" width="65%" style="text-align:left;">
										&nbsp;&nbsp;For Date : <?php print date($SiteDateFormat,strtotime($rec_receipt['receipt_date'])); ?> 
										</td>
										<td valign="top" width="15%"><center>
										 _________________</br>
											 Principal																
										<center></td>
										</table>	
							</td>
						</tr>
						</table>
					</td>
					</tr>					
					</table>
					

                    <div class="break"><br/><br /><br /></div> 
					
					
                               
                       <?php
				}	


				
		}			
				
			$HtmlCode= ob_get_contents();
			//echo $HtmlCode;
			ob_end_flush();
			$HtmlUrl  =	"feereceipt-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">
			
		
		//	SetPageAction('PRINT');
                function SetPageAction(varAction) {
                    if(varAction=="PRINT"){			
                        document.frm.action="print/create-print.php";
                        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";?>