fechaini=request.Form("fechaini")
fechafin=request.Form("fechafin")
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.Addheader "Content-Disposition", "atachment; filename= " & FileName
Response.write "<?xml version='1.0'encoding='ISO-8859-1'?>"
Response.write "<Workbook xmlns='urn:schemas-microsoft-com:office:spreadsheet'>"
Response.write "<ExcelWorkbook xmlns='urn:schemas-microsoft-com:office:excel'/>"
Response.write "xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet'"
Response.write "<Styles>"
Response.write "<Style ss:ID='s21'>"
Response.write "<Alignment ss:Horizontal='Center' ss:Vertical='Bottom' ss:WrapText='1'/>"
Response.write "<Borders>"
Response.write "<Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1' "
Response.write "ss:Color='#000000'/>"
Response.write "<Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1' "
Response.write "ss:Color='#000000'/>"
Response.write "<Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1' "
Response.write "ss:Color='#000000'/>"
Response.write "<Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1' "
Response.write "ss:Color='#000000'/>"
Response.write "</Borders>"
Response.write "<Font ss:Color='#FFFFFF' ss:Bold='1'/>"
Response.write "<Interior ss:Color='#800000' ss:Pattern='Solid'/>"
Response.write "</Style>"
Response.write " <Style ss:ID='s22'>"
Response.write "<Alignment ss:Horizontal='Center' ss:Vertical='Bottom' ss:WrapText='1'/>"
Response.write "<Borders>"
Response.write "<Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1' "
Response.write "ss:Color='#000000'/>"
Response.write "<Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1' "
Response.write "ss:Color='#000000'/>"
Response.write "<Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1' "
Response.write "ss:Color='#000000'/>"
Response.write "<Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1' "
Response.write "ss:Color='#000000'/>"
Response.write "</Borders>"
Response.write "<Font ss:Color='#FFFFFF' ss:Bold='1'/>"
Response.write "<Interior ss:Color='#008000' ss:Pattern='Solid'/>"
Response.write "</Style>"
Response.write "</Styles>"
Response.write "<Worksheet ss:Name='Activacion Tarjeta'>"
Response.write "<Table>"
Response.write "<Column ss:AutoFitWidth='0' ss:Width='120' ss:Span='250'/>"
conectar()
sql="select a.no_tarjeta,a.nombre,a.edad,a.calle,a.no_exterior,a.no_interior,a.colonia,a.codpos,a.municipio,a.estado,a.lada,a.telefono,"&_
"a.correoe,a.fecha_captura,b.usuario from (select no_tarjeta,nombre,edad,calle,no_exterior,no_interior,colonia,codpos,municipio,estado,"&_
"lada,telefono,correoe,convert(varchar,fecha_actualizacion,103)fecha_captura,usuario from politicos.dbo.prospectos_oaxaca_progreso where "&_
"md_status=243 and fecha_actualizacion between convert(datetime,'"&fechaini&"',103) and convert(datetime,'"&fechafin&"',103)+1) a left join "&_
"(select idusuario,'['+idusuario+'] - '+ltrim(rtrim(nombre))+' '+ltrim(rtrim(paterno))+' '+ltrim(rtrim(materno))as usuario from prod.rh.usuarios)b on a.usuario=b.idusuario"
'response.Write(sql)
'response.End()
rs.Open sql,conn
Response.write "<Row>"
Response.write "<Cell ss:StyleID='s21'><Data ss:Type='String'>No. Tarjeta</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Nombre</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Edad</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Calle</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>No. Exterior</Data></Cell>"
Response.write "<Cell ss:StyleID='s21'><Data ss:Type='String'>No. Interior</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Colonia</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>C. P.</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Municipio</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Estado</Data></Cell>"
Response.write "<Cell ss:StyleID='s21'><Data ss:Type='String'>Lada</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Telefono</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Correo-e</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Fecha Captura</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>[Login] - Usuario</Data></Cell>"
Response.write "</Row>"
do while not rs.EOF
Response.write "<Row>"
Response.write "<Cell><Data ss:Type='String'>"&rs(0)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(1)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(2)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(3)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(4)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(5)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(6)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(7)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(8)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(9)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(10)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(11)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(12)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(13)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(14)&"</Data></Cell>"
Response.write "</Row>"
rs.Movenext
loop
desconectar()
Response.write "</Table>"
Response.write "</Worksheet>"
'***************************************************************************
Response.write "<Worksheet ss:Name='Nuevas Tarjetas'>"
Response.write "<Table>"
Response.write "<Column ss:AutoFitWidth='0' ss:Width='120' ss:Span='250'/>"
conectar()
sql="select a.no_tarjeta,a.nombre,a.edad,a.calle,a.no_exterior,a.no_interior,a.colonia,a.codpos,a.municipio,a.estado,a.lada,a.telefono,"&_
"a.correoe,a.fecha_captura,b.usuario from (select no_tarjeta,nombre,edad,calle,no_exterior,no_interior,colonia,codpos,municipio,estado,"&_
"lada,telefono,correoe,convert(varchar,fecha_actualizacion,103)fecha_captura,usuario from politicos.dbo.prospectos_oaxaca_progreso where "&_
"md_status=100 and fecha_actualizacion between convert(datetime,'"&fechaini&"',103) and convert(datetime,'"&fechafin&"',103)+1) a left join "&_
"(select idusuario,'['+idusuario+'] - '+ltrim(rtrim(nombre))+' '+ltrim(rtrim(paterno))+' '+ltrim(rtrim(materno))as usuario from prod.rh.usuarios)b on a.usuario=b.idusuario"
rs.Open sql,conn
Response.write "<Row>"
Response.write "<Cell ss:StyleID='s21'><Data ss:Type='String'>No. Tarjeta</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Nombre</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Edad</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Calle</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>No. Exterior</Data></Cell>"
Response.write "<Cell ss:StyleID='s21'><Data ss:Type='String'>No. Interior</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Colonia</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>C. P.</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Municipio</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Estado</Data></Cell>"
Response.write "<Cell ss:StyleID='s21'><Data ss:Type='String'>Lada</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Telefono</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Correo-e</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>Fecha Captura</Data></Cell>"
Response.write "<Cell ss:StyleID='s22'><Data ss:Type='String'>[Login] - Usuario</Data></Cell>"
Response.write "</Row>"
do while not rs.EOF
Response.write "<Row>"
Response.write "<Cell><Data ss:Type='String'>"&rs(0)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(1)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(2)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(3)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(4)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(5)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(6)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(7)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(8)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(9)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(10)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(11)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(12)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(13)&"</Data></Cell>"
Response.write "<Cell><Data ss:Type='String'>"&rs(14)&"</Data></Cell>"
rs.Movenext
loop
desconectar()
Response.write "</Table>"
Response.write "</Worksheet>"
Response.write "</Workbook>"