<?php require "_header.php";
//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 Fees Receipt</h4></center>

	<div style="float:left">
		<a href="addedit-feesreceive.php">&laquo;&nbsp;Back to Fee Recive</a>
	</div>
	<br/>
	<br/>
	<?php
	$header_row_string="";

	//$receipt_no = $_REQUEST['receipt_no'];
	$receipt_no = $_SESSION["receiptno1"];
	if($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])){
		ob_start();
		$sql_receipt = "
		SELECT
		frm.feesreceive_id,
		frm.student_id,
		frm.receipt_no,
		frm.receipt_date,
		frm.cheque_no,
		frm.bank_name,
		frm.comment_show,
		frm.comments,
		frm.month_duration_from,
		frm.month_duration_to,
		frm.branch_id,
		frm.semester_id,
		frm.createdon
		FROM
		cms_feesreceivemaster frm
		WHERE
		frm.fees_type = 'T' and
		frm.receipt_no = $receipt_no AND
		frm.year_id = ".$_SESSION["VedantnrYearId"];


//echo $sql_receipt;
		$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'];
				$comment_show = $rec_receipt['comment_show'];
				$comments = $rec_receipt['comments'];
				$cheque_no = $rec_receipt['cheque_no'];
				$bank_name = $rec_receipt['bank_name'];
								$month_duration_from = $rec_receipt['month_duration_from'];

				$month_duration_to = $rec_receipt['month_duration_to'];

				$createdon = date('YmdHis',strtotime($rec_receipt['createdon']));

				$sql_student = "
				SELECT
				stud.student_surname,
				stud.student_firstname,
				stud.student_lastname,
				stud.student_gturegno,
				bm.branch_name,
				sm.semester_name,
				stud.transport_facility
				FROM
				cms_studentmaster stud,
				cms_studentdetail sd,
				cms_branchmaster bm,
				cms_semestermaster sm
				WHERE
				stud.student_id = sd.student_id AND
				stud.student_id = $student_id AND
				sd.cur_branchid = bm.branch_id  AND
				sd.cur_semesterid = sm.semester_id AND
				sd.cur_branchid = $branch_id AND
				sd.cur_semesterid = $semester_id AND
				sd.year_id = ".$_SESSION["VedantnrYearId"];
				$res_student = dbQuery($sql_student);
				$rec_student = dbArray($res_student);
				$sql_fees = "
				SELECT
				fh.head_name,
				frd.recdetail_amt
				FROM
				cms_feesreceivemaster frm,
				cms_feesreceivedetail frd,
				cms_feeshead fh
				WHERE
				frm.fees_type = 'T' and
				frm.receipt_no = $receipt_no AND
				frm.feesreceive_id = frd.feesreceive_id AND
				frd.head_id = fh.head_id AND
				frm.year_id = ".$_SESSION["VedantnrYearId"]."
				ORDER BY fh.head_id";
				$res_fees = dbQuery($sql_fees);
				if(dbRows($res_fees) > 0){
					

					?>

					<br/>
					<h2 style=font-size:20px; > Transportation Slip </h2>
					<br/>
					<table class="table-report" cellpadding="0" cellspacing="15" width="95%" style=font-size:16px;>
						<tr>
							<th width="20%" >Receipt No:</th>
              <td width="8%"><b><?php echo $receipt_no; ?></b></td>
            </tr>
            <tr>
							<th width="20%">Student Name:</th>
							<td width="50%"><?php echo $rec_student['student_surname']." ".$rec_student['student_firstname']." ".$rec_student['student_lastname']; ?></td>
							
						</tr>
						<tr>
							<th width="20%">Branch:</th>
							<td><?php echo $rec_student['branch_name']." - ".$rec_student['semester_name']; ?></td>
						</tr>
						<tr>
							<th width="20%">Receipt Date:</th>
							<td width="8%"><?php echo date('d-m-Y',strtotime($receipt_date)); ?></td>
						</tr>
						<tr>
							<td colspan="2"><hr /></td>
						</tr>
						<?php
						$total = 0;
						while($rec_fees = dbArray($res_fees)){
							if($rec_fees['recdetail_amt'] != "" && $rec_fees['recdetail_amt'] != 0){?>
								<tr>
									<th width="20%">Route</th>
									<td width="20%"><?php echo $rec_fees['head_name']; ?></td>
								</tr>
								<tr>
								<th width="20%">Fees Amount</th>
									<td><?php echo $rec_fees['recdetail_amt']; $total = $total + $rec_fees['recdetail_amt']; ?></td>
								</tr>
								<tr>
							<th width="20%">Duration:</th>
							<td><?php echo  date('d-m-Y',strtotime($rec_receipt['month_duration_from']))." - ". date('d-m-Y',strtotime($rec_receipt['month_duration_to'])); ?></td>
						</tr>
						
						<tr>
							<th>Payment Mode</th>
									<td>
										<?php
										if($cheque_no != "" && $bank_name != ""){
											echo "Cheque &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
											&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
											&nbsp&nbsp&nbsp&nbsp&nbsp  Cheque No:$cheque_no $bank_name";
										}
										else
										{
											echo "Cash";
										}
										?>
									</td>
						</tr>
						
								<tr>
									<th width="20%">Received by:</th>
									<td><?php echo $_SESSION["VedantnrUserName"]; ?></td>
								</tr>
								<?php
							}
							else{?>
								<tr>
								</tr><?php
							}
						}
						?>
						<?php $barcode= $receipt_no.$createdon;
						/*echo $barcode;
						exit;*/?>

					</table>

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

			$HtmlCode= ob_get_contents();
			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">
			<?php sleep(20);?>
			<?php if($barcode != '') { ?>
			SetPageAction('PRINT');
			function SetPageAction(varAction) {
			if(varAction=="PRINT"){
			document.frm.action="print/create-print.php";
			document.frm.submit();
			}
			<?php } ?>
			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";?>
