

<html>
<head>
<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
</head>
<script language="javascript">

function pon_prefijo(numdoc,salact,codmov) {
	parent.opener.document.form_busqueda.numade.value=numdoc;
	parent.opener.document.form_busqueda.monade.value=salact;
	parent.opener.document.form_busqueda.codmov.value=codmov;
	//parent.opener.document.getElementById("monabo").focus();
	//parent.opener.document.getElementById("monabo").select();
	//parent.opener.document.getElementById("form_busqueda").submit();
	//parent.opener.buscar();
	parent.window.close();


}

function limpiar() {
	parent.opener.document.form_busqueda.codmov.value="";
	parent.opener.document.form_busqueda.numade.value="";
	parent.opener.document.form_busqueda.monade.value="";
	parent.opener.document.form_busqueda.monabo.value="";
	parent.opener.document.form_busqueda.salfac.value="";
	parent.opener.document.form_busqueda.numfac.value="";
	parent.opener.document.form_busqueda.vuelto.value="";
	parent.opener.document.form_busqueda.pagcon.value="";
//	parent.opener.document.getElementById("monabo").focus();
//	parent.opener.document.getElementById("monabo").select();
//	parent.opener.document.getElementById("form_busqueda").submit();
	parent.window.close();

}

</script>
<?php include ("../conexion.php"); 


$cdgcli=$_POST["cdgcli"];

?>
<body>
<?php

	if ($result = $mysqli->query("SELECT * FROM movimientos_caja  WHERE codigo = '$cdgcli' AND salact > 0 AND tipmov = 'REC'  ") ){
   $nrs = $result->num_rows;
   $result->close();
}

?>
<div id="tituloForm2" >
<form id="form1" name="form1">
<?php if ($nrs>0) { ?>
		<table class="fuente8" width="98%" cellspacing=0 cellpadding=3 border=0>
		  <tr class="cabeceraTabla" >
			<td width="20%"><div align="center"><span class="cabeceraTabla"><b>RECIBO</b></span></div></td>
			<td width="20%"><div align="center"><span class="cabeceraTabla"><b>FECHA</b></span></div></td>
			<td width="80%"><div align="center"><span class="cabeceraTabla"><b>DETALLE</b></span></div></td>
			<td width="35%"><div align="center"><span class="cabeceraTabla"><b>TOTAL</b></span></div></td>
			<td width="35%"><div align="center"><span class="cabeceraTabla"><b>SALDO</b></span></div></td>
			<td width="30%"><span class="totalResultado"></span></td>
			
		    <div align="center">
			
		  </tr>
		<?php

				
		$consulta2 = "SELECT * FROM  movimientos_caja  WHERE codigo = '$cdgcli' AND salact >  0 AND tipmov = 'REC' ";

        if ($resultado2 = $mysqli->query($consulta2)) 
        $contador=0;
		
		  while ($fila = $resultado2->fetch_assoc()) {
        $codmov	= $fila["codmov"];
        $fecha  = $fila["fecha"];
        $total = $fila["total"];
        $salact = $fila["salact"];
		$numdoc = $fila["numdoc"];
		$detmov = $fila["detmov"];
		$detmov = substr($detmov, 0, 50); 	
       	$fecha= implode("-", array_reverse(explode("-", $fecha)));	
		
		if ($contador % 2) { $fondolinea="itemParTabla"; } else { $fondolinea="itemImparTabla"; }?>
		
		<tr class="<?php echo $fondolinea?>">
		<td width="10%">  <div align="center"><?php echo $numdoc;?></div></td>
		<td width="10%"> <div align="center"><?php echo $fecha;?></div></td>
		<td  width="10%"> <div align="left"><?php echo $detmov;?></div></td>
		<td  width="40%"><div align="right"><?php echo number_format( $total, 2 );?></div></td>
		<td  width="40%" ><div align="right"><?php echo number_format( $salact, 2 );?></div></td>
					<td align="center"><div align="center"><a href="javascript:pon_prefijo(<?php echo $numdoc?>,'<?php echo $salact?>','<?php echo $codmov?>')"><img src="../img/Redo_32x32-32.png" border="0" title="Seleccionar"></a></div></td>					
				</tr>
                
			<?php }
		?>
  </table>
  
  		<?php } else { ?>
					<table class="fuente8" width="87%" cellspacing=0 cellpadding=3 border=0>
						<tr>
							<td width="100%" class="mensaje"><?php echo "Cliente no posee saldos a FAVOR";?></td>
					    </tr>
					</table>					
					<?php } ?>	
  
  
<iframe id="frame_datos" name="frame_datos" width="0%" height="0" frameborder="0">
	<ilayer width="0" height="0" id="frame_datos" name="frame_datos"></ilayer>
</iframe>
<input type="hidden" id="accion" name="accion">
</form>
</div>
</body>
</html>
