<?php
 
session_start();
$com = "M";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DFJQUERY.inc");
include("DF30000.inc");
include("DF80000.php");
include ("varfun.php");
include("JQUERY.inc");
?>
<html>
    <head>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/> 
<script type="text/javascript" language="JavaScript1.2" src="RSSCRIPT.js"></script>
    </head>
<script language="javascript">
    
//function openWindow(dataGen,valores){
//	var objDate=new Date();
//	var getVars,getVarsAux,distPage;
//	var idVentana;
//	for(getVarsAux in valores){
//		getVars +='&'+getVarsAux+'='+valores['getVarsAux'];
//	}
//	if(typeof dataGen.width=='undefined') dataGen.width='800';
//	if(typeof dataGen.height=='undefined') dataGen.height='600';
//	distPage='?tmr='+objDate.getHours()+objDate.getMinutes()+objDate.getSeconds()+objDate.getDay()+objDate.getMonth()+objDate.getFullYear();
//	idVentana=window.open(dataGen.action+distPage+getVars,dataGen.name,'width='+dataGen.width+',height='+dataGen.height+',top=100,left=50,scrollbars=yes,menubar=yes,status=yes');
//	return idVentana;
//}
function act_checkbox(va)
{
	if(va == true){
		document.frm1.campo1.disabled = 0;
		//document.getElementById("ftipocto").style.visibility='visible';
	}else{
		document.frm1.campo1.disabled = 1;
		//document.getElementById("ftipocto").style.visibility='hidden';
	}
}
</script>
<?php

