<%@ 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 shopKeepers = ( ListView )request.getAttribute( "shopKeepers" );
    ListView view = ( ListView )request.getAttribute( "view" );
    
    String firstRow = ( String )request.getAttribute( "firstRow" );
    String lastRow = ( String )request.getAttribute( "lastRow" );
    String total = ( String )request.getAttribute( "total" );
    String page1 = ( String )request.getAttribute( "page" );
    String pages = ( String )request.getAttribute( "pages" );
    int pageResults = Integer.valueOf(request.getAttribute( "pageResults" ).toString()).intValue();
    
    //String companyType = ( String )request.getAttribute( "companyType" );
    //int supplier = ( ( Integer )request.getAttribute( "supplier" ) ).intValue();
    //int shopKeeper = ( ( Integer )request.getAttribute( "shopKeeper" ) ).intValue();
    int order = ( ( Integer )request.getAttribute( "order" ) ).intValue();
    
    String date = ( String )request.getAttribute( "date" );
    String startDate = ( String )request.getAttribute( "startDate" );
    String endDate = ( String )request.getAttribute( "endDate" );
    
%>
<!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>Listado de Pedidos</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 = "61";
%>
<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 = "&Oacute;rdenes de Compra";
            %>
            <%@ include file="/titulo.jsp" %>

<p align="center">
    Resultados <%=firstRow%> - <%=lastRow%> de <%=total%>
</p>
<table border="0" align="center" width='90%' >
  <tr class='tableheader'>
    <td width='25%'><strong>Minorista</strong></td>
    <td width='25%'><strong>Establecimiento</strong></td>
    <td><strong>Fecha</strong></td>
    <td><strong>Valor</strong></td>
    <td align='center'><strong>Estado</strong></td>
    <td align='center'><strong>Ver</strong></td>
  </tr>
    <%
        int cont = 0;
        while( view.move() ){
            cont++;
            int id = Integer.parseInt( ( String )view.nextElement() );
            String data="";
            view.nextElement();
    %>
            <tr>
         <%
            while((data=(String)view.nextElement())!=null){
         %>
                <td><%=data%></td>
         <% }
         %>
                <td align="center"><a href="/proveedor/verordencompra?key=<%= id %>"><img  name="view" src='/images/buttons/supplier/detalle.gif'  border='0'></a></td>
            </tr>
    <%
        }
    if(cont == 0){%>
       <tr>
            <td colspan='6'>
                <b >NINGUNA ORDEN DE COMPRA HA SIDO GENERADA POR SUS CLIENTES</b>
            </td>
       </tr>
    <%}%>
</table>
<!-- -->
<form action="/proveedor/ordenesdecompra" method="post" name="buscador" id="buscador">
    <p align="center">
        P&aacute;gina <input type="text" name='page' value='<%=page1%>' size='2'> de <%=pages%><br>
        <input type="text" name='pageResults' value='<%=pageResults%>' size='2'> Resultados por p&aacute;gina<br>
        <input type="submit" name='ir' value='ir' id='ir'>
    </p>
    <hr width='70%'>
  <table width="50%" border="0" align="left">
    <tr>
        <td colspan='6'>
        <%
            tittle = "Buscador";
        %>
        <%@ include file="/titulo.jsp" %>

        </td>
    </tr>
    <tr align='right'>
        <td align="center"><input name="date" type="radio" value="1" <%if( date.equals("1") ){%>checked<%}%>></td>
        <td align='left'>Hoy</td>
        <td align="center"><input name="date" type="radio" value="2" <%if( date.equals("2") ){%>checked<%}%>></td>
        <td align='left'>&Uacute;ltimos ocho d&iacute;as</td>
        
    </tr>
    <tr align='right'>
        <td align="center"><input name="date" type="radio" value="3" <%if( date.equals("3") ){%>checked<%}%>></td>
        <td align='left'>Este Mes</td>
        <td align="center"><input name="date" type="radio" value="4" <%if( date.equals("4") ){%>checked<%}%>></td>
        <td align='left'>Este Aņo</td>
        
    </tr>    
    <tr><td colspan='4'>&nbsp;</td></tr>
    <tr>
        <td>Fecha inicial</td>
        <td><input type="text" name='startDate' value='<%=startDate%>' size='10' ></td><td><a href="javascript:cal_startDate.popup()"><img src="../images/pages/cal.gif" width='20' height='20'></a></td>
            <script type='text/javascript' language='javascript' src='../js/calendar1.js'></script>
            <script>
                var cal_startDate = new calendar1(document.buscador.startDate);
            </script>
        <td>Fecha final</td>
        <td><input type="text" name='endDate' value='<%=endDate%>' size='10' ></td><td><a href="javascript:cal_endDate.popup()"><img src="../images/pages/cal.gif" width='20' height='20'></a></td>
            <script>
                var cal_endDate = new calendar1(document.buscador.endDate);
            </script>
    </tr>
    <tr><td colspan='4'>&nbsp;</td></tr>
    <tr>
      <td><div align="right">Ordenar por: </div></td>
      <td><select name="order">
        <option value="1" <%if( order == 1 ){%>selected<%}%>>Empresa</option>
        <option value="2" <%if( order == 2 ){%>selected<%}%>>Fecha</option>
        <!--<option value="3" <%if( order == 3 ){%>selected<%}%>>Valor</option>-->
        <option value="4" <%if( order == 4 ){%>selected<%}%>>Estado</option>
      </select></td> 
      <td colspan='2' align="center">
          <input type="submit" value=' Buscar -->' name='Buscar' id='Buscar'>
      </td>
    </tr>
  </table>
</form>

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