sports-arena-website / manager_online_sales_report.php
manager_online_sales_report.php
Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<?php
session_start();
// if dont have session user..then
if(! isset($_SESSION['manname']))
{
session_write_close();
die("<script>alert('Please login as manager first before proceed!');window.location.href='login.html';</script>");
}
?>

<?php
    include("conn.php");
    //online items sales report
    $query = "SELECT i.Item_ID, i.Item_Name, i.Item_Price, SUM(od.Order_Amount)
            FROM online_ordering_details od, item i
            WHERE (i.Item_ID = od.Item_ID) 
            GROUP BY i.Item_ID";
    $result = mysqli_query($conn, $query);

    //walk in items sales report
    $query1 = "SELECT i.Item_ID, i.Item_Name, i.Item_Price, SUM(wid.Sal_Amount)
            FROM walk_in_sales_details wid, item i
            WHERE (i.Item_ID = wid.Item_ID) 
            GROUP BY i.Item_ID";
    $result1 = mysqli_query($conn, $query1);
?>

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
    integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
 <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="shortcut icon" href="images/logo.png" type="image/x-icon" />
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css">
<script src="https://kit.fontawesome.com/0c641bf868.js" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Acme&display=swap" rel="stylesheet">


<title>Manager - Court Booking Report</title>

<style>
    hr.style17 {
        border-top: 1px solid #8c8b8b;
        text-align: center;
        width: 100%;
        margin-top: 40px;
    }
    hr.style17:after {
        content: '§';
        display: inline-block;
        position: relative;
        top: -14px;
        padding: 0 10px;
        background: #f0f0f0;
        color: #8c8b8b;
        font-size: 18px;
        -webkit-transform: rotate(60deg);
        -moz-transform: rotate(60deg);
        transform: rotate(60deg);
    }
    /*style for animated background*/
    .animatedbg{
        width: 100%;
        min-height: 87vh;
        background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
        background-size: 400% 400%;
        animation: change 10s ease-in-out infinite;
        padding-top:40px;
        padding-bottom: 40px;
        font-family: 'Acme', sans-serif;
    }
    @keyframes change{
        0%{
            background-position: 0 50%;
        }
        50%{
            background-position: 100% 50%;
        }
        100%{
            background-position: 0 50%;
        }
    }
    .card {
        /* Add shadows to create the "card" effect */
        box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); 
        transition: 0.3s;
        min-height:500px;
        width: 1400px;
        padding: 20px;
        margin: auto;
        margin-top: 20px;
        margin-bottom: 20px;
        background-color: #d9d9d9;
        
    }
    /* On mouse-over, add a deeper shadow */
    .card:hover {
        box-shadow: 0 12px 32px 0 lightblue;
        }
        .center {
        display: block;
        margin-left: auto;
        margin-right: auto;
        width: 50%;
    }
    .card button
    {
        border: none;
        outline: none;
        height: 35px;
        width: 120px;
        background: #CF161E;
        color: #fff;
        font-size: 14px;
    }
    .card button:hover
    {
        cursor: pointer;
        background: #ffc107;
        color: #000;
    }

</style>
</head>

<body>
<!--Navigation Bar-->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark sticky-top">
    <a class="navbar-brand" href="manager_userinfo.php"><img alt="Brand" src="images/logo.png"
            style="width: 80px; height: 80px;"></a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
        aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav ml-auto" style="padding-right: 50px;">
            <li class="nav-item">
                <a class="nav-link" href="manager_userinfo.php">User Info <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
                    aria-haspopup="true" aria-expanded="false">
                    Court Booking
                </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                    <a class="dropdown-item" href="manager_badminton_court_booking_management.php">Badminton Booking Management</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manager_volleyball_court_booking_management.php">Volleyball Booking Management</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manager_squash_court_booking_management.php">Squash Booking Management</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manager_futsal_court_booking_management.php">Futsal Booking Management</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manager_court_booking_report.php">Court Booking Report</a>
                    
                </div>
            </li>
            <li class="nav-item dropdown active">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
                    aria-haspopup="true" aria-expanded="false">
                    Sales
                </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                    <a class="dropdown-item" href="manager_online_sales_management.php">Sales Management</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="Manager_online_sales_report.php">Sales Report</a>
                </div>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="logout.php">Logout</a>
            </li>
        </ul>
    </div>
</nav>

