<!DOCTYPE html>
<html>
<head>
	<?php include('include/head.php'); ?>
</head>
<body>
	<?php include('include/header.php'); ?>
	<?php include('include/sidebar.php'); ?>
	<div class="main-container">
		<div class="pd-ltr-20 xs-pd-20-10">
			<div class="min-height-200px">
				<div class="page-header">
					<div class="row">
						<div class="col-md-6 col-sm-12">
							<div class="title">
								<h4>Invoice</h4>
							</div>
							<nav aria-label="breadcrumb" role="navigation">
								<ol class="breadcrumb">
									<li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>
									<li class="breadcrumb-item active" aria-current="page">invoice</li>
								</ol>
							</nav>
						</div>
						<!-- <div class="col-md-6 col-sm-12 text-right">
							<div class="dropdown">
								<a class="btn btn-primary dropdown-toggle" href="#" role="button" data-toggle="dropdown">
									January 2018
								</a>
								<div class="dropdown-menu dropdown-menu-right">
									<a class="dropdown-item" href="#">Export List</a>
									<a class="dropdown-item" href="#">Policies</a>
									<a class="dropdown-item" href="#">View Assets</a>
								</div>
							</div>
						</div> -->
					</div>
				</div>
			<div id="div_print">
				<div class="pd-20 bg-white border-radius-4 box-shadow mb-30">
					<h2 align="center">Invoice</h2><br>
							<?php 
								$count=0;
								 $query="select i.*,sr.*,c.*,ct.* from tbl_invoice i, tbl_student_reg sr,tbl_course c, tbl_city ct where i.fld_invoice_id='".$_GET['fld_invoice_id']."' and c.fld_course_id=sr.fld_course_id and i.fld_reg_no=sr.fld_reg_no and sr.fld_city_id=ct.fld_city_id and i.fld_delete='0' and i.fld_invoice_status='Final' order by i.fld_invoice_id desc";
			                    $row=mysqli_query($connect,$query) or die(mysqli_error($connect));
			                    $fetch=mysqli_fetch_array($row);
			                    extract($fetch);
							?>
						<?php                                       
			              $query=mysqli_query($connect,"select * from tbl_dynamic_header_footer where fld_id='1'") or die (mysqli_error($connect));
			              $fetch1=mysqli_fetch_array($query);
			              extract($fetch1);
			            ?>    
					<table class="table table-bordered">
							<tr>
								<td>
									<b><?php echo $fld_company_name; ?></b><br>
									<?php echo $fld_company_address; ?><br>
									<?php echo $fld_mobile; ?><br>
									<?php echo $fld_phone; ?><br>
									<?php echo $fld_email; ?><br>
									<?php echo $fld_website; ?><br>
								</td>
								<td align="right"><b><?php echo "Invoice Number : "; ?></b>
										<?php echo $fld_invoice_no; ?><br>
									<b><?php echo "Invoice Date : "; ?></b>
									<?php echo $fld_invoice_current_date;?>
								</td>
							</tr>
							<tr>
								<td>
									<b><?php echo "Student Information"; ?></b><br>
									<?php echo $fetch['fld_first_name'] ?> <?php echo $fetch['fld_middle_name'] ?> <?php echo $fetch['fld_last_name'] ?><br>
									<?php echo $fld_email; ?><br><?php echo $fld_city_name; ?>
								</td>
								<td colspan="2" align="right">
									<b><?php echo "Registration Number :"; ?></b>
										<?php echo $fld_reg_no; ?>
								</td>
							</tr>
					</table>
					<table class="table table-bordered" style="margin-top: -15px;">
						<tr>
							<td><b><?php echo "Sr no."; ?></b></td>
							<td><b><?php echo "Course Name"; ?></b></td>
							<td><b><?php echo "Amount" ?></b></td>
							<td><b><?php echo "Discount%"; ?></b></td>
							<td><b><?php echo "Final Fees"; ?></b></td>
						</tr>
						<tr>
							<td><?php echo++$count; ?></td>
							<td><?php echo $fld_course_name; ?></td>
							<td><?php echo $fld_fee_of_course; ?>/-</td>
							<td><?php echo $fld_discount; ?>%</td>
							<td align="right"><?php echo $fld_final_fees; ?>/-</td>
						</tr>
						<tr>
							<td></td>
							<td align="right"><b><?php echo "Pending Amount"; ?></b></td>
							<td colspan="3" align="right"><?php echo $fld_pending_amount; ?>/-</td>
						</tr>
						
						<tr>
							<td></td>
							<td align="right"><b><?php echo "Paid Amount"; ?></b></td>
							<td colspan="3" align="right"><?php echo $fld_paid_amount; ?>/-</td>
						</tr>
						<tr>
							<td></td>
							<td align="right"><b><?php echo "Balance Amount"; ?></b></td>
							<td colspan="3" align="right"><?php echo $fld_balance_amount; ?>/-</td>
						</tr>

						<tr>
							<td></td>
							<td align="right"><b><?php echo "Total Amount" ?></b></td>
							<td colspan="3" align="right"><?php echo $fld_final_fees; ?>/-</td>
						</tr>
						<tr>
							<td colspan="5" align="right"><b>for <?php echo $fld_company_name; ?></b><br><br><br><?php echo "Authorised Signatory" ?>
							</td>
						</tr>
					</table>
				</div>
			</div>
				<span style="padding-left: 470px"><input name="b_print" type="button" class="ipt btn btn-success"  onClick="printdiv('div_print');" value=" Print " style="margin-top:-40px;"></span>
				</div>
			
			<?php include('include/footer.php'); ?>
		</div>
	</div>
	<?php include('include/script.php'); ?>
	<script language="javascript">
function printdiv(printpage)
{
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}
</script>   
</body>
</html>