<%@ page import="com.fenalco.utilities.lists.ListView" %>
<%@ page import="com.fenalco.entities.*"%>
<%@page import="co.com.ddt.views.View"%>
<%@ page import="java.util.Hashtable"%>
<%@ page import="java.util.Enumeration"%>
<%@ page import="java.util.Vector"%>
<%
    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();
%>
<%
    
    
    int id = 0;
    String label = "";
    String data = "";
    int field = 0;
    
    Enumeration en;
	
	
%>
<%!int i;%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel='stylesheet' style='text/css' href='/css/tablas.css'>
<title>Reportes Pedidos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" background="/images/sysmanager/fondo1.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="showMessage('<%=request.getAttribute("message")%>')">
<script language='javascript' type='text/javascript' src='/js/library.js'></script>
<script>
	
    function showMessage(message){
        if(message!=null && message!=""){
            window.alert(message);
        }
        return true;
    }

     function submitCombo(comboName){
                document.ordersReport.combo.value=comboName;
                document.ordersReport.action = "/administrador/reportes/no_compra_minorista";
                document.ordersReport.submit();
                return true;
     }
     
    function showCompany(id){
           var left = (screen.availWidth-515)/2;
	   var top = (screen.availHeight-500)/2;
           window.open('/administrador/verempresa?key='+id,'','WIDTH=515,HEIGHT=520,left='+left+',top='+top+'SCROLLBARS=yes');
    }
    
     

</script>
<table border="0" cellpadding="0" cellspacing="0" width="780">
        <%
            String helpId = "76";
        %>
        <%@ include file="../encabezado.jsp" %>
