<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> Lonja Zamora <% Function CFecha ( expr, formato ) 'Devuelve una expresion de fecha válida '* Si formato es True se tiene en cuenta como fecha hispana '* Si formato es False se tiene en cuenta como fecha anglosajona Dim iDia, iMes, iAno, iPos, iPos2 iPos = InStr(expr, "/") iDia = Mid(expr, 1, iPos-1) iPos2 = iPos + 1 iPos = InStr(iPos2, expr, "/") iMes = Mid(expr, iPos2, iPos-iPos2) iAno = Mid(expr, iPos+1) 'if formato then 'CFecha = iDia & " del " & iMes & " de " & iAno 'CFecha = DateSerial ( iAno, iMes, iDia ) 'else 'CFecha = iMes & " del " & iDia & " de " & iAno CFecha = iMes & "/" & iDia & "/" & iAno 'DateSerial ( iAno, iDia, iMes) 'end if End Function 'CFecha Dim Conn Dim rcsFecha1 Dim rcsFecha2 Dim rcsFechas Dim rcsFechas2 Dim strSQL dim Fecha1 dim Fecha2 Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "lonja" 'Set rcsFechas = Server.CreateObject("ADODB.Recordset") 'strSQL="SELECT Fecha FROM Precios GROUP BY Fecha ORDER BY Fecha DESC" 'rcsFechas.Open strSQL, Conn Set rcsFechas2 = Server.CreateObject("ADODB.Recordset") strSQL="SELECT Fecha FROM Precios GROUP BY Fecha ORDER BY Fecha DESC" rcsFechas2.Open strSQL, Conn If (Request.Form("Fecha1") = "" Or Request.Form("Fecha1")="Elegir Fecha") Then Fecha1=rcsFechas2("Fecha") else Fecha1=Request.Form("Fecha1") End If rcsfechas2.movenext If (Request.Form("Fecha2") = "" Or Request.Form("Fecha2")="Elegir Fecha") Then Fecha2=rcsFechas2("Fecha") else Fecha2=Request.Form("Fecha2") End If ' Ahora pintamos nuestra lista desplegable: %>

<% ' %> <% Set rcsFecha1 = Server.CreateObject("ADODB.Recordset") Set rcsFecha2 = Server.CreateObject("ADODB.Recordset") strSQL="SELECT Productos.Producto, Tipos.Tipo, Precios.Precio, Precios.Fecha , Productos.Peso FROM (Tipos INNER JOIN Productos ON Tipos.ID = Productos.Tipo) INNER JOIN Precios ON Productos.ID = Precios.Producto WHERE ((Precios.Fecha)=#" & cFecha(Fecha1,false) & "#) ORDER BY Productos.ID" rcsFecha1.Open strSQL, Conn strSQL="SELECT Productos.Producto, Tipos.Tipo, Precios.Precio, Precios.Fecha , Productos.Peso FROM (Tipos INNER JOIN Productos ON Tipos.ID = Productos.Tipo) INNER JOIN Precios ON Productos.ID = Precios.Producto WHERE ((Precios.Fecha)=#" & cFecha(Fecha2,false) & "#) ORDER BY Productos.ID" rcsFecha2.Open strSQL, Conn %> <% Dim strGrupo strGrupo = "" Do While NOT rcsFecha1.EOF if strGrupo <> rcsFecha1.Fields.Item("Tipo").Value then %> <% strGrupo = rcsFecha1.Fields.Item("Tipo").Value end if %> <% rcsFecha1.MoveNext rcsFecha2.Movenext loop rcsFecha1.close rcsFecha2.Close Conn.close set Conn=nothing %>
Precios de la Lonja de Zamora
LONJA ACTUAL
LONJAS ANTERIORES
Productos
<% Response.Write(rcsFecha1.Fields.Item("Tipo").Value) %>
<%=Fecha1%>
<%=Fecha2%>
<% Response.Write(rcsFecha1.Fields.Item("Producto").Value & " " & rcsFecha1.Fields.Item("Peso").Value)%>
<% Response.Write(rcsFecha1.Fields.Item("Precio").Value)%>
<% Response.Write(rcsFecha2.Fields.Item("Precio").Value)%>
©Fabricados FZ C.B. - Todos los derechos reservados - Aviso Legal