<!DOCTYPE html>
<html>
<head>
	<!-- <title></title> -->
	<?php include('include/head.php'); ?>
	<link rel="stylesheet" type="text/css" href="src/plugins/datatables/media/css/jquery.dataTables.css">
	<link rel="stylesheet" type="text/css" href="src/plugins/datatables/media/css/dataTables.bootstrap4.css">
	<link rel="stylesheet" type="text/css" href="src/plugins/datatables/media/css/responsive.dataTables.css">
</head>
<body>
	<?php include('include/header.php');
include('include/sidebar.php'); ?>

	<div class="main-container">
		<div class="pd-ltr-20 customscroll customscroll-10-p height-100-p xs-pd-20-10">
			
			<div class="min-height-200px">
				<div class="page-header">
					<div class="row">
						<div class="col-md-7 col-sm-10">
							<div class="title">
								<h4>Fee Details</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"><a href="view_student_reg.php">Student Registration</a></li>
									<li class="breadcrumb-item active" aria-current="page">Student Invoice History</li>
								</ol>
							</nav>
						</div>

						<div class="col-md-5 col-sm-2" align="right">
<!--  -->
							<?php 
								

								 // $abc1="select * from tbl_student_reg where fld_stud_reg_id='".$_GET['fld_stud_reg_id']."' and fld_stud_reg_delete='0' order by fld_stud_reg_id desc limit 1";
								// $query1=mysqli_query($connect,$abc1); 
								// $fetch_pack=mysqli_fetch_array($query1);
									// if(mysqli_num_rows($query1)==1)
									// {
										if($_GET['fld_status']=="Balance")
										{ 
									?>
										<a href="add_student_invoice.php?fld_reg_no=<?php echo $_GET['fld_reg_no'];?>&fld_status=<?php echo $_GET['fld_status']; ?>"><button class="btn btn-primary">Add Invoice</button></a>
									<?php } else {?>
									
							<?php } //}?>

							<?php //} //active ?>
							 <a href="view_student_reg.php"><button class="btn btn-danger">Back</button></a>
						</div>
					</div>
				</div>
				
				<!-- Export Datatable start -->
				<div class="pd-20 bg-white border-radius-4 box-shadow mb-30">
					<div class="clearfix mb-20">
						<div class="pull-left">
							<!-- <h5 class="text-blue">View Customer Package History</h5> -->
						</div>
					</div>
					<div class="row">
						<!-- <table class="stripe hover multiple-select-row data-table-export nowrap"> -->
						<table class="stripe hover data-table-export nowrap">
							<thead>
								<tr>
									<th class="table-plus datatable-nosort">Sr No</th>
									<th class="datatable-nosort">Action</th>
                                    <th>Invoice<br> Number</th>
                                    <th>Registration<br> Id</th>
                                    <th>Total<br> Amount</th>
                                    <th>Pending <br>Amount</th>
                                    <th>Paid <br>Amount</th>
                                    <th>Balance<br> Amount</th>
                                    <th>Current Date</th>
                                    <!-- <th>Created Date</th> -->
                                    <!-- <th>Modified Date</th> -->
								</tr>
							</thead>
							<?php 
                                    $count=0; 
                                    date_default_timezone_set('Asia/Kolkata');
                                	$current_date=Date("Y-m-d");
                                    $query="select * from tbl_invoice where fld_reg_no='".$_GET['fld_reg_no']."' and fld_delete='0' group by fld_invoice_id order by fld_invoice_id desc";
                                    $row=mysqli_query($connect,$query) or die(mysqli_error($connect));
                                    
                                    while($fetch=mysqli_fetch_array($row)) {
                                    extract($fetch);
								?>
							<tbody>
								
								<tr>
									<td><?php echo++$count; ?></td>
									<td>
										
										<?php
											if ($fld_invoice_status=='Not_final') { ?>

												<a href="update_student_invoice.php?fld_reg_no=<?php echo $_GET['fld_reg_no'];?>&fld_invoice_id=<?php echo $fetch['fld_invoice_id'] ?>&fld_status=<?php echo $_GET['fld_status']; ?>"  class="fa fa-edit" style="font-size: 20px; color: green;">
												</a>
												<a href="final_status.php?fld_reg_no=<?php echo $_GET['fld_reg_no'];?>&fld_invoice_id=<?php echo $fetch['fld_invoice_id'] ?>&fld_status=<?php echo $_GET['fld_status']; ?>"  class="fa fa-check" style="font-size: 20px; color: blue;">
										</a>
										
										<?Php } else {?>
											<a href="invoice_print.php?fld_reg_no=<?php echo $_GET['fld_reg_no'];?>&fld_invoice_id=<?php echo $fetch['fld_invoice_id'] ?>&fld_status=<?php echo $_GET['fld_status']; ?>"  class="fa fa-print" style="font-size: 20px; color: orange;">
										</a>

										<?php } ?>
									</td>
									<td><?php echo $fld_invoice_no; ?></td>
									<td><?php echo $fld_reg_no; ?></td>
									<td><?php echo $fld_final_fees; ?></td>
									<td><?php echo $fld_pending_amount; ?></td>
									<td><?php echo $fld_paid_amount; ?></td>
									<td><?php echo $fld_balance_amount; ?></td>
									<td><?php echo $fld_invoice_current_date; ?></td>
									<!-- <td><?php //echo $fld_created_date; ?></td> -->
								</tr>
							</tbody>
						<?php } ?>
						</table>
					</div>
				</div>
				<!-- Export Datatable End -->
			</div>
			<?php include('include/footer.php'); ?>
		</div>
	</div>
	<?php include('include/script.php'); ?>
	<script src="src/plugins/datatables/media/js/jquery.dataTables.min.js"></script>
	<script src="src/plugins/datatables/media/js/dataTables.bootstrap4.js"></script>
	<script src="src/plugins/datatables/media/js/dataTables.responsive.js"></script>
	<script src="src/plugins/datatables/media/js/responsive.bootstrap4.js"></script>
	<!-- buttons for Export datatable -->
	<script src="src/plugins/datatables/media/js/button/dataTables.buttons.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.bootstrap4.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.print.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.html5.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.flash.js"></script>
	<script src="src/plugins/datatables/media/js/button/pdfmake.min.js"></script>
	<script src="src/plugins/datatables/media/js/button/vfs_fonts.js"></script>
	<script>
		$('document').ready(function(){
			$('.data-table').DataTable({
				scrollCollapse: true,
				autoWidth: false,
				responsive: true,
				columnDefs: [{
					targets: "datatable-nosort",
					orderable: false,
				}],
				"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
				"language": {
					"info": "_START_-_END_ of _TOTAL_ entries",
					searchPlaceholder: "Search"
				},
			});
			$('.data-table-export').DataTable({
				scrollCollapse: true,
				autoWidth: false,
				responsive: true,
				columnDefs: [{
					targets: "datatable-nosort",
					orderable: false,
				}],
				"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
				"language": {
					"info": "_START_-_END_ of _TOTAL_ entries",
					searchPlaceholder: "Search"
				},
				dom: 'Bfrtip',
				buttons: [
				'copy', 'csv', 'pdf', 'print'
				]
			});
			var table = $('.select-row').DataTable();
			$('.select-row tbody').on('click', 'tr', function () {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				}
				else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
			var multipletable = $('.multiple-select-row').DataTable();
			$('.multiple-select-row tbody').on('click', 'tr', function () {
				$(this).toggleClass('selected');
			});
		});
	</script>
<script type="text/javascript">
  $(document).ready(function(){
    $("select#country").change(function(){
          var t = $("#country option:selected").val();
          // alert(t);
          $.ajax({
              type: "POST",
              url: "state.php", 
              data: { country : t} 
          }).done(function(data){
              $("#state").html(data);
          });
      });
  });
</script>
<script type="text/javascript">
  $(document).ready(function(){
    $("select#state").change(function(){
          var t = $("#state option:selected").val();
          // alert(t);
          $.ajax({
              type: "POST",
              url: "district.php", 
              data: { state : t} 
          }).done(function(data){
              $("#district").html(data);
          });
      });
  });
</script>
<script type="text/javascript">
  $(document).ready(function(){
    $("select#district").change(function(){
          var t = $("#district option:selected").val();
          // alert(t);
          $.ajax({
              type: "POST",
              url: "taluka.php", 
              data: { district : t} 
          }).done(function(data){
              $("#taluka").html(data);
          });
      });
  });
</script>
</body>
</html>