<%@ page contentType="text/html; charset=iso-8859-1" language="java" errorPage="" %>
<%@ page import="com.fenalco.utilities.lists.ListView"%>
<%@ page import="com.fenalco.entities.User"%>
<%@ page import="com.fenalco.entities.DataAccess"%>
<%
    ListView productos = ( ListView )request.getAttribute( "productos" );
    
    String inicio = ( String )request.getAttribute( "inicio" );
    String fin = ( String )request.getAttribute( "fin" );
    String total = ( String )request.getAttribute( "total" );
    String pagina = ( String )request.getAttribute( "pagina" );
    String paginas = ( String )request.getAttribute( "paginas" );
    String cantidad = ( String )request.getAttribute( "cantidad" );
    
    boolean esNombre = ( ( Boolean )request.getAttribute( "esNombre" ) ).booleanValue();
    String nombre = ( String )request.getAttribute( "nombre" );
    String categoria = ( String )request.getAttribute( "categoria" );
    int ordenamiento = ( ( Integer )request.getAttribute( "ordenamiento" ) ).intValue();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel='stylesheet' style='text/css' href='../css/tablas.css'>
<title>Cat&aacute;logo de Productos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" background="../images/supplier/general/fondo.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%
	String helpId = "58";
%>
<table border="0" cellpadding="0" cellspacing="0" width="760">
    <%@ include file="encabezado.jsp" %>
</table>
<table width="760" border='0' align='left'>
    
    <tr>
        <td width="152" valign='top'>
			<%@ include file="menuproveedor.jsp" %>
	</td>
	<td valign='top'>
            <%
                String tittle = "Buscador";
            %>
            <%@ include file="/titulo.jsp" %>
            <form action="" method="post" name="buscador" id="buscador">
              <table width="410" border="0" align="center">
                <tr>
                  <td width="200"><div align="right">
                    <select name="esnombre">
                      <option value='1' <%if( esNombre ){%>selected<%}%>>NOMBRE</option>
                      <option value='2' <%if( !esNombre ){%>selected<%}%>>CODIGO</option>
                    </select>
                  </div></td>
                  <td width="200"><input type="text" name="nombre" value='<%=nombre%>'></td>
                  <td><div align="right"><b>Ordenar por:</b> </div></td>
                  <td><select name="ordenamiento">
                    <option value="1" <%if( ordenamiento == 1 ){%>selected<%}%>>CODIGO BARRAS</option>
                    <option value="2" <%if( ordenamiento == 2 ){%>selected<%}%>>NOMBRE</option>
                    <option value="3" <%if( ordenamiento == 3 ){%>selected<%}%>>CATEGORIA</option>
                  </select></td>
                </tr>
                <tr>
                  <td><div align="right"><b>Categor&iacute;a:</b></div></td>
                  <td><input type="text" name="categoria" value="<%=categoria%>"></td>
                  <td colspan='2' align="center">
                        <input type="submit" value='Buscar' name='Buscar' id='Buscar'>
                  </td>
                </tr>
              </table>
              <input type='hidden' name='communityId' value='<%=((Integer)request.getAttribute("communityId")).intValue()%>'>
                <p align="center">
                    P&aacute;gina <input type="text" name='pagina' value='<%=pagina%>' size='2'> de <%=paginas%><br>
                    <input type="text" name='cantidad' value='<%=cantidad%>' size='2'> Resultados por p&aacute;gina  <input type="submit" name='ir' value='Ver' id='ir'>
                </p>
           </form>
            <%
                tittle = "Productos";
            %>
            <%@ include file="/titulo.jsp" %>


<p align="center">
    Resultados <%=inicio%> - <%=fin%> de <%=total%>
</p>
<table align="center" >
  <tr class='tableheader'>
    <td><div align="center"><strong>C&oacute;digo Barras </strong></div></td>
    <td><div align="center"><strong>Nombre</strong></div></td>
    <td><div align="center"><strong>Categor&iacute;a</strong></div></td>
    <td><div align="center"><strong>Marca</strong></div></td>
    <td><div align="center"><strong>Proveedor</strong></div></td>
    <td><div align="center"><strong>Asignar Escalas</strong></div></td>
    
    
  </tr>
    <form name="products" method="post" action='/proveedor/escala'>
    <%
        int cont = 0;
        String color = "";
        while( productos.move() )
        {
            int id = Integer.parseInt( ( String )productos.nextElement() );
            if(cont % 2 ==  0){
                color="#FFFFFF";

            }
            else{
             color = "#efefef";
            }
            %>
                <tr bgcolor='<%=color%>'>
                    <td><%=productos.nextElement()%></td>
                    <td><%=productos.nextElement()%></td>
                    <td><%=productos.nextElement()%></td>
                    <td><%=productos.nextElement()%></td>
                    <td><%=productos.nextElement()%></td>
                    
                    <!--<td align='center'><a href='#'><img name='stores' src='' height='20' width='20' onClick="window.open('/proveedor/verproducto?key=<%=id%>','','HEIGHT=600,WIDTH=715')"></a></td>-->
                    <td align='center'><input type='image'  onClick="document.products.key.value=<%=id%>" src='/images/buttons/supplier/escalas.gif'></td>
                </tr>
            <%
             cont++;
        }
    %>
    <input type='hidden' name='communityId' value='<%=((Integer)request.getAttribute("communityId")).intValue()%>'>
    <input type='hidden' name='key'>
    <tr><td>&nbsp;</td></tr>
    <tr>
        <td colspan='6' align='left'><input type='submit' name='back' value='<< Regresar a la Comunidad' onClick="document.products.action='/proveedor/comunidad?key=<%=request.getParameter("communityId")%>'"></td>
    </tr>
</table>
   
    </form>


  </td>
</td>
</table>
</body>
</html>
