<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
//include("DMMYSQLG.php");
//incluímos la clase ajax
require ('xajax/xajax_core/xajax.inc.php');
//instanciamos el objeto de la clase xajax
$xajax = new xajax(); 

function agrega($form_entrada){
$ssql = "insert into fcomhues  (no_pers,no_hab,folio,nombre,comentarios,cvmesa,cvpunto,cvarea,cvmesero,usuario) values ('" . $form_entrada["txtpersona"] . "','" . $form_entrada["txthabit"] . "','" . $form_entrada["txtfolio"] . "','" . $form_entrada["txtnombre"] . "','" . $form_entrada["txtcomen"] . "','" . $_GET['ms'] . "','" . $_GET['pt'] . "','" . $_GET['ar'] . "','" . $form_entrada["txtmesero"] . "','" . $_SESSION['num_usu'] . "' )";	
	if (mysqli_query($con ,$ssql)){
    	$salida = "Insertado correctamente";
	}else{
	    $salida = "No se ha insertado. Este es el error: " . mysqli_error($con);
	}
}
//registramos la función creada anteriormente al objeto xajax
$xajax->registerFunction("agrega");
//El objeto xajax tiene que procesar cualquier petición
$xajax->processRequest();
//include('JQUERY.inc');

include("DFJSISCI.inc");
?>
<html>
<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript" src="ajax2.js"></script>
<script type='text/javascript'>
</script>
<?php $xajax->printJavascript("xajax/"); ?>
<head>
<script type="text/javascript" language="javascript" src="DSSCRIPT.js"></script>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<?php

require_once("DFJQUERY.inc");
?>
<style type="text/css">
<!--
#Layer1 {
	position:absolute;
	width:944px;
	height:149px;
	z-index:1;
	left: 93px;
	top: 240px;
}
</style>
<style>
#regBus{
height:400px;
overflow:auto;
}

body {
	background-color: #A9C6FE;
	background-image: url();
	background-repeat: repeat;
}
</style>
<script type='text/javascript'>
function abrir(URL){
window.open(URL,"ventana1","width=230,height=260,scrollbars=NO,minimize=0") 
}
</script>
<script type='text/javascript'>
function valida(url){ 
   	//valido el nombre 
   	if (document.form1.txtpersona.value.length==0){ 
      	 alert("INGRESE EL NUMERO DE PERSONAS") 
      	 document.form1.txtpersona.focus() 
      	 return 0; 
   	}else
	{
xajax_agrega(xajax.getFormValues('form1'))
window.open(url,"ventana1","width=230,height=260,scrollbars=NO,minimize=0") 
}
}
		</script> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<form name="form1" action="" method="post">
<?php

$msr=mysqli_fetch_array (mysqli_query($con ,"select nparte1 from ctmeser where codigo='".$_GET['mesero']."' and cvpvta='".$_GET['pt']."'"));
$reg=mysqli_fetch_array ($sql = mysqli_query($con ,"SELECT * FROM ctmesas where nparte1='".$_GET['ms']."' "));
include("DE10000.php");	?>
<input name="txtmesero" type="hidden" value="<?php
 echo $msr['nparte1']; ?>">
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
	<div align="center">
    <table width="463" height="22" border='0'>
      <tr>
        <th colspan="8"> 
          <div align="center">DATOS DEL CLIENTE</div>
       	</th></tr>
	</table>
   	<table width="460" height="132" border="0">
      <tr>
        <td style="border:double" width="68">
          <div align="center">
            <input name="btnper" type="button" class="boton" onClick="openpage('CAL10000.php?ms=<?php
 echo $reg['nparte1'];?>&ar=<?php
 echo $reg['area'];?>&pt=<?php
 echo $reg['descripcion'];?>&mesero=<?php
 echo $_GET['mesero'];?>&tpo=2')" value=" Personas ">          
        </div>        </td>
        <td width="171"><label>
          <input name="txtpersona" type="text" id="txtpersona" 
		  <?php
 
					if(isset($_POST['txtpersona']))
						echo 'value="'.$_POST['txtpersona'].'"'; 
				  	else
				    	echo 'value="'.$_GET['cant'].'"'; 
				?>>
        </label></td>
        <td width="59"><label></label></td>
        <td width="144">&nbsp;</td>
      </tr>
      <tr>
        <td style="border:double" height="28"><div align="center">
          <input name="btnper2" type="button" class="boton" onClick="openpage('CAL10000.php?ms=<?php
 echo $reg['nparte1'];?>&ar=<?php
 echo $reg['area'];?>&pt=<?php
 echo $reg['descripcion'];?>&mesero=<?php
 echo $_GET['mesero'];?>&cant=<?php
 echo $_GET['cant'];?>&tpo=3')" value="Habitacion">
        </div></td>
        <td><input name="txthabit" type="text" id="txthabit" value="<?php
 echo $_GET['hab'];?>"></td>
        <td>          <div align="center" class="boton">Folio</div></td>
        <td><input name="txtfolio" type="text" id="txtfolio" value=""></td>
      </tr>
      <tr>
        <td height="25" style="border:double"><div align="center" class="boton">Nombre</div></td>
        <td><input name="txtnombre" type="text" id="txtnombre"></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="35" style="border:double"><div align="center" class="boton">Comentario</div></td>
        <td><label>
          <textarea name="txtcomen" id="txtcomen"></textarea>
        </label></td>
        <td>&nbsp;</td>
        <td><div align="right">
          <input name="Submit" type="button" class="botonmen" onClick="valida('CAL10000.php?mesero=<?php
 echo $_GET['mesero'];?>&pt=<?php
 echo $_GET['pt'];?>&ar=<?php
 echo $_GET['ar'];?>&ms=<?php
 echo $_GET['ms'];?>&hb=<?php
 echo $_POST['txthabit'];?>&tpo=12')" value="Enviar">
        </div></td>
      </tr>
    </table>
   	<p>
 
    </p>
   	<label></label>
	<div align="center" id="area">
   
    </div>
	<div align="center" id="mesas">
   
    </div>
	<div align="center" id="clave">
   
    </div>

</div>
</form>

</body>
</html>
<?php mysqli_close($con); 	?>