<!--#include file="conection.asp"-->
<%
Dim mostrar 'cantidad de registros a mostrar por página
Dim cant_paginas 'cantidad de páginas que recibimos
Dim pagina_actual 'La página que mostramos
Dim registro_mostrado 'Contador utilizado para mostrar las páginas
Dim I 'Variable Loop
Dim bodega1, bodega2, bodega3
bodega1 = "0000000006"
bodega2 = "0000000009"
bodega3 = "0000000011"
bodega4 = "0000000022"
orden1 = "asc"
'and s.ProductoID = p.ID and s.stock <> 0 and p.Marca != 'apple' "para borrar una marca"
sSQL="select DISTINCT p.ID as ID, p.Código as Código, p.Ubicación as Ubicación, p.Nombre as Nombre, p.Marca as Marca, p.Descripción as Descripción, p.Precio1 as Precio1,p.Precio6 as Precio6, p.CAE as CAE from INV_PRODUCTOS p, INV_PD_BODEGA_STOCK s , inv_grupos g where g.id = p.grupoid and CHARINDEX ('"& Request.QueryString("App") &"',g.ruta) > 0 and s.ProductoID = p.ID and s.stock <> 0 and p.grupoid != '0000000057' and s.ProductoID = p.ID and s.stock <> 0 and p.grupoid != '0000000086' and s.ProductoID = p.ID and s.stock <> 0 and p.Marca != 'IBM' and s.ProductoID = p.ID and s.stock <> 0 and p.Código != '19EN33S' and (s.bodegaID = '"& bodega1 &"' or s.bodegaID = '"& bodega2 &"' or s.bodegaID = '"& bodega3 &"' or s.bodegaID = '"& bodega4 &"') Order by Precio1 desc"
'esta sentencia SQL puede ser creada a partir de un buscador como el que hemos visto en otro reportaje
'y almacenada en una session para emplearla sucesivas veces en el script: session("ssql")=ssql 1"
mostrar = 12 ' Pueden modificar este número para cambiar la cantidad de registros por página
' IF para saber que página mostrar
If Request.QueryString("page") = "" Then
pagina_actual = 1
Else
pagina_actual = CInt(Request.QueryString("page"))
End If
Set Conn = Server.CreateObject("ADODB.Connection")
' Creamos el RecordSet y definimos la cantidad de registros a mostrar
Set RS = Server.CreateObject("ADODB.Recordset")
RS.PageSize = mostrar
RS.CacheSize = mostrar
' Abrimos la tabla...
RS.Open sSQL, oConn,3,1
'contamos las páginas que se formaron con la variable mostrar.
cant_paginas = RS.PageCount
' Si el pedido de página cae afuera del rango,
' lo modificamos para que caiga adentro
If pagina_actual > cant_paginas Then pagina_actual = cant_paginas
If pagina_actual < 1 Then pagina_actual = 1
' Si la cantidad de páginas da 0 es que no hay registros... por eso este IF
If cant_paginas = 0 Then
Response.Redirect("notDataFound.asp")
Else
' Nos movemos a la página elegida
RS.AbsolutePage = pagina_actual
' Mostramos el dato de que página estamos...
Dim precio
If Not RS.EOF Then
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="210" height="6"></td>
<td width="11"></td>
<td width="210"></td>
<td width="11"></td>
<td width="214"></td>
</tr>
<tr>
<td height="5" colspan="5" align="center" valign="middle">
<img src="http://www.forosdelweb.com/f86/images/products_03Bar.jpg" width="652" height="5" border="0" /></td>
</tr>
<tr>
<td height="153" valign="top">
<%
precio = 0
registro_mostrado = 0
precio5=0
preciom=0
Do While registro_mostrado < mostrar And Not RS.EOF
registro_mostrado = registro_mostrado + 1
If Session("usuario") = False Then
preciom = RS.Fields("Precio1").Value
precion=preciom / 0.87
precio=precion
Else
preciom = rs.Fields("Precio1").Value
precio5=preciom / 0.95
precio=precio5
'precio = RS.Fields("Precio1").Value
End If
if ((registro_mostrado -1) mod 3) = 0 and registro_mostrado <> 1 Then
Response.Write("<tr /><td height='153' valign='top'>")
end if
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="13" height="5"></td>
<td width="96"></td>
<td width="4"></td>
<td width="97"></td>
</tr>
<tr>
<td height="14"></td>
<td rowspan="6" align="center" valign="middle" class="borderProducts"><%if RS.Fields("CAE").Value <> "" Then %>
<a href="productOnce.asp?App=<% =RS.Fields("ID").Value %>">
<img src="http://www.forosdelweb.com/f86/upload/<%= RS.Fields("CAE").Value%>" width="94" height="101" border="0" />
<%Else%>
<img src="http://www.forosdelweb.com/f86/upload/NO_DISPONIBLE_PE.jpg" width="94" height="101" border="0" />
<%End If%> </td>
<td></td>
<td valign="top" class="textRed12"><b class="textIDProduct"><%= RS.Fields("Código").Value %></b> </td>
</tr>
<tr>
<td height="13"></td>
<td></td>
<td valign="top" class="textRed11"><b>Marca:</b></td>
</tr>
<tr>
<td height="21"></td>
<td></td>
<td align="center" valign="middle" class="textNormal11"><b><%= Left(RS.Fields("Marca").Value,16) %></b></td>
</tr>
<tr>
<td height="13"></td>
<td></td>
<td valign="top" class="textRed11"><b>Precio:</b></td>
</tr>
<tr>
<td height="13"></td>
<td></td>
<td align="center" valign="middle" class="textNormal11"><b><%= formatNumber(precio,2) %></b></td>
</tr>
<tr>
<td height="29"></td>
<td></td>
<td align="left" valign="bottom"><a href="productOnce.asp?App=<% =RS.Fields("ID").Value %>">
<img src="http://www.forosdelweb.com/f86/images/view_Detail.jpg" width="67" height="20" border="0" /></a>
<% If session("usuario") = False Then
Response.Write("<!--DWLayoutEmptyCell--> ")
Else %>
<a href="productOnce.asp?App=<% =RS.Fields("ID").Value %>">
<img src="http://www.forosdelweb.com/f86/images/carritoC.jpg" width="24" height="18" border="0" /></a><%End If%></td>
</tr>
<tr>
<td height="4"></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="41"></td>
<td colspan="3" align="center" valign="top" class="labelDescripcionProduct"><%= Left(RS.Fields("Nombre").Value,30) %></td>
</tr>
</table>
<td> </td><td height='153' valign='top'>
<%
' Nos movemos al próximo registro...
RS.MoveNext
Loop
Else
Response.Redirect("notDataFound.asp")
End If
%>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="656" height="20" align="right" valign="middle" class="ubicacion">Página:
<% 'Ahora mostramos los enlaces a las otras páginas con el resto de los registros...
If pagina_actual > 1 Then
%>
<a href="products_menu.asp?App=<%=Request.QueryString("App")%>&page=<%= pagina_actual - 1 %>"><span class="ubicacion">[<< Anterior]</span></a>
<%
End If
' mostramos la paginacion por numeros de página
For I = 1 To cant_paginas
If I = pagina_actual Then
%>
<%= I %>
<%
Else
%>
<a href="products_menu.asp?App=<%=Request.QueryString("App")%>&page=<%=I%>"><%= I %></a>
<%
End If
Next 'I
If pagina_actual < cant_paginas Then
%>
<a href="products_menu.asp?App=<%=Request.QueryString("App")%>&page=<%= pagina_actual + 1 %>"><span class="ubicacion">[Siguiente >>]</span></a>
<%
End If
'Fin...
%></td>
</tr>
</table>
<%
End If
RS.Close
%>