<?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;
	}	
	.break { page-break-before: always; }
</style>
<div id="main-report">
<?php
if($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])) 
{ 
	ob_start();
	
	$student_id 	= $_SESSION['student_id'];

	$order_by = $_REQUEST['hid_orderby'];
	$SQL_CONDITION  = "";
	
	$SQL_STUDENT = "
		SELECT 
			sm.student_id,
			sem.semester_name,
			branch.branch_name,
			cur_divison,
			fm.receipt_date,
			fm.receipt_no,
			fd.recdetail_amt,
			fh.	head_name,
			um.user_name
		FROM
			cms_studentmaster sm,
			cms_studentdetail sd,
			cms_semestermaster sem,
			cms_branchmaster branch,
			cms_feesreceivemaster fm,
			cms_feesreceivedetail fd,
			cms_feeshead fh,
			cms_usermaster um
		WHERE 
			sm.student_active = 1 AND 
			sm.student_id = sd.student_id AND
			sd.current_active = 1 AND
			sd.cur_semesterid = sem.semester_id AND
			sd.cur_branchid = branch.branch_id 	 AND
			sm.student_id = fm.student_id AND
			fm.feesreceive_id = fd.feesreceive_id AND
			fd.recdetail_amt != 0 AND
			um.user_id = fd.login_id AND
			fd.head_id = fh.head_id AND
			sm.student_id = ".$_SESSION["student_id"]." AND
			fm.year_id = sd.year_id 
			order by sd.cur_semesterid,fm.receipt_no,fd.recdetail_amt";
		
	
	
	
	$RES_STUDENT = dbQuery($SQL_STUDENT);
	
	if(dbRows($RES_STUDENT)>0){?>
        <center><h4>Paid Fees Information</h4></center>
      <br />
		<table class="table-report" border="1" cellpadding="0" cellspacing="0" width="80%">
        <tr>
        	<th style="text-align:center;" width="5%">Sr</th>
            <th style="text-align:center;" width="8%">ReceiptNo</th>
            <th style="text-align:center;" width="15%">Receipt Date</th>
            <th style="text-align:center;" width="20%">Fees Head</th>
            <th style="text-align:center;"   width="15%">Paid Amout</th>
            <th style="text-align:center;" width="15%" >Paid to</th>
            
            
        </tr>
		<?php
		$i = 1;
		$temp = "";
		while($REC_STUDENT = dbArray($RES_STUDENT)){
			 if($REC_STUDENT["semester_name"] != $temp)
			 {
				 $temp1=$REC_STUDENT["branch_name"];
				 $temp=$REC_STUDENT["semester_name"];
				?>
                <tr><th colspan="6"><?php echo strtoupper($temp1)."  ".$REC_STUDENT['semester_name'].'-'.$REC_STUDENT['cur_divison']; ?></th></tr><?php
			}?>
            <tr>
				<td style="text-align:center;">&nbsp;<?php echo $i++; ?></td>
                <td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['receipt_no'];?></td>
                <td style="text-align:center;">&nbsp;<?php echo date("d-m-Y",strtotime($REC_STUDENT['receipt_date'])); ?></td>
                <td style="text-align:right;">&nbsp;<?php echo $REC_STUDENT['head_name'];?></td>
                <td style="text-align:right;">&nbsp;<?php echo $REC_STUDENT['recdetail_amt']; ?></td>
                <td style="text-align:right;">&nbsp;<?php echo $REC_STUDENT['user_name']; ?></td>
             
       		</tr><?php
		}
		?>
		</table>
		<?php
	}
	else{
		echo "NO DATA FOUND!";	
	}
	
?>

<?php
	$HtmlCode = ob_get_contents();
	ob_end_flush();
	
	$HtmlUrl = "studentfeeslist-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";
?>