<?php
include('../conexion.php'); 


?>
<META HTTP-EQUIV="REFRESH" CONTENT="5;URL=rejilla.php">
<html>
	<head>
		<title>Clientes</title>
		<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
		<script language="javascript">
			function abrir_mesa(mesa,estado) {
		
		if (estado==1) {
		
		
		parent.location.href="nuevo_pedido.php?mesa=" + mesa + "&estado=" + estado ;	
		} else {
		
	    parent.location.href="modificar_pedido.php?mesa=" + mesa + "&estado=" + estado ;	

		}}


	
		</script>
	</head>

	<body onload= nobackbutton(); inicio()>	
		<div id="">
			<div id="zonaContenidoPP">
			<div align="center">
			  <table class="fuente9" width="100%" cellspacing=0 cellpadding=0 border=0 id="Table1">
                <input type="hidden" name="numfilas" id="numfilas" value="<?php echo $filas?>">
                <input type="hidden" name="totalfacturas" id="totalfacturas" value="<?php echo $totalfacturas?>">
                <?php 
				/*INICIAR VARIABLES CLIETES DE MESAS*/
				 $climes1="";  $climes2=""; $climes3="";
				 $climes4="";  $climes5=""; $climes6="";
				 $climes7="";  $climes8=""; $climes9="";
				 $climes10=""; $climes11=""; $climes12="";
				 $climes13=""; $climes14=""; $climes15="";
				 
				 
				 /*INICIAR VARIABLES CLIETES DE ASIENTOS*/
				 $cliasiento1="";$cliasiento2="";$cliasiento3="";
				 $cliasiento4="";$cliasiento5="";$cliasiento6="";
				 $cliasiento7="";$cliasiento8="";$cliasiento9="";
				 $cliasiento10="";$cliasiento11="";$cliasiento12="";
				 $cliasiento13="";$cliasiento14="";$cliasiento15="";
				 $cliasiento16="";$cliasiento17="";$cliasiento18="";
				 $cliasiento19=""; $cliasiento20="";$cliasiento21="";
				 $cliasiento22="";$cliasiento23="";$cliasiento24="";
				 $cliasiento25="";
				 
				 
						 $sel_resultado="SELECT * FROM mesas";
			             $res_resultado=$mysqli->query($sel_resultado);
			             $row = $res_resultado->fetch_array();
						 
						 

						   $contador=0;
					
								$mesa1=$row["mesa1"];
							    $mesa2=$row["mesa2"];
							    $mesa3=$row["mesa3"];
								$mesa4=$row["mesa4"];
								$mesa5=$row["mesa5"];
								$mesa6=$row["mesa6"];
								$mesa7=$row["mesa7"];
								$mesa8=$row["mesa8"];;
								$mesa9=$row["mesa9"];
								$mesa10=$row["mesa10"];
								$mesa11=$row["mesa11"];
								$mesa12=$row["mesa12"];
								$mesa13=$row["mesa13"];
								$mesa14=$row["mesa14"];
								$mesa15=$row["mesa15"];
								
								$asiento1=$row["asiento1"];
								$asiento2=$row["asiento2"];
								$asiento3=$row["asiento3"];
								$asiento4=$row["asiento4"];
								$asiento5=$row["asiento5"];
								$asiento6=$row["asiento6"];
								$asiento7=$row["asiento7"];
								$asiento8=$row["asiento8"];
								$asiento9=$row["asiento9"];
								$asiento10=$row["asiento10"];
								$asiento11=$row["asiento11"];
								$asiento12=$row["asiento12"];
								$asiento13=$row["asiento13"];
								$asiento14=$row["asiento14"];
								$asiento15=$row["asiento15"];
								$asiento16=$row["asiento16"];
								$asiento17=$row["asiento17"];
								$asiento18=$row["asiento18"];
								$asiento19=$row["asiento19"];
								$asiento20=$row["asiento20"];
								$asiento21=$row["asiento21"];
								$asiento22=$row["asiento22"];
								$asiento23=$row["asiento23"];
								$asiento24=$row["asiento24"];
								$asiento25=$row["asiento25"];
								
								//$ip = $_SERVER['REMOTE_ADDR'] ;
								//echo "SOY ".$ip;
		
								
    ?>
                <tr>
                  <?php		
		if ($mesa1==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_1.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa1" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {



		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA1'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();
		
		$climes1 = $row["dsccli"];
		
	
?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_1.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa1" ?>', <?php echo 0 ?> )"></a></td>
                  <?php }
			
				if ($mesa2==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_2.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa2" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_2.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa2" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
	
		
						$sel_resultado= "SELECT dsccli FROM pedidos WHERE codfactura='MESA2'";
			             $res_resultado=$mysqli->query($sel_resultado);
			             $row = $res_resultado->fetch_array();
						 $climes2=$row["dsccli"];
						 	
		
			 } 
			
					if ($mesa3==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_3.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa3" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_3.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa3" ?>', <?php echo 0 ?> )"></a></td>
                  <?php


		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA3'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes3 = $row["dsccli"];	
			
			 }?>
                  <td width="5%">              
                  <td><?php							if ($asiento1==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_1.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento1" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_1.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento1" ?>', <?php echo 0 ?> )"></a></td>
                  <?php


		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento1'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento1 = $row["dsccli"];			
			 }
			
											if ($asiento2==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_2.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento2" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_2.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento2" ?>', <?php echo 0 ?> )"></a></td>
                  <?php


		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento2'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento2 = $row["dsccli"];	

		
			 }
			
												if ($asiento3==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_3.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento3" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_3.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento3" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 


		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento3'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento3 = $row["dsccli"];				
			
			}
			
												if ($asiento4==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_4.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento4" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_4.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento4" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 



		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento4'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento4 = $row["dsccli"];				
			
			}
			
			
															if ($asiento5==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_5.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento5" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_5.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento5" ?>', <?php echo 0 ?> )"></a></td>
                  <?php


		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento5'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento5 = $row["dsccli"];				
			 }
	
			?>

                </tr>
                <tr>
                  <td align="center"><?php echo substr($climes1,0,14);?></td>
                  <td align="center"><?php echo substr($climes2,0,14);?></td>
                  <td align="center"><?php echo substr($climes3,0,14);?></td>
                  <td align="center">&nbsp;</td>
                  <td align="center">&nbsp;</td>
                  <td align="center"><?php echo substr($cliasiento1,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento2,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento3,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento4,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento5,0,14);?></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                
                  <?php		
		if ($mesa4==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_4.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa4" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_4.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa4" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  
		
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA4'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes4 = $row["dsccli"];	
 }
			
				if ($mesa5==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_5.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa5" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_5.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa5" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 

		
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA5'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes5 = $row["dsccli"];
} 
			
					if ($mesa6==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_6.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa6" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_6.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa6" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA6'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes6 = $row["dsccli"];
				  }?>
                  <td width="5%">              
                  <td><?php							if ($asiento6==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_6.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento6" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_6.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento6" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  
	
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento6'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento6 = $row["dsccli"];
	 }
			
											if ($asiento7==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_7.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento7" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_7.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento7" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  
	

	
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento7'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento7 = $row["dsccli"];	
 }
			
												if ($asiento8==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_8.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento8" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_8.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento8" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento8'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento8 = $row["dsccli"];	

}
			
												if ($asiento9==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_9.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento9" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_9.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento9" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento9'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento9 = $row["dsccli"];	

		
 }
			
			
															if ($asiento10==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_10.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento10" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_10.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento10" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento10'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento10 = $row["dsccli"];		
}
	
			?>
                </tr>
                <tr>
                  <td align="center"><?php echo substr($climes4,0,14);?></td>
                  <td align="center"><?php echo substr($climes5,0,14);?></td>
                  <td align="center"><?php echo substr($climes6,0,14);?></td>
                  <td align="center">&nbsp;</td>
                  <td align="center">&nbsp;</td>
                  <td align="center"><?php echo substr($cliasiento6,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento7,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento8,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento9,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento10,0,14);?></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <?php		
		if ($mesa7==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_7.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa7" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_7.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa7" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA7'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes7 = $row["dsccli"];	
 }
			
				if ($mesa8==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_8.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa8" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_8.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa8" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA8'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes8 = $row["dsccli"];
} 
			
					if ($mesa9==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_9.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa9" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_9.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa9" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA9'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes9 = $row["dsccli"];
				   }?>
                  <td width="5%">              
                  <td><?php							if ($asiento11==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_11.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento11" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_11.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento11" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento11'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento11 = $row["dsccli"];	
	}
			
											if ($asiento12==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_12.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento12" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_12.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento12" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 
				  
	
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento12'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento12 = $row["dsccli"];	
	}
			
												if ($asiento13==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_13.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento13" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_13.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento13" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  
	
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento13'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento13 = $row["dsccli"];
	 }
			
												if ($asiento14==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_14.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento14" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_14.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento14" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento14'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento14 = $row["dsccli"];
		}
			
			
															if ($asiento15==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_15.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento15" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_15.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento15" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 
				  
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento15'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento15 = $row["dsccli"];
	
}
	
			?>
                </tr>
                <tr>
                  <td align="center"><?php echo substr($climes7,0,14);?></td>
                  <td align="center"><?php echo substr($climes8,0,14);?></td>
                  <td align="center"><?php echo substr($climes9,0,14);?></td>
                  <td align="center">&nbsp;</td>
                  <td align="center">&nbsp;</td>
                  <td align="center"><?php echo substr($cliasiento11,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento12,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento13,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento14,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento15,0,14);?></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <?php		
		if ($mesa10==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_10.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa10" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_10.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa10" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA10'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes10 = $row["dsccli"];

 }
			
				if ($mesa11==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_11.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa11" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_11.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa11" ?>', <?php echo 0 ?> )"></a></td>
                  <?php

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA11'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes11 = $row["dsccli"];

 } 
			
					if ($mesa12==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_12.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa12" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_12.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa12" ?>', <?php echo 0 ?> )"></a></td>
                  <?php

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA12'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes12 = $row["dsccli"];

 }?>
                  <td width="5%">              
                  <td><?php							if ($asiento16==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_16.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento16" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_16.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento16" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento16'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento16 = $row["dsccli"];
	}
			
											if ($asiento17==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_17.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento17" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_17.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento17" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 
				  
	
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento17'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento17 = $row["dsccli"];
	
}
			
												if ($asiento18==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_18.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento18" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_18.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento18" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento18'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento18 = $row["dsccli"];
		
 }
			
												if ($asiento19==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_19.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento19" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_19.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento19" ?>', <?php echo 0 ?> )"></a></td>
                  <?php

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento19'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento19 = $row["dsccli"];		
 }
			
			
															if ($asiento20==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_20.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento20" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_20.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento20" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento20'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento20 = $row["dsccli"];			
				   }
	
			?>
                </tr>
                <tr>
                  <td align="center"><?php echo substr($climes10,0,14);?></td>
                  <td align="center"><?php echo substr($climes11,0,14);?></td>
                  <td align="center"><?php echo substr($climes12,0,14);?></td>
                  <td align="center">&nbsp;</td>
                  <td align="center">&nbsp;</td>
                  <td align="center"><?php echo substr($cliasiento16,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento17,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento18,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento19,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento20,0,14);?></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <?php		
		if ($mesa13==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_13.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa13" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_13.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa13" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA13'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes13 = $row["dsccli"];	
 }
			
				if ($mesa14==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_14.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa14" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_14.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa14" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA14'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes14 = $row["dsccli"];	

} 
			
					if ($mesa15==0 ){ ?>
                  <td><a href="#"><img src="../img/Mesa_libre_15.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa15" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/Mesa_ocupada_15.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "mesa15" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='MESA15'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$climes15 = $row["dsccli"];	
 
				  }?>
                  <td width="5%">              
                  <td><?php							if ($asiento21==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_21.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento21" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_21.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento21" ?>', <?php echo 0 ?> )"></a></td>
                  <?php
				  	
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento21'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento21 = $row["dsccli"];		
				   }
			
											if ($asiento22==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_22.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento22" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_22.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento22" ?>', <?php echo 0 ?> )"></a></td>
                  <?php


		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento22'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento22 = $row["dsccli"];			
				   }
			
												if ($asiento23==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_23.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento23" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_23.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento23" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 
				  

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento23'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento23 = $row["dsccli"];		
				  }
			
												if ($asiento24==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_24.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento24" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_24.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento24" ?>', <?php echo 0 ?> )"></a></td>
                  <?php 
				  
		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento24'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento24 = $row["dsccli"];			
				  }
			
			
															if ($asiento25==0 ){ ?>
                  <td><a href="#"><img src="../img/asiento_libre_25.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento25" ?>', <?php echo 1 ?> )"></a></td>
                  <?php }	else  {?>
                  <td><a href="#"><img src="../img/asiento_ocupado_25.png" alt="mesa" width="108" height="80" border="0"  onClick="abrir_mesa('<?php echo "asiento25" ?>', <?php echo 0 ?> )"></a></td>
                  <?php

		$query = "SELECT dsccli FROM pedidos WHERE codfactura='asiento25'";
		$rs_query = $mysqli->query($query);
		$row = $rs_query->fetch_array();	
		$cliasiento25 = $row["dsccli"];		 
				   }
	
			?>
                <tr>
                  <td align="center"><?php echo substr($climes13,0,14);?></td>
                  <td align="center"><?php echo substr($climes14,0,14);?></td>
                  <td align="center"><?php echo substr($climes15,0,14);?></td>
                  <td align="center">&nbsp;</td>
                  <td align="center">&nbsp;</td>
                  <td align="center"><?php echo substr($cliasiento21,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento22,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento23,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento24,0,14);?></td>
                  <td align="center"><?php echo substr($cliasiento25,0,14);?></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
  <td width="8%">  </tr>
              </table>
			</div>
			</div>
		  </div>			
		</div>
	</body>
</html>
