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

function pon_prefijo(dsccli,salact) {
	parent.document.form_busqueda.dsccli.value=dsccli;
	
	parent.document.getElementById("monabo").focus();
	parent.document.getElementById("monabo").select();
	parent.opener.document.getElementById("form_busqueda").submit();

}

function limpiar() {
	parent.document.form_busqueda.cdgcli.value="";
	parent.document.form_busqueda.dsccli.value="";

	parent.opener.document.getElementById("form_busqueda").submit();
	parent.document.getElementById("cdgcli").focus();
	parent.document.getElementById("cdgcli").select();
		
}

</script>
<?php include('../conexion.php'); ?>
<body>
<?php
	$cdgcli=$_GET['cdgcli'];
	
	     $query_saldo = "SELECT SUM(salact) AS saldo FROM web_2101 WHERE cdgcli='$cdgcli'"; 
		 $rs_busqueda = $mysqli->query($query_saldo);
			$fila = $rs_busqueda->fetch_array();
			$salact = $fila["saldo"];
		
		if ($salact > 0)  {
		$salact = $fila['saldo'];
		}else  {
		$salact = "0.00";
		}
		
	$consulta="SELECT * FROM web_0301 WHERE cdgcli=$cdgcli ";
	$rs_busqueda = $mysqli->query($consulta);
	$fila2 = $rs_busqueda->fetch_array();	
    $nrs = $rs_busqueda->num_rows;

	
	
	
	
	if ($nrs>0) {
		?>	
		<script languaje="javascript">
				
		pon_prefijo("<?php echo $fila2['DSCCLI']?>","<?php echo $salact ?>");
		
		</script>
		<?php 
	} else { ?>
	<script>
	alert ("No existe ningun cliente con ese codigo");
	limpiar();

	
	</script>
	<?php }
?>
</div>
</body>
</html>