if ($_POST['bot']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=res_registro_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	
	include('res_registro_CL.php');
	$varible_clase = new clase();
	$res=$varible_clase->lista_busqueda($_POST["bot"]);
	$reg=mysqli_fetch_array($res);
	if(!isset($_POST['fcodtarifa'])){
	$_REQUEST['fcodtarifa']=$reg['fcodtarifa'];
	$_REQUEST['fnumres']=$reg['fnumres'];
	$_REQUEST['fnumcto']=$reg['fnumcto'];
	$_REQUEST['ffecllegada']=chfecha($reg['ffecllegada'],'Y-m-d','d/m/Y');
	$_REQUEST['ffecsalida']=chfecha($reg['ffecsalida'],'Y-m-d','d/m/Y');
	$_REQUEST['fnumadu']=$reg['fnumadu'];
	$_REQUEST['fnummenor']=$reg['fnummenor'];
	$_REQUEST['fhorallega']=$reg['fhorallega'];
	$_REQUEST['fnumctos']=$reg['fnumctos'];
	$_REQUEST['ffecalt']=chfecha($reg['ffecalt'],'Y-m-d','d/m/Y');
	$_REQUEST['ftipocto']=$reg['ftipocto'];
	//forma de pago
	$_REQUEST['fformpago']=$reg['fformpago'];
	$_REQUEST['fnumtar']=$reg['fnumtar'];
	$_REQUEST['fsaldo']=$reg['fsaldo'];
	$_REQUEST['flimite']=$reg['flimite'];
	$_REQUEST['fcodseg']=$reg['fcodseg'];
	//datos
	$_REQUEST['fcodgrupo']=$reg['fcodgrupo'];
	$_REQUEST['fcodagen']=$reg['fcodagen'];
	$_REQUEST['fcodmeca']=$reg['fcodmeca'];
	$_REQUEST['fplan']=$reg['fplan'];
	$_REQUEST['smerf']=$reg['smerf'];
	$_REQUEST['fnorasvip']=$reg['fnorasvip'];
	//direccion
	$_REQUEST['fnombre']=$reg['fnombre'];
	$_REQUEST['fapellido']=$reg['fapellido'];
	$_REQUEST['flengua']=$reg['flengua'];
	$_REQUEST['fempresa']=$reg['fempresa'];
	$_REQUEST['ftelefono']=$reg['ftelefono'];
	$_REQUEST['fvip']=$reg['fvip'];
	$_REQUEST['femail']=$reg['femail'];
	$_REQUEST['fmail']=$reg['fmail'];
	$_REQUEST['fdireccion']=$reg['fdireccion'];
	$_REQUEST['tcol']=$reg['fgntd'];
	$_REQUEST['tcp']=$reg['fcp'];
	$_REQUEST['pais']=$reg['fpais'];
	$_REQUEST['estados']=$reg['festado'];
	$_REQUEST['tmun']=$reg['fciudad'];
	$_REQUEST['fvehiculo']=$reg['fvehiculo'];
	$_REQUEST['fplacas']=$reg['fplacas'];
	$_REQUEST['ftelemp']=$reg['ftelemp'];
	$_REQUEST['ftiphuesped']=$reg['ftiphuesped'];
	$_REQUEST['tex']=$reg['tex'];
	$_REQUEST['tex2']=$reg['tex2'];
	$_REQUEST['tex3']=$reg['tex3'];
	$_REQUEST['tex4']=$reg['tex4'];
	$_REQUEST['tex5']=$reg['tex5'];
	$_REQUEST['tex6']=$reg['tex6'];
	$_REQUEST['text1']=$reg['text1'];
	$_REQUEST['text2']=$reg['text2'];
	$_REQUEST['text3']=$reg['text3'];
	$_REQUEST['text4']=$reg['text4'];
	$_REQUEST['text5']=$reg['text5'];
	$_REQUEST['text6']=$reg['text6'];
	$_REQUEST['ftotal']=$reg['ftotal'];
	$_REQUEST['n_reg']=$reg['n_reg'];
	$_REQUEST['codseg']=$reg['codseg'];
}
?>

<body
<?php
 
if(isset($_POST['bot3'])){
	echo ' onLoad="deshab()"';
}
?>
>
    <body onLoad=" restaFechas()">
<div id="Layer2"></div>
<form  name="frm1" method="post" action="" enctype="multipart/form-data">
<input name="bot" type="hidden" value="<?php
 echo $_POST["bot"]?>">

  <table width="1018" align="center">
        <tr>
          <th colspan="13" class=\"titulo\"><div align="center"> MODIFICAR REGISTRO DE RESERVACIONES INDIVIDUALES </div></th>
        </tr>
    <tr>
      <td width="64"><strong>ALTA:</strong></td>
      <td width="48"><input name="ffecalt" type="text"  class="styTabEspA" id="ffecalt" onKeyPress="return validar(event)" size="7" disabled="disabled" value="<?php echo $_REQUEST['ffecalt'];?>"></td>
      <td width="138"><input name="fusualta" type="text" id="fusualta" disabled="disabled" size="20" value=" <?php
 
		echo  $_SESSION['usuario']  ;?>"></td>
      <td colspan="2"><strong>CAMBIO:</strong></td>
      <td><input name="ffeccam" type="text" class="styTabEspA" id="ffeccam"  value="<?php echo date('d/m/Y') ?>"size="7" ></td>
      <td colspan="2"><strong>FOLIO.</strong></td>
      <td><input name="ffecalt2" type="text"  class="styTabEspA" id="ffecalt2" onKeyPress="return validar(event)" size="7" disabled="disabled" value="<?php echo $_REQUEST['n_reg'];?>"></td>
      <td width="59"><div align="right"><strong>STATUS:</strong></div></td>
      <td colspan="2"><select name="select1">
          <option value="RESERVA INDIVIDUAL"<?php if(isset($_REQUEST['select1'])&&$_REQUEST['select1']=="RESERVA INDIVIDUAL") echo 'selected';?>>RESERVA INDIVIDUAL</option>
          </select></td>
    </tr>
    <tr>
      <td colspan="2"><strong>FECHA DE LLEGADA.      </strong></td>
      <td><label>
        <input name="ffecllegada" type="text" class="emplea datefrom" id="ffecllegada" size="15" 
		<?php
 
		if(isset($_POST['bot'])){
		$fec1=$reg["ffecllegada"];
		include('DF20000.php');
		echo 'value="'.$f_f.'"';
		}
		?>>
            
		     </label></td>
      <td colspan="2"><strong>DIAS.</strong></td>
      <?php $varfs=(isset($_POST['ffecsalida']))?$_POST['ffecsalida']:"";
      $varfl=(isset($_POST['ffecllegada']))?$_POST['ffecllegada']:""; ?>
      <td><input name="fnumctos" type="text" id="fnumctos" onKeyPress="return validar(event)" size="5" value="
          <?php echo (isset($_REQUEST['fnumctos']))?$_REQUEST['fnumctos']:""; ?>"></td>  <!-- //(daydiff ($varfs,$varfl,'d/m/Y')) -->
      <td colspan="4"><label></label>        
        <label></label>        <label>
        </label>
        <div align="center"><strong>
          <input name="?323" type="button" class="pp" tabindex="3" onClick="
	  	openWindow(
		{
			action:'FRGC20000.php',
			width:700,
			height:350
		},{
			val:'fnumcto',
			des:'ftipocto'
		})" value="Buscar Habitacion" >
        </strong></div></td>
      <td colspan="2"><div align="center" class="Estilo18"><strong>NOTAS:</strong></div></td>
    </tr>
    <tr>
      <td colspan="2"><strong>FECHA DE SALIDA.</strong> </td>
      <td><input name="ffecsalida" type="text" class="emplea dateto" id="ffecsalida" size="15" onChange="restaFechas ()"
		<?php
 
		if(isset($_POST['bot'])){
		$fec1=$reg["ffecsalida"];
		include('DF20000.php');
		echo 'value="'.$f_f.'"';
		}
		?>>
           
           </td>
      <td colspan="2"><strong>NUMERO DE ADULTOS.</strong></td>
      <td><input name="fnumadu" type="text" id="fnumadu" tabindex="1" onKeyPress="return validar(event)" size="5"  value="<?php echo $_REQUEST['fnumadu'];?>"></td>
      <td colspan="2"><strong>TIPO DE HABITACION.</strong></td>
      <td colspan="2"><input name="ftipocto" type="text" id="ftipocto" value="<?php echo $_REQUEST['ftipocto'];?>"></td>
      <td colspan="2" rowspan="2"><div align="center">
        <textarea name="fnorasvip" cols="30" rows="3" id="fnorasvip" tabindex="4"><?php echo $_REQUEST['fnorasvip'];?>
		</textarea>
      </div></td>
    </tr>
    <tr>
      <td colspan="2"><strong>HORA DE LLEGADA. </strong></td>
      <td><input name="fhorallega" type="text" id="fhorallega" tabindex="20" onKeyPress="return validar(event)" disabled="disabled" size="6"  value="<?php echo $_REQUEST['fhorallega'];?>"></td>
      <td colspan="2"><strong>NUMERO DE MENORES.</strong></td>
      <td><input name="fnummenor" type="text" id="fnummenor" tabindex="2" onKeyPress="return validar(event)" size="5"  value="<?php echo $_REQUEST['fnummenor'];?>"></td>
      <td colspan="2"><strong>NUMERO DE HABITACION</strong>.</td>
      <td colspan="2"><input name="fnumcto" type="text" id="fnumcto" size="5"  value="<?php echo $_REQUEST['fnumcto'];?>"></td>
    </tr>
	
	
	
	<tr>
      <th colspan="13" class="titulo"><div align="center" class="Estilo18">MODIFICAR DATOS </div></th>
    </tr>
    <tr>
      <td><span class="Estilo18"><strong>GRUPO.</strong></span></td>
      <td colspan="4"><span class="Estilo18">
        <select name="fcodgrupo" id="fcodgrupo" tabindex="5">
        <option value="">----------SELECCIONE----------</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus04");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fcodgrupo']==$reg['gdescrip'] ){
		echo '<option value="' . $reg['gdescrip'] . '" selected>' . $reg['gdescrip'] . '</option>';
	}else{
		echo '<option value="' . $reg['gdescrip'] . '">' . $reg['gdescrip'] . '</option>';
	}
}
?>
      </select>
		
        
      </span></td>
      <td width="88"><span class="Estilo18"><strong>MERCADO.</strong></span></td>
      <td colspan="4"><span class="Estilo18">
        <select name="fcodmeca" id="fcodmeca" tabindex="6">
        <option value="">-----SELECCIONE-----</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM tipmerca");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fcodmeca']==$reg['tdescrip'] ){
		echo '<option value="' . $reg['tdescrip'] . '" selected>' . $reg['tdescrip'] . '</option>';
	}else{
		echo '<option value="' . $reg['tdescrip'] . '">' . $reg['tdescrip'] . '</option>';
	}
}
?>
      </select>
      </span></td>
      <td width="57"><strong>EMPRESA.</strong></td>
      <td width="193" colspan="2"><select name="fempresa" id="fempresa" tabindex="7">
        <option value="">-----SELECCIONE-----</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM fcompas");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fempresa']==$reg['pdesco'] ){
		echo '<option value="' . $reg['pdesco'] . '" selected>' . $reg['pdesco'] . '</option>';
	}else{
		echo '<option value="' . $reg['pdesco'] . '">' . $reg['pdesco'] . '</option>';
	}
}
?>
      </select></td>
    </tr>
    <tr>
      <td><span class="Estilo18"><strong>AGENCIA.</strong></span></td>
      <td colspan="4"><span class="Estilo18">
        <select name="fcodagen" id="fcodagen" tabindex="8">
        <option value="">--SELECCIONE--</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus07");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fcodagen']==$reg['agdescrip'] ){
		echo '<option value="' . $reg['agdescrip'] . '" selected>' . $reg['agdescrip'] . '</option>';
	}else{
		echo '<option value="' . $reg['agdescrip'] . '">' . $reg['agdescrip'] . '</option>';
	}
}
?>
      </select>
      </span></td>
      <td><span class="Estilo18"><strong>PLAN.</strong></span></td>
      <td colspan="4"><span class="Estilo18">
        <select name="fplan" id="fplan" tabindex="9">
        <option value="">--SELECCIONE--</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM pplan");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fplan']==$reg['pdescrip'] ){
		echo '<option value="' . $reg['pdescrip'] . '" selected>' . $reg['pdescrip'] . '</option>';
	}else{
		echo '<option value="' . $reg['pdescrip'] . '">' . $reg['pdescrip'] . '</option>';
	}
}
?>
      </select>
      </span></td>
      <td><strong>SEGMENTO.</strong></td>
      <td colspan="2"><select name="codseg" id="codseg">
        <option value="">--SELECCIONE--</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus06");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['codseg']==$reg['descripcion'] ){
		echo '<option value="' . $reg['descripcion'] . '" selected>' . $reg['descripcion'] . '</option>';
	}else{
		echo '<option value="' . $reg['descripcion'] . '">' . $reg['descripcion'] . '</option>';
	}
}
?>
      </select></td>
    </tr>
    <tr>
      <td><span class="Estilo18"><strong>SMERF.</strong></span></td>
      <td colspan="4"><span class="Estilo18">
        <select name="smerf" id="smerf" tabindex="11">
          <option value="">--SELECCIONE--</option>
          <?php
 