</table>
<table width="760">
	<tr>
            <td width="152" valign='top'>
                    <%@ include file="../menuadministrador_reportes.jsp" %>
            </td>
            <td valign='top'>
                <%
                    String tittle = "Reporte de Pedidos(No compra-minoristas)";
                %>
                <%@ include file="/titulo.jsp" %>
                <form name="ordersReport" method="post" action="/administrador/reportes/no_compra_minorista">
                
        <table width="560" border="0" cellpadding="0" cellspacing="0" bgcolor="#E8E8F4" align="center">
          <tr> 
            <td width="16" align="left" valign="top"><img src="../images/bus1.gif" width="16" height="14"></td>
            <td colspan='2' width="529">&nbsp;</td>
            <td width="15" align="right" valign="top"><img src="../images/bus3.gif" width="15" height="14"></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td colspan='2'> <table width="265" align="center">
                <tr> 
                  <td width="189">&nbsp;&nbsp;Pa&iacute;s&nbsp;</td>
                  <td width="64"> <select name="country" onChange="submitCombo(this.name)">
                      <%
                                        Vector countriesList = (Vector)request.getAttribute("countriesList");
                                        int temp = Integer.parseInt(request.getAttribute("countryId").toString());
                                        for(int i = 0 ; i < countriesList.size() ; i++){
                                            id = ((Country)countriesList.elementAt(i)).getId();
                                            label = ((Country)countriesList.elementAt(i)).getName();
                                        %>
                      <option value="<%=id%>" <%=(temp==id)?"selected":""%>><%=label%> 
                      </option>
                      <%
                                        }
                                        %>
                    </select> </td>
                </tr>
                <tr> 
                  <td>&nbsp;&nbsp;Departamento&nbsp;</td>
                  <td> <select name="province" onChange="submitCombo(this.name)">
                      <option value="-1" selected>Todos</option>
                      <%
                                        Vector provincesList = (Vector)request.getAttribute("provincesList");
                                        temp = Integer.parseInt(request.getAttribute("provinceId").toString());
                                        for(int i = 0 ; i < provincesList.size() ; i++){
                                            id = ((Province)provincesList.elementAt(i)).getId();
                                            label = ((Province)provincesList.elementAt(i)).getName();
                                        %>
                      <option value="<%=id%>" <%=(temp==id)?"selected":""%>><%=label%> 
                      </option>
                      <%
                                        }
                                        %>
                    </select> </td>
                </tr>
                <tr> 
                  <td>&nbsp;&nbsp;Ciudad&nbsp;</td>
                  <td> <select name="city" onChange="submitCombo( this.name )">
                      <option value="-1" selected>Todas</option>
                      <%
                                        Vector citiesList = (Vector)request.getAttribute("citiesList");
                                        temp = Integer.parseInt(request.getAttribute("cityId").toString());
                                        for(int i = 0 ; i < citiesList.size() ; i++){
                                            id = ((City)citiesList.elementAt(i)).getId();
                                            label = ((City)citiesList.elementAt(i)).getName();
                                        %>
                      <option value="<%=id%>" <%=(temp==id)?"selected":""%>><%=label%> 
                      </option>
                      <%
                                        }
                                        %>
                    </select> </td>
                </tr>
                <tr> 
                  <td>&nbsp;&nbsp;Zona&nbsp;</td>
                  <td> <select name="zone"  onChange="submitCombo( this.name )">
                      <option value="-1" selected>Todas</option>
                      <%
                                        Vector zonesList = (Vector)request.getAttribute("zonesList");
                                        temp = Integer.parseInt(request.getAttribute("zoneId").toString());
                                        for(int i = 0 ; i < zonesList.size() ; i++){
                                            id = ((Zone)zonesList.elementAt(i)).getId();
                                            label = ((Zone)zonesList.elementAt(i)).getName();
                                        %>
                      <option value="<%=id%>" <%=(temp==id)?"selected":""%>><%=label%> 
                      </option>
                      <%
                                        }
                                        %>
                    </select> </td>
                </tr>
                <tr> 
                  <td>&nbsp;&nbsp;Barrio&nbsp;</td>
                  <td> <select name="neighbourhood">
                      <option value="-1" selected>Todos</option>
                      <%
                                        Vector neighbourhoodsList = (Vector)request.getAttribute("neighbourhoodsList");
                                        temp = Integer.parseInt(request.getAttribute("neighbourhoodId").toString());
                                        for(int i = 0 ; i < neighbourhoodsList.size() ; i++){
                                            id = ((Neighbourhood)neighbourhoodsList.elementAt(i)).getId();
                                            label = ((Neighbourhood)neighbourhoodsList.elementAt(i)).getName();
                                        %>
                      <option value="<%=id%>" <%=(temp==id)?"selected":""%>><%=label%> 
                      </option>
                      <%
                                        }
                                        %>
                    </select> </td>
                </tr>
              </table></td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td align="left" valign="bottom"><img src="../images/bus2.gif" width="16" height="15"></td>
            <td colspan='2'>&nbsp;</td>
            <td align="right" valign="bottom"><img src="../images/bus4.gif" width="15" height="15"></td>
          </tr>
        </table>
                <table align="center">
                    <tr>
                        <td>
                            <jsp:include page="/general/paginador.jsp" flush="true">
                                <jsp:param name="page" value="<%=page1%>" />
                                <jsp:param name="pages" value="<%=pages%>" />
                                <jsp:param name="pageResults" value="<%=pageResults%>" />
                            </jsp:include>
                        </td>
                    </tr>    
                    <tr>
                        
                                <td colspan='6'>
                                    <jsp:include page="/general/resultados.jsp" flush="true">
                                        <jsp:param name="firstRow" value="<%=firstRow%>" />
                                        <jsp:param name="lastRow" value="<%=lastRow%>" />
                                        <jsp:param name="total" value="<%=total%>" />
                                    </jsp:include>
                                </td>
                            
                    </tr>    
                </table>
                <table align="center" cellspacing='2' border='0' width='560'>
                    <tr><td colspan='5' height='10'></td></tr>
                    <tr class='tableheader'>
                        <!-- Encabezado del listado -->
                        
                          
                                <td align="center"><font color="white">Empresa</font></td>
                                <td align="center"><font color="white">NIT</font></td>
                                <td align="center"><font color="white">Direcci&oacute;n</font></td>
                                <td align="center"><font color="white">Tel&eacute;fono</font></td>
                                <td align="center"><font color="white">Fecha de ingreso</font></td>
                          
                        
                    </tr>
                    <% 
                        Vector view = ( Vector )request.getAttribute("list");
                                
                        //Enumeration rows = view.elements();
                        int count = 0;
                        if(view != null){
                        for(int i = 0 ; i < view.size() ; i++){
                            count++;
                            try{
                                Company cmp = new Company( ((Integer)view.elementAt(i)).intValue());
                    %>
                            <tr bgcolor="<%=count%2==0?"#EFEFEF":"FFFFF"%>">
                            
                                    <td><%=cmp.getCommercialName()%></td>
                                    <td><%=cmp.getNit()%></td>
                                    <td><%=cmp.getAddress()%></td>
                                    <td><%=cmp.getPhoneNumber1()%></td>
                                    <td><%=cmp.getRegisterDate()%></td>
                            <%  
                             
                            }catch( Exception e ){
                                e.printStackTrace();
                            }
                            %>
                            </tr>
                        <%
                        }}
                        %>
                      </table>
                       
                        
                        <table align="center">
                            <tr>
                                <td colspan='6'>
                                    <jsp:include page="/general/resultados.jsp" flush="true">
                                        <jsp:param name="firstRow" value="<%=firstRow%>" />
                                        <jsp:param name="lastRow" value="<%=lastRow%>" />
                                        <jsp:param name="total" value="<%=total%>" />
                                    </jsp:include>
                                </td>
                            </tr>
                        </table>    
                    <%
                        if( count == 0 ){
                    %>
                        <br>
                        <table align="center" width='560' border="0">	 
                            <tr>
                                <td colspan='6' align="center">
                                    <strong>No se encontraron resultados</strong>
                                </td>
                            </tr>
                        </table>
                    <%
                        }
                    %>
                <input type="hidden" name="combo" value="<%=(String)request.getAttribute("combo")%>">
                </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/.”