<?php
 
session_start();
$com = "M";
include("DSA3000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
include("DF80000.php");
include ("varfun.php");
include("DFJQUERY.inc");
include("JQUERY.inc");
$Segundos=0;
$cuenta=0;
$val1=0;
$val2=0;
$f_f="";
$f_m="";
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<!--<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>-->-->
<script type="text/javascript" language="JavaScript1.2" src="RSSCRIPT.js"></script>
<script language="javascript">

function restaTex(){
	var objTex1=document.getElementById('tex4'),
		objTex2=document.getElementById('tex5'),
		objTex3=document.getElementById('tex6');
	objTex3.value=(parseFloat(objTex1.value)*parseFloat(objTex2.value)).toFixed(2);
}
</script>
<script language="javascript">
    $(document).ready(function(){
	function formatItem(row) {
		return " (<strong>" + row[1] + "</strong>)"+row[0];
	}
	var pagRes='valeryus51100_CPS.php';
	var idObjDes='tex2';
	var idObjCve='tex';//esto es num de adultos no id de tarifa
	var idObjTotal='tex4';
	var nomObjRad='tip_bus_ope';
	$("#"+idObjDes).autocomplete({
            source:pagRes,
		 change: function (event, ui) {
                                          if (ui.item == null || ui.item == undefined) {
                                            $("#"+idObjDes).val( "");
                                                $("#"+idObjTotal).val("");
                                                  $("#"+idObjCve).val("");                                                                                    
                                        }
                         },
    
                minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
		 minLength: 0,                //ancho del cuadro de despliegue
		 autoFocus: true,              //ancho del cuadro de despliegue
		 delay: 200,           //Resalta letras coincidentes
		autoFill: true,             //autocompleta en texto la posible palabra
		scroll: true,				 //si cuadro tiene barra scroll
		scrollHeight: 100,           //alto del cuadro para el scroll
		
                           select: function( event, ui ) {
                        
                     $("#"+idObjDes).val( ui.item.gdescrip);
		$("#"+idObjTotal).val(ui.item.gtotal);
         }
	});		
});
<!--
$(document).ready(function(){
	function formatItem(row) {
		return " (<strong>" + row[1] + "</strong>)"+row[0];
	}
	var pagRes='valeryus51000_CPS.php';
	var idObjDes='tex2';
        var idObjCve='tex';
	var idObjTotal='tex4';
	var nomObjRad='tip_bus_ope';
	$("#"+idObjDes).autocomplete({
            source:pagRes,
		 change: function (event, ui) {
                                          if (ui.item == null || ui.item == undefined) {
                                            $("#"+idObjDes).val( "");
                                                $("#"+idObjTotal).val("");
                                                  $("#"+idObjCve).val("");                                                                                    
                                         }
                         },
		minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
		minLength: 0,                //ancho del cuadro de despliegue
		
                autoFocus: true,
                delay: 200,           //Resalta letras coincidentes
		autoFill: true,             //autocompleta en texto la posible palabra
		scroll: true,				 //si cuadro tiene barra scroll
		scrollHeight: 100,           //alto del cuadro para el scroll
		
                           select: function( event, ui ) {
                        
                     $("#"+idObjDes).val( ui.item.gdescrip);
		$("#"+idObjTotal).val(ui.item.gtotal);
            }
    });	
    
});
//$(document).ready(function(){
//	function formatItem(row) {
//		return " (<strong>" + row[1] + "</strong>)"+row[0];
//	}
//	var pagRes='valeryus51000_CPS.php';
//	var idObjDes='tex2';
//	var idObjCve='tex';
//        var idObjTotal='tex4';
//	var idObjManual='manual';
//	
//	var nomObjRad='tip_bus_ope';
//	$("#"+idObjDes).autocomplete(pagRes,{
//		minChars: 1,                 //Caracteres Minimos antes de autocompletar
//		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
//		cacheLength: 0,
//		delay: 200,                  //Retardo de autocompletar 
//		width: 500,                  //ancho del cuadro de despliegue
//		highlight: false,            //Resalta letras coincidentes
//		autoFill: true,             //autocompleta en texto la posible palabra
//		scroll: true,				 //si cuadro tiene barra scroll
//		scrollHeight: 100,           //alto del cuadro para el scroll
//		formatItem:formatItem,	     //formato de presentacion de las posibles busquedas
//		formatResult:function(row){
//			return row[0];
//		},
//		extraParams:{typeRequest:'ac',tipBusCat:'nom',cr:'ALLREC'}  //Parametros Extra a Mandar en autosugestion
//	});
//	$("#"+idObjCve).autocomplete(pagRes,{
//		minChars: 1,                 //Caracteres Minimos antes de autocompletar
//		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
//		cacheLength: 0,
//		delay: 200,                  //Retardo de autocompletar 
//		width: 500,                  //ancho del cuadro de despliegue
//		highlight: false,            //Resalta letras coincidentes
//		autoFill: true,             //autocompleta en texto la posible palabra
//		scroll: true,				 //si cuadro tiene barra scroll
//		scrollHeight: 100,           //alto del cuadro para el scroll
//		formatItem:formatItem,	     //formato de presentacion de las posibles busquedas
//		formatResult:function(row){
//			return row[1];
//		},		
//		extraParams:{typeRequest:'ac',tipBusCat:'id',cr:'ALLREC'}  //Parametros Extra a Mandar en autosugestion
//	});	
//	$("#"+idObjDes).result(function(event, data, formatted){
//		$("#"+idObjTotal).val(data[2]);
//		$("#"+idObjCve).val(data[1]);
//		$("#"+idObjManual).val(data[3]);
//	    document.getElementById('frm1').submit();
//	});	
//	$("#"+idObjCve).result(function(event, data, formatted){
//		$("#"+idObjDes).val(data[0]);
//		$("#"+idObjTotal).val(data[2]);
//		$("#"+idObjManual).val(data[3]);
//	    document.getElementById('frm1').submit();
//		
//	});
//});
</script>
<?php

if(!isset($_POST['fnumctos']))$_POST['fnumctos']="";
if($_POST["fnumctos"] == ""){		
		"<script languaje=\"javascript\"> javascript:document.getElementById('frm1').submit();</script>";
	
	}
if ($_POST['bot']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=res_registro_PR.php"  HTTP-EQUIV="REFRESH">';

}else{
	
	include('rec_checkin_CL.php');
	$varible_clase = new clase();
	$res=$varible_clase->lista_busqueda($_POST["bot"]);
	$reg=mysqli_fetch_array($res);
	if(!isset($_POST['fnombre'])){
	$_REQUEST['fcodtarifa']=$reg['fcodtarifa'];
	$_REQUEST['fnumres']=$reg['fnumres'];
	$_REQUEST['fnumcto']=$reg['fnumcto'];
	$_REQUEST['fmuncto']=$reg['fmuncto'];
	$_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'];
	$_REQUEST['select1']=$reg['status'];
	$_REQUEST['fusualta']=$reg['fusualta'];
	
	//forma de pago
	$_REQUEST['fformpago']=$reg['fformpago'];
	$_REQUEST['fnumtar']=$reg['fnumtar'];
	$_REQUEST['fsaldo']=$reg['fsaldo'];
	$_REQUEST['flimite']=$reg['flimite'];
	$_REQUEST['fcodseg']=$reg['fcodseg'];
	$_REQUEST['codseg']=$reg['codseg'];
	//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['cuarto_seguro']=$reg['cuarto_seguro'];
	$_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['fdeposito']=$reg['fdeposito'];
	$_REQUEST['edades']=$reg['edades'];
	}
?>
<?php


?>

<body onLoad="restaTex();">
<div id="width_wrapper" align="left">
<form  name="frm1" method="post" id="frm1" style="margin:auto" action="" enctype="multipart/form-data">
<input name="bot" type="hidden" value="<?php
 echo $_POST["bot"]?>">
<?php

if (!isset($_POST['Submit2'])){
//CHECA HABITACION OCUPADA O DESCUPADA EN EL MOMENTO DE ESTAR INGRESANDO DATOS
	$fec = $_REQUEST['ffecllegada'];
		include('DF20000.php');
		$fini = $f_m;
		$fec = $_REQUEST['ffecsalida'];
		include('DF20000.php');
		$fsal = $f_m;
	
	if ($_REQUEST['fnumcto']!=$reg['fnumcto']){
//COMPARACION DE FECHAS PARA LA rec_ocupacion DE CUARTOS
  		$dt_user=mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto FROM valeryus19 WHERE fnumcto='".$_REQUEST['fnumcto']."' AND ffecllegada < '$fini' AND ffecsalida > '$fini' "));
  echo mysqli_error($con);
   $dt_uper=mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto FROM valeryus19 WHERE fnumcto='".$_REQUEST['fnumcto']."' AND 
		ffecllegada < '$fsal' AND ffecsalida > '$fsal' "));
  echo mysqli_error($con);
   $dt_uwer=mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto FROM valeryus19 WHERE fnumcto='".$_REQUEST['fnumcto']."' AND 
		ffecllegada > '$fini' AND ffecsalida < '$fsal' "));
  echo mysqli_error($con);
  $dt_user2=mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto,ffecllegada FROM valeryus19 WHERE fnumcto='".$_REQUEST['fnumcto']."'  AND ffecllegada < '$fsal' AND ffecsalida >= '$fsal' "));
  echo mysqli_error($con);
		
  		if($dt_user2['numRows']!=0){
		   	$oc1=1;
				}else  
  		if($dt_user['numRows']!=0){
		  	$oc1=1;
				}else  
  		if($dt_uper['numRows']!=0){
 		  		$oc2=1;
				} else
  		if($dt_uwer['numRows']!=0){
		 		$oc3=1;
				}else{
				$oc1=0;
				$oc2=0;
				$oc3=0;
				}
		if( ($oc1==1) || ($oc2==1) || ($oc3==1)){ 
	echo '	<script language="javascript">
		alert("LA HABITACION ESTA OCUPADA!!!");
			</script>';
		$_REQUEST['fnumcto']='';
		$_REQUEST['ftipocto']='';
				
		}
	}	
}
     $fecha = daydiff ($_REQUEST['ffecsalida'],$_REQUEST['ffecllegada'],'d/m/Y');
 
         for ($i=0; $i<$fecha; $i++)   
    {   
        $Segundos = $Segundos + 86400;         
        $caduca = date("D",time()+$Segundos);     
            if ($caduca == "Fri")   
            {    
				$val1=$val1+1;  
            }   
            else if ($caduca == "Sat")   
            {   
				$val2=$val2+1;
            }   
            else  
            {   
                $FechaFinal = date("Y-m-d",time()+$Segundos);  
				$cuenta=$cuenta+1; 
            }   
    }  
	$sabd=$val1+$val2;
	  
$lkjsa = daydiff ($_REQUEST['ffecsalida'],$_REQUEST['ffecllegada'],'d/m/Y');	
?>
<table width="998" align="center" onMouseOver="restaTex();">
  <tr><td colspan="13" class="titulo"><div align="center"> MULTIPLO DE REGISTRO DE RESERVACIONES INDIVIDUALES. </div></td></tr>
  <tr>
    <th width="91"  ><div align="left"><span class="Estilo20">ALTA</span></div></th>
    <td width="57" style="#A15E8D"><!--input name="ffecalt" type="text" id="ffecalt" size="7" disabled="disabled" value="<?php
 //echo $_REQUEST['ffecalt'];?>"-->
	  <input name="ffecalt" type="text" id="ffecalt"  class="styTabEspA" disabled="disabled" size="7"
	  <?php
 
		if(isset($_POST['bot'])){
		$fec1=$reg["ffecalt"];
		include('DF20000.php');
		echo 'value="'.$f_f.'"';
		}
		?>/></td>
    <td width="119" style="#A15E8D"><input name="fusualta" type="text" disabled="disabled" id="fusualta" size="16"
	  <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['fusualta'].'"';
		}
		?>></td>
    <th colspan="2"  ><div align="left"><span class="Estilo20">DIAS</span></div></th>
    <td colspan="2" style="#A15E8D"><input name="fnumctos" type="text" id="fnumctos" tabindex="20" size="15" value="<?php
 
$fecha=chfecha($_REQUEST['ffecsalida'],'d/m/Y','Y-m-d');
list($year, $month, $day) = explode('-', $fecha); 
$fecha = mktime(0, 0, 0, $month, $day, $year); 
$hoy=chfecha($_REQUEST['ffecllegada'],'d/m/Y','Y-m-d'); 
list($year, $month, $day) = explode('-', $hoy); 
$hoy = mktime(0, 0, 0, $month, $day, $year); 
$dias = ($fecha - $hoy )/(60 * 60 * 24) ; 
echo  $dias; 
	?>" READONLY></td>
    <th width="111"  ><div align="left"><span class="Estilo20">ULTIMO CAMBIO</span></div></th>
    <td colspan="2" style="#A15E8D"><input name="ffeccam" type="text" class="styTabEspA" id="ffeccam" size="7" disabled="disabled"
	<?php
 
		if(isset($_POST['bot'])){
		$fec1=$reg["ffeccam"];
		include('DF20000.php');
		echo 'value="'.$f_f.'"';
		}
		?>>
      <input name="fusucamb" type="text" id="fusucamb" disabled="disabled" size="12"
	<?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['fusucamb'].'"';
		}
		?>></td>
    <th width="67"  ><div align="left"><span class="Estilo20">FOLIO</span></div></th>
    <td width="130" colspan="2" style="#A15E8D"><input name="ffecalt2" type="text" id="ffecalt2"  class="styTabEspA" disabled="disabled" size="7"
	  <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['n_reg'].'"';
		}
		?>/></td>
    </tr>
  <tr>
    <th colspan="2"  ><div align="left"><span class="Estilo20">FECHA DE LLEGADA </span></div></th>
    <td style="#A15E8D">
        <input name="ffecllegada" class="datefrom" type="text" id="ffecllegada" size="10"  value="<?php echo $_REQUEST['ffecllegada'];?>" >
	</td>
    <th colspan="2"  ><div align="left"><span class="Estilo20">NUMERO DE ADULTOS</span></div></th>
    <td colspan="2" style="#A15E8D"><input name="fnumadu" type="text" id="fnumadu" tabindex="1" onKeyPress="return validar(event)" size="5"  value="<?php
 echo $_REQUEST['fnumadu'];?>"></td>
	<td colspan="3" style="#A15E8D">
        <label>
        <div align="center"><span class="Estilo1">
          <input name="?323" type="button" class="original" tabindex="3" onClick="
	  	openWindow(
		{
			action:'FRGC20000.php',
			width:700,
			height:350
		},{
			val:'fnumcto',
			des:'ftipocto',
			alta:'tex4',
			baja:'text4'
		})" value="Buscar Habitacion" >
        </span></div>
        </label></td>
    <th colspan="2"  ><div align="center" class="Estilo18 Estilo20">NOTAS</div></th>
  </tr>
  <tr>
    <th colspan="2"  ><div align="left"><span class="Estilo20">FECHA DE SALIDA</span></div></th>
    <td style="#A15E8D"><input name="ffecsalida" type="text" class="dateto" id="ffecsalida" size="10"  value="<?php
 echo $_REQUEST['ffecsalida'];?>" >
     </td>
    <th colspan="2"  ><div align="left"><span class="Estilo20">NUMERO DE MENORES</span></div></th>
    <td colspan="2" style="#A15E8D"><input name="fnummenor" type="text" id="fnummenor" tabindex="2" onKeyPress="return validar(event)" size="5"  value="<?php
 echo $_REQUEST['fnummenor'];?>"></td>
    <th  ><div align="left"><span class="Estilo20">TIPO DE HABITACION </span></div></th>
    <td colspan="2" style="#A15E8D"><input name="ftipocto" type="text" id="ftipocto" value="<?php
 echo $_REQUEST['ftipocto'];?>" READONLY></td>
    <td colspan="2" rowspan="2" style="#A15E8D"><div align="center">
      <textarea name="fnorasvip" cols="30" rows="3" id="fnorasvip" onBlur="may(this)" tabindex="4"><?php
 echo $_REQUEST['fnorasvip'];?></textarea>
    </div></td></tr>
  <tr>
    <th colspan="2"  ><div align="left"><span class="Estilo20">HORA DE LLEGADA </span></div></th>
    <td style="#A15E8D"><input name="fhorallega" type="text" disabled="disabled" class="styTabEspA" id="fhorallega" onKeyPress="return validar(event)"  value="<?php
 echo (isset($_REQUEST['fhorallega']))?$_REQUEST['fhorallega']:"";?>" size="6"></td>
    <th colspan="2"  ><div align="left"><span class="Estilo20">EDADES DE MENORES</span></div></th>
    <td colspan="2" style="#A15E8D"><input name="edades" type="text" id="edades" tabindex="2" size="5"  value="<?php
 echo $_REQUEST['edades'];?>"></td>
    <th  ><div align="left"><span class="Estilo20">NUMERO DE HABITACION </span></div></th>
    <td colspan="2" style="#A15E8D"><input name="fnumcto" type="text" id="fnumcto" tabindex="20" size="5"  value="<?php
 echo $_REQUEST['fnumcto'];?>" READONLY></td></tr>
  <tr><td colspan="13" class="titulo"><div align="center" class="Estilo18">MULTIPLO DE DATOS </div></td></tr>
  <tr>
    <th  ><div align="left"><span class="Estilo18 Estilo22"><strong>GRUPO</strong></span></div></th>
    <td colspan="4" style="#A15E8D"><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>
    <th width="99"  ><div align="left"><span class="Estilo18 Estilo22"><strong>MERCADO</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><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>
    <th width="83"  ><div align="left"><span class="Estilo22"><strong>SEGMENTO</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><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>
    <th  ><div align="left"><span class="Estilo18 Estilo22"><strong>AGENCIA</strong></span></div></th>
    <td colspan="4" style="#A15E8D"><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>
    <th  ><div align="left"><span class="Estilo18 Estilo22"><strong>PLAN</strong></span></div></th>
    <td colspan="7" style="#A15E8D"><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>
    </tr>
  <tr>
    <th  ><div align="left"><span class="Estilo18 Estilo22"><strong>SMERF</strong></span></div></th>
    <td colspan="4" style="#A15E8D"><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>      <div align="center"></div></td>
    <th  ><div align="left"><span class="Estilo22"><strong>EMPRESA</strong></span></div></th>
    <td colspan="7" style="#A15E8D"><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 colspan="13" class="titulo"><div align="center" class="Estilo18">MULTIPLO DE FORMA DE PAGO </div></td></tr>
  <tr>    
	      <th  >
            <div align="left"><span class="Estilo22">  
              <strong> TARIFA</strong> </span>              </div>
	      <td colspan="7" style="#A15E8D"> <label><input name="tex" type="text" id="tex" size="3" value="<?php
 echo $_REQUEST['tex'];?>" />
      <input name="tex2" type="text" id="tex2" size="20" value="<?php
 echo (isset($_REQUEST['tex2']))?$_REQUEST['tex2']:"";?>" READONLY>
      <input name="text3" type="hidden" id="text3" size="2" value="<?php
 echo $_REQUEST['tex3'];?>" READONLY>
      <span class="Estilo17"><strong>$</strong></span>
      <input name="tex4" type="text" id="tex4" size="4" value="<?php
  if ($_REQUEST['tex4']!='') { echo $_REQUEST['tex4']; } else { echo '0'; }?>" onMouseOver="restaTex()" READONLY>
      <input name="tex5" type="text" id="tex5" size="3" value="<?php

	 if ($cuenta==''){
			 echo '0';
	 		}else{	
			echo "".$cuenta."";
			}
	  ?>" onMouseOver="restaTex()">
      =<span class="Estilo17"><strong> $</strong></span><input name="tex6" type="text" id="tex6" size="4" onMouseOver="restaTex()" value="<?php
 echo $_REQUEST['tex6']; ?>" READONLY>
