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

<script language="javascript">
function ajax(){
			new Ajax('script.php', {
							update: $('resultado'),
							postBody: $('frm1').toQueryString()
						}).request();
		}

</script> 
<script src="mootools.js" type="text/javascript"></script>
<script language=""javascript>
function sumaTex(){
	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='ftarifaxa';
	var idObjCve='ia';//esto es num de adultos no id de tarifa
	var idObjTotal='fmonadu';
	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='valeryus51100_CPS.php';
	var idObjDes='ftarifaxm';
        var idObjCve='im';
	var idObjTotal='fmonmen';
	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);
            }
    });	
    
});
-->
</script>
<script language="javascript">
function restaFecha ()
 {
var d1 = $('#ffecllegada').val().split("/"); 
  var dat1 = new Date(d1[2], parseFloat(d1[1])-1, parseFloat(d1[0]));
//console.log(dat1);
 var d2 = $('#ffecsalida').val().split("/");
 var dat2 = new Date(d2[2], parseFloat(d2[1])-1, parseFloat(d2[0]));
//    //var dif = fFecha2 - fFecha1;
 var fin = dat2.getTime() - dat1.getTime();
    var dias = Math.floor(fin / (1000 * 60 * 60 * 24)); 
//   //return dias
    if(dias>0){ 
    $("#fnumctos").val(dias); 
    $("#tex5").val(dias);
    }
    else{
         $('#ffecsalida').val('');
         alert("Fechas invalidas")
    }
 }
</script>


<style type="text/css">
-->
BODY {
SCROLLBAR-FACE-COLOR:#7397A7; 
SCROLLBAR-HIGHLIGHT-COLOR:#5FBEC2;/*sombra izquierda arriba*/ 
SCROLLBAR-SHADOW-COLOR:#5FBEC2;/*sombra derecha abajo*/ 
SCROLLBAR-3DLIGHT-COLOR:#5FBEC2;/*lo mismo que la segunda*/ 
SCROLLBAR-ARROW-COLOR:#5FBEC2;/*flechita*/ 
SCROLLBAR-TRACK-COLOR:#5FBEC2;/*base*/
SCROLLBAR-DARKSHADOW-COLOR:#5FBEC2/*lo mismo que la tercera*/
}
-->
table {margin:auto;}
<!--
form{
text-align:center;}
.Estilo17 {font-size: 14px}
.Estilo18 {font-weight: bold}
.Estilo19 {
	font-size: 16px;
	font-weight: bold;
}
#Layer2 {	position:absolute;
	 left:586px;
	top:166px; 
	width:175px;
	height:91px;
	z-index:1;
	overflow:auto;
	right:auto;
	color:#000;
}.pp {
background-color:#666666;
color:#000;
}
.Estilo20 {
	color: #000000;
	font-weight: bold;
}
.Estilo23 {color: #000}
.Estilo24 {color: #fff}
.Estilo22 {color: #000}
.Estilo25 {font-weight: bold; color: #fff; }
-->

</style>
<body onLoad="sumaTex(); restaFecha()">
<div id="resultado" style="text-align:center;"></div>
<form  name="frm1" id="frm1" method="post" action=""  enctype="multipart/form-data" >
  <?php
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////checar habitaciones
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['Submit2'])){
    
 include ("rec_chin_AC.php");
}
if (!isset($_POST['Submit2'])){
    
	if (isset($_POST['fnumcto'])&& $_POST['fnumcto']!=''){
//CHECA HABITACION OCUPADA O DESCUPADA EN EL MOMENTO DE ESTAR INGRESANDO DATOS
	$fec = $_POST['ffecllegada'];

        include('DF20000.php');
		 $fini = $f_m;
		$fec = $_POST['ffecsalida'];
		include('DF20000.php');
		$fsal = $f_m;
	
//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='".$_POST['fnumcto']."' AND ffecllegada < '$fini' AND ffecsalida > '$fini' and cancelado='0' "));
  echo mysqli_error($con);
   $dt_uper=mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto FROM valeryus19 WHERE fnumcto='".$_POST['fnumcto']."' AND 
		ffecllegada < '$fsal' AND ffecsalida > '$fsal' and cancelado='0' "));
  echo mysqli_error($con);
   $dt_uwer=mysqli_fetch_array(mysqli_query($con ,"SELECT  count(*) as numRows, fnumcto FROM valeryus19 WHERE fnumcto='".$_POST['fnumcto']."' AND 
		ffecllegada > '$fini' AND ffecsalida < '$fsal' and cancelado='0' "));
  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>';
		$_POST['fnumcto']='';
		$_POST['ftipocto']='';
				
		}
	}	
}

	$fechaInicial = isset($_POST['ffecllegada'])?$_POST['ffecllegada']:"";
       $fecs=(isset($_POST['ffecsalida']))?$_POST['ffecsalida']:"";
     $fecha = daydiff ($fecs,$fechaInicial,'d/m/Y'); 
//	      $fecha = daydiff ('javascript.document.frm1.ffecsalida','javascript.document.frm1.ffecllegada','d/m/Y');
     //$MaxDias = 6;   
         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 ($fecs,$fechaInicial,'d/m/Y');	
?>
 <table width="1031"  align="center" bordercolor=" " bordercolordark=" ">
    <tr>
      <th colspan="13" class=\"titulo\"><div align="center">AGREGAR REGISTRO DE HUESPEDES </div></th>
    </tr>
    
	<tr>
      <td width="66" ><span class="Estilo23"><strong>RESERV&Oacute;</strong></span></td>
      <td width="47"  ><input name="ffecalt" type="text" class="styTabEspA" id="ffecalt" disabled="disabled" value="<?php
echo date('d/m/Y') ?>"size="7" ></td>
      <td width="144"  ><input name="fusualta" type="text" id="fusualta" disabled="disabled" size="20"></td>
      <td ><span class="Estilo23"><strong>DIAS</strong></span></td>
      <td  ><input name="fnumctos" id="fnumctos" value="<?php
echo (isset($_REQUEST['fnumctos']))?$_REQUEST['fnumctos']:""; ?>" type="text" size="5" READONLY></td>
      <td colspan="2" ><span class="Estilo23"><strong>RECEPCIONISTA</strong></span></td>
      <td width="118"  ><input name="alta_huesped" type="text" id="alta_huesped" disabled="disabled" size="10" value=" <?php
 
		echo  $_SESSION['usuario']  ;?>"></td>
      <td colspan="2" ><span class="Estilo23"><strong>STATUS
        <select name="select3">
          <option value="IN"<?php

          if(isset($_REQUEST['select3']) && $_REQUEST['select3']=="IN") echo 'selected';?> > IN</option>
        </select>
      </strong></span></td>
    </tr>
    <tr>
      <td colspan="2" ><span class="Estilo23">
        <label><strong>FECHA DE LLEGADA</strong> </label>
      </span></td>
      <td  ><span class="Estilo32">
	   <?php
//           
//	   $fecha = (isset($dt_empres['fec_alta']))?$dt_empres['fec_alta']:"";
//	   $fechita = chfecha($fecha,'Y-m-d','d/m/Y');
	   ?>

	  <input name="ffecllegada" type="text" class="emplea datefrom" id="ffecllegada" size="10"
               <?php 
 
				//if(!isset($dt_empres['fec_alta']))$dt_empres['fec_alta']="";
				$fecha = (isset($dt_empres['fec_alta']))?$dt_empres['fec_alta']:"";
 	            $fechita = chfecha($fecha,'Y-m-d','d/m/Y');
				if(isset($_POST['ffecllegada']))
			  		echo 'value="'.$_POST['ffecllegada'].'"'; 
			  	else
			  		echo 'value="'.$fechita.'"'; 
			?>                 
                 /></span></td>
      <td ><span class="Estilo23"><strong>NUMERO DE ADULTOS</strong></span></td>
      <td  ><input name="fnumadu" type="text" id="fnumadu" tabindex="2"
	  onBlur="may(this)" size="5"
	  		<?php

				if(isset($_POST['fnumadu'])){ //este es el truco
					echo 'value="' . $_POST['fnumadu'] .  '"';
				}
			?>/></td>
	  <td colspan="3" ><label>
      </label>
        <div align="center"><span class="Estilo1">
          <input name="?323" type="button" class="pp" tabindex="5" onClick="
	  	openWindow(
		{
			action:'FRGC20000.php',
			width:700,
			height:350
		},{
			val:'fnumcto',
			des:'ftipocto',
			alta:'tex4',
			baja:'text4'
		})" value="Buscar Habitacion" >
        </span></div></td>
      <td colspan="5" ><div align="center" class="Estilo23"><strong>NOTAS</strong></div></td>
    </tr>
    <tr>
      <td colspan="2" ><span class="Estilo23"><strong>FECHA DE SALIDA</strong></span></td>
      <td ><span class="Estilo32">
	  <input name="ffecsalida" type="text" class="emplea dateto" tabindex="1" id="ffecsalida" size="10" onChange="restaFecha ()"
	  <?php
 
				$fecha = (isset($dt_empres['fec_alta']))?$dt_empres['fec_alta']:date('Y-m-d');
 	            $fechita = chfecha($fecha,'Y-m-d','d/m/Y');
				
				function sumaDia($fecha,$dia){	
	            list($year,$mon,$day) = explode('-',$fecha);	
	            return date('Y-m-d',mktime(0,0,0,$mon,$day+$dia,$year));
				}
				$wert = sumaDia($fecha,1);
				$lkj = chfecha($wert,'Y-m-d','d/m/Y');
				
				if(isset($_POST['ffecsalida']))
			  		echo 'value="'.$_POST['ffecsalida'].'"'; 
			  	else
			  		echo 'value="'.$lkj.'"'; 
			?>
	  >
       
      </span></td>
      <td ><span class="Estilo23"><strong>NUMERO DE MENORES</strong></span></td>
     
				<?php
 
				if ('fnumctos'==-1){
				echo hola;
				}
				?>
      <td  ><input name="fnummenor" type="text" id="fnummenor" tabindex="3"
	  onBlur="may(this)" size="5"
	  		<?php

				if(isset($_POST['fnummenor'])){ //este es el truco
					echo 'value="' . $_POST['fnummenor'] .  '"';
				}
			?>/></td>
      <td width="73" ><span class="Estilo23"><strong>TIPO DE HABITACION</strong></span></td>
      <td colspan="2"  ><input name="ftipocto" type="text" id="ftipocto" onBlur="may(this)" READONLY
	  <?php

				if(isset($_POST['ftipocto'])){ //este es el truco
					echo 'value="' . $_POST['ftipocto'] .  '"';
				}
			?>></td>
      <td colspan="5" rowspan="2"  ><div align="center"><span class="Estilo18">
		<textarea name="fnorasvip" cols="26" rows="3" id="fnorasvip" tabindex="6"
	  onBlur="may(this)"><?php

				if(isset($_POST['fnorasvip'])){ //este es el truco
					echo $_POST['fnorasvip'];
				}
			?></textarea>
      </span></div></td>
    </tr>
    <tr>
      <td colspan="2" ><span class="Estilo23"><strong>HORA DE LLEGADA</strong></span></td>

      <input name="fhorallega" type="text" class="tdan" id="fhorallega" value="<?php
echo date('H:i:s') ?>"size="9" ></td>
      <td ><span class="Estilo23"><strong>EDADES DE MENORES</strong></span></td>
      <td  ><input name="edades" type="text" id="edades" tabindex="4"
	  onBlur="may(this)" size="5"
	  		<?php

				if(isset($_POST['edades'])){ //este es el truco
					echo 'value="' . $_POST['edades'] .  '"';
				}
			?>/></td>
      <td ><span class="Estilo1 Estilo23">NUMERO DE HABITACION</span></td>
      <td colspan="2"  ><input name="fnumcto" type="text" id="fnumcto" READONLY
	  onBlur="may(this)" size="5"
	  		<?php

				if(isset($_POST['fnumcto'])){ //este es el truco
					echo 'value="' . $_POST['fnumcto'] .  '"';
				}
			?>/></td>
    <tr>
      <th colspan="13" class="titulo"><div align="center" class="Estilo18">AGREGAR SEGMENTOS </div></th>
    </tr>
    <tr>
      <td height="28" ><span class="Estilo20">GUEST HISTORY</span></td>
      <td colspan="3"  ><span class="priDat">
        <input name="id_cli" type="hidden" id="id_cli" size="10" tabindex="1" value="<?php
echo $_REQUEST['id_cli'];?>">
        <input name="nom_cli" type="text" id="nom_cli" size="40" tabindex="7" value="<?php
 echo (isset($_REQUEST['nom_cli']))?$_REQUEST['nom_cli']:"";?>">
      </span></td>
      <td ><span class="Estilo23"><strong>MERCADO</strong></span></td>
      <td colspan="3"  ><span class="Estilo1">
        <select name="fcodmeca" id="fcodmeca"  tabindex="10">
          <option value="">-----SELECCIONE-----</option>
          <?php
 
$sql = mysqli_query($con ,"SELECT * FROM tipmerca order by tdescrip");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['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="69" ><span class="Estilo23"><strong>SEGMENTO</strong></span></td>
      <td width="209"   colspan="2"><select name="codseg" id="codseg"  tabindex="11">
        <option value="">--SELECCIONE--</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus06 order by descripcion");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['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 height="26" ><span class="Estilo18 Estilo23">AGENCIA</span></td>
      <td colspan="3"  ><span class="Estilo18">
        <select name="fcodagen" id="fcodagen"  tabindex="8">
        <option value="">--SELECCIONE--</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus07 order by agdescrip");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['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="Estilo23"><strong>PLAN</strong></span></td>
      <td colspan="3"  ><span class="Estilo25">
        <select name="fplan" id="fplan"  tabindex="12">
          <option value="">--SELECCIONE--</option>
          <?php
 
$sql = mysqli_query($con ,"SELECT * FROM pplan order by pdescrip");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['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 >&nbsp;</td>
      <td colspan="2"  >&nbsp;</td>
    </tr>
    <tr>
      <td height="26" ><span class="Estilo23"><strong>SMERF</strong> </span></td>
      <td height="26" colspan="3"  ><label></label><label><span class="Estilo18">
        <select name="smerf" id="smerf"  tabindex="9">
          <option value="">--SELECCIONE--</option>
          <?php
 
$sql = mysqli_query($con ,"SELECT * FROM fsmerf order by descripcion");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['smerf']==$reg['descripcion'] ){
		echo '<option value="' . $reg['descripcion'] . '" selected>' . $reg['descripcion'] . '</option>';
	}else{
		echo '<option value="' . $reg['descripcion'] . '">' . $reg['descripcion'] . '</option>';
	}
}
?> </select>
      </span></label></td>
      <td height="26" ><span class="Estilo23"><strong>EMPRESA</strong></span></td>
      <td height="26" colspan="6"  ><span class="Estilo24">
        <select name="fempresa" id="fempresa"  tabindex="13">
          <option value="">-----SELECCIONE-----</option>
          <?php
 
$sql = mysqli_query($con ,"SELECT * FROM fcompas order by pdesco");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['fempresa']==$reg['pdesco'] ){
		echo '<option value="' . $reg['pdesco'] . '" selected>' . $reg['pdesco'] . '</option>';
	}else{
		echo '<option value="' . $reg['pdesco'] . '">' . $reg['pdesco'] . '</option>';
	}
}
?>
          </select>
      </span></td>
    </tr>
	<tr>
      <th colspan="14" class="titulo"><div align="center" class="Estilo18">AGREGAR FORMA DE PAGO </div></th></tr>
    <tr>
      <td >
		<span class="Estilo20">TARIFA</span>
	  <td colspan="5"  >        
	    <input name="tex" type="text" id="tex" size="5" tabindex="15"
		<?php

				if(isset($_POST['tex'])){ //este es el truco
					echo 'value="' . $_POST['tex'] .  '"';
				}
		?> >
        <input name="tex2" type="text" id="tex2" size="20" 
		<?php

				if(isset($_POST['tex2'])){ //este es el truco
					echo 'value="' . $_POST['tex2'] .  '"';
				}
		?> READONLY/>
        <input name="tex3" type="hidden" id="tex3" size="3" 
		<?php

				if(isset($_POST['tex3'])){ //este es el truco
					echo 'value="' . $_POST['tex3'] .  '"';
				}
		?> READONLY>
        <span class="Estilo17"><strong>$</strong></span>
		<input name="manual" type="hidden" id="manual" size="3" value="<?php
echo $_REQUEST['manual'];?>"/>
		<?php

		@$sql = mysqli_query($con ,"select * from dxopemaex where nombre like '".$_SESSION['usuario']."'");
        @$reg = mysqli_fetch_array($sql);
       
		if (isset($_POST['manual']) &&$_POST['manual']=='SI' and $reg['manual']=='1'){?>
                <input readonly name="tex4" type="text" id="tex4" size="4" value="<?php
if ($_REQUEST['tex4']!='') { echo $_REQUEST['tex4']; } else { echo '0'; }?>"onMouseMove="sumaTex()">
		<?php
}else{ ?>
		<input readonly name="tex4" type="text" id="tex4" size="4" value="<?php
if(isset($_REQUEST['tex4'])&&$_REQUEST['tex4']!='') { echo $_REQUEST['tex4']; } else { echo '0'; }?>"onMouseMove="sumaTex()" >
		<?php
} ?>
        <input name="tex5" type="text" id="tex5" size="2" value="<?php

		echo (isset($_REQUEST['tex5']))?$_REQUEST['tex5']:""; //(daydiff ($_POST['ffecsalida'],$_POST['ffecllegada'],'d/m/Y'));
		?>" onMouseMove="sumaTex()" READONLY>
        =<span class="Estilo17"><strong>$</strong></span>
        <input name="tex6" type="text" id="tex6" size="5" onMouseMove="sumaTex()" value="<?php
echo (isset($_REQUEST['tex6']))?$_REQUEST['tex6']:"";?>" READONLY>
               		                
	  <td >        <span class="Estilo20">FORMA DE PAGO
	  </span>
	  <td colspan="6"  >                <span class="Estilo1">
		  <select name="fformpago" id="fformpago"  tabindex="18">
            <option value="">---SELECCIONE---</option>
      <?php
 
$sql = mysqli_query($con ,"SELECT * FROM valeryus09 WHERE pmontomax = 'ABONO' AND ppago = 'SI' ORDER by descripcion");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['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 ><label><span class="Estilo20">No ADULTO  EXTRA</span></label></td>
      <td colspan="5"  ><span class="Estilo24">
        <input name="fnumadulx" type="text" id="fnumadulx" onBlur="may(this)" size="5" tabindex="16" value="<?php
 echo (isset($_REQUEST['fnumadulx']))?$_REQUEST['fnumadulx']:"" ;?>"/>
        <input name="ia" type="hidden" id="ia" size="5" value="<?php
echo $_REQUEST['ia'];?>" />
        <input name="ftarifaxa" type="text" id="ftarifaxa" size="40" value="<?php

        echo (isset($_REQUEST['ftarifaxa']))?$_REQUEST['ftarifaxa']:"" ;?>" />
      
        <input name="fmonadu" type="text" id="fmonadu" size="5" value="<?php
 if(isset($_REQUEST['fmonadu'])&&$_REQUEST['fmonadu']!='') { echo $_REQUEST['fmonadu']; } else { echo '0'; }?>" READONLY />
      </span></td>
      <td ><span class="Estilo20">NUMERO DE TARJETA</span></td>
      <td colspan="4"  ><input name="fnumtar" type="text" id="fnumtar" tabindex="19"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['fnumtar'])){ //este es el truco
					echo 'value="' . $_POST['fnumtar'] .  '"';
				}
			?>/></td>
    </tr>
    <tr>
      <td ><span class="Estilo20">No MENOR EXTRA</span></td>
      <td colspan="5"  ><span class="Estilo24">
        <input name="fnummenorx" type="text" id="fnummenorx" tabindex="17"
	  onBlur="may(this)" size="5" value="<?php
; echo (isset($_REQUEST['fnummenorx']))?$_REQUEST['fnummenorx']:"" ;?>"/>        
        <label></label>
        <span class="Estilo22">
        <input name="im" type="hidden" id="im" size="5" value="<?php
echo $_REQUEST['im'];?>" />
        <input name="ftarifaxm" type="text" id="ftarifaxm" size="40" value="<?php
 echo (isset($_REQUEST['ftarifaxm']))?$_REQUEST['ftarifaxm']:"" ;?>" />
        <input name="fmonmen" type="text" id="fmonmen" size="5" value="<?php
if(isset($_REQUEST['fmonmen'])&&$_REQUEST['fmonmen']!='')  { echo $_REQUEST['fmonmen']; } else { echo '0'; }?>" READONLY />
      </span></span></td>
      <td width="57" ><span class="Estilo20">EXPIRA </span></td>
      <td  ><strong>
        <input name="flimite" type="text" id="flimite" tabindex="20"
	  onBlur="may(this)" size="10"
	  		<?php

				if(isset($_POST['flimite'])){ //este es el truco
					echo 'value="' . $_POST['flimite'] .  '"';
				}
			?>/>
      </strong></td>
      <td ><span class="Estilo23"><strong>CODIGO DE SEGURIDAD</strong></span></td>
      <td colspan="2"  ><input name="fcodseg" type="text" id="fcodseg" tabindex="21"
	  onBlur="may(this)" size="10"
	  		<?php

				if(isset($_POST['fcodseg'])){ //este es el truco
					echo 'value="' . $_POST['fcodseg'] .  '"';
				}
			?>/></td>
    </tr>	
	<tr>
      <th colspan="13" class="titulo"><div align="center" class="Estilo18">AGREGAR DATOS</div></th>
    </tr>
    <tr>
      <td height="29" ><span class="Estilo23"><strong>NOMBRE</strong></span></td>
      <td colspan="2"  >
			 <textarea name="fnombre" cols="29" rows="3" id="fnombre" tabindex="23"
	  onBlur="may(this)"><?php

				if(isset($_POST['fnombre'])){ //este es el truco
					echo $_POST['fnombre'];
				}
			?></textarea>			 </td>
      <td width="70" ><span class="Estilo20">APELLIDO</span></td>
      <td colspan="2"  >
	  <textarea name="fapellido" cols="25" rows="3" id="fapellido" tabindex="22"
	  onBlur="may(this)"><?php

				if(isset($_POST['fapellido'])){ //este es el truco
					echo $_POST['fapellido'];
				}
			?></textarea>			</td>
      <td ><span class="Estilo23"><strong>COMO SE ENTERO? </strong></span></td>
      <td colspan="2"  >
	  <select name="ftiphuesped" id="ftiphuesped"  tabindex="24">
        <option value="">--SELECCIONE--</option>
        <?php
 
$sql = mysqli_query($con ,"SELECT * FROM tiphuesped order by tpdescrip");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['ftiphuesped']==$reg['tpdescrip'] ){
		echo '<option value="' . $reg['tpdescrip'] . '" selected>' . $reg['tpdescrip'] . '</option>';
	}else{
		echo '<option value="' . $reg['tpdescrip'] . '">' . $reg['tpdescrip'] . '</option>';
	}
}
?>
      </select></td>
      <td 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 height="29" ><span class="Estilo23"><strong>TELEFONO</strong></span></td>
      <td colspan="2"  ><input name="ftelefono" type="text" id="ftelefono" tabindex="25"
	  onBlur="may(this)" size="30"
	  		<?php

				if(isset($_POST['ftelefono'])){ //este es el truco
					echo 'value="' . $_POST['ftelefono'] .  '"';
				}
			?>/></td>
      <td ><span class="Estilo20">TELEFONO EMPRESA</span></td>
      <td colspan="2"  ><input name="ftelemp" type="text" id="ftelemp" tabindex="26"
	  onBlur="may(this)" size="30"
	  		<?php

				if(isset($_POST['ftelemp'])){ //este es el truco
					echo 'value="' . $_POST['ftelemp'] .  '"';
				}
			?>/></td>
      <td colspan="3"  ><div align="center"><span class="Estilo1"><strong><span class="Estilo19">V.I.P.</span></strong>
            <input name="fvip" type="checkbox" id="fvip" tabindex="27" value="SI"<?php
  if(isset($_REQUEST['fvip'])&&$_REQUEST['fvip']) echo 'checked';?>>
      </span> </div></td>
    </tr>
    <tr>
      <td height="29" ><span class="Estilo23"><strong>E-MAIL</strong></span></td>
      <td colspan="2"  ><input name="fmail" type="text" id="fmail" tabindex="28" size="28"
	  		<?php

				if(isset($_POST['fmail'])){ //este es el truco
					echo 'value="' . $_POST['fmail'] .  '"';
				}
			?>/></td>
      <td ><span class="Estilo1 Estilo23">E-MAIL EMPRESA </span></td>
      <td colspan="2"  ><input name="femail" type="text" id="femail" tabindex="29" size="30"
	  		<?php

				if(isset($_POST['femail'])){ //este es el truco
					echo 'value="' . $_POST['femail'] .  '"';
				}
			?>
			
			/></td>
      <td ><span class="Estilo23"><strong>DIRECCION</strong></span></td>
      <td colspan="2"  ><input name="fdireccion" type="text" id="fdireccion" tabindex="30"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['fdireccion'])){ //este es el truco
					echo 'value="' . $_POST['fdireccion'] .  '"';
				}
			?>/></td>
    </tr>
    <tr>
      <td ><span class="Estilo1 Estilo23">CODIGO POSTAL</span></td>
      <td colspan="2"  ><input name="tcp" id="tcp" type="text" onKeyPress="return validar(event)"  value="<?php