$sql = mysqli_query($con ,"SELECT * FROM fsmerf");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['smerf']==$reg['descripcion'] ){
		echo '<option value="' . $reg['descripcion'] . '" selected>' . $reg['descripcion'] . '</option>';
	}else{
		echo '<option value="' . $reg['descripcion'] . '">' . $reg['descripcion'] . '</option>';
	}
}
?>
        </select>
      </span></td>
      <td colspan="8">&nbsp;</td>
    </tr>
	
	
	<tr>
      <th colspan="13" class="titulo"><div align="center" class="Estilo18">MODIFICAR FORMA DE PAGO </div></th>
    </tr>
    <tr>
      <td><strong>TARIFA ALTA.</strong></td>
      <td colspan="8"><label>
        <input name="tex" type="text" id="tex" value="<?php echo $_REQUEST['tex'];?>" size="6">
        <input name="tex2" type="text" id="tex2" value="<?php echo $_REQUEST['tex2'];?>" size="20" onChange="javascript: document.frm1.tex5.disabled=true; javascript: document.frm1.tex5.disabled=true;">
        <input name="tex3" type="text" id="tex3" value="<?php echo $_REQUEST['tex3'];?>" size="3">
        <span class="Estilo17"><strong>$</strong></span>
        <input name="tex4" type="text" id="tex4" value="<?php echo $_REQUEST['tex4'];?>" size="5">
        <input name="tex5" type="text" id="tex5" value="<?php echo $_REQUEST['tex5'];?>" size="2">