<!--             <input name="?3222" type="button" class="original" tabindex="13"onClick="
	  	openWindow(
		{
			action:'rec_checkin_AG3.php',
			width:700,
			height:350
		},{
			val:'tex',
			des:'tex2',
			kji:'tex4'
		})" value="Buscar" >-->
      </label></td>         
    	
          <th width="93"  ><div align="left"><span class="Estilo22"><strong>FORMA DE PAGO</strong> </span>
            </div>
        <td colspan="4" style="#A15E8D"><span class="Estilo1">
		  <select name="fformpago" id="fformpago" onChange="javascript: document.getElementById('frm1').submit()" 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>
	</div>
  <tr>
  <th width="93"  ><div align="left"><span class="Estilo22"><strong>DEPOSITOS</strong> </span>
            </div>
<!--           <td  ><span class="Estilo22"><label></label>
               <input name="?2" type="button" value="Depositos" onClick="window.open('res_registro_MODE.php?retPag=res_registro_ACEX.php&bot=<?php
 echo $_POST['bot'];?>','popuppage','width=850,height=400,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" class="original" >
           </span></td>-->
             <td colspan="3" style="#A15E8D"><label>
      <strong>
      <input name="fdeposito" type="text" id="fdeposito" tabindex="14" size="10" value="<?php
 echo $_REQUEST['fdeposito'];?>" READONLY>
      </strong></label></td>
             <th style="#A15E8D"><div align="left"><strong>CODIGO DE SEGURIDAD</strong></div></th>
             <td colspan="2" style="#A15E8D"><input name="fcodseg" type="text" id="fcodseg" tabindex="15" size="12" value="<?php
 echo $_REQUEST['fcodseg'];?>"></td>
             <th style="#A15E8D"><div align="left"><strong>NUMERO D TARJETA</strong></div></th>
             <td colspan="2"  ><input name="fnumtar" type="text" id="fnumtar" tabindex="15"
	  onBlur="may(this)" size="20"
	  		<?php

				if(isset($_REQUEST['fnumtar'])){ //este es el truco
					echo 'value="' . $_REQUEST['fnumtar'] .  '"';
				}
			?>/></td>
      <th style="#A15E8D"><div align="left"><span class="Estilo22"><strong>LIMITE</strong></span></div></th>
	  <td colspan="2" style="#A15E8D"><input name="flimite" type="text" id="flimite" tabindex="16" size="15" value="<?php
 echo $_REQUEST['flimite'];?>"></td>
	  </tr>
  <tr>
    <td colspan="13" class="titulo"><div align="center" class="Estilo18">MULTIPLO DE DIRECCION</div></td></tr>
  <tr>
    <th  ><div align="left"><span class="Estilo22"><strong>NOMBRE</strong></span></div></th>
    <td colspan="3" style="#A15E8D">
	<textarea name="fnombre" cols="25" rows="3" id="fnombre" onBlur="may(this)" tabindex="4"><?php
 echo $_REQUEST['fnombre'];?></textarea>
    <th width="98"  ><div align="left"><span class="Estilo22"><strong>APELLIDO</strong></span></div></th>
    <td colspan="3" style="#A15E8D">
	<textarea name="fapellido" cols="20" rows="3" id="fapellido" onBlur="may(this)"tabindex="4"><?php
 echo $_REQUEST['fapellido'];?></textarea>	</td>
    <th  ><div align="left"><span class="Estilo24">TIPO DE HUESPED </span></div></th>
	<td colspan="2" style="#A15E8D"><select name="ftiphuesped" id="ftiphuesped" onChange="javascript: document.getElementById('frm1').submit()" tabindex="19">
      <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 style="#A15E8D"><div align="center"><strong><span class="Estilo19">VIP</span></strong><span class="Estilo18">
      <input name="fvip" type="checkbox" id="fvip" value="SI" <?php
 if(isset($_REQUEST['fvip']) && $_REQUEST['fvip']=='SI') echo 'checked';?>>
    </span></div></td>
  <tr>
    <th  ><div align="left"><span class="Estilo22"><strong>TELEFONO</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><input name="ftelefono" type="text" id="ftelefono" tabindex="20" size="25" value="<?php
 echo $_REQUEST['ftelefono'];?>"></td>
    <th  ><div align="left"><span class="Estilo22"><strong>TELEFONO EMPRESA</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><input name="ftelemp" type="text" id="ftelemp" tabindex="21" size="25" value="<?php
 echo $_REQUEST['ftelemp'];?>"></td>
    <th  ><div align="left"><span class="Estilo26">
    </span></div>      <span class="Estilo26"><label>
      <div align="left"><strong>E-MAIL</strong></div>
      </label>
    </span></th>
    <td colspan="3" style="#A15E8D"><input name="fmail" type="text" id="fmail" tabindex="23" size="25" value="<?php
 echo $_REQUEST['fmail'];?>"></td>
    </tr>
  <tr>
    <th  ><div align="left"><span class="Estilo22"><strong>E-MAIL EMPRESA</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><input name="femail" type="text" id="femail" tabindex="24" size="25" value="<?php
 echo $_REQUEST['femail'];?>"></td>
    <th  ><div align="left"><span class="Estilo22"><strong>DIRECCION</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><input name="fdireccion" type="text" id="fdireccion" tabindex="25" size="20" onBlur="may(this)" value="<?php
 echo $_REQUEST['fdireccion'];?>">
      <span class="Estilo18">
      <input name="?" type="button" class="original" tabindex="26" onClick="window.open('DX40000_AG1.php?retPag=res_registro_ACEX.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" value="..." >
      </span></td>
    <th  ><div align="left"><span class="Estilo26"><strong>CODIGO POSTAL</strong></span></div></th>
 <td style="#A15E8D"><input name="tcp" type="text" onKeyPress="return validar(event)" value="<?php
 echo $_REQUEST['tcp'];?>" size="10" maxlength="5"></td>
 <th  ><div align="left"><span class="Estilo22"><strong>COLONIA</strong></span></div></th>
 <td style="#A15E8D"><span class="Estilo18">
   <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">
   <input name="cuarto_seguro" type="hidden" id="cuarto_seguro" value="<?php
 echo $_REQUEST['cuarto_seguro'];?>" size="15"/>
 </span></td>
  </tr>
  <tr>
    <th  ><div align="left"><span class="Estilo22"><strong>PAIS</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><span class="Estilo18">
      <select name="pais" id="pais" onChange="javascript: document.getElementById('frm1').submit()">
        <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>
    <th  ><div align="left"><span class="Estilo22"><strong>ESTADO</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><span class="Estilo18">
      <select name="estados" onChange="javascript: document.getElementById('frm1').submit()">
        <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>
    <th  ><div align="left"><span class="Estilo26"><strong>DELEGACION O MUNICIPIO</strong></span></div></th>
    <td colspan="3" style="#A15E8D"><span class="Estilo18">
      <select name="tmun" id="tmun" >
        <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">
      <input name="Submit2" type="submit" class="original" tabindex="29" value="Agregar Multiplo"/>
      &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="bot_WsW" tabindex="30" onClick="openpage('res_registro_PR.php','_self')" value="Regresar"/>
    </div></td>
    </tr>
