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

function pon_prefijo(dsccli,cedcli,cliexe,cdgcli,limcre,salact) {
	parent.document.formulario.clanumref.value     ="";
	parent.document.formulario.feccomref.value    ="";
	parent.document.formulario.tipdocref.value    ="";
	parent.document.formulario.cdgtipexo.value    ="";
	parent.document.formulario.numdocexo.value    ="";
	parent.document.formulario.nominstexo.value   ="";
	parent.document.formulario.cliexento.value    =1 ;
	parent.document.formulario.razref.value       ="";
	parent.document.formulario.cdgclifac.value=cdgcli;
	parent.document.formulario_lineas.cdgclifac2.value=cdgcli;
	parent.document.formulario.dsccli.value=dsccli;
	parent.document.formulario.salact.value=salact;
	parent.document.formulario.numfacafe.value="";
	parent.document.formulario_lineas.numfacafe2.value="";
	parent.document.formulario_lineas.cliexe2.value=cliexe;
	parent.document.formulario_lineas.cdgbar.value="";
	parent.document.formulario_lineas.dscart.value="";
	parent.document.formulario_lineas.preivi.value="";
	parent.document.formulario_lineas.cantidad.value="";
	parent.document.formulario_lineas.importe.value="";
	parent.document.formulario_lineas.descuento.value="";


}

function limpiar() {
	parent.document.formulario.clanumref.value     ="";
	parent.document.formulario.feccomref.value    ="";
	parent.document.formulario.tipdocref.value    ="";
	parent.document.formulario.cdgtipexo.value    ="";
	parent.document.formulario.numdocexo.value    ="";
	parent.document.formulario.nominstexo.value   ="";
	parent.document.formulario.cliexento.value    =1 ;
	parent.document.formulario.razref.value       ="";
	parent.document.formulario.cdgclifac.value="";
	parent.document.formulario.dsccli.value="";
	parent.document.formulario.cdgcli.value="";
	parent.document.formulario.cdgcli.focus();
	parent.document.formulario.limcre.value="";
	parent.document.formulario.salact.value="";
	parent.document.formulario.numfacafe.value="";
	parent.document.formulario_lineas.cdgclifac2.value="";
	parent.document.formulario_lineas.numfacafe2.value="";
	parent.document.formulario_lineas.cdgbar.value="";
	parent.document.formulario_lineas.dscart.value="";
	parent.document.formulario_lineas.preivi.value="";
	parent.document.formulario_lineas.cantidad.value="";
	parent.document.formulario_lineas.importe.value="";
	parent.document.formulario_lineas.descuento.value="";
	parent.document.formulario_lineas.cliexe.value="";

}


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

	$cdgcli=$_GET["cdgcli"];

	$consulta ="SELECT * FROM web_0301 WHERE cdgcli=$cdgcli ";
	$resultado = $mysqli->query($consulta);
	$fila = $resultado->fetch_array();
		$estcli = $fila["ESTCLI"];
		$cdgcli = $fila["CDGCLI"];
        $dsccli = $fila["DSCCLI"];
        $cedcli = $fila["CEDCLI"];
		$cliexe = $fila["CLIEXE"];
		$limcre = $fila["LIMCRE"];
		$salact = $fila["SALACT"];
	


	if ($result = $mysqli->query("SELECT * FROM web_0301 WHERE cdgcli=$cdgcli  " )) {
    $filas = $result->num_rows;
    $result->close();
    }

		
	if ($filas>0) {
	
		if ($estcli=="ACTIVO") {
	
		?>
		<script languaje="javascript">
		pon_prefijo("<?php echo $dsccli ?>","<?php echo $cedcli ?>","<?php echo $cliexe ?>","<?php echo $cdgcli ?>" ,"<?php echo $limcre ?>","<?php echo $salact ?>");
		</script>
		<?php 
	}
		if ($estcli=="INACTIVO") {
	 ?>


	<script>
	alert ("Cliente Inactivo favor consulte con el Administrador");
	limpiar();
	</script>
	<?php }
	
	} else {
	?>
		<script>
			alert ("No existe ningun cliente con ese codigo");
	        limpiar();
	</script>
	<?php
	}
	
	
?>
</div>
</body>
</html>