=<strong> </strong><span class="Estilo17"><strong>$</strong></span>
        <input name="tex6" type="text" id="tex6" size="10" value="<?php echo $_REQUEST['tex6'];?>">
        <input name="?322" type="button" class="pp" tabindex="12" onClick="
	  	openWindow(
		{
			action:'rec_chin_AG2.php',
			width:700,
			height:350
		},{
			val:'tex',
			des:'tex2',
			jio:'tex3',
			kji:'tex4'
		})" value="Buscar" >
      </label></td>
      <td><strong>FORMA DE PAGO</strong>. </td>
      <td colspan="2"><span class="Estilo18">
        <select name="fformpago" id="fformpago" tabindex="14">
          <option value="">---SELECCIONE---</option>
          <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus09 WHERE pmontomax = 'ABONO' AND ppago = 'SI'");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['fformpago']==$reg['descripcion'] ){
		echo '<option value="' . $reg['descripcion'] . '" selected>' . $reg['descripcion'] . '</option>';
	}else{
		echo '<option value="' . $reg['descripcion'] . '">' . $reg['descripcion'] . '</option>';
	}
}
?>
        </select>

      </span></td>
    </tr>
    <tr>
      <td><strong>TARIFA BAJA.</strong></td>
      <td colspan="8"><label>
        <input name="text1" type="text" id="text1" value="<?php echo $_REQUEST['text1'];?>" size="6">
      </label>
        <label>
        <input name="text2" type="text" id="text2" value="<?php echo $_REQUEST['text2'];?>" size="20">
        </label>
        <label>
        <input name="text3" type="text" id="text3" value="<?php echo $_REQUEST['text3'];?>" size="3">
        <span class="Estilo17"><strong>$</strong></span>
        <input name="text4" type="text" id="text4" value="<?php echo $_REQUEST['text4'];?>" size="5">
        <input name="text5" type="text" id="text5" value="<?php echo $_REQUEST['text5'];?>" size="2">
