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


$ano=date("Y");
$fecha = $_GET["fecha"];
date_default_timezone_set("America/Buenos aires" ) ; 
$hora = date('h:i a',time() - 3600*date('I')); 
?>
<!DOCTYPE html>

<html dir="ltr" lang="en-US"><head><!-- Created by Artisteer v4.3.0.60745 -->
  
    <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/verifcar_ped_clie.php?mesa=" + mesa + "&ventana=<? echo "1"; ?>&fecha=<? echo $fecha ?>&hora=<? echo $hora ?>";
		}

function cierre(){
	
			miPopup = window.open("cierre/index.php?fecha=<? echo $fecha ?>","cant_","width=900,height=500,top=80,left=200,status=no, scrollbars=no, toolbars=no, menubar=no,resizable=yes,directories=no");
			miPopup.focus();
}
</script>
</head>
<body onload="nobackbutton();">
<div id="art-main">
    <div class="art-sheet clearfix">
<nav class="art-nav">
    <ul class="art-hmenu">
    <li><a><font size="+1" color="#FF0000">Fecha: <? echo $fecha ?></font></a></li>
        <li><a><font size="+1" color="#FF0000">Hrs: <? echo $hora ?></font></a></li>

    <li><a href="index.php" class="active">INICIO</a></li>
    
    <li><a href="" onClick="cierre()">CIERRE CAJA</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>TOMA DE PEDIDOS</h3>
        <p><strong>Presione algunos de los vendedores disponible para agregar productos...</strong> </p>
        <div class="image-caption-wrapper" style="width: 100%">
          <table align="center" width="833" border="0">
  
     <tr>
<? for($a=1;$a<=4;$a++){//activo=1 | descativo=2
	?><td width="497"><?
   
	      $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");
		  $cliente=mysql_result($res_activo,0,"cliente");
		  
	      if ($num_activo==1){	
		   
	    if($a==4){ ?><img src="images/llevar.png"  onClick="menu('<? echo $a ?>')"></a> <? }
		 else{?><img src="images/disponible.png"  onClick="menu('<? echo $a ?>')"></a> <? }
	
	}else
	      {
	    ?> <img src="images/ocupada.png" style="border: #000 1px solid; background-color: #FF99FF"disabled>
	    <?
		  }

	?><font size="+1" color="#0000CC"> <b><? echo $nombre_mesa ?><br><? echo $cliente ?></b></font>
	<? }?></td>
<td width="326"><div style="height:430px; width:100%;  overflow: auto;">
  <?
        $buscar='select * from ventas where fecha like \'%'.$fecha.'%\' order by idventas desc';
		   $r=mysql_query($buscar,$conn) or die("Error en el query: ".mysql_error());
		   $n=mysql_num_rows($r);
		    //si hay registros los procesamos
			if($n>0)
			{
			?>
  <table  width="281" height="113" border="0">
    <tr >
      <td>Listado de Pedido</td>
    </tr>
    <tr>
      <td><?
				while($row=mysql_fetch_assoc($r))
				{ //Procesamos cada registro como una fila de tabla
					?>
        <form method="post" action="funciones/verifcar_ped_elim.php"  name="eliminar" id="eliminar" >
          <input type="submit" style="background-image:url(images/delete.png); height:20px; width:20px;" 
                         id="aceptar" value="" name="aceptar"  >
          <? $mesa=$row["mesa"];
					        $query_mesa="SELECT * FROM mesa  WHERE num_mesa='$mesa'";
							$rs_query_mesa=mysql_query($query_mesa);
							$nom_mesa=mysql_result($rs_query_mesa,0,"nombre_mesa"); 
							$vendedor=mysql_result($rs_query_mesa,0,"cliente");
							?>
          <input type="button" class="art-button-dos" 
               value="hora: <? echo $row["hora"];  ?> Pedido: <? echo $row["idpedido"];?> Total: <?  echo $row["total"]; ?>" style="height:20px; width:265px;" >
          <input type="button" class="art-button-dos" 
               value="Vendedor: <? echo $vendedor; ?> " style="height:20px; width:290px;" >
          <input type="hidden" id="fecha" name="fecha" value="<? echo $row["fecha"];?>">
          <input type="hidden" id="mesa" name="mesa" value="<? echo $row["mesa"];?>">
          <input type="hidden" id="numero" name="numero" value="<? echo $row["idpedido"];?>">
          <input type="hidden" id="ventana" name="ventana" value="<? echo "2";  ?>">
        </form>
        <? 
					 $idpedido=$row["idpedido"]; 
                     
                     $buscar_r='select *, SUM(cantidad) as cant, SUM(valor_total) as valor from 
                     detalles_pedido where numero like \'%'.$idpedido.'%\' group by grupo, idplatos  ';
		             $rs=mysql_query($buscar_r,$conn) or die("Error en el query: ".mysql_error()); 
                      while($rows=mysql_fetch_assoc($rs))
				        { //Procesamos cada registro co
                          ?>
        <div style="background-color:#CCC">
          <?
						  $cant=$rows["cant"];
						  $plato=$rows["idplatos"];
						  
					      $query="SELECT *  FROM platos WHERE idplatos='$plato'";
 					      $rs_query=mysql_query($query);
					      $nombre=mysql_result($rs_query,0,"descrip_plato");
					      $idgrupos=mysql_result($rs_query,0,"idgrupos");
                          echo $nombre;  ?>
          (<? echo $cant ?>)</div>
        <br>
        <?
                         
                         
                         } ?>
        <? }?>
      </table>
  <br>
  <? } 
			else
			{
				echo "No hubieron coincidencias!";
     
			} ?>
</div></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>