<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
	<title>Plot Booking Report | Admin Panel</title>

	<!-- Favicons -->
<link rel="shortcut icon" type="image/x-icon" href="../UserProfile/images/logo/logo.png">

	<!-- Bootstrap CSS -->
	<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">

	<!-- Fontawesome CSS -->
	<link rel="stylesheet" href="assets/plugins/fontawesome/css/fontawesome.min.css">
	<link rel="stylesheet" href="assets/plugins/fontawesome/css/all.min.css">
	 
	<!-- Animate CSS -->
	<link rel="stylesheet" href="assets/css/animate.min.css">

	<!-- Main CSS -->
	<link rel="stylesheet" href="assets/css/admin.css">
		<!-- Datatables CSS -->
	<link rel="stylesheet" href="assets/plugins/datatables/datatables.min.css">
 <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"> 
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css">
  <style>
input[type=search]
{
    display: block;
    width: 100%;
    padding: .50rem 1rem;
    font-size: 1rem;
    line-height: 1.25;
    color: #4E5154;
    background-color:#FFF;
    background-clip: padding-box;
    border: 1px solid #BABFC7;
    border-radius: .25rem;
}
input[type=button]
{
 
    background-color:#140dec;

}
</style>
</head>

<body>
	<div class="main-wrapper">
	
		<!-- Header -->
	<?php include 'include/header.php'; ?>
		<!-- /Header -->
		
		<!-- Sidebar -->
		<?php include 'include/leftmenu.php'; ?>
		<!-- /Sidebar -->
		
		<div class="page-wrapper">
			<div class="content container-fluid">
			
				<!-- Page Header -->
				<div class="page-header">
					<div class="row">
						<div class="col">
							<h5 class="page-title text-white">Plot Booking Report</h5>
						</div>

					</div>
				</div>
			         <div class="row">
						<div class="col-sm-12">
							<div class="card">
							
								<div class="card-body">
								    <form name="frm" id="frm" method="post" action="#">
								    <div class="row">
								<div class="col-sm-6 col-md-6">
									<div class="form-group">
										<label>Select Site</label>
								    <select name="project" id="project" class="form-control" required>
								        <option value="ALL">Show All Plot</option>
								        <?php 
								        $resPr=mysqli_query($connection,"Select * from tbl_prject_master order by project_name");
								        while($rowP=mysqli_fetch_array($resPr))
								        {
								            ?>
								            <option value="<?php echo $rowP['project_id']; ?>"><?php echo $rowP['project_name']; ?>-<?php echo $rowP['businessper']; ?>%</option>
								            <?php
								        }
								        ?>
								    </select>
									</div>
								</div>
								
									<div class="col-sm-4 col-md-3">
									<div class="form-group">
							      
										<button class="btn btn-primary " id="btnsubmit" type="submit" onClick="SubmitForm()" style="width:150px;margin-top:30px">Submit</button>
									
									</div>
								
								</div>
							    </div></div>
							    </form>
							 </div>
							</div>
					    </div>
				    <?php
				    if ($_SERVER['REQUEST_METHOD'] == 'POST') 
				    {
				        $project_id=$_REQUEST['project'];
				        if($project_id=='ALL')
				        {
				            $project_name="All Active Plot Booking List";
				        }
				        else
				        {
				        $project_name=get_value("Select project_name from tbl_prject_master where project_id='$project_id'");
				        }
				    ?>
                	<div class="row">
						<div class="col-sm-12">
							<div class="card">
								<div class="card-body">
                                    <h5><?php echo $project_name; ?></h5>
                                    <br>
									<div class="table-responsive">
										<table class="table table-stripped" id="example">
											<thead>
												<tr style="background-color: #140dec;color:#FFF">
												    
													<th>#</th>
													<th>Booking Date</th>
													<th>Customer Id</th>
													<th>Customer Name</th>
													<th>Plot Code</th>
                                                    <th>Size-Rate</th>
                                                    <th>Business(%)</th>
                                                    <th>Total Amt</th>
                                                    <th>Discount Amt</th>
                                                    <th>Net Amt</th>
                                                    <th>Paid Amt</th>
                                                    <th>Balance Amt</th>
												</tr>
											</thead>
											<tbody>
											    <?php 
											    $cnt=1;
											 if($project_id=='ALL')
											 {
											     $str="SELECT * from tbl_plot_registry_booking  order by booking_id desc";
											 }
											 else
											 {
											    $str="SELECT * from tbl_plot_registry_booking  where project_id=$project_id order by booking_id desc";
											 }
											    $res=mysqli_query($connection,$str);
											    while($row=mysqli_fetch_array($res))
											    {
											    ?>
												<tr>
												    <td>
												        <div class="btn-group">
										<button type="button" class="btn btn-primary">Action</button>
										<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
											<span class="sr-only">Toggle Dropdown</span>
										</button>
										<div class="dropdown-menu">
											<a class="dropdown-item" href="PlotEMIPaymentSummary?booking_random_no=<?php echo $row['booking_random_no']; ?>" target="_blank">Payment Summary</a>
										<a class="dropdown-item" href="EditPlotBooking?booking_random_no=<?php echo $row['booking_random_no']; ?>" target="_blank">Edit Booking Details</a>
										<?php if($row['paid_amount']==0){ ?>
											<a class="dropdown-item" href="Apk/DeletePlotBooking?booking_random_no=<?php echo $row['booking_random_no']; ?>&member_user_id=<?php echo $row['member_user_id']; ?>" onClick="return confirm('Sure to Want Delete this Booking');">Delete This Booking </a><?php } ?>
										</div>
									</div>
												         </td>
												  
													<td><?php echo date("d-M-Y",strtotime($row['booking_date'])); ?></td>
													<td><?php echo $row['member_user_id']; ?></td>
													<td><?php echo $row['member_name']; ?></td>
													<td><?php echo $row['plot_code']; ?></td>
										<td><?php echo $row['plot_size']; ?>-<?php echo $row['plot_rate']; ?></td>
															<td><?php echo $row['businessper']; ?></td>
															<td><?php echo $row['total_amount']; ?></td>
															<td><?php echo $row['discount_amt']; ?></td>
															<td><?php echo $row['net_amount']; ?></td>
															<td><?php echo $row['paid_amount']; ?></td>
															<td><?php echo $row['balance_amt']; ?></td>
												</tr>
												<?php } ?>


											</tbody>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
					<?php } ?>
			</div>
		</div> 
	</div>

	<!-- jQuery -->
	<script src="assets/js/jquery-3.5.0.min.js"></script>

	<!-- Bootstrap Core JS -->
	<script src="assets/js/popper.min.js"></script>
	<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>

	<!-- Slimscroll JS -->
	<script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<script src="assets/plugins/datatables/jquery.dataTables.min.js"></script>
	<script src="assets/plugins/datatables/datatables.min.js"></script> 

	<!-- Custom JS -->
	<!-- Custom JS -->
	<script src="assets/js/admin.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.js" type="text/javascript"></script>
  <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" type="text/javascript"></script> 
  <script src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js" type="text/javascript"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.flash.min.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js" type="text/javascript"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js" type="text/javascript"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js" type="text/javascript"></script>
 <script>
$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
    } );
} );
</script>

</body>

</html>