=<strong> </strong><span class="Estilo17"><strong>$</strong></span>
        <input name="text6" type="text" id="text6" size="10" value="<?php echo $_REQUEST['text6'];?>">
        <input name="?3222" type="button" class="pp" tabindex="13"onClick="
	  	openWindow(
		{
			action:'rec_chin_AG3.php',
			width:700,
			height:350
		},{
			val:'text1',
			des:'text2',
			jio:'text3',
			kji:'text4'
		})" value="Buscar" >
      </label></td>
      <td><strong>NUMERO D TARJETA. </strong></td>
      <td colspan="2"><input name="fnumtar" type="text" id="fnumtar" tabindex="15" size="30"
	  <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['fnumtar'].'"';
		}
		?>></td></tr>
    <tr>
      <td><span class="Estilo16">TOTAL.</span></td>
      <td colspan="3"><label>
        <span class="Estilo19">$</span>
        <input name="ftotal" type="text" id="ftotal" value="<?php echo $_REQUEST['ftotal'];?>" size="15">
      </label></td>
      <td><strong>DEPOSITO.</strong></td>
      <td><span class="Estilo16">$</span>
      <input name="fsaldo" type="text" id="fsaldo" tabindex="16" size="5" value="<?php echo $_REQUEST['fsaldo'];?>"></td>
      <td width="103"><strong>CODIGO DE SEGURIDAD.</strong></td>
      <td colspan="3"><input name="fcodseg" type="text" id="fcodseg" tabindex="17" size="15" value="<?php echo $_REQUEST['fcodseg'];?>"></td>
      <td><strong>LIMITE.</strong></td>
      <td><input name="flimite" type="text" id="flimite" tabindex="18" size="15" value="<?php echo $_REQUEST['flimite'];?>"></td>
    </tr>
	
	<tr>
      <th colspan="13" class="titulo"><div align="center" class="Estilo18">MODIFICAR DIRECCION</div></th>
    </tr>
    <tr>
      <td><strong>NOMBRE.</strong></td>
      <td colspan="3"><p>
        <textarea name="fnombre" cols="29" rows="3" id="fnombre" tabindex="4"><?php echo $_REQUEST['fnombre'];?>
		</textarea>
