<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
include ("varfun.php");
include("DFJQUERY.inc");
include("JQUERY.inc");
$f_m=""

?>
<html>
<HEAD> 
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8">

</HEAD>
<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">CAMBIOS EN EL SISTEMA </th>
	  </tr>
          <?php
          $fec=(isset($_POST['fec']))?$_POST['fec']:date('d/m/Y');
          ?>
	<tr>
	  <td><div align="right"><span class="Estilo27"><span class="Estilo25"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" /> PERIODO</span></span></div></td>
	  <td>
	    <strong>De:</strong>
        <input name="fec" type="text" class="emplea date" 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" height="25">	  </td>
	  </tr>
      <tr>
        <td colspan="2">
            <div align="center">
              <a style="text-decoration:underline;cursor:pointer;" href="menu_PR.php"/></a>
              <input name="Submit" type="button" class="original" onClick="openpage('valeryus82500_PR.php','_self')" value="Buscar"/>
			  <input name="bot4" type="button" class="bot_WsW" onClick="openpage('valeryus82500_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 fcam_sys");
	?>
    <div style="height:450px; overflow:scroll; width:1050;">
	<table>
	<tr><th colspan="15">&nbsp;</th>
	</tr>
      <tr>
        <th width="7%"><div align="center">CARGO</div></th>
		
		<th width="26%"><div align="center">NOTAS</div></th>
		<th width="9%"><div align="center">FOLIO</div></th>
		<th width="7%"><div align="center"> # HAB.</div></th>
		<th width="10%"><div align="center">CARGOS</div></th>
		<th width="10%"><div align="center">ABONOS</div></th>
		<th width="7%"><div align="center">CAJERO</div></th>
		<th width="24%"><div align="center">HUESPED</div></th>
	  </tr>
	<?php

	 // --->
	// if(!isset($_POST['fec']))$_POST['fec']="";
	  	$fec =(isset($_POST['fec']))? $_POST['fec']:"";
		include('DF20000.php');
		$fecha_inicial = $f_m;
		//if(!isset($_POST['fec2']))$_POST['fec2']="";
		$fec = (isset($_POST['fec2']))? $_POST['fec2']:"";
		include('DF20000.php');
		$fecha_final = $f_m;
	  // -->
     
	    //  if ($_POST['r1']==''){
	  	 /* $carDet=mysqli_query($con ,"SELECT 
		DISTINCT(ftarifad.nparte1_det) AS detalle 
		FROM 
		valeryus19 
		LEFT JOIN valeryus030 ON valeryus19.n_reg=valeryus030.nparte1
		LEFT JOIN ftarifas ON valeryus19.tex=ftarifas.gclave 
		LEFT JOIN ftarifad ON ftarifas.n_reg=ftarifad.nparte1
		WHERE 
		valeryus030.acc_fec BETWEEN '$fecha_inicial' AND '$fecha_final'
		AND valeryus19.cancelado='0'
		AND (valeryus030.cancelado='0' or valeryus030.cancelado='2')");
	     
	while($det=mysqli_fetch_array($carDet)){
	//echo "".$det['detalle']."--";*/
	
	
	$result = mysqli_query($con ,"select * from fcam_sys WHERE acc_fec between '".$fecha_inicial."' and '".$fecha_final."'");
	$c=0;
	$costo=0; 
	while($reg = mysqli_fetch_array($result))
	{
	  	
		echo "<tr>";
		$varnd=(isset($reg['nparte1_det']))?$reg['nparte1_det']:"";
		$cargo=mysqli_fetch_array(mysqli_query($con ,"select * from valeryus09 where n_reg='".$varnd."'"));
		
		if(isset($reg["fnumcto"]) && $reg["fnumcto"]==''){
		if(!isset($reg['fmuncto']))$reg['fmuncto']="";
		$reg["fnumcto"]=$reg["fmuncto"];
		}
		if(!isset($col))$col="";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["no_reg"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["description"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["acc_fec"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["acc_hor"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>$ " . $reg["usuario"] . "&nbsp;</strong></div></td>";
	$var1=(isset($reg["total"]))?$reg["total"]:0;
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $var1 . "&nbsp;</strong></div></td>";
	$var2=(isset($reg["usuArIo"]))?$reg["usuArIo"]:"";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $var2 . "&nbsp;</strong></div></td>";
	//echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["fcodmeca"] . "&nbsp;</strong></div></td>";
	$var3=(isset($reg["fapellido"]))?$reg["fapellido"]:"";
	$var4=(isset($reg["fnombre"]))?$reg["fnombre"]:"";
	echo "<td style='".$col."'> <div align='left' style=' '><strong>". $var3 . ' '. $var4 . "</strong></div></td></tr>";
	//if(!isset($reg["costo"]))$reg["costo"]="";	
	$varn=(isset($reg["costo"]))?$reg["costo"]:"";  
        $costo+=$varn;	
		$c++;
			}
			echo "<tr>";
		$cargo=mysqli_fetch_array(mysqli_query($con ,"select * from valeryus09 where n_reg='".$reg['nparte1_det']."'"));
		echo "<td colspan='2' style=' '> <div align='center'><strong>Totales</strong></div></td>";
		echo "<td colspan='2' style=' '> <div align='center'><strong>".$c."</strong></div></td>";
		echo "<td style=' '> <div align='center'><strong>$ " . number_format($costo,2,'.',',') . "&nbsp;</strong></div></td>";
		echo "<td style=' '> <div align='center'><strong>$ " .  number_format(floatval($reg['ftotal']), 2, '.', ',') . "</strong></div></td></tr>";
		//echo "<tr><td  colspan='13'  height='5' style='background:#000099'></td></tr>";
	    //}
	mysqli_close($con);
	?>
    </table> </div></form>  </div>  </body>  </html>