
<?php include("../conn.php");
$page='  Total Revenue Management';?>
<!DOCTYPE html>
<html lang="en">
<?php include("../common/head.php")?>
<body>
<?php include("../common/menu.php")?>
<!---side nav bar end-->
<?php include("../common/tittle.php")?>

            <!--Main body Start-->
            <div class="col-sm-12 mt-2">
            
               <!--search section start-->


               <center>
               <?php include('../button.php')?>
              </center>            
      <hr class="bg-success">

      
                <!--search section end-->
                <!--Orders start-->
                
            <?php 
            $today= date("F j, Y ");
            $sql2="SELECT * FROM currency ";
            $result2 = mysqli_query($conn,$sql2)or die( mysqli_error($conn));
            $row2=mysqli_fetch_array($result2) ;
            $currency=$row2['curency'];
            
        $sql1="select  SUM(amount) from orders_details ";
        $result1 = mysqli_query($conn,$sql1)or die( mysqli_error($conn));
        $row1=mysqli_fetch_array($result1);
        $amount=$row1['SUM(amount)'];

        $sql5="select  SUM(total)from orders where status='0' and location='Bar' ";
        $result5 = mysqli_query($conn,$sql5)or die( mysqli_error($conn));
        $row5=mysqli_fetch_array($result5);
      
        $bar_total=$row5['SUM(total)'];;

        $sql6="select  SUM(total) from orders where status='0' and location='Restaurant' ";
        $result6 = mysqli_query($conn,$sql6)or die( mysqli_error($conn));
        $row5=mysqli_fetch_array($result6);
        $restaurant_total=$row5['SUM(total)'];

        $total_earning=$bar_total+$restaurant_total;


        $sql2="select * from orders_details where status='0' ";
        $result2 = mysqli_query($conn,$sql2)or die( mysqli_error($conn));
        $total_orders = mysqli_num_rows($result2) ;

        $sql3="select * from orders_details where status='0' ";
        $result3 = mysqli_query($conn,$sql3)or die( mysqli_error($conn));
        $total_orders = mysqli_num_rows($result3) ;

        $sql4="select * from customers  ";
        $result4 = mysqli_query($conn,$sql4)or die( mysqli_error($conn));
        $new_cus = mysqli_num_rows($result4) ;
      
    

      
            ?>
                <div id="myList" class="menu-analytics row no-gutters">
                <div class="daily-report text-white d-flex flex-wrap refreeshmes ">
                        

                        <div class="col-sm-3 m-2 revenue  ">
                    <div class="first-item">
                      <div class="item-label p-2">
                        <h4><?php echo $currency."". number_format($total_earning,2)?> <i style="float: right;" class="fa fa-money fa-lg fa-icon"></i></h4>
                        <div class="progress">
                          <div class="progress-bar progress-bar-striped <?php echo $bgt?> active" role="progressbar"
                          aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width:100%">
                          </div>
                        </div>
                        <p title="Yesterday sales was <?php echo  $currency."".  number_format($total_yesterday_earning,2) ?> " class="my-1">Today Earnings  <span style="float: right;"></span></p>
                      </div>
                    </div>
                  </div>
    
                  <div class="col-sm-3 m-2 revenue ">
                    <div class="first-item5">
                      <div class="item-label p-2">
                        <h4> <?php echo $total_orders?><i style="float: right;" class="fa fa-handshake-o fa-lg fa-icon"></i></h4>
                        <div class="progress">
                          <div class="progress-bar progress-bar-striped active" role="progressbar"
                          aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width:100%">
                          </div>
                        </div>
                        <p class="my-1">Order Completed <span style="float: right;"></span></p>
                      </div>
                    </div>
                  </div>
    
                  <div class="col-sm-3 m-2 revenue ">
                    <div class="first-item4">
                      <div class="item-label p-2">
                        <h4><?php echo  $currency."".  number_format($bar_total,2)?> <i style="float: right;" class="fa fa-money  fa-lg fa-icon"></i></h4>
                        <div class="progress">
                          <div class="progress-bar progress-bar-striped <?php echo $bg?> active" role="progressbar"
                          aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:100%;">
                          </div>
                        </div>
                        <p title="Yesterday sales was <?php echo  $currency."".  number_format($bar_total_yesterday,2) ?> " class="my-1">Bar Earnings  <span style="float: right;"></span></p>
                      </div>
                    </div>
                  </div>
    
                  <div class="col-sm-3 m-2 revenue ">
                    <div class="first-item6">
                      <div class="item-label p-2">
                        <h4><?php echo  $currency."".  number_format($restaurant_total,2)?> <i style="float: right;" class="fa fa-money fa-lg fa-icon"></i></h4>
                        <div class="progress">
                          <div class="progress-bar progress-bar-striped <?php echo $bgr?> active" role="progressbar"
                          aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width:100%">
                          </div>
                        </div>
                        <p title="Yesterday sales was <?php echo  $currency."".  number_format($restaurant_total_yesterday,2) ?> "class="my-1">Restaurant Earnings  <span style="float: right;"></span></p>
                      </div>
                    </div>
                  </div>
    
                           
             
                 
    
    
               
    
    
                  <div class="col-sm-3 m-2 revenue ">
                    <div class="first-item5">
                      <div class="item-label p-2">
                        <h4> <?php echo $new_cus?><i style="float: right;" class="fa fa-handshake-o fa-lg fa-icon"></i></h4>
                        <div class="progress">
                          <div class="progress-bar progress-bar-striped active" role="progressbar"
                          aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width:100%">
                          </div>
                        </div>
                        <p class="my-1">New Customers <span style="float: right;"></span></p>
                      </div>
                    </div>
                  </div>
                        <!---revanue section end ----->    
                        </div>
    



                    <!-- <div id="chart_div" style="width: 100%; height: 500px;"></div>--->
        
                </div>

         
              
            </div>
            <!--Main body end-->

            <!--Invoice Section start-->
         

           
            <!--Invoice Section end-->

           
        </div>

    </div>
    
    <!--  isotope plugin cdn  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="sha256-CBrpuqrMhXwcLLUd5tvQ4euBHCdh7wGlDfNz8vbu/iI=" crossorigin="anonymous"></script>
    <script src="js/script.js"></script>
    <!--  isotope plugin cdn  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="sha256-CBrpuqrMhXwcLLUd5tvQ4euBHCdh7wGlDfNz8vbu/iI=" crossorigin="anonymous"></script>
    <script src="js/script.js"></script>
     <!-- jQuery js-->
 
     <!-- Bootstrap js -->
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
     <!-- jQuery Datatable js -->
     <script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
     <!-- Bootstrap Datatable js -->    
     <script src="https://cdn.datatables.net/1.10.21/js/dataTables.bootstrap4.min.js"></script>
     <script>
       $(document).ready( function () {
           $('#example_table').DataTable();
       } );
       </script>
    <!--google graph-->
   
 <!--auto refresh--->
