<?php require('header.php'); ?>
<?php require("connect.php"); ?>


<div class="row">
    <div class="box col-md-12"><center>
<?php
echo "<a href='index.php?pg=1'><button class='btn btn-warning btn-sm'>Today</button>";
echo "&nbsp;&nbsp;";
echo "<a href='index.php?pg=2'><button class='btn btn-warning btn-sm'>Yesterday&nbsp;&nbsp;</button>";
echo "&nbsp;&nbsp;";
echo "<a href='index.php?pg=0'><button class='btn btn-warning btn-sm'>All</button>";

$dd01 = $_GET ["pg"];
//echo $dd01;



if ($_GET ["pg"] == 1 ){$d1=strtotime("today");}
if ($_GET ["pg"] == 2 ){$d1=strtotime("yesterday");	}

$dddd = date("Y-m-d", $d1) . "<br>";

if ($_GET ["pg"] == 0 ){$dddd=("All");}

//echo $dddd;


//echo $query05 ;






?>
</center>
   </div>
    </div>
<div class="row">
    <div class="box col-md-12">
    <div class="box-inner">
    <div class="box-header well" data-original-title="">
        <h2><i class="glyphicon glyphicon-user"></i>Receivers</h2>

        <div class="box-icon">
          
            <a href="#" class="btn btn-minimize btn-round btn-default"><i
                    class="glyphicon glyphicon-chevron-up"></i></a>
          
        </div>
    </div>
    <div class="box-content">
   
    <table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
    <thead>
    <tr>
						<tr>
                            <th>Αριθμός Παραγγελίας</th>
                            <th>Ημερομηνία</th>
                            <th>Όνομα πελάτη</th>
                            <th>Παράδοση</th>
							 <th>Προορισμός</th>
							 <th>Κιβώτια</th>
							 <th>Κιλά</th>
                            <th>Actions</th>
                        </tr>
    </tr>
    </thead>
    <tbody>

    <?php

					
					//$sid2 = $_SESSION['sid2'];
					$sid2 = "222-090722000";
					if ($_SESSION['sid2'] == 1 ){$query = "Select * from RECEIVERS";}
					else { $query = "Select * from RECEIVERS where UserCode ='".$sid2."'";}			
					if ($_GET ["pg"] > 0 ){$query = "Select * from RECEIVERS where UserCode ='".$sid2."' and PhrDate='".$dddd."'";}
					//echo $query ;
					$result = mysqli_query($dbC,$query) or die(mysqli_error());
					$y=0;
					 while($row = mysqli_fetch_array($result)){
                            $y++;
							
                            echo "<tr onclick='get_details(".$row['OrderId'].", $(this).offset());'>";
                            echo "<td>".$row['OrderId'] ." </td>";
							echo "<td>".$row['PhrDate']."</td>";
							echo "<td>".$row['RecName']."</td>";
							echo "<td>".$row['RecParadosh']."</td>";  
							echo "<td>".$row['RecProorismos']."</td>"; 	
							echo "<td>".$row['PhrKibotia']."</td>";
							echo "<td>".$row['PhrKila']."</td>";
							echo "<td><a href='index_details.php?oid=".$row['OrderId']."&sid2=".$sid2."'><button class='btn btn-warning btn-sm'>View Order</button></a></td>";
   
							
						    echo "</tr>";
							
					 }
					 ?>
   
   
   
   

    </tbody>
    </table>
    </div>
    </div>
    </div>
    <!--/span-->

    </div><!--/ro-->






  

   

    
<?php require('footer.php'); ?>
