<?php
 ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
$com = "M";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DF80000.php");
include ("varfun.php");
include("JQUERY.inc");
$val2=0;
$val1=0;
$f_f="";
?>
<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');
var objTex1 =  document.getElementById("tex4");
if (objTex1){ }else {    console.log("dt does not exist tex4") }
var objTex2 =  document.getElementById("tex5");
if (objTex2){ }else {    console.log("dt does not exist tex5") }
var objTex3 =  document.getElementById("tex6");
if (objTex3){ }else {    console.log("dt does not exist 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='valeryus51000_CPS.php';
	var idObjDes='tex2';
        var idObjCve='tex';
	var idObjTotal='tex4';
	var idObjManual='manual';
	
	var nomObjRad='tip_bus_ope';
	$("#"+idObjDes).autocomplete({
            source:pagRes,
		minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
		                 //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);
		$("#"+idObjCve).val(ui.item.id);
                $("#"+idObjTotal).val(ui.item.gtotal);
                $("#"+idObjManual).val(ui.item.manual);
         }
	});	
	
});
<!--
$(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({
            source:pagRes,
		minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
		                 //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);
		$("#"+idObjCve).val(ui.item.id);
                $("#"+idObjTotal).val(ui.item.gtotal);
                $("#"+idObjManual).val(ui.item.manual);
            }
    });	
    
});
<!--
 $(document).ready(function(){
	function formatItem(row) {
		return " (<strong>" + row[1] + "</strong>)"+row[0];
	}
	var pagRes='valeryus51100_CPS.php';
	var idObjDes='ftarifaxa';
	var idObjCve='ia';//esto es num de adultos no id de tarifa
	var idObjTotal='fmonadu';
	//var idObjManual='manual';
	
	var nomObjRad='tip_bus_ope';
//ademas el autocomplete se va a ejecutar con la descripcion no con la clave
	$("#"+idObjDes).autocomplete({
            source:pagRes,
		minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
		                 //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='valeryus51200_CPS.php';
	var idObjDes='ftarifaxm';
	var idObjCve='im';
	var idObjTotal='fmonmen';
	var nomObjRad='tip_bus_ope';
	$("#"+idObjDes).autocomplete({
            source:pagRes,
		minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
		                 //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);
         }
	});	
});
-->
</script>
<?php
if(!isset($_POST['bot']))$_POST['bot']="";
if ($_POST['bot']==""){
$_REQUEST['bot']=isset($bot)?$bot:"";
$_POST['bot']=isset($bot)?$bot:"";
}else{
$_REQUEST['bot']=$_REQUEST['bot'];
$_POST['bot']=$_POST['bot'];
}
if (isset($_POST['bot']) && $_POST['bot']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=rec_checkin_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	include('rec_checkin_CL.php');
	$varible_clase = new clase();
	$res=$varible_clase->lista_busqueda((isset($_POST["bot"]))?$_POST["bot"]:"");
	$reg=mysqli_fetch_array($res);
	if(!isset($_POST['fnombre'])){
	$_REQUEST['fcodtarifa']=$reg['fcodtarifa'];
	$_REQUEST['fnumres']=$reg['fnumres'];
	$_REQUEST['fnumcto']=$reg['fnumcto'];
	$_REQUEST['ffecllegada']=chfecha($dt_empres['fec_alta'],'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['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['cuarto_seguro']=$reg['cuarto_seguro'];
	$_REQUEST['fnumadulx']=$reg['fnumadulx'];
	$_REQUEST['fnummenorx']=$reg['fnummenorx'];
	$_REQUEST['ftarifaxa']=$reg['ftarifaxa'];
	$_REQUEST['ftarifaxm']=$reg['ftarifaxm'];
	$_REQUEST['fmonadu']=$reg['fmonadu'];
	$_REQUEST['fmonmen']=$reg['fmonmen'];
	$_REQUEST['edades']=$reg['edades'];
	}  
	
}?>

<body  onLoad="restaTex();">
<form  name="frm1" method="post" id="frm1" 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);
  
  		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="1059" border="0" align="center" onMouseOver="restaTex();">
  <tr><th colspan="13" class=\"titulo\"><div align="center"> AGREGAR MULTIPLO DE REGISTRO DE HUESPEDES </div></th></tr>
  <tr>
    <td width="64"  ><span class="Estilo21"><strong>ALTA</strong></span></td>
    <td width="47" style="#66CCFF"><!--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="141" style="#66CCFF"><input name="fusualta" type="text" disabled="disabled" id="fusualta" size="16" value="<?php echo $_SESSION['usuario'];?>"></td>
    <td colspan="2"  ><span class="Estilo21"><strong>DIAS</strong></span></td>
    <td colspan="2" style="#66CCFF"><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>
    <td width="141"  ><span class="Estilo21"><strong>FOLIO</strong></span></td>
    <td width="78" style="#66CCFF"><input name="ffecalt2" type="text" id="ffecalt2"  class="styTabEspA" disabled="disabled" size="7"
	  <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['n_reg'].'"';
		}
		?>/></td>
    <td colspan="2"  ><div align="right" class="Estilo21"><strong>STATUS:</strong></div></td>
    <td width="147" style="#66CCFF"><select name="select1">
      <option value="IN"<?php if($_REQUEST['select1']=="IN") echo 'selected';?>>IN</option>
    </select></td>
  </tr>
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>FECHA DE LLEGADA</strong></span></td>
    <td style="#66CCFF"><label>
	  <input name="ffecllegada" type="text" id="ffecllegada" class="emplea datefrom" size="10" onKeyPress="return validar(event)" value="<?php echo $_REQUEST['ffecllegada'];?>"></label></td>
    <td colspan="2"  ><span class="Estilo21"><strong>NUMERO DE ADULTOS </strong></span></td>
    <td style="#66CCFF"><input name="fnumadu" type="text" id="fnumadu" tabindex="1" onKeyPress="return validar(event)" size="5"  value="<?php echo $_REQUEST['fnumadu'];?>"></td>
    <td colspan="3"  ><label></label>
        <label></label>        <label>
        <div align="center"><span class="Estilo1">
          <input name="?323" type="button" class="pp" 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>
    <td colspan="3"  ><div align="center" class="Estilo18 Estilo21"><strong>NOTAS:</strong></div></td>
  </tr>
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>FECHA DE SALIDA </strong></span></td>
    <td style="#66CCFF"><input name="ffecsalida" type="text" id="ffecsalida" class="emplea dateto" size="10" onKeyPress="return validar(event)" value="<?php echo $_REQUEST['ffecsalida'];?>" >
       </td>
    <td colspan="2"  ><span class="Estilo21"><strong>NUMERO DE MENORES</strong></span></td>
    <td style="#66CCFF"><input name="fnummenor" type="text" id="fnummenor" tabindex="2" onKeyPress="return validar(event)" size="5"  value="<?php echo $_REQUEST['fnummenor'];?>"></td>
    <td  ><span class="Estilo21"><strong>TIPO DE HABITACION </strong></span></td>
    <td colspan="2" style="#66CCFF"><input name="ftipocto" type="text" id="ftipocto" value="<?php echo $_REQUEST['ftipocto'];?>" READONLY></td>
    <td colspan="3" rowspan="2" style="#66CCFF"><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>
    <td colspan="2"  ><span class="Estilo21"><strong>HORA DE LLEGADA</strong></span></td>
    <td style="#66CCFF"><input name="fhorallega" type="text" disabled="disabled" class="styTabEspA" id="fhorallega" onKeyPress="return validar(event)"  value="<?php echo $_REQUEST['fhorallega'];?>" size="6"></td>
    <td colspan="2"  ><span class="Estilo21"><strong>EDADES DE MENORES</strong></span></td>
    <td style="#66CCFF"><input name="edades" type="text" id="edades" tabindex="2" size="5"  value="<?php echo $_REQUEST['edades'];?>"></td>
    <td  ><span class="Estilo21"><strong>NUMERO DE HABITACION </strong></span></td>
    <td colspan="2" style="#66CCFF"><input name="fnumcto" type="text" id="fnumcto" tabindex="20" size="5"  value="<?php echo $_REQUEST['fnumcto'];?>" READONLY></td></tr>
  <tr><th colspan="13" class="titulo"><div align="center" class="Estilo18"> DATOS </div></th></tr>
  <tr>
    <td  ><span class="Estilo18 Estilo21"><strong>GRUPO</strong></span></td>
    <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>
    <td width="188"  ><span class="Estilo18 Estilo21"><strong>MERCADO</strong></span></td>
    <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>
    <td colspan="4"><strong>SEGMENTO:</strong>      <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 Estilo21"><strong>AGENCIA</strong></span></td>
    <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>
    <td  ><span class="Estilo18 Estilo21"><strong>PLAN</strong></span></td>
    <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>
    <td  ><span class="Estilo18 Estilo21"><strong>SMERF</strong></span></td>
    <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></td>
    <td  ><span class="Estilo21"><strong>EMPRESA</strong></span></td>
    <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>
    <th colspan="14" class="titulo"><div align="center" class="Estilo18"> FORMA DE PAGO </div></th></tr>
  <tr>
	      <td  >
		    <span class="Estilo20">TARIFA		    </span>
	      <td colspan="6" style="#66CCFF">
		  <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 $_REQUEST['tex2'];?>" READONLY>
      <input name="tex3" type="hidden" id="tex3" size="3" value="<?php echo $_REQUEST['tex3'];?>" READONLY>
      <span class="Estilo17"><strong>$</strong></span>
      <input name="tex4" type="text" id="tex4" size="3" value="<?php  if ($_REQUEST['tex4']!='') { echo $_REQUEST['tex4']; } else { echo '0'; }?>" onMouseOver="restaTex()" READONLY>
      <input name="tex5" type="text" id="tex5" size="1" value="<?php 
		     if (isset($cuenta) && $cuenta==''){
			 echo '0';
	 		}else{	
			echo "".( (isset($cuenta))?$cuenta:"" )."";	}
	  ?>" onMouseOver="restaTex()">
      =<span class="Estilo17"><strong> $</strong></span><input name="tex6" type="text" id="tex6" size="5" onMouseOver="restaTex()" value="<?php echo $_REQUEST['tex6']; ?>" READONLY>
      