<!--Contents here-->
<section class="animatedbg">
    <div class="card">
        <h1 style="text-align:center;color:red;">Monthly Sales Report</h1>
        <div class="row" style="margin-top:20px;">
            <div class="col-md-2">
                <input type="text" name="from_date" id="from_date" class="form-control" placeholder="Start Date" />
            </div>
            <div class="col-md-2">
                <input type="text" name="to_date" id="to_date" class="form-control" placeholder="End Date" />
            </div>
            <div class="col-md-5">
                <input type="button" name="filter" id="filter" value="Generate" class="btn btn-primary" />
            </div>
        </div>
        <label style="color:red;padding-top:5px;">*** If there is no particular Item ID displaying, that means there is no sales for particular item in the range date</label>
        <div id="order_table" style="text-align:center">
            <h3 style="color:orange;margin-top:15px;">Online Sales</h3>
            <table class="table">
                <thead class="thead-dark">
                    <tr>
                        <th>Item ID</th>
                        <th>Item Name</th>
                        <th>Price</th>
                        <th>Online Sold</th>
                        <th>Total Revenue</th>
                    </tr>
                </thead>
            <?php
            while($row = mysqli_fetch_array($result))
            {
            ?>
                <tbody>
                    <tr>
                        <td><?php echo $row["Item_ID"]; ?></td>
                        <td><?php echo $row["Item_Name"]; ?></td>
                        <td>RM <?php echo $row["Item_Price"]; ?></td>
                        <td><?php echo $row["SUM(od.Order_Amount)"]; ?></td>
                        <td>RM <?php $rate = $row["Item_Price"]; $sale = $row["SUM(od.Order_Amount)"]; echo $rate * $sale; ?></td>
                    </tr>
                </tbody>
            <?php    
            }
            ?>
            </table>
        </div>
        <hr class="style17">
        <div id="order_table1" style="text-align:center">
            <h3 style="color:orange;margin-top:15px;">Walk In Sales</h3>
            <table class="table">
                <thead class="thead-dark">
                    <tr>
                        <th>Item ID</th>
                        <th>Item Name</th>
                        <th>Price</th>
                        <th>Walk-In Sold</th>
                        <th>Total Revenue</th>
                    </tr>
                </thead>
            <?php
            while($row = mysqli_fetch_array($result1))
            {
            ?>
                <tbody>
                    <tr>
                        <td><?php echo $row["Item_ID"]; ?></td>
                        <td><?php echo $row["Item_Name"]; ?></td>
                        <td>RM <?php echo $row["Item_Price"]; ?></td>
                        <td><?php echo $row["SUM(wid.Sal_Amount)"]; ?></td>
                        <td>RM <?php $rate = $row["Item_Price"]; $sale = $row["SUM(wid.Sal_Amount)"]; echo $rate * $sale; ?></td>
                    </tr>
                </tbody>
            <?php    
            }
            ?>
            </table>
        </div>
    </div>
</section>




<!--Bootstrap js-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
    integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
    crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
    integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
    crossorigin="anonymous"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> 
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> 
<script>
    //to make dropdown hover
    const $dropdown = $(".dropdown");
    const $dropdownToggle = $(".dropdown-toggle");
    const $dropdownMenu = $(".dropdown-menu");
    const showClass = "show";

    $(window).on("load resize", function () {
        if (this.matchMedia("(min-width: 768px)").matches) {
            $dropdown.hover(
                function () {
                    const $this = $(this);
                    $this.addClass(showClass);
                    $this.find($dropdownToggle).attr("aria-expanded", "true");
                    $this.find($dropdownMenu).addClass(showClass);
                },
                function () {
                    const $this = $(this);
                    $this.removeClass(showClass);
                    $this.find($dropdownToggle).attr("aria-expanded", "false");
                    $this.find($dropdownMenu).removeClass(showClass);
                }
            );
        } else {
            $dropdown.off("mouseenter mouseleave");
        }
    });

    $(document).ready(function(){  
           $.datepicker.setDefaults({  
                dateFormat: 'yy-mm-dd'   
           });  
           $(function(){  
                $("#from_date").datepicker();  
                $("#to_date").datepicker();  
           });  
           $('#filter').click(function(){  
                var from_date = $('#from_date').val();  
                var to_date = $('#to_date').val();  
                if(from_date != '' && to_date != '')  
                {  
                     $.ajax({  
                          url:"filter4.php",  
                          method:"POST",  
                          data:{from_date:from_date, to_date:to_date},  
                          success:function(data)  
                          {  
                               $('#order_table').html(data);  
                          }  
                     });  
                }  
                else  
                {  
                     alert("Please Select Date");  
                }

                if(from_date != '' && to_date != '')  
                {  
                     $.ajax({  
                          url:"filter5.php",  
                          method:"POST",  
                          data:{from_date:from_date, to_date:to_date},  
                          success:function(data)  
                          {  
                               $('#order_table1').html(data);  
                          }  
                     });  
                }  
                else  
                {  
                     alert("Please Select Date");  
                }
           });  
      });
</script>

</body>

</html>