<link href="wstyle.css" rel="stylesheet" type="text/css" />
<div align="center">
<? if ($_GET['stat'] == '' ) { ?>
<table width="100%" border="0">
  <tr>
    <td class="td1">Date</td>
    <td class="td1">Time</td>
    <td class="td1">Plate No.</td>
    <td class="td1">Type</td>
    <td colspan="2" class="td1">Size</td>
    <td class="td1">Remarks</td>
    <td class="td1">Printed</td>
    <td class="td1">Urgency</td>
  </tr>
		<?
            $result = mysql_query('SELECT *  FROM p1_order_info where status = 1 and stop1=0 order  by aid ,  Type2 desc , Time_a, oid',$db); 
            while($row = mysql_fetch_array($result)){ 
        
        ?>
  <tr <? if( $row['Type2'] == '1') { ?>class="td4" <? }else{ ?> class="td2" <? } ?>>
    <td><div align="center"><? echo $row['Date_a']; ?></div></td>
    <td><div align="center"><? echo $row['Time_a']; ?></div></td>
    <td><div align="center"><? echo $row['Plate']; ?></div></td>
    <td><div align="center"><div align="center" class="p_c<? echo $row['Type1']?>">
      <?	
                        $result1 = mysql_query('select * from p1_plate_type where tyid = '.$row['Type1']); 
                        while($row1 = mysql_fetch_array($result1)){ 
                				echo $row1['plate_type'] ;
								
            
					}
				?>
    </div></div></td>
    <td><div align="center"><? echo $row['Size1']; ?></div></td>
    <td><div align="center"><? echo $row['Size2']; ?></div></td>
    <td><div align="center"><? echo $row['Remarks']; ?></div></td>
    <td><div align="center"><a href="index.php?page=3&stat=Delivery&id=<? echo $row['oid']; ?>&plate=<? echo $row['Plate']; ?>" <? if( $row['Type2'] == '1') { ?>class="td4" <? }else{ ?> class="td2" <? } ?>>Printed</a></div></td>
    <td><? if( $row['Type2'] == '1') { ?>Yes<? } elseif( $row['Type2'] == '0')  { ?>No<? }elseif( $row['Type2'] == '2'){ 
	
	
	
	?>Agent <?
   
     $aid = $row['aid'];
	$query1 = mysql_query("SELECT p1_agent_order.aid, p1_agent_order.tid, p1_agent.agent_name, p1_agent_order.agent_date, p1_agent_order.status
FROM p1_agent INNER JOIN p1_agent_order ON p1_agent.tid = p1_agent_order.tid where aid = $aid");
	if (mysql_num_rows($query1) <> "0")
				{
					echo  " (".mysql_result($query1,0,"agent_name").") ";
				}
	}elseif( $row['Type2'] == '3') { ?>VIP<? }
				?></td>
  </tr>
		<?
			}
		
		?>
</table>

<? } if ($_GET['stat'] == 'Delivery' ) { ?>
	<table width="50%" border="0">
      <tr>
        <td width="40%" class="td1">Plate No.</td>
        <td class="td2">&nbsp;<? echo $_GET['plate'];?></td>
      </tr>
      <tr>
        <td class="td1">Delivery</td>
        <td class="td2">&nbsp;<a href="index.php?page=3&stat=change&id=<? echo $_GET['id']; ?>" class="link">Delivery</a></td>
      </tr>
    </table>
	<p>&nbsp;</p>


<? } ?>


</div>