<!--      <input name="?3222" type="button" class="pp" tabindex="13"onClick="
	  	openWindow(
		{
			action:'rec_checkin_AG3.php',
			width:700,
			height:350
		},{
			val:'tex1',
			des:'tex2',
			jio:'tex3',
			kji:'tex4'
		})" value="Buscar" >		  </td>          -->
	    
          <td  ><span class="Estilo20">FORMA DE PAGO</span></td>
          <td colspan="4" style="#66CCFF"><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>
  <tr>
             <td  ><span class="Estilo20">No ADULTO  EXTRA</span></td>
      <td colspan="6" style="#66CCFF"><input name="fnumadulx" type="text" id="fnumadulx" onBlur="may(this)" size="5" value="<?php echo $_REQUEST['fnumadulx'];?>"/>
        <span class="Estilo23">
        <!--input name="ia" type="text" id="ia" size="3" value="<?php //echo $_REQUEST['ia'];?>" /-->
        <input name="ftarifaxa" type="text" id="ftarifaxa" size="40" value="<?php echo $_REQUEST['ftarifaxa'];?>" />
        <input name="fmonadu" type="text" id="fmonadu" size="5" value="<?php  if ($_REQUEST['fmonadu']!='') { echo $_REQUEST['fmonadu']; } else { echo '0'; }?>" READONLY />
      </span></td>
             <td  ><span class="Estilo20">NUMERO DE TARJETA </span></td>
             <td colspan="4" style="#66CCFF"><input name="fnumtar" type="text" id="fnumtar" tabindex="15"
	  onBlur="may(this)" size="30"
	  		<?php

				if(isset($_REQUEST['fnumtar'])){ //este es el truco
					echo 'value="' . $_REQUEST['fnumtar'] .  '"';
				}
			?>/></td>
    </tr>
  <tr>
    <td  ><span class="Estilo20">No MENOR EXTRA</span></td>
    <td colspan="6" style="#66CCFF"><span class="Estilo22"></span><span class="Estilo22">
      <input name="fnummenorx" type="text" id="fnummenorx"
	  onBlur="may(this)" size="5" value="<?php echo $_REQUEST['fnummenorx'];?>"/>
      <span class="Estilo23">
      <!--input name="im" type="text" id="im" size="3" value="<?php //echo $_REQUEST['im'];?>" /-->
      <input name="ftarifaxm" type="text" id="ftarifaxm" size="40" value="<?php echo $_REQUEST['ftarifaxm'];?>" />
      <input name="fmonmen" type="text" id="fmonmen" size="5" value="<?php  if ($_REQUEST['fmonmen']!='') { echo $_REQUEST['fmonmen']; } else { echo '0'; }?>" READONLY />
      </span></span></td>
    <td  ><span class="Estilo20">EXPIRA</span></td>
    <td colspan="2" style="#66CCFF"><strong>
      <input name="flimite" type="text" id="flimite" tabindex="16" size="10" value="<?php echo $_REQUEST['flimite'];?>">
    </strong></td>
    <td width="67"  ><span class="Estilo20">CODIGO DE SEGURIDAD</span></td>
    <td style="#66CCFF"><input name="fcodseg" type="text" id="fcodseg" tabindex="15" size="12" value="<?php echo $_REQUEST['fcodseg'];?>"></td>
    </tr>
  
 <tr>
    <th colspan="13" class="titulo"><div align="center" class="Estilo18"> DIRECCION</div></th></tr>
  <tr>
    <td  ><span class="Estilo20">NOMBRE</span></td>
    <td colspan="3" style="#A15E8D">
	<textarea name="fnombre" cols="25" rows="3" id="fnombre" onBlur="may(this)" tabindex="4"><?php echo $_REQUEST['fnombre'];?></textarea>
    <td width="100"  ><span class="Estilo20">APELLIDO</span></td>
    <td colspan="2" style="#A15E8D">
	<textarea name="fapellido" cols="20" rows="3" id="fapellido" onBlur="may(this)"tabindex="4"><?php echo $_REQUEST['fapellido'];?></textarea>	</td>
    <td  ><span class="Estilo21"><strong> COMO SE ENTERO ? </strong></span></td>
	<td colspan="3" 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 colspan="3" rowspan="6" nowrap bordercolor="#FFFFFF" style="#5F84B1"><div align="center" id="capa"><?php

			$fotografia = 'foto/valeryus19/NO_'. $reg["n_reg"] .'.JPG';
			if (file_exists($fotografia)) {
				echo '<img src="foto/valeryus19/NO_'.$reg["n_reg"].'.JPG" width="150" height="175">';
			}else{
				echo '<img src="foto/Sin_Foto.jpg" width="150" height="175">';
			}
		  ?></div>
	    <input type="checkbox" name="ac" value="1" onClick="act_fichero(ac.checked)">
        <input name="fichero" type="file" disabled="disabled" size="1" ></td></tr>
  <tr>
    <td  ><span class="Estilo20">TELEFONO</span></td>
    <td colspan="3" style="#A15E8D"><input name="ftelefono" type="text" id="ftelefono" tabindex="20" size="25" value="<?php echo $_REQUEST['ftelefono'];?>"></td>
    <td  ><span class="Estilo20">TELEFONO EMPRESA</span></td>
    <td colspan="2" style="#A15E8D"><input name="ftelemp" type="text" id="ftelemp" tabindex="21" size="25" value="<?php echo $_REQUEST['ftelemp'];?>"></td>
    <td colspan="4"  ><span class="Estilo21">
      <label>
     
      <div align="center" class="Estilo21"><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>
      <span class="Estilo21">
      </label>
      </span></td></tr>
  <tr>
    <td  ><span class="Estilo20">E-MAIL</span></td>
    <td colspan="3" style="#A15E8D"><input name="fmail" type="text" id="fmail" tabindex="23" size="25" value="<?php echo $_REQUEST['fmail'];?>"></td>
    <td  ><span class="Estilo20">E-MAIL EMPRESA </span></td>
    <td colspan="2" style="#A15E8D"><input name="femail" type="text" id="femail" tabindex="24" size="25" value="<?php echo $_REQUEST['femail'];?>"></td>
    <td  ><span class="Estilo21"><strong>DIRECCION</strong></span></td>
 <td colspan="3" style="#A15E8D">
 <input name="fdireccion" type="text" id="fdireccion" tabindex="25" size="25" onBlur="may(this)" value="<?php echo $_REQUEST['fdireccion'];?>"></td></tr>
  <tr>
    <td  ><span class="Estilo18 Estilo21"><strong>COLONIA</strong></span></td>
    <td colspan="3" 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="?" type="button" class="pp" tabindex="26" onClick="window.open('DX40000_AG1.php?retPag=rec_checkin_MO.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" value="..." >
    </span></td>
    <td  ><span class="Estilo20">CODIGO POSTAL </span></td>
    <td colspan="2" style="#A15E8D"><input name="tcp" type="text" onKeyPress="return validar(event)" value="<?php echo $_REQUEST['tcp'];?>" size="25" maxlength="5"></td>
    <td  ><span class="Estilo21"><strong>PAIS</strong></span></td>
    <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></tr>
  <tr>
    <td height="29"  ><span class="Estilo18 Estilo21"><strong>ESTADO</strong></span></td>
    <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>
    <td  ><span class="Estilo20">DELEGACION O MUNICIPIO</span></td>
    <td colspan="2" style="#A15E8D"><label><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></label></td>
    <td  ><span class="Estilo21"><strong>VEHICULO</strong></span></td>
    <td colspan="3" style="#A15E8D"><label>
      <input name="fvehiculo" type="text" id="fvehiculo" tabindex="27" size="25" onBlur="may(this)" value="<?php echo $_REQUEST['fvehiculo'];?>"></label></td></tr>

  <tr>
    <td  ><span class="Estilo21"><strong>PLACAS</strong></span></td>
    <td colspan="3" style="#A15E8D"><input name="fplacas" type="text" id="fplacas" tabindex="28" size="25" onBlur="may(this)" value="<?php echo $_REQUEST['fplacas'];?>"></td>
    <td colspan="7"><div align="center">
      <input name="Submit2" type="submit" class="pp" 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;&nbsp;&nbsp;
      <input name="Submit" type="button" class="pp" tabindex="30" onClick="openpage('rec_checkin_PR.php','_self')" value="Regresar"/>
    </div></td>
    </tr>