</p></td>
      <td width="95"><strong>APELLIDO.</strong></td>
      <td colspan="3">
	  <textarea name="fapellido" cols="25" rows="3" id="fapellido" tabindex="4"><?php echo $_REQUEST['fapellido'];?>
		</textarea>	  </td>
      <td><strong>TIPO DE HUESPED.</strong></td>
      <td colspan="2"><select name="ftiphuesped" id="ftiphuesped" tabindex="23">
        <option value="">--SELECCIONE--</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM tiphuesped");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['ftiphuesped']==$reg['tpdescrip'] ){
		echo '<option value="' . $reg['tpdescrip'] . '" selected>' . $reg['tpdescrip'] . '</option>';
	}else{
		echo '<option value="' . $reg['tpdescrip'] . '">' . $reg['tpdescrip'] . '</option>';
	}
}
?>
      </select></td>
      <td><div align="center"><strong><span class="Estilo19">VIP.</span>
          <input name="fvip" type="checkbox" id="fvip" value="SI" <?php if($_REQUEST['fvip']=='SI') echo 'checked';?>>
            </strong></div></td>
    </tr>
    <tr>
      <td><strong>TELEFONO.</strong></td>
      <td colspan="3"><input name="ftelefono" type="text" id="ftelefono" tabindex="21" size="25" value="<?php echo $_REQUEST['ftelefono'];?>"></td>
      <td><strong>TELEFONO EMPRESA.</strong></td>
      <td colspan="3"><input name="ftelemp" type="text" id="ftelemp" tabindex="22" size="25" value="<?php echo $_REQUEST['ftelemp'];?>"></td>
      <td><strong>E-MAIL.</strong></td>
      <td colspan="4"><label>
        <input name="fmail" type="text" id="fmail" tabindex="24" size="25" value="<?php echo $_REQUEST['fmail'];?>">
      </label></td>
    </tr>
    <tr>
      <td><strong>E-MAIL EMPRESA. </strong></td>
      <td colspan="3"><input name="femail" type="text" id="femail" tabindex="25" size="25" value="<?php echo $_REQUEST['femail'];?>"></td>
	  
	  <td><strong>DIRECCION.</strong></td>
	  <td colspan="3"><input name="fdireccion" type="text" id="fdireccion" tabindex="26" size="25" value="<?php echo $_REQUEST['fdireccion'];?>">
	    <span class="Estilo1">
	    <input name="?" type="button" class="pp" onClick="window.open('DX40000_AG1.php?retPag=res_registro_MO.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" value="..." >
      </span></td>
      <td><strong>CODIGO POSTAL.</strong></td>
      <td><input name="tcp" type="text" onKeyPress="return validar(event)" value="<?php echo $_REQUEST['tcp'];?>" size="8" maxlength="5" tabindex="28"></td>
      <td><strong>COLONIA.</strong></td>
      <td><span class="Estilo1">
        <input type="hidden" name="tcol1" id="tcve" value="<?php echo $_REQUEST['tcve'];?>">
        <input name="tcol" type="text" id="tcol" value="<?php echo $_REQUEST['tcol'];?>" size="20" tabindex="27">
      </span></td>
    </tr>
    <tr>
      <td><strong>PAIS.</strong></td>
      <td colspan="3"><span class="Estilo1">
        <select name="pais" id="pais" onChange="javascript: document.getElementById('frm1').submit()" tabindex="29">
          <option value="">-----Selecciona-----</option>
          <?php    
		  include("DMMYSQLG.php");
			@$resultado=mysqli_query($con ,"select * from dxpaises");
			if(!isset($_REQUEST['pais'])){
				$dt_paises=mysqli_fetch_array($resultado);
				$selPais=$dt_paises['cve_pais'];
				if(mysqli_num_rows($resultado)>0)
					mysqli_data_seek($resultado,0);		
			}
			else{
				$selPais=$_REQUEST['pais'];
			}
			while($registro=mysqli_fetch_array($resultado)){
				if($selPais==$registro['cve_pais']){
					echo '<option value="' . $registro['cve_pais'] . '" selected>' . $registro['des_pais'] . '</option>';
				}else{
					echo '<option value="' . $registro['cve_pais'] . '">' . $registro['des_pais'] . '</option>';
				}
				
			}			
		?>
        </select>
      </span></td>
      <td><strong>ESTADO.</strong></td>
      <td colspan="3"><span class="Estilo1">
        <select name="estados" onChange="javascript: document.getElementById('frm1').submit()" tabindex="30">
          <option  value="">-----Selecciona-----</option>
          <?php   
		@$resultado=mysqli_query($con ,"select * from dxestado where cve_pais='$selPais'");
		if(!isset($_REQUEST['estados'])){
			$dt_estado=mysqli_fetch_array($resultado);
			$selEnt=$dt_estado['cve_estado'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}
		else{
			$selEnt=$_REQUEST['estados'];
		}
		while($registro=mysqli_fetch_array($resultado)){
			if($selEnt==$registro['cve_estado'] ){ 
				echo '<option value="' . $registro['cve_estado'] . '" selected>' . $registro['des_estado'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_estado'] . '">' . $registro['des_estado'] . '</option>';
			}
			
		}
?>
        </select>
      </span></td>
      <td><strong>DELEGACION O MUNICIPIO.</strong></td>
      <td colspan="3"><span class="Estilo1">
        <select name="tmun" id="tmun" tabindex="31">
          <option  value="">-----Selecciona-----</option>
          <?php  
		@$resultado=mysqli_query($con ,"select * from dxdelmun where cve_estado='$selEnt' and cve_pais='$selPais'");
		if(!isset($_REQUEST['tmun'])){
			$dt_delmun=mysqli_fetch_array($resultado);
			$selDelMun=$dt_delmun['cve_delmun'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}
		else{
			$selDelMun=$_REQUEST['tmun'];
		}
		while(@$registro=mysqli_fetch_array($resultado)){
			if($selDelMun==$registro['cve_delmun']){ 
				echo '<option value="' . $registro['cve_delmun'] . '" selected>' .$registro['des_delmun'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_delmun'] . '">' . $registro['des_delmun'] . '</option>';
			}
		}
?>
        </select>
      </span></td>
    </tr>

<tr>
      <td colspan="13" class="titulo"><div align="center" class="Estilo26">AGREGAR ARCHIVOS QUE RESPALDEN RESERVA </div></td>
	</tr>
	<tr>
		<td colspan="13"> <iframe src="reservas-ev/index.php?folio=<?php echo $_REQUEST['n_reg'];?>">
			  <p>Your browser does not support iframes.</p>
			</iframe>
		</td>
	</tr>
	<tr>
      <td colspan="13"><div align="center">
          <input name="Submit2" type="submit" class="pp" tabindex="32" value="Modificar"/>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input name="Submit" type="button" class="pp" tabindex="33" onClick="openpage('res_registro_PR.php','_self')" value="Regresar"/>
           
      </div></td>
    </tr>
  </table>
</form>
  <?php
 
if(isset($_POST['bot3'])){
	echo '<div align="center">
	<form id="form1" name="form1" action="res_registro_PR.php" target="_self">
		<input type="submit" name="submit" value="Regresar">
	</form>
	</div>';
	
}
?>
<?php 
if (isset($_POST['Submit2'])){


 ///////FECHA DEL SISTEMA
        $fecha = (isset($dt_empres['fec_alta'])) ? $dt_empres['fec_alta'] : "0";
        $fechita = chfecha($fecha, 'Y-m-d', 'd/m/Y');
        $fechall = chfecha($_POST['ffecllegada'], 'd/m/Y', 'Y-m-d');
        $fecSal = chfecha($_POST['ffecsalida'], 'd/m/Y', 'Y-m-d');
        ////////////////////////////////////////////////////////////////////SENTENCIA DE REGISTRO/////////////////////////////////
        if (empty($_POST['ffecllegada'])) {
            echo alert_JS("ERROR (1) FECHA DE ENTRADA INVALIDA!!!");
            return false;
        }
        if (empty($_POST['ffecsalida'])) {
            echo alert_JS("ERROR (1) FECHA DE SALIDA INVALIDA!!!");
            return false;
        }
        if ($fecSal < $fechall) {
            echo alert_JS("���ERROR (2) FECHA DE ENTRADA INVALIDA!!!");
            return false;
        }if ($fechall < $fecha) {  //dt_empres['fec_alta']
            echo alert_JS("���FECHA DE ENTRADA INVALIDA!!!");
            return false;
        }if ($_POST['fnumctos'] <= 0) {
            echo alert_JS("���FECHA DE SALIDA INVALIDA!!!");
            return false;
        }if ($_POST['fnumadu'] == "") {
            echo alert_JS("���COMPLETE EL NUMERO DE ADULTOS!!!");
            return false;
        }
       
        if (empty($_POST['codseg'])) {
            echo alert_JS("���SELECCIONE EL TIPO DE SEGMENTO!!!");
            return false;
        }
        if ($_POST['codseg'] == "ONLINE" and empty($_POST['fcodagen'])) {
////
            echo alert_JS("POR FAVOR SELECCIONE EL NOMBRE DE LA  AGENCIA");
            return false;
        }
        if ($_POST['codseg'] == "AGENCIAS" and empty($_POST['fcodagen'])) {
            echo alert_JS("POR FAVOR SELECCIONE EL NOMBRE DE LA AGENCIA");
            return false;
        }if ($_POST['codseg'] == "GRUPOS-AGENCIAS" and empty($_POST['fcodagen'])) {
//// 
            echo alert_JS("POR FAVOR SELECCIONE EL NOMBRE DE LA  AGENCIA");
            return false;
        }if ($_POST['fcodmeca'] == "CONVENIOS" and empty($_POST['fempresa'])) {
////
            echo alert_JS("POR FAVOR SELECCIONE EL NOMBRE DE LA  EMPRESA");
            return false;
        }
        if (($_POST['fcodmeca'] == "AGMIN" || $_POST['fcodmeca'] == "AGMAY" || $_POST['fcodmeca'] == "GRUPOS AGENCIA" || $_POST['fcodmeca'] == "OTA") and empty($_POST['fcodagen'])) {
////
            echo alert_JS("POR FAVOR SELECCIONE EL NOMBRE DE LA  AGENCIA");
            return false;
        }
        ///////////////////////////////////////////SENTENCIA DE FORMA DE PAGO//////////////////////////////////////////////////////


        if ($_POST['fcodmeca'] == 'USO CASA' || $_POST['fcodmeca'] == 'CORTESIA') {
            
        } else {

            if (empty($_POST['tex']) or empty($_POST['tex2'])) {
                echo alert_JS("���COMPLETE LA TARIFA!!!");
                return false;
            }
            $vart4 = (isset($_POST['tex4'])) ? $_POST['tex4'] : "0";
            $vart5 = (isset($_POST['tex5'])) ? $_POST['tex5'] : "0";
            $dfk = $vart4 * $vart5; // 6
            $vart6 = (isset($_POST['tex6'])) ? $_POST['tex6'] : "0";
            if ($dfk != $vart6) {
                echo alert_JS("���TOTAL TARIFA INCORRECTA!!!");
                return false;
            }
        }

        //if(empty($_POST['fformpago'])){ // 12
        //echo alert_JS("���SELECCIONE LA FORMA DE PAGO!!!");
        //return false;  
        //}
        /////////////////////////////////////////////////////////////////////////////////////SENTENCIA DE DATOS/////////////////
        if ($_POST['fnombre'] == "") {
            echo alert_JS("���COMPLETE EL NOMBRE!!!");
            return false;
        }
        if ($_POST['fapellido'] == "") {
            echo alert_JS("���COMPLETE EL APELLIDO!!!");
            return false;
        }//if($_POST['ftelefono'] == "" ){
        //echo alert_JS ("���COMPLETE EL TELEFONO!!!");
        //return false;
        //}
        if ($_POST['fmail'] == "") {
            echo alert_JS("���COMPLETE EL CORREO ELETRONICO!!!");
            return false;
        }
       
        if ($_POST['estados'] == "" and $_POST['tmun'] == "") {
            echo alert_JS("���SELECCIONE EL ESTADO Y MUNICIPIO!!!");
            return false;
        }if ($_POST['estados'] == '1' and $_POST['tmun'] == '1') {
            echo alert_JS("���SELECCIONE EL ESTADO Y MUNICIPIO!!!");
            return false;
        }
        if ($_POST['pais'] == '1') {
            if ($_POST['tmun'] == "") {
                echo alert_JS("���SELECCIONE EL MUNICIPIO!!!");
                return false;
            }
        }

        //if(empty($_POST['flimite'])){ 
        //echo alert_JS("���SELECCIONE EL M!!!");
        //return false;
        //}
        if (isset($_POST['fnumcto'])) {
            $usu = mysqli_real_escape_string($con,$_POST['fnumcto']);
            $dt_user = mysqli_fetch_array(mysqli_query($con ,"SELECT   count(*) as numRows, ncto FROM valeryus08 WHERE ncto='$usu' "));
            echo mysqli_error($con);

            if ($dt_user['numRows'] == 0) {
                echo alert_JS("����LA HABITACION SELECCIONADA NO EXISTE!!!!");
                return false;
            }
            $fec = $_POST['ffecllegada'];
            include('DF20000.php');
            $fecha_inicial = $f_m;
            $fec = $_POST['ffecsalida'];
            include('DF20000.php');
            $fecha_final = $f_m;
            $usu = mysqli_real_escape_string($con,$_POST['fnumcto']);

            $dt_user = mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto FROM valeryus19 WHERE fnumcto='$usu' AND ffecllegada <= '$fecha_inicial' AND ffecsalida > '$fecha_inicial' "));
            $xox = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus19 WHERE fnumcto='$usu' AND ffecllegada <= '$fecha_inicial' AND ffecsalida > '$fecha_inicial' ")); //ENTRADA ENTRE DOS FEHCAS
            echo mysqli_error($con);

            if ($dt_user['numRows'] != 0) {
                echo alert_JS("����LA HABITACION ESTA OCUPADA POR: " . $xox['fapellido'] . " " . $xox['fnombre'] . " !!!!");
                //return false;
            }

            $dt_uper = mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto FROM valeryus19 WHERE fnumcto='$usu' AND ffecllegada < '$fecha_final' AND ffecsalida >= '$fecha_final' "));
            $yoy = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus19 WHERE fnumcto='$usu' AND ffecllegada < '$fecha_final' AND ffecsalida >= '$fecha_final' ")); //SALIDA ENTRE DOS FECHAS
            echo mysqli_error($con);

            if ($dt_uper['numRows'] != 0) {
                echo alert_JS("����LA HABITACION ESTA OCUPADA POR: " . $yoy['fapellido'] . " " . $yoy['fnombre'] . " !!!!");
               /// return false;
            }

            $dt_uwer = mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto FROM valeryus19 WHERE fnumcto='$usu' AND ffecllegada > '$fecha_inicial' AND ffecsalida < '$fecha_final' "));
            $dod = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus19 WHERE fnumcto='$usu' AND ffecllegada > '$fecha_inicial' AND ffecsalida < '$fecha_final' ")); //FECHA ENTRE DOS FECHAS
            echo mysqli_error($con);

            if ($dt_uwer['numRows'] != 0) {
                echo alert_JS("����LA HABITACION ESTA OCUPADA POR: " . $dod['fapellido'] . " " . $dod['fnombre'] . " !!!!");
               // return false;
            }

	if($_POST['fnumadu'] == 0 || $_POST['fnumadu'] == "") {
		echo alert_JS ("\A1\A1\A1COMPLETE EL NUMERO DE ADULTOS!!!");
		return false;
	
	}
    include("res_registro_MC.php");
	//"openpage('res_registro_MC.php','_self')"
	//echo '<meta content="0; url=res_registro_MC.php" HTTP-EQUIV="REFRESH">';
//include ("res_registro_MC.php");
}

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