<%@ page import="com.fenalco.utilities.lists.ListView"%>
<%@ page import="com.fenalco.entities.User"%>
<%@ page import="com.fenalco.entities.DataAccess"%>

<!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'>
<link rel='stylesheet' style='text/css' href='../css/fuentes.css'>
<title>Reportes Proveedor</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" cellpadding="0" cellspacing="0" width="780">
        <%
            String helpId = "10";
            int numRows = Integer.valueOf(request.getAttribute( "numRows" ).toString()).intValue();
        %>
        <%@ include file="encabezado.jsp" %>
</table>

<table width="760">
	<tr>
		<td width="152" valign='top'>
			<%@ include file="menuproveedor.jsp" %>
		</td>
		<td valign='top'>
                    <%
                            String tittle = "Generador de Reportes";
                    %>
                    <%@ include file="/titulo.jsp" %>
                    <form name="reportBuilder" action="/proveedor/reportestop" method="post">
                    <table width="80%" border="0" cellpadding="0" cellspacing="0" bgcolor="#E8E8F4" align="center">
                        <%
                            int companyTypeId = ( (Integer)request.getAttribute("companyTypeId") ).intValue();
                            int companyId = ( (Integer)request.getAttribute("companyId") ).intValue();
                            int reportType = ( (Integer)request.getAttribute("reportType") ).intValue();
                            String checked1 = "";
                            String checked2 = "";
                            if( reportType == 1){
                                checked1 = "checked";
                            }else{
                                checked2 = "checked";
                            }
                        %>
                        <tr>
                            <td width="16" align="left" valign="top"><img src="/proveedor/images/bus1.gif" width="16" height="14"></td>
                            <td colspan='6'>&nbsp;</td>
                            <td width="15" align="right" valign="top"><img src="/proveedor/images/bus3.gif" width="15" height="14"></td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td colspan="6"><strong>Tipos de Reportes</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td colspan="3"><input type="radio" name="reportType" value="1" <%=checked1%>>Productos</td>
                            <td colspan="3"><input type="radio" name="reportType" value="2" <%=checked2%>>Minoristas</td>
                            <td>&nbsp;</td>
                        </tr>
                        <input type="hidden" name="companyTypeId" value="<%=companyTypeId%>">
                        <input type="hidden" name="supplier" value="<%=companyId%>">
                        <tr>
                                <td>&nbsp;</td>
                                <td colspan='6'><hr color="#333399"></td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td colspan="6"><br><strong>Criterios Adicionales</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td>N&uacute;mero de Filas</td>
                            <td colspan='2'><input type="text" name="numRows" maxlength='3' size='2' value="<%=request.getAttribute("numRows")%>"></td>
                            <td>Ordenar</td>
                            <td colspan='2'>
                                <%
                                    int sort = ( (Integer)request.getAttribute("sort") ).intValue();
                                    String selected0 = "";
                                    String selected1 = "";
                                    if( sort == 0){
                                        selected0 = "selected";
                                    }else{
                                        selected1 = "selected";
                                    }
                                %>
                                <select name="sort">
                                    <option value="0" <%=selected0%>>DESC</option>
                                    <option value="1" <%=selected1%>>ASC</option>
                                </select>
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td colspan="6">&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td>Fecha inicial</td>
                            <td width='15%'><input type="text" name='startDate' value='' 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.reportBuilder.startDate);
                                </script>
                            <td>Fecha final</td>
                            <td width='15%'><input type="text" name='endDate' value='' 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.reportBuilder.endDate);
                                </script>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td colspan="6">&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td colspan='6' align="center"><input type="submit" value="Generar Reporte"></td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td align="left" valign="bottom"><img src="/proveedor/images/bus2.gif" width="16" height="15"></td>
                            <td colspan='6'>&nbsp;</td>
                            <td align="right" valign="bottom"><img src="/proveedor/images/bus4.gif" width="15" height="15"></td>
                        </tr>
                    </table>
                    </form>
                    <%
                        tittle = "Resultados";
                    %>
                    <%@ include file="/titulo.jsp" %>
                    <form action="/proveedor/reportestop" method="post">
                        <table width='80%' align="center">
                            <tr>
                                <td colspan='3'><strong>REPORTE <%=request.getAttribute("reportTitle")%></td>
                            </tr>
                            <tr class="tableheader" align="center">
                                <td>N°</td>
                                <td width='60%'>Nombre</td>
                                <td>Valor</td>
                            </tr>
                            <%
                            ListView view = ( ListView )request.getAttribute("view");
                            String data;
                            String color="";
                            boolean rows = false;
                            int cont=0;
                            while(view.move())
                                {
                                    int i=0;
                                    String id="";
                                    if(cont % 2 ==  0){
                                        color="#FFFFF0";
                                    }else{
                                     color = "#EFEFEF";
                                    }
                            %>
                                        <tr bgcolor='<%=color%>'>
                                            <td align="center"><%=cont+1%></td>
                                        <% while((data=(String)view.nextElement()) != null){
                                                rows = true;
                                                if(i==1){%>
                                                        <td><%= data %></td>
                                              <%}else{ 
                                                        i=1; 
                                                        id=data;
                                                }%>
                                        <%
                                        }
                                        %>
                                        </tr>  
                            <%
                                cont++;
                            }
                            
                            if(!rows){
                                %><tr><td colspan="2" align="center"><br><strong>No hay resultados disponibles</td></tr><%
                            }
                            %>
                            </tr>
                        </table>
                    </form>
                </td>
        </tr>
</table>

<table width="760">
	<tr>
		<td><%@ include file="/piepagina.jsp" %></td>
	</tr>
</table>

</body>
</html>
// “Copyright (C) <2008> Multilateral Investment Fund of the Inter-American Development Bank.
// Este archivo es parte de <ICT4BUS-PVL>
// < ICT4BUS-PVL > es software libre: usted puede redistribuirlo y/o modificarlo bajo los términos de la Licencia Pública General GNU publicada por la Fundación para el Software Libre, ya sea la versión 3 de la Licencia, o (a su elección) cualquier versión posterior.
// < ICT4BUS-PVL > se distribuye con la esperanza de que sea útil, pero SIN GARANTÍA ALGUNA; ni siquiera la garantía implícita MERCANTIL o de APTITUD PARA UN PROPÓSITO DETERMINADO. 
// Consulte los detalles de la Licencia Pública General GNU para obtener una información más detallada. 
// Debería haber recibido una copia de la Licencia Pública General GNU junto a este programa. En caso contrario, consulte http://www.gnu.org/licenses/.”