</table>
</form>
</div>	
  <?php
 
  if(!isset($dt_empres['fec_alta']))$dt_empres['fec_alta']="";
$fecha = $dt_empres['fec_alta'];
	$fechita = chfecha($fecha,'Y-m-d','d/m/Y');
	if(!isset($_POST['ffecllegada']))$_POST['ffecllegada']="";
	$fecha_llegada = chfecha($_POST['ffecllegada'],'d/m/Y','Y-m-d');
if (isset($_POST['Submit2'])){
if(empty($_POST['tex']) or empty($_POST['tex2'])){  // 8
     echo alert_JS("¡¡¡COMPLETE LA TARIFA!!!");
	 return false;  
    }
	
	$oahi = $_POST['tex4'] * $_POST['tex5']; 
	
	if($oahi != $_POST['tex6']){
	echo alert_JS ("¡¡¡TOTAL TARIFA INCORRECTA!!!");
	return false;
	}

     
	 if($fecha_llegada < $fecha){
		echo alert_JS ("¡¡¡FECHA DE LLEGADA INVALIDA!!! MENOR A LA FECHA ACTUAL");
		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;
	/////////////////////////////////////MODIFICAR DATOS////////////////////////////////////////////////
	}if(empty($_POST['fcodmeca'])){ // 6
     echo alert_JS("¡¡¡SELECCIONE EL TIPO DE MERCADO!!!");
	 return false;  
    
	}if(empty($_POST['fplan'])){ // 7
     echo alert_JS("¡¡¡SELECCIONE EL TIPO DE PLAN!!!");
	 return false;  
    
	}if(empty($_POST['codseg'])){  // 8
     echo alert_JS("¡¡¡SELECCIONE EL TIPO DE SEGMENTO!!!");
	 return false;  
    }
	///////////////////////////////////////MODIFICAR FORMA DE PAGO///////////////////////////////////////////////////
	$dkuh = $_POST['tex4'] * $_POST['tex5']; // 9
	if($dkuh != $_POST['tex6']){
	echo alert_JS ("¡¡¡TOTAL TARIFA INCORRECTA!!!");
	return false;
	}
	
	if(empty($_POST['fformpago'])){ // 15
     echo alert_JS("¡¡¡SELECCIONE LA FORMA DE PAGO!!!");
	 return false;  
    }/////////////////////////////////MODIFICAR DIRECCION///////////////////////////////////////////////////////////////
	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['ftelemp'] == "" ){
		echo alert_JS ("¡¡¡COMPLETE EL TELEFONO DE LA EMPRESA!!!");
		return false;
		
	}if($_POST['femail'] == "" ){
		echo alert_JS ("¡¡¡COMPLETE EL CORREO ELECTRONICO DE LA EMPRESA!!!");
		return false;
		
	}if($_POST['fdireccion'] == "" ){
		echo alert_JS ("¡¡¡COMPLETE LA DIRECCION!!!");
		return false;
		
	}if(empty($_POST['ftiphuesped'])){ 
     echo alert_JS("¡¡¡SELECCIONE EL TIPO DE HUESPED!!!");
	 return false;
	 
	}
	include("DMMYSQLG.php");
    include("DMMYSQLG.php");
	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;
				}
        include ("valeryus50100_MC.php");
		}
		?>
	
</body>
<?php
 
mysqli_close($con);
}
//961---->900 ultima actualizacion 23-junio-2011
//872---->800 ultima actualizacion 30-noviembre-2011
?>
</html>