</table>
</form>
  <?php
 
if (isset($_POST['Submit2'])){
 if (empty($_POST['tex']) or empty($_POST['tex2'])) {
                echo alert_JS("���COMPLETE LA TARIFA!!!");
                return false;
            }
	/////////////////////////////////////////////////////////////SENTENCIA DE REGISTRO///////////////////////////////////////
	if($_POST['fnumctos'] == "" || $_POST['fnumctos'] == 0){
		echo alert_JS ("\A1\A1\A1ESTA SEGURO DE GUARDAR LOS CAMBIOS!!!");
		return false;
	}
	if($_POST['fnumadu'] == ""){
		echo alert_JS ("\A1\A1\A1COMPLETE EL NUMERO DE ADULTOS!!!");
		return false;
	}
	/////////////////////////////////////////////////////////////////SENTENCIA DE SEGMENTOS//////////////////////////////////////
	if(empty($_POST['fcodmeca'])){ 
     echo alert_JS("\A1\A1\A1SELECCIONE EL TIPO DE MERCADO!!!");
	 return false;  
    }if(empty($_POST['fplan'])){ 
     echo alert_JS("\A1\A1\A1SELECCIONE EL TIPO DE PLAN!!!");
	 return false;  
    }if(empty($_POST['codseg'])){ 
     echo alert_JS("\A1\A1\A1SELECCIONE EL TIPO DE SEGMENTO!!!");
	 return false;  
    }//if(empty($_POST['text2'])){ 
     //echo alert_JS("\A1\A1\A1SELECCIONE LA TARIFA!!!");
	 //return false;  
    //}
	
	/////////////////////////////////////////////////////////////////SENTENCIA DE FORMA DE PAGO/////////////////////////////

    if ($_POST['fcodmeca'] == 'USO CASA' || $_POST['fcodmeca'] == 'CORTESIA'){
	
	}else{
	
	
	
           
            $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'])){ 
     echo alert_JS("\A1\A1\A1SELECCIONE LA FORMA DE PAGO!!!");
	 return false;  
    }
	///////////////////////////////////////////////////////////////////SENTANCIA DE DATOS////////////////////////////////////
	if($_POST['fnombre'] == "" ){
		echo alert_JS ("\A1\A1\A1COMPLETE EL NOMBRE!!!");
		return false;
	
	}if($_POST['fapellido'] == "" ){
		echo alert_JS ("\A1\A1\A1COMPLETE EL APELLIDO!!!");
		return false;
	 
	}if($_POST['ftelefono'] == "" ){
		echo alert_JS ("\A1\A1\A1COMPLETE EL TELEFONO!!!");
		return false;
	
	}if($_POST['fmail'] == "" ){
		echo alert_JS ("\A1\A1\A1COMPLETE EL CORREO ELETRONICO!!!");
		return false;
	
	}
	//if($_POST['ftelemp'] == "" ){
		//echo alert_JS ("\A1\A1\A1COMPLETE EL TELEFONO DE LA EMPRESA!!!");
		//return false;
		
	//}
	//if($_POST['femail'] == "" ){
		//echo alert_JS ("\A1\A1\A1COMPLETE EL CORREO ELECTRONICO DE LA EMPRESA!!!");
		//return false;
		
	//}
	if($_POST['fdireccion'] == "" ){
		echo alert_JS ("\A1\A1\A1COMPLETE LA DIRECCION!!!");
		return false;
		
	}if(empty($_POST['ftiphuesped'])){ 
     echo alert_JS("\A1\A1\A1SELECCIONE EL TIPO DE HUESPED!!!");
	 return false;
	 
	}if(isset($_POST['fnumcto'])){
		include("DMMYSQLG.php");
        include("DMMYSQLG.php");
		$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("\A1\A1\A1\A1LA 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("\A1\A1\A1\A1LA 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("\A1\A1\A1\A1LA 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("\A1\A1\A1\A1LA HABITACION ESTA OCUPADA POR: ".$dod['fapellido']." ".$dod['fnombre']." !!!!");
				return false;
				}
		include ("valeryus60100_MC.php");
		}
		?>
</body>
<?php
 
mysqli_close($con);
}
?>
</html>
<?php

//980-->500 ULTIMA ACTUALIZACION 4/ENERO/2012 CREAR MULTIPLO 40,000-->35,000
?>
