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

function pon_prefijo(cdgbar,dscart,cosart,utiart1,utiart2, PRE001, PRE002, cob_iv, desart,cdgfam,cdglin) {
	parent.document.formulario_lineas.cdgbar.value=cdgbar;
	parent.document.formulario_lineas.dscart.value=dscart;
	parent.document.formulario_lineas.cosart.value=cosart;
	


    
}


function limpiar() {

	parent.document.formulario_lineas.dscart.value="ARTICULO NUEVO";
	parent.document.formulario_lineas.cosart.value=0.00;
}

</script>
<?php include ("../conexion.php"); ?>
<body>
<?php
	$cantidad = "";
	$cdgbar=strtoupper($_GET["cdgbar"]);
	
	
	$consulta2 ="SELECT * FROM web_1001 WHERE cdgbar='$cdgbar'  and estart = 1 ";
    $resultado2 = $mysqli->query($consulta2);
    $fila = $resultado2->fetch_array();
    $nrs = $resultado2->num_rows;
	
	
	    $cdgbar  = $fila["CDGBAR"];
        $dscart  = $fila["DSCART"];
        $PRE002  = $fila["PRE002"];
		$PRE001  = $fila["PRE001"];
		$cosart  = $fila["cosart"];
		$exiact  = $fila["EXIACT"];
		$cob_iv  = $fila["COB_IV"];
		$utiart1 = $fila["utiart1"];
		$utiart2 = $fila["utiart2"];
     	$desart  = $fila["DESART"];
		$desfac  = $fila["DESFAC"];
		$fleart  = $fila["fleart"];
		$cdglin  = $fila["CDGLIN"];
		$cdgfam  = $fila["CDGFAM"];
		$ivporc  = $fila["ivporc"];	
	
	
	
	if ($nrs > 0) {
		?>
		<script languaje="javascript">
		
	
		
		pon_prefijo('<?php echo $cdgbar  ?>','<?php echo htmlspecialchars($dscart) ?>','<?php echo $cosart?>' , '<?php  echo $utiart1 ?>' , '<?php echo  $utiart2 ?>' ,'<?php echo $PRE001 ?>', '<?php echo $PRE002  ?>' , '<?php echo $cob_iv   ?>' , '<?php echo $desart  ?>', '<?php echo $cdgfam  ?>' , '<?php echo $cdglin   ?>'); 
		
					parent.document.getElementById("canart").focus();
					parent.document.getElementById("canart").select();
		</script>
		<?php 
	} else { ?>
	<script>
		if (confirm(" Articulo nuevo desea agregarlo ? "))
	limpiar();
		parent.document.getElementById("canart").focus();
		parent.document.getElementById("canart").select();
	</script>
	<?php }
?>
</div>
</body>
</html>