<script>

$(document).ready(function(){
setInterval(function(){
   $(".refreeshmes").load(window.location.href + " .refreeshmes" );
}, 3000);
});

</script>

<script>
    google.charts.load('current', {'packages':['corechart']});
    google.charts.setOnLoadCallback(drawChart);
    
    function drawChart() {
    
    // Set Data
    const data = google.visualization.arrayToDataTable([
      ['Facility', 'GHC'],
      ['Restaurant',<?php echo $restaurant_total; ?>],
      ['Bar',<?php echo $bar_total; ?>],
      ['Hotel',<?php echo $hotel_amount; ?>],
      ['Pole',<?php echo $pole_amount; ?>],
    ]);
    
    // Set Options
    const options = {
      title:'Performance According to Facility',
      is3D:true
    };
    
    // Draw
    const chart = new google.visualization.PieChart(document.getElementById('myChart'));
    chart.draw(data, options);
    
    }
    </script>

>

<script type="text/javascript">
    google.charts.load('current', {'packages':['corechart']});
    google.charts.setOnLoadCallback(drawChart);

    function drawChart() {
      var data = google.visualization.arrayToDataTable([
        ['Year', '2024 Revenue (GHC)', '2023 Revenue (GHC)'],
        ['Januuary',  1000,      400],
        ['Febuary',  1170,      460],
        ['March',  660,       1120],
        ['April',  1030,      540],
        ['May',  1030,      540]
      ]);

      var options = {
        title: 'Company Performance',
        hAxis: {title: 'Months',  titleTextStyle: {color: '#333'}},
        vAxis: {minValue: 0}
      };

      var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
      chart.draw(data, options);
    }
  </script>

</body>

</html>