<?php
 
session_start();
$com = "M";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DF80000.php");
include ("varfun.php");
include ("JQUERY.inc");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script language="javascript">
<!--
function Suma(isChecked, myValue)
{
	tot = parseFloat(document.frm1.total.value);
	
	myValue = parseFloat(myValue);
	if (isChecked) document.frm1.total.value = tot + myValue;
	
	else document.frm1.total.value = tot - myValue;
	   
}

function SumAbono(isChecked, myValue)
{
	tot = parseFloat(document.frm1.costo.value);
	
	myValue = parseFloat(myValue);
	if (isChecked) document.frm1.costo.value = tot + myValue;
	
	else document.frm1.costo.value = tot - myValue;
	   
}
-->
</script>
<?php

if (isset($_POST['bot']) && $_POST['bot']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=caj_revision_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
 error_reporting(E_ALL);
ini_set('display_errors', 1);	
    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['n_reg']=$reg['n_reg'];
	$_REQUEST['fnumcto']=$reg['fnumcto'];
	$_REQUEST['ffecllegada']=chfecha($reg['ffecllegada'],'Y-m-d','d/m/Y');
	$_REQUEST['ffecsalida']=chfecha($reg['ffecsalida'],'Y-m-d','d/m/Y');
	$_REQUEST['fnumadu']=$reg['fnumadu'];
	$_REQUEST['fnummenor']=$reg['fnummenor'];
	$_REQUEST['fhorallega']=$reg['fhorallega'];
	$_REQUEST['fnumctos']=$reg['fnumctos'];
	$_REQUEST['ffecalt']=chfecha($reg['ffecalt'],'Y-m-d','d/m/Y');
	$_REQUEST['ftipocto']=$reg['ftipocto'];
	$_REQUEST['select1']=$reg['status'];
	$_REQUEST['fusualta']=$reg['fusualta'];
	
	//forma de pago
	$_REQUEST['fformpago']=$reg['fformpago'];
	$_REQUEST['fnumtar']=$reg['fnumtar'];
	$_REQUEST['suma']=$reg['suma'];
	$_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['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['ftotal']=$reg['ftotal'];
	$_REQUEST['cuarto_seguro']=$reg['cuarto_seguro'];
	$_REQUEST['edades']=$reg['edades'];
	}
?>

<body>

<form  name="frm1" id="frm1" method="post" action="" enctype="multipart/form-data">
<input name="bot" type="hidden" value="<?php
 echo $_POST["bot"]?>">
<table width="754" border="0" align="center">
  <tr><th colspan="10" class=\"titulo\"><div align="center">REVISION DE MOVIMIENTOS </div></th></tr>
  
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>FECHA DE LLEGADA</strong></span></td>
    <td width="209" style="#66CCFF"><label>
	  <input name="ffecllegada" type="text" id="ffecllegada" class="datefrom" size="10" onKeyPress="return validar(event)" value="<?php echo $_REQUEST['ffecllegada'];?>"></label></td>
    <td width="107"  ><span class="Estilo21"><strong>FECHA DE SALIDA</strong></span></td>
    <td colspan="3" style="#66CCFF"><input name="ffecsalida" class="dateto" type="text" id="ffecsalida" size="10" onKeyPress="return validar(event)" value="<?php echo $_REQUEST['ffecsalida'];?>" >        </td>
   <td width="176" 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>      </td>
  </tr>
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>HUESPED</strong></span></td>
    <td style="#66CCFF"><input name="huesped" type="text" id="huesped" value="<?php echo "".$_REQUEST['fapellido']." ".$_REQUEST['fnombre']."";?>" size="30" READONLY></td>
    <td  ><span class="Estilo21"><strong>FOLIO</strong></span></td>
    <td colspan="3" style="#66CCFF"><input name="folio" type="text" id="folio" tabindex="21" size="25" value="<?php echo $_REQUEST['n_reg'];?>"></td>
  </tr>
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>TIPO DE HABITACION</strong></span></td>
    <td style="#66CCFF"><input name="ftipocto" type="text" id="ftipocto" value="<?php echo $_REQUEST['ftipocto'];?>" READONLY></td>
    <td  ><span class="Estilo21"><strong>SEGMENTO</strong></span></td>
    <?php ;?>
    <td colspan="3" style="#66CCFF"><input name="segmento" type="text" id="segmento" tabindex="21" size="25" value="<?php echo (isset($_REQUEST['fcod_seg']))?$_REQUEST['fcod_seg']:"";?>"></td>
  </tr>
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>GRUPO</strong></span></td>
    <td style="#66CCFF"><input name="grupo" type="text" id="grupo" tabindex="21" size="25" value="<?php echo $_REQUEST['fcodgrupo'];?>"></td>
    <td  ><span class="Estilo21"><strong>FORMA DE PAGO </strong></span></td>
    <td colspan="3" style="#66CCFF">
      <input name="pago" type="text" id="pago" tabindex="21" size="25" value="<?php echo $_REQUEST['fformpago'];?>"></td>
    </tr>
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>MERCADO</strong></span></td>
    <td style="#66CCFF"><input name="mercado" type="text" id="mercado" tabindex="21" size="25" value="<?php echo $_REQUEST['fcodmeca'];?>"></td>
    <td  ><span class="Estilo21"><strong>EMPRESA</strong></span></td>
    <td colspan="3" style="#66CCFF">
      <input name="empresa" type="text" id="empresa" tabindex="21" size="25" value="<?php echo $_REQUEST['fempresa'];?>"></td>
    </tr>
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>HABITACION</strong></span></td>
    <td style="#66CCFF"><input name="habitacion" type="text" id="habitacion" tabindex="21" size="25" value="<?php echo $_REQUEST['fnumcto'];?>"></td>
    <th colspan="4"><div align="center" class="Estilo18">NOTAS:</div></th>
    </tr>
  <tr>
    <td colspan="2"  ><span class="Estilo21"><strong>TARIFA</strong></span></td>
    <td style="#66CCFF"><input name="tex" type="text" id="text" size="25" value="<?php echo "".$_REQUEST['tex']."--".$_REQUEST['tex4']."";?>" READONLY></td>
    <td colspan="5" style="#66CCFF"><div align="center">
      <textarea name="fnorasvip" cols="50" rows="3" id="fnorasvip" onBlur="may(this)" tabindex="4"><?php echo $_REQUEST['fnorasvip'];?></textarea>
    </div></td>
    </tr>
	    <td colspan="2"  ><span class="Estilo21"><strong>SALDO	</strong></span></td>
    <td style="#66CCFF"><input name="saldo" type="text" id="saldo" tabindex="21" size="25" value="<?php echo "".$_REQUEST['suma']."";?>"></td>
  <tr><th colspan="10" class="titulo"><div align="center" class="Estilo18">
    <input name="Submit2" type="submit" class="original" tabindex="29" value="Clear"/>
    &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('caj_revision_PR.php','_self')" value="Regresar"/>
  </div></th></tr>
</table>
<?php
include("DMMYSQLG.php");
//$sql = mysqli_query($con ,"SELECT * FROM valeryus030 where nparte1='".$_POST['bot']."' and total='0' order by id_invend");
$var5=(isset($_POST['bot']))?$_POST['bot']:"";
$sql = mysqli_query($con ,"SELECT * FROM valeryus030 where nparte1='".$var5."' order by id_invend");
	include("DE10000.php");
	?>
	<?php
  
	$lm=0;
	$sc=0;
	$ch=0;
	$fr=0;
	$bq=0;
	$as=0;
echo "<table align=center border=1 cellpadding='0' cellspacing='0' bordercolor=' ' bordercolordark=' '>";  

$columnes = 1; # Número de columnas (variable)  

//if (($rows=mysqli_num_rows($sql))==0) {  
//  echo "<tr><th colspan=$columnes style=\"color=#FFFFFF;font-size:12px;\">No hay resultados en la BD.</th></tr> ";  
//} else {  
//  echo "<tr><th colspan=$columnes  style=\"color=#FFFFFF;font-size:12px;\" align='right'> TOTAL: <input type='text' name='total' value='0'></th></tr>";  
//}
 //if (($rows=mysqli_num_rows($sql))==0) {  
//  echo "<tr><th colspan=$columnes style=\"color=#FFFFFF;font-size:12px;\">No hay resultados en la BD.</th></tr> ";  
//} else {  
  echo "<tr><th colspan=$columnes  style=\"color=#FFFFFF;font-size:12px;\" align='left'> TOTAL CARGOS: <input type='text' name='total' value='0'></th></tr>"; 
  echo "<tr><th colspan=$columnes  style=\"color=#FFFFFF;font-size:12px;\" align='right'> TOTAL ABONOS: <input type='text' name='costo' value='0'></th></tr>"; 
//} 
for ($i=1; $row = mysqli_fetch_row ($sql); $i++) 
{  
$resto = ($i % $columnes); # Número de celda del <tr> en que nos encontramos  
if ($resto == 1) {echo "<tr>";} # Si es la primera celda, abrimos <tr>  
    $desCar=mysqli_fetch_array(mysqli_query($con ,"select * from valeryus09 where n_reg='$row[2]'"));
	echo "<td valign='top'>"; 
    echo "<table width='180' border='1' cellpadding='0' cellspacing='0' bordercolor=' ' bordercolordark=' ' style=\"font-size:22px; font:Arial, Helvetica, sans-serif; \">
  
  <tr> 
    <th style=\"color=#FFFFFF; font-size:12px;\">&nbsp;SEL&nbsp;</th>
	<th style=\"color=#FFFFFF; font-size:12px;\">&nbsp;FECHA&nbsp;</th>
	<th style=\"color=#FFFFFF; font-size:12px;\">&nbsp;HORA&nbsp;</th>
	<th style=\"color=#FFFFFF; font-size:12px;\">&nbsp;RECIBO&nbsp;</th>
	<th style=\"color=#FFFFFF; font-size:12px;\">&nbsp;DESCRIPCION&nbsp;</th>
	<th style=\"color=#FFFFFF; font-size:12px;\">&nbsp;CARGOS&nbsp;</th>
	<th style=\"color=#FFFFFF; font-size:12px;\">&nbsp;ABONOS&nbsp;</th>
	<th style=\"color=#FFFFFF; font-size:12px;\">&nbsp;NOTAS&nbsp;</th>
	</tr>";
    if ($row[15]=='1'){
	echo"<td style=\"color=#000000; font-size:12px;\" style='#FF0000'></td> 
	     <td style=\"color=#000000; font-size:12px;\" style='#FF0000'>".$row[11]."</td>
		 <td style=\"color=#000000; font-size:12px;\" style='#FF0000'>".$row[12]."</td>
		 <td style=\"color=#000000; font-size:12px;\" style='#FF0000'>".$row[3]."</td>
		 <td style=\"color=#000000; font-size:10px;\" style='#FF0000'>".$desCar['descripcion']."</td>
		 <td style=\"color=#000000; font-size:12px;\" style='#FF0000'>".number_format($row[5],2,'.',',')."</td>
		 <td style=\"color=#000000; font-size:12px;\" style='#FF0000'>".number_format($row[6],2,'.',',')."</td>
		 <td style=\"color=#000000; font-size:12px;\" style='#FF0000'>".$row[9]."</td> 
  </tr> ";
     }else{
     if($row[5]=='0'){
	 echo"<td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'><input name='checkbox' type='checkbox' onClick='SumAbono(this.checked,this.value)' value='".$row[6]."' /></td>";
	 }else{
//     echo"<td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'><input name='checkbox' type='checkbox' onClick='Suma(this.checked,this.value)' value='".number_format($row[5],2,'.',',')."' /></td>"; }
	 echo"<td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'><input name='checkbox' type='checkbox' onClick='Suma(this.checked,this.value)' value=".$row[5]."'/></td>"; }
	 echo " 
	     <td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'>".$row[11]."</td>
		 <td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'>".$row[12]."</td>
		 <td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'>".$row[3]."</td>
		 <td style=\"color=#FFFFFF; font-size:10px;\" style='#82A2AF'>".$desCar['descripcion']."</td>
		 <td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'>".number_format($row[5],2,'.',',')."</td>
		 <td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'>".number_format($row[6],2,'.',',')."</td>
		 <td style=\"color=#FFFFFF; font-size:12px;\" style='#82A2AF'>".$row[9]."</td> 
  </tr> "; 	
		}
echo "</table>"; 
     
    echo "</td>"; 
if (isset($resto) &&$resto == 0) {echo "</tr>";} # Si es la última celda, cerramos </tr>  
}  
if (isset($resto) &&$resto <> 0) { # Si el resultado no es múltiple de $columnes acabamos de rellenar los huecos  
$ajust = $columnes - $resto; # Número de huecos necesarios  
for ($j = 0; $j < $ajust; $j++) {echo "<td>&nbsp;</td>";}  
echo "</tr>"; # Cerramos la última línea </tr>  
}  
//mysqli_close($connexion);  
?>
 
</table>  
</form>
 
</body>
<?php
 
mysqli_close($con);
}
?>
</html>
<?php

//980-->500
?>