<?
require_once('conf/connection.php');

$numero = $_GET["numero"];
$mesa = $_GET["mesa"];
$ventana = $_GET["ventana"];

$ano=date("Y");

$up_add_mesa="insert into add_mesa (codigo, pedido, mesa) values ('','$mesa', '$mesa')";    
mysql_query($up_add_mesa, $conn) or die("Error en el query: ".mysql_error());

?>
<!DOCTYPE html>

<html dir="ltr" lang="en-US"><head><!-- Created by Artisteer v4.3.0.60745 -->
    <META HTTP-EQUIV="REFRESH" CONTENT="3">
    <meta charset="utf-8">
    <title>SELECCION DE MESAS</title>
    <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">

    <!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <link rel="stylesheet" href="style.css" media="screen">
    <!--[if lte IE 7]><link rel="stylesheet" href="style.ie7.css" media="screen" /><![endif]-->
    <link rel="stylesheet" href="style.responsive.css" media="all">


    <script src="jquery.js"></script>
    <script src="script.js"></script>
    <script src="script.responsive.js"></script>



<style>
.art-content .art-postcontent-0 .layout-item-0 { margin-bottom: 10px;  }
.art-content .art-postcontent-0 .layout-item-1 { border-right-style:solid;border-right-width:1px;border-right-color:#C4C6BD; padding-right: 10px;padding-left: 10px;  }
.ie7 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
.ie6 .art-post .art-layout-cell {border:none !important; padding:0 !important; }

.table { border:2px black solid;
 border-radius:10px;
 min-width:300px;
 min-height:300px;
 font-family: Helvetica,Arial;
}
</style>

<script>
 var miPopup
		function menu(mesa){

			window.location.href = "funciones/add_mesa.php?mesa=" + mesa + "&numero=<? echo $numero ?>&ventana=<? echo $ventana ?>";
		}
		
</script>
</head>
<body>
<div id="art-main">
    <div class="art-sheet clearfix">
<nav class="art-nav">
    <ul class="art-hmenu"><li><a href="index.php" class="active">INICIO</a></li></ul> 
    </nav>
<div class="art-layout-wrapper">
                <div class="art-content-layout">
                    <div class="art-content-layout-row">
                      <div class="art-layout-cell art-content"><article class="art-post art-article">
                                
                                                
                                <div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout-wrapper layout-item-0">
<div class="art-content-layout">
    <div class="art-content-layout-row">
    <div class="art-layout-cell layout-item-1" style="width: 100%" >
        <h3>SELECCION DE MESAS</h3>
        <p><strong>Presione algunos de las mesas disponible para agregar productos...</strong> </p>
        <div class="image-caption-wrapper" style="width: 100%">
          <table align="center" width="420" border="0">
            <tr>
              <? for($a=1;$a<=5;$a++){//activo=1 | descativo=2
	?>
              <td><?
   
	      $query_activo="SELECT * FROM mesa WHERE num_mesa='$a'";
          $res_activo=mysql_query($query_activo);
          $num_activo=mysql_result($res_activo,0,"est_mesa");
		  $nombre_mesa=mysql_result($res_activo,0,"nombre_mesa");
	      if ($num_activo==1){	
		
	?>
                <a href="#"> <img src="images/disponible.png" alt=""  onClick="menu('<? echo $a ?>')"></a>
                <?   }else
	      {
	    ?>
                <a href="#"><img src="images/ocupada.png" alt="" style="border: #000 1px solid; background-color: #FF99FF"disabled></a>
                <?
		  }

	?>
                <p class="fuente" align="center"><font size="+1" color="#0000CC"> <b><? echo $nombre_mesa?></b></font></p>
                <? }?></td>
            </tr>
            <tr>
              <? for($b=6;$b<=10;$b++){//activo=1 | descativo=2
	?>
              <td><?
   
	      $query_activo="SELECT * FROM mesa WHERE num_mesa='$b'";
          $res_activo=mysql_query($query_activo);
          $num_activo=mysql_result($res_activo,0,"est_mesa");
		  $nombre_mesa=mysql_result($res_activo,0,"nombre_mesa");
	      if ($num_activo==1){	
		
	?>
               <a href="#"> <img src="images/disponible.png" alt=""  onClick="menu('<? echo $b ?>')"></a>
                <?   }else
	      {
	    ?>
                 <a href="#"> <img src="images/ocupada.png" alt="" style="border: #000 1px solid; background-color: #FF99FF"disabled></a>
                <?
		  }
	?>
                <p class="fuente" align="center"><font size="+1" color="#0000CC"><b><? echo $nombre_mesa?></b></font></p>
                <? }?></td>
            </tr>
            <tr>
              <? for($c=11;$c<=15;$c++){//activo=1 | descativo=2
	?>
              <td><?
   
	      $query_activo="SELECT * FROM mesa WHERE num_mesa='$c'";
          $res_activo=mysql_query($query_activo);
          $num_activo=mysql_result($res_activo,0,"est_mesa");
		  $nombre_mesa=mysql_result($res_activo,0,"nombre_mesa");
		  $num_mesa=mysql_result($res_activo,0,"num_mesa");
	      if ($num_activo==1){	
		
	?>
                <a href="#">  <img src="images/disponible.png" alt=""  onClick="menu('<? echo $c ?>')"></a>
                <?   }else
	      {
	    ?>
                 <a href="#"> <img src="images/ocupada.png" alt="" style="border: #000 1px solid; background-color: #FF99FF"disabled></a>
                <?
		  }
	?>
                <p class="fuente" align="center">
                <font size="+1" color="#0000CC"><b><? echo $nombre_mesa; ?></b></font></p>
           
                <?  }?></td>
            </tr>
            <tr>
              <? for($d=16;$d<=20;$d++){//activo=1 | descativo=2
	?>
              <td><?
   
	      $query_activo="SELECT * FROM mesa WHERE num_mesa='$d'";
          $res_activo=mysql_query($query_activo);
          $num_activo=mysql_result($res_activo,0,"est_mesa");
		  $nombre_mesa=mysql_result($res_activo,0,"nombre_mesa");
		  $num_mesa=mysql_result($res_activo,0,"num_mesa");
	      if ($num_activo==1){	
		
	?>
                 <a href="#"> <img src="images/disponible.png" alt=""  onClick="menu('<? echo $d ?>')"></a>
                <?   }else
	      {
	    ?>
                  <a href="#"><img src="images/ocupada.png" alt="" style="border: #000 1px solid; background-color: #FF99FF"disabled></a>
                <?
		  }if($num_mesa==16 or $num_mesa==17 or $num_mesa==18 ){?>
		  
          <p class="fuente" align="center"><font size="+1" color="#00CC00"><b><? echo $nombre_mesa?></b></font></p>
		  <?	  
			  }else {
	?>
                <p class="fuente" align="center"><font size="+1"><b><? echo $nombre_mesa?></b></font></p>
                <? }}?></td>
            </tr>
            <tr>
              <? for($e=21;$e<=26;$e++){//activo=1 | descativo=2
	?>
              <td><?
   
	      $query_activo="SELECT * FROM mesa WHERE num_mesa='$e'";
          $res_activo=mysql_query($query_activo);
          $num_activo=mysql_result($res_activo,0,"est_mesa");
		  $nombre_mesa=mysql_result($res_activo,0,"nombre_mesa");
		   $num_mesa=mysql_result($res_activo,0,"num_mesa");
	      if ($num_activo==1){	
		
	?>
                 <a href="#"> <img src="images/disponible.png" alt=""  onClick="menu('<? echo $e ?>')"></a>
                <?   }else
	      {
	    ?>
                 <a href="#"> <img src="images/ocupada.png" alt="" style="border: #000 1px solid; background-color: #FF99FF"disabled></a>
                <?
		  }if($num_mesa==21){?>
		  
          <p class="fuente" align="center"><font size="+1"><b><? echo $nombre_mesa?></b></font></p>
		  <?	  
			  }else {
	?>
                <p class="fuente" align="center"><font size="+1" color="#FF00FF"><b><? echo $nombre_mesa?></b></font></p>
                <? }}?></td>
            </tr>
          </table>
        </div>
    </div>
    </div>
</div>
</div>
</div>


</article></div>
                    </div>
                </div>
            </div><footer class="art-footer">
<p><br></p>
<p>Copyright © <? echo $ano; ?>. All Rights Reserved.</p>
</footer>

    </div>
    <p class="art-page-footer">
        <span id="art-footnote-links"><a href="http://www.virtualsurchile.cl" target="_blank">Informatica Francisco Arias E.I.R.L.</a></span>
    </p>
</div>


</body></html>