echo (isset($_REQUEST['tcp']))?$_REQUEST['tcp']:"";?>" size="20" maxlength="5">
      <td><span class="Estilo23"><strong>PAIS</strong></span></td>
      <td colspan="2"  ><span class="Estilo1">
        <select name="pais" id="pais">
          <option value="" selected>--SELECCIONE--</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'];
			}*/
                        $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 height="29" ><span class="Estilo23"><strong>ESTADO</strong></span></td>
      <td colspan="2"  ><span class="Estilo1" >
        <select name="estados" id="estados">
          <option  value="">-----SELECCIONE-----</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'];
		}*/
                /*$selEnt=$_REQUEST['estados'];
		while($registro=mysqli_fetch_array($resultado)){
			if($selEnt==$registro['cve_estado'] ){ 
				echo '<option value="' . $registro['cve_estado'] . '">' . $registro['des_estado'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_estado'] . '">' . $registro['des_estado'] . '</option>';
			}
			
		}*/
            ?>
        </select>
      </span></td>
    </tr>
    <tr> 
      <td ><span class="Estilo1 Estilo23">DELEGACION O MICIPIO</span></td>
      <td colspan="2"  ><span class="Estilo1">
        <select name="tmun" id="tmun">
          <option  value="">-----SELECCIONE-----</option>
          <?php
		//@$resultado=mysqli_query($con ,"select * from dxdelmun where cve_estado='$selEnt'");
		/*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'];
		}*/
                /*$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>
      
      <td ><span class="Estilo23"><strong>COLONIA</strong></span></td>
      <td colspan="2"  ><span class="Estilo1">
              <!--<input type="hidden" name="tcol1" id="tcve" value="<?php
                //echo $_REQUEST['tcve'];?>">-->
       <select name="tcol" id="tcol">
                  <option value="" selected>-----SELECCIONE-----</option>
                  <?php
                  
		  //include("DMMYSQLG.php");
                        
			//@$resultado=mysqli_query($con ,"select * from dxcoloni where cve_estado='$selEnt' and cve_pais='$selPais' and cve_delmun='$selDelMun'");
			/*if(!isset($_REQUEST['tcol'])){
				$dt_colonia=mysqli_fetch_array($resultado);
				$selCol=$dt_colonia['cve_col'];
				if(mysqli_num_rows($resultado)>0)
					mysqli_data_seek($resultado,0);		
			}
			else{
				$selCol=$_REQUEST['tcol'];
			}*/
			/*while($registro=mysqli_fetch_array($resultado)){
				if($selCol==$registro['cve_col']){
					echo '<option value="' . $registro['cve_col'] . '">' . $registro['des_colonia'] . '</option>';
				}else{
					echo '<option value="' . $registro['cve_col'] . '">' . $registro['des_colonia'] . '</option>';
				}
				
			}*/			
		?>
              </select>
      </span></td>
      
      <td ><span class="Estilo23"><strong>VEHICULO</strong></span></td>
      <td colspan="2"  ><span class="Estilo1">
        <input name="fvehiculo" type="text" id="fvehiculo" tabindex="32"
	  onBlur="may(this)" size="20"
	  		<?php

				if(isset($_POST['fvehiculo'])){ //este es el truco
					echo 'value="' . $_POST['fvehiculo'] .  '"';
				}
			?>/>
      </span></td>
    </tr>
    
	
	<tr>
      <td ><span class="Estilo23"><strong>PLACAS</strong></span></td>
      <td colspan="2"  ><input name="fplacas" type="text" id="fplacas" tabindex="30"
	  onBlur="may(this)" size="30"
	  		<?php

				if(isset($_POST['fplacas'])){ //este es el truco
					echo 'value="' . $_POST['fplacas'] .  '"';
				}
			?>/></td>
      <td colspan="6"><div align="center">
        <input name="Submit2" type="submit" class="pp" tabindex="33"  value="Guardar"/>
  &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="Submit2" type="button" class="pp" tabindex="34" onClick="openpage('rec_chin_PR.php','_self')" value="Regresar"/>
      </div></td>
    </tr>
  </table>
</form>
</body>
</html>
