<%
Response.AddHeader "Content-Disposition", "attachment;filename=WasReport.xls"
'Response.Buffer = true
Response.ContentType = "application/vnd.ms-excel"
'Response.Expires = 0
%>
Si me muestra la pagina, cual sera el problema?
Código ASP:
Ver original
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <% Response.AddHeader "Content-Disposition", "attachment;filename=WasReport.xls" 'Response.Buffer = true Response.ContentType = "application/vnd.ms-excel" 'Response.Expires = 0 %> --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>WAS2</title> </head> <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF"> <style type="text/css"> table.sample { border-width: 1px; border-spacing: 2px; border-style: groove; border-color: green; border-collapse: collapse; background-color: rgb(255, 255, 240); } table.sample th { border-width: 1px; padding: 3px; border-style: inset; border-color: red; background-color: ; -moz-border-radius: 0px 0px 0px 0px; } table.sample td { border-width: 1px; padding: 3px; border-style: inset; border-color: red; background-color: ; -moz-border-radius: 0px 0px 0px 0px; } </style> <!--<table border="0" width="100%" cellspacing="0" cellpadding="0" background="img/topbkg.gif"> <tr> <td width="50%"><img border="0" src="img/img2.png" width="142" height="66"></td> <td width="50%"> <p align="right"><img border="0" src="img/topright.gif" width="327" height="66"></td> </tr> </table> <table border="0" width="100%" cellspacing="0" cellpadding="0" background="img/blackline.gif"> <tr> <td width="100%"><font color="#B8C0F0" face="Arial" size="2"><b> <a href="http://messrv00/Mes/Asp/was2/Default.htm">Home </a> | Reports | Other Link</b></font></td> </tr> </table>--> <p style="margin-left: 20"><b><font color="#B8C0F0" face="Arial" size="2"> </font></b><font face="Arial" size="2" color="#000000"> <p align="center"><table border="1" CLASS="sample"></p> <tr> <td><b>Linea</b></td> <td><b>Peso</b></td> <td><b>Target</b></td> <td><b>Marca</b></td> <td><b>Vaso</b></td> <td><b>Tubo</b></td> <td><b>Fecha</b></td> </tr> <% 'dim conexion,calendar1,calendar2,registros,linea,hora,test calendar1=request.QueryString("calendar1") calendar2=request.QueryString("calendar2") linea=request.QueryString("linea") tubo=request.QueryString("tubo") hora=request.QueryString("hora") hora=request.form("hora") test=("SELECT h.hora,h.marca,h.codoptima,h.target,P.CODOPTIMA,O.CODIGO,p.hora,p.peso,p.vaso,p.fecha, o.linea,o.tubo FROM pesos as p, optimas as o,htargets as h where o.codigo = p.codOptima and o.linea = '"&linea&"' and o.tubo LIKE '"&tubo&"' AND p.fecha Between '"&calendar1&"' AND '"&calendar2&"' AND p.hora='"&hora&"'and h.codoptima = o.codigo and h.hora='"&hora&"'") SET conexion=Server.CreateObject("ADODB.Connection") conexion.Open "PROVIDER=SQLOLEDB; DATA SOURCE=VALP-MESSRV02;UID=sa;PWD=messrv;DATABASE=wasp " SET registros=Server.CreateObject("ADODB.RecordSet") 'registros.open"SELECT peso,tubo from pesos where fecha between '"&calendar1&"' AND '"&calendar2&"'",conexion 'registros.open"SELECT h.hora AS hora1,h.marca,h.codoptima AS codoptimaT,h.target,P.CODOPTIMA,O.CODIGO,p.hora,p.peso,p.vaso,p.fecha,o.linea,o.tubo INTO #c FROM pesos AS p, optimas AS o,htargets AS h WHERE o.codigo = p.codOptima AND o.linea = '"&linea&"' AND o.tubo ='"&tubo&"' AND p.fecha BETWEEN '"&calendar1&"' AND '"&calendar2&"' AND p.hora='"&hora&"' AND h.codoptima = o.codigo AND h.hora='"&hora&"'",conexion registros.open"SELECT h.hora,h.marca,h.codoptima,h.target,P.CODOPTIMA,O.CODIGO,p.hora,p.peso,p.vaso,p.fecha, o.linea,o.tubo FROM pesos as p, optimas as o,htargets as h where o.codigo = p.codOptima and o.linea = '"&linea&"' and o.tubo ='"&tubo&"' AND h.fecha Between '"&calendar1&"' AND '"&calendar2&"' AND p.fecha Between '"&calendar1&"' AND '"&calendar2&"' AND p.hora='"&hora&"'and h.codoptima = o.codigo and h.hora='"&hora&"'" ,conexion 'registros.open"SELECT p.hora,p.peso,p.vaso,p.fecha, o.linea,o.tubo FROM pesos as p, optimas as o where o.codigo = p.codOptima and o.linea = 'L15N' and o.tubo LIKE '%' AND p.fecha Between '2010-06-14 09:00:00.000' AND '2010-06-14 09:30:00.000' AND p.hora='9:00 - 9:30'" ,conexion 'SELECT h.codoptima,h.target,P.CODOPTIMA,O.CODIGO,p.hora,p.peso,p.vaso,p.fecha, o.linea,o.tubo,o.codigo FROM pesos as p, optimas as o,htargets as h where o.codigo = p.codOptima and o.linea = 'L07N' and o.tubo LIKE '%' AND p.fecha Between '2010-06-14 09:30' AND '2010-06-14 10:00' AND p.hora='9:30 - 10:00' and h.codoptima = o.codigo dim a do while not registros.eof a=cint(registros.fields("target")) response.write("<tr>") response.write("<td>"®istros.fields("linea")&"</td>") response.write("<td>"®istros.fields("peso")&"</td>") response.write("<td>"®istros.fields("target")&"</td>") 'response.write("<td>"&a&"</td>") response.write("<td>"®istros.fields("marca")&"</td>") response.write("<td>"®istros.fields("vaso")&"</td>") response.write("<td>"®istros.fields("tubo")&"</td>") response.write("<td>"®istros.fields("fecha")&"</td>") registros.movenext loop conexion.close response.write(test) '<--Test Debug 'RESPONSE.WRITE("<br>") dim codoptima if linea="L01N" AND tubo="A" then codoptima=30 elseif _ linea="L01N" AND tubo="B" then codoptima=31 elseif linea="L01N" AND tubo="C" then codoptima=32 elseif linea="L01S" AND tubo="D" then codoptima=33 elseif linea="L01S" AND tubo="E" then codoptima=34 elseif linea="L01S" AND tubo="F" then codoptima=35 elseif linea="L02N" AND tubo="A" then codoptima=54 elseif linea="L02N" AND tubo="B" then codoptima=55 elseif linea="L02N" AND tubo="C" then codoptima=56 elseif linea="L02N" AND tubo="D" then codoptima=57 elseif linea="L02N" AND tubo="E" then codoptima=58 elseif linea="L02N" AND tubo="F" then codoptima=59 elseif linea="L03N" AND tubo="A" then codoptima=60 elseif linea="L03N" AND tubo="B" then codoptima=61 elseif linea="L03N" AND tubo="C" then codoptima=62 elseif linea="L03S" AND tubo="D" then codoptima=63 elseif linea="L03S" AND tubo="E" then codoptima=64 elseif linea="L03S" AND tubo="F" then codoptima=65 elseif linea="L06N" AND tubo="A" then codoptima=36 elseif linea="L06N" AND tubo="B" then codoptima=37 elseif linea="L06N" AND tubo="C" then codoptima=38 elseif linea="L06S" AND tubo="D" then codoptima=39 elseif linea="L06S" AND tubo="E" then codoptima=40 elseif linea="L06S" AND tubo="F" then codoptima=41 elseif linea="L07N" AND tubo="A" then codoptima=42 codoptima=50 end if 'SELECT p.peso,p.tubo,p.fecha, o.linea FROM pesos as p, optimas as o where o.codigo = p.codOptima and o.linea = 'L02N' AND p.fecha Between '2010-05-11 09:42:34.000' AND '2010-05-11 09:42:39.000' SET conexion2=Server.CreateObject("ADODB.Connection") conexion2.Open "PROVIDER=SQLOLEDB; DATA SOURCE=VALP-MESSRV02;UID=sa;PWD=messrv;DATABASE=wasp " SET registros2=Server.CreateObject("ADODB.RecordSet") registros2.open"SELECT AVG(PESO)as peso from pesos where fecha Between '"&calendar1&"' AND '"&calendar2&"'AND hora='"&hora&"' AND codoptima='"&codoptima&"'",conexion2 'RESPONSE.WRITE("SELECT AVG(PESO)as peso from pesos where fecha Between '"&calendar1&"' AND '"&calendar2&"'AND hora='"&hora&"' AND codoptima='"&codoptima&"'") do while not registros2.eof c=cint(registros2.fields("peso")) b=(a-c)/a response.write("Promedio: "®istros2.fields("peso")&"") '############## Aritmetica #################### ' C = Promedio WHERE B=(a-c)/a ' A = Target response.write("<br> Op: "&b&"<br>") saving=(c-a) registros2.movenext loop conexion2.close %> </tr> </table> </table> </font></p> <p style="margin-left: 20"><font face="Arial" size="2" color="#000000"> </font></p> <div align="center"> <a href="Show.asp"> <img src="../ProyImgs/excel.gif" alt="Exportar" width="22" height="20" border="0" /> </a> </div> <p style="margin-left: 20"><font face="Arial" size="2" color="#000000"> </font></p> <p style="margin-left: 20"><font face="Arial" size="2" color="#000000"> </font></p> <p style="margin-left: 20"><font face="Arial" size="2" color="#000000"> </font></p> <p style="margin-left: 20"><font face="Arial" size="2" color="#000000"> </font></p> <p style="margin-left: 20"><font face="Arial" size="2" color="#000000"> </font></p> <p style="margin-left: 20"><font face="Arial" size="2" color="#000000"> </font></p> <p style="margin-left: 20"><font face="Arial" size="2" color="#000000"> </font></p> <p style="margin-left: 20" align="center"><font face="Arial" color="#000000" size="1">© COPYRIGHT 2010 ALL RIGHTS RESERVED PG.COM</font></p> <table border="0" width="100%" cellspacing="0" cellpadding="0" background="img/botline.gif"> <tr> <td width="100%"><img border="0" src="img/botline.gif" width="41" height="12"></td> </tr> </table> </body> </html>