<?php
 
session_start();
$com = "A";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");
require_once("DFJQUERY.inc");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script language="javascript">
function checaMesas(){
	var punto=document.getElementById('descpvta');
	var area=document.getElementById('area');
	
	if(punto.value==""){
		alert('Seleccione el Punto de Venta!!');
		return false;
	}
	if(area.value==""){
		alert('Seleccione el Area!!');
		return false;
	}

	openpage('cat_mesas_AC.php','_self');
	
}

</script>
<style type="text/css">
<!--
.Estilo23 {font-size: 11px; font-weight: bold; }
-->
</style>

<body>
  

<form name="frm1" id="frm1" method="post" action="">
  <div id="width_wrapper" align="center">
  <table width="475" border="0" align="center">
    <tr>
      <td colspan="4" class="titulo">AGREGAR MESAS </td>
    </tr>
    <tr>
      <th width="77"><div align="left"><span class="Estilo23">DESCRIPCION</span></div></th>
      <td width="382" colspan="3" style="#D2BEE4"><input name="tap2" id="tap2" type="text" tabindex="2"
		  onBlur="may(this)" size="30"
		<?php

			if(isset($_REQUEST['tap2'])){ 
				echo 'value="' . $_REQUEST['tap2'] .  '"';
			}
		?>></td>
    </tr>
    <tr>
      <th><div align="left"><span class="Estilo23"> PUNTO DE VENTA </span></div></th> 
      <td colspan="3" style="#D2BEE4">
          <select name="descpvta" id="descpvta" onchange="document.getElementById('frm1').submit();">
            <option>-----Selecciona-----</option>
    <?php

	@$res=mysqli_query($con ,"select * from ptventa order by np_desc1 ASC");
	while(@$reg=mysqli_fetch_array($res)){
		if($_POST['descpvta'] == $reg['nparte1']){
			echo '<option value="' . $reg['nparte1'] . '" selected>' . $reg['np_desc1'] . '</option>';
		}else{
			echo '<option value="' . $reg['nparte1'] . '">' . $reg['np_desc1'] . '</option>';
		}
	}
	?>
         </select>	  </td>
    </tr>
    <tr>
      <th><div align="left"><span class="Estilo23">AREA</span></div></th>
      <td colspan="3" style="#D2BEE4">		
		<select name="area" id="area">
          <option>-----Selecciona-----</option>
          <?php

		if(isset($_POST['descpvta'])){ 
		@$res=mysqli_query($con ,"select * from ctarea where codigo='".$_POST['descpvta']."'");
			while(@$reg=mysqli_fetch_array($res)){
				if($_POST['area'] == $reg['nparte1']){
					echo '<option value="' . $reg['nparte1'] . '" selected>' . $reg['np_desc1'] . '</option>';
				}else{
					echo '<option value="' . $reg['nparte1'] . '">' . $reg['np_desc1'] . '</option>';
				}
			}
		}
?>
        </select>	  </td>
    </tr>
      <tr>
      <th width="77"><div align="left"><span class="Estilo23">ORDEN</span></div></th>
      <td width="382" colspan="3" style="#D2BEE4"><input name="orden" id="orden" type="text" tabindex="2"
		  onBlur="may(this)" size="30"
		<?php

			if(isset($_REQUEST['orden'])){ 
				echo 'value="' . $_REQUEST['orden'] .  '"';
			}
		?>></td>
    </tr>
      <tr>
        <td class="titulo" colspan="4"><label>
          <div align="center">
          <input name="Submit22" type="Button" onClick="checaMesas();" value="Guardar" class="original">
          <input type="Button" name="Submit2" value="Regresar" onClick="envia1('cat_mesas_PR.php','_self')" class="bot_WsW">
        </div>
        </label></td>
      </tr>
    </table>
  </div>
</form>
</body>
</html>
<?php
 mysqli_close($con);?>