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

function pon_prefijo(cdglin) {

	parent.document.form_lineas.dsclin.focus();
	parent.document.form_lineas.cdglin.value=cdglin;


}



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

	
	$cdgfam=$_GET["cdgfam"];
	


	$consulta = "SELECT MAX(cdglin) AS cdglin FROM lineas WHERE  cdgfam = $cdgfam";
	$resultado = $mysqli->query($consulta);
	$fila = $resultado->fetch_array();
						$cdglin =  $fila["cdglin"];
						$cdglin = $cdglin + 1 ;
						$cdglin = sprintf("%03d",$cdglin);
						

				?>
				<script>
				pon_prefijo("<?php echo $cdglin ?>");	
				</script>
       			<?php 

?>
</div>
</body>
</html>
