<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("JQUERY.inc");
include("DF30000.inc");
$f_m="";
$f_f="";
?>
<html>
<HEAD> <meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8">

</HEAD>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>

<body>
<div align="left">

</div>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="">
    <table width="441" border="0">
	<tr>
	  <th colspan="2"><span class="Estilo23">REPORTE DE CAMBIOS</span></th>
	  </tr>
	<tr>
	  <td width="142"><div align="right" class="Estilo24"><span class="Estilo25"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" />  FOLIO.</span></div></td>
	  <td width="289"><input name="r1" type="radio" value="no" tabindex="3"/></td>
	</tr>
        
	<tr>
	  <td> <div align="right" class="Estilo24"><span class="Estilo25"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" /> APELLIDO.</span></div></td>
	  <td><input name="r1" type="radio" value="p" tabindex="4"/></td>
	</tr>
	<tr>
	  <td> <div align="right" class="Estilo24"><span class="Estilo25"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" /> PERIODO. </span></div></td>
	  <td><input name="r1" type="radio" value="f" tabindex="5"/>
	    <strong>De:</strong>
            <?php
        $fec=(isset($_POST['fec']))?$_POST['fec']:date('d/m/Y');
        ?>
          <input name="fec" type="text" class="emplea datefrom" id="fec" size="9" maxlength="20" value="<?=$fec?>"
			<?php

				if(isset($_POST['fec'])){ //este es el truco
					echo 'value="' . $_POST['fec'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?>onkeypress="return soloNumeros(event)"		/>
          <!--  <input name="bot" id="bot" type="image" value=" ... " src="logos/cal4.jpg"/>
            -->
            <strong>            A:</strong>
          <input name="fec2" type="text" class="emplea dateto" id="fec2" size="9" maxlength="20" value="<?=date("d/m/Y")?>"
			<?php

				if(isset($_POST['fec2'])){ //este es el truco
					echo 'value="' . $_POST['fec2'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?> onkeypress="return soloNumeros(event)"
		/>
           <!-- <input name="bot12" id="bot1" type="image" value="Cal" src="logos/cal4.jpg" />
            --> </td>
	</tr>
      <tr>
        <td colspan="2">
            <div align="center">
             
              <input name="Submit" type="button" class="original" onClick="openpage('ger_cambios_PR.php','_self')" value="Buscar"/>
			  <input name="bot4" type="button" class="bot_WsW" onClick="openpage('ger_cambios_IM.php','_self')" value="Imprimir "/>        
              
		  </div></td>
      </tr>
    </table>
   </form>
</div>
<div align="center">
  <form method="post" action="" >
    <?php

	@$result = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE status = 'huesped' AND boton = 'C'");
	@$tot=mysqli_fetch_array(mysqli_query($con ,"select count(boton) as total from valeryus19 where boton = 'C'"));
	?>
    <table width="979"   align="center">
      <tr>
        
		<th width="45"><div align="center">FOLIO</div></th>
        <th width="75"><div align="center">CUARTO ANTERIOR </div></th>
		<th width="75"><div align="center">CUARTO ACTUAL</div></th>
		<th width="150"><div align="center">APELLIDO /NOMBRE</div></th>
		<th width="60"><div align="center">TIPO DE CUARTO</div></th>
		<th width="75"><div align="center">TARIFA ANTERIOR</div></th>
		<th width="75"><div align="center">TARIFA ACTUAL </div></th>
		<th width="190"><div align="center">NOTAS</div></th>
		<th width="80"><div align="center">FEC. DE CAMBIO</div></th>
		<th width="80"><div align="center">USUARIO</div></th>
		<th width="90"><div align="center">HORA</div></th>
	  </tr>
	<?php

	
	 // --->
	 //if(!isset($_POST['fec']))$_POST['fec']="";
	  	$fec = (isset($_POST['fec']))?$_POST['fec']:"";
		include('DF20000.php');
		$fecha_inicial = $f_m;
		//$pdf->Cell(15,5,$fecha_inicial,1,0,'C');
		//if(!isset($_POST['fec2']))$_POST['fec2']="";
		$fec = (isset($_POST['fec2']))?$_POST['fec2']:"";
		include('DF20000.php');
		$fecha_final = $f_m;
	  // -->
	 // if(!isset($_POST['r1']))$_POST['r1']="";
              
	if(isset($_POST['r1']) && $_POST['r1']=="no"){
		echo '<input name="tbusqueda" type="hidden" value="no">';
	  	$result = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE status = 'huesped' AND boton = 'C' order by n_reg");
   	    @$tot=mysqli_fetch_array(mysqli_query($con ,"select count(boton) as total from valeryus19 where status = 'huesped' AND boton = 'C'"));
	}elseif(isset($_POST['r1']) && $_POST['r1']=="f"){
		//$fec = $_POST['tt'];
		//include("DF20000.php");
		//echo $f_m;
		echo '<input name="tbusqueda" type="hidden" value="f">';
		$result = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE ffeccam >= '".$fecha_inicial."' and ffeccam <= '".$fecha_final."' AND status = 'huesped' AND boton = 'C'");
		@$tot=mysqli_fetch_array(mysqli_query($con ,"select count(boton) as total from valeryus19 where ffeccam >= '".$fecha_inicial."' and ffeccam <= '".$fecha_final."' AND boton = 'C'"));
   	}elseif(isset($_POST['r1']) && $_POST['r1']=="p"){
		echo '<input name="tbusqueda" type="hidden" value="p">';
	  	$result = mysqli_query($con ,"SELECT * FROM valeryus19 WHERE status = 'huesped' AND boton = 'C' order by fapellido");
	    @$tot=mysqli_fetch_array(mysqli_query($con ,"select count(boton) as total from valeryus19 WHERE status = 'huesped' AND boton = 'C'"));
	}
	include("DE10000.php");
	while($reg = mysqli_fetch_array($result))
	{
	  	echo "<tr>";
		//echo '<td><div align="center"><input name="bot" type="radio" value="'. $reg["n_reg"].'">&nbsp</div></td>';
		echo "<td> <div align='center'><strong>" . $reg["n_reg"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $reg["fmuncto"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $reg["fnumcto"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $reg["fapellido"] . ' '. $reg["fnombre"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $reg["ftipocto"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center'><strong>$" .  number_format($reg['ftotal'], 2, '.', ',') . "</strong></div></td>";
		echo "<td> <div align='center'><strong>$" .  number_format($reg['ftotal'], 2, '.', ',') . "</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $reg["fnorasvip"] . "&nbsp;</strong></div></td>";
		$fec1=$reg["ffeccam"];
		include('DF20000.php');
		echo "<td> <div align='center'><strong>" . $f_f . "&nbsp</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $reg["fusucamb"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center'><strong>" . $reg["acc_hor"] . "&nbsp;</strong></div></td>";
			    	}
	    echo "<tr><td colspan='2'><div align='center' style=' '><strong>TOTAL DE CAMBIOS :</strong></div></td>
                  <td><div align=\"center\" style=' '><strong>".$tot['total']."</strong></div></td>
	          </tr>";
	mysqli_close($con);
	?>
    </table>
  </form>
</div>
</body>
</html>