WHY THE PAYMENT FOR APPROVED-NOT PAID DID NOT APPEAR
Published: 2023-08-02 15:51:58

`<?php
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if (strlen($_SESSION['hbmsaid']==0)) {
  header('location:logout.php');
  } else{
  

?>
<!DOCTYPE HTML>
<html>
<head>
<title>Jihan Maju Enterprise Canopy Rental Booking System | Payment List</title>

<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- Graph CSS -->
<link href="css/font-awesome.css" rel="stylesheet"> 
<!-- jQuery -->
<link href='//fonts.googleapis.com/css?family=Roboto:700,500,300,100italic,100,400' rel='stylesheet' type='text/css'/>
<link href='//fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<!-- lined-icons -->
<link rel="stylesheet" href="css/icon-font.min.css" type='text/css' />
<script src="js/simpleCart.min.js"> </script>
<script src="js/amcharts.js"></script>	
<script src="js/serial.js"></script>	
<script src="js/light.js"></script>	
<!-- //lined-icons -->
<script src="js/jquery-1.10.2.min.js"></script>
   <!--pie-chart--->
</head> 
<?php
// Define pagination variables
    $no_of_records_per_page = 10;
    $pageno = isset($_GET['pageno']) ? $_GET['pageno'] : 1;
    $offset = ($pageno - 1) * $no_of_records_per_page;

// Generate and display the SQL query
$sql_not_paid = "SELECT customer.*, booking.BookingNo, booking.ID, booking.Status, booking.BookingDate, booking.StatusPayment, package.Price
FROM booking 
JOIN customer ON booking.CustomerID = customer.ID
LEFT JOIN package ON booking.PackageId = package.ID
WHERE booking.Status = 'Approved' AND booking.StatusPayment = ''
LIMIT $offset, $no_of_records_per_page";



$sql_paid = "SELECT customer.*, booking.BookingNo, booking.ID, booking.Status, booking.BookingDate, booking.StatusPayment, package.Price 
            FROM booking 
            JOIN customer ON booking.CustomerID = customer.ID
            LEFT JOIN package ON booking.PackageId = package.ID
            WHERE booking.Status = 'Approved' AND booking.StatusPayment = 'Paid'
            LIMIT $offset, $no_of_records_per_page";
``

    $cnt = 1;

// Function to display the table data
function displayTableData($query, $cnt)
{
    if ($query->rowCount() > 0) {
        foreach ($query as $row) {
            echo '<tr>';
            echo '<td class="text-center">' . htmlentities($cnt) . '</td>';
            echo '<td>' . htmlentities($row['BookingNo']) . '</td>';
            echo '<td>' . htmlentities($row['FullName']) . '</td>';
            echo '<td>' . htmlentities($row['Email']) . '</td>';
            echo '<td>' . htmlentities($row['MobileNumber']) . '</td>';
            echo '<td>' . htmlentities($row['Price']) . '</td>';
            echo '<td><span class="badge badge-primary">' . htmlentities($row['BookingDate']) . '</span></td>';
            echo '<td>';
            $status = $row['Status'];
            if ($status == '') {
                echo '<span class="badge badge-warning">Not Updated Yet</span>';
            } elseif ($status == 'Cancelled') {
                echo '<span class="badge badge-danger">' . htmlentities($row['Status']) . '</span>';
            } elseif ($status == 'Approved') {
                echo '<span class="badge badge-success">' . htmlentities($row['Status']) . '</span>';
            }
            echo '</td>';
            echo '<td class="d-none d-sm-table-cell"><a href="view-booking-detail.php?bookingid=' . htmlentities($row['BookingNo']) . '" class="btn btn-info btn-sm">View Details</a></td>';
            echo '</tr>';
            $cnt++;
        }
    } else {
        echo '<tr><td colspan="8" style="color:red; font-size:22px; text-align:center">No record found</td></tr>';
    }
}

?>
<body>
<div class="page-container">
    <div class="left-content">
        <div class="inner-content">
            <!-- Your existing content here -->
            <div class="content">
                <div class="women_main">
                    <!-- start content -->
                    <div class="grids">
                        <div class="progressbar-heading grids-heading">
                            <h2>Payment List</h2>
                        </div>
                        <div class="panel panel-widget forms-panel">
                            <div class="forms">
                                <div class="form-grids widget-shadow" data-example-id="basic-forms">
                                    <div class="form-title">
                                        <h4>Payment List</h4>
                                    </div>
                                    <div class="form-body">
                                        <!-- Create two separate tables for each status -->
                                        <h3>Approved - Not Paid</h3>
                                        <table class="table table-bordered table-striped table-vcenter js-dataTable-full-pagination">
                                            <thead>
                                            <tr>
                                                <th>S.No</th>
                                                <th>Booking Number</th>
                                                <th>Name</th>
                                                <th>Email</th>
                                                <th>Mobile Number</th>
                                                <th>Price</th>
                                                <th>Booking Date</th>
                                                <th>Status</th>
                                                <th>Action</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                            $query_not_paid = $dbh->prepare($sql_not_paid);
                                            $query_not_paid->execute();
                                            displayTableData($query_not_paid, $cnt);
                                            ?>
                                            </tbody>
                                        </table>

                                        <h3>Approved - Paid</h3>
                                        <table class="table table-bordered table-striped table-vcenter js-dataTable-full-pagination">
                                            <thead>
                                            <tr>
                                                <th>S.No</th>
                                                <th>Booking Number</th>
                                                <th>Name</th>
                                                <th>Email</th>
                                                <th>Mobile Number</th>
                                                <th>Price</th>
                                                <th>Booking Date</th>
                                                <th>Status</th>
                                                <th>Action</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                            $query_paid = $dbh->prepare($sql_paid);
                                            $query_paid->execute();
                                            displayTableData($query_paid, $cnt);
                                            ?>
                                            </tbody>
                            </table>
<div align="left">
    <ul class="pagination" >
    <li><a href="?pageno=1"><strong>First</strong></a></li>
<li class="<?php if($pageno <= 1){ echo 'disabled'; } ?>">
    <a href="<?php if($pageno <= 1){ echo '#'; } else { echo "?pageno=".($pageno - 1); } ?>"><strong style="padding-left: 10px">Prev</strong></a>
</li>
<li class="<?php if($pageno >= $total_pages){ echo 'disabled'; } ?>">
    <a href="<?php if($pageno >= $total_pages){ echo '#'; } else { echo "?pageno=".($pageno + 1); } ?>"><strong style="padding-left: 10px">Next</strong></a>
</li>
<li><a href="?pageno=<?php echo $total_pages; ?>"><strong style="padding-left: 10px">Last</strong></a></li>

    </ul>
</div>
								</div>
							</div>
						</div>
					</div>
			
	
				</div>

	<!-- end content -->
	
<?php include_once('includes/footer.php');?>
</div>

</div>
			<!--content-->
		</div>
</div>
				<!--//content-inner-->
			<!--/sidebar-menu-->
			<?php include_once('includes/sidebar.php');?>
							  <div class="clearfix"></div>		
							</div>
							
<script src="js/jquery.nicescroll.js"></script>
<script src="js/scripts.js"></script>
<!-- Bootstrap Core JavaScript -->
   <script src="js/bootstrap.min.js"></script>
   <!-- /Bootstrap Core JavaScript -->
   <!-- real-time -->
<script language="javascript" type="text/javascript" src="js/jquery.flot.js"></script>
	
		   <script src="js/menu_jquery.js"></script>

		   <script src="js/pages/be_tables_datatables.js"></script>
</body>
</html><?php }  ?>`