<?php
include('../conexion.php'); 
include ("../funciones/fechas.php");




		 
	if ($result = $mysqli->query("SELECT count(*) as filas FROM lineas")) {
   $filas = $result->num_rows;
   $result->close();
}		 
		 


?>
<html>
	<head>
		<title>Familias</title>
		<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
		<script language="javascript">
	
		
		function modificar_linea(cdglin,dscli,cdgfam) {
			
					parent.document.forms.formulario_lineas.cdglin.value=cdglin;
					parent.document.forms.formulario_lineas.cdgfam.value=cdgfam;
					parent.document.forms.formulario_lineas.target="frame_articulos";
					parent.document.forms.formulario_lineas.action="rejilla_articulos.php";
					parent.document.getElementById("formulario_lineas").submit();

		}
		
	//////////////////////////////////////  funcion anular familia //////////////////////////////////////////////////////

		
		function CambiaColor(esto,fondo,texto)
		{
			colorfondo=esto.style.background;
			esto.style.background=fondo;
			esto.style.color=texto;
			return colorfondo;
		}
		
		function CambiaColor2(esto,texto)
		{
			esto.style.background=colorfondo;
			esto.style.color=texto;
		}
		
				function nobackbutton(){	
   window.location.hash="no-back-button";	
   window.location.hash="Again-No-back-button" //chrome	
   window.onhashchange=function(){window.location.hash="no-back-button";}	
}

		
		</script>
	</head>

	<body onload= nobackbutton(); >	
		<div id="">
			<div id="zonaContenidoPedido">
			<div align="center">
			<table class="fuente13" width="100%" cellspacing=0 cellpadding=0 border=0 ID="Table1">
            	<form id="formulario" name="formulario" method="post" action="">
			<input type="hidden" name="numfilas" id="numfilas" value="<?php echo $filas?>">

				<?php
				
					
                    
                   if ($filas>0){

						  
						   
						   ///////////
						   $consulta = "SELECT cdgfam,cdglin, dsclin FROM lineas  ORDER BY  dsclin DESC";
								if ($resultado = $mysqli->query($consulta)) 
								 $contador=0;	
						
								
								 while ($fila = $resultado->fetch_assoc()) {

												$cdgfam = $fila["cdgfam"];
												$cdglin = $fila["cdglin"];
												$dsclin = $fila["dsclin"];
						   
							

								if ($contador % 2) { $fondolinea="itemParTabla"; } else { $fondolinea="itemImparTabla"; }?>
								
								<tr class="<?php echo $fondolinea ?>" onMouseOver="CambiaColor(this,'#000000','#ffffff')" onMouseOut="CambiaColor2(this,'#000000')" >
                   
		
								<td width="81%"><div align="left"><?php echo substr($dsclin." ", 0, 25);?></div></td>	

								<td width="0%">&nbsp;</td>
								<td width="19%"><div align="center"><a href="#"><img src="../img/Arrow-Left_48x48-32.png" width="48" height="48" border="0" onClick="modificar_linea('<?php echo $cdglin ?>', '<?php echo $dsclin ?>', '<?php echo $cdgfam ?>' )" title="Modificar"></a></div></td>
						</tr>
						</tr>	
						<?php $contador++;
							}
						?>			
					</table>
					<?php } else { ?>
					<table class="fuente8" width="87%" cellspacing=0 cellpadding=3 border=0>
						<tr>
							<td width="100%" class="mensaje"><?php echo $fechainicio; echo $fechafin; echo "No hay ninguna Linea registrada";?></td>
					    </tr>
					</table>		
                    	</form>			
					<?php } ?>					
			  </div>
			</div>
		  </div>			
		</div>
	</body>
</html>
