<% Set oConn = New NTI 'clase NTI manejo del sistema oConn.Conecta set rs=Server.CreateObject("Adodb.Recordset") set rs2=Server.CreateObject("Adodb.Recordset") set rs3=Server.CreateObject("Adodb.Recordset") set rs=Server.CreateObject("Adodb.Recordset") Function listar_sql_1() sql = "SELECT * FROM clase_caso WHERE 1=1 " listar_sql_1 =sql End Function Function buscar_sql(campo,buscar,orden,clase) sql = "SELECT C.id_casos as id_casos, C.titulo as titulo, CC.nombre_clase as clase, C.fecha,E.nombre AS Empresa FROM casos as C, clase_caso as CC,empresa AS E WHERE C.id_clase_caso=CC.id_clase_caso AND E.id_empresa=C.id_empresa" if campo<>"" then sql= sql & " AND "&campo&" like '" & buscar &"%'" end if if clase<>0 then sql= sql & " AND C.id_clase_caso= '" & clase &"'" end if 'if orden<>"" then sql=sql&" ORDER BY C.fecha desc" 'end if 'Response.Write(sql) buscar_sql =sql End Function if Request.Form("campo") <> empty then campo=Request.Form("campo") end if if Request.Form("txt_busqueda") <>empty then txt_busqueda=Request.Form("txt_busqueda") end if if Request.QueryString("campo") <> empty then campo=Request.QueryString("campo") end if if Request.QueryString("txt_busqueda") <> empty then txt_busqueda=Request.QueryString("txt_busqueda") end if '''''''''''''' campo=FormatSqlWeb(campo) txt_busqueda=FormatSqlWeb(txt_busqueda) SQL3=listar_sql_1() set rs3=Server.CreateObject("ADODB.Recordset") rs3.Open SQL3, oConn.Conn ''''''''''''''''''''''''''''''''''''''''''''''''''' chek="" dominio =dominio&"" if (isNumeric(Request.QueryString("id_clase"))) then id_clase=CInt(Request.QueryString("id_clase"))+0 else id_clase=0 end if If Not rs3.BOF or not rs3.EOF Then Do While Not rs3.EOF if (id_clase=rs3("id_clase_caso"))then dominio =dominio&"" else dominio =dominio&"" end if rs3.MoveNext Loop end if rs3.close() set objTemplate = new template_cls chek="" dim objTemplate const TMPLDIR = "templates/" const IMGDIR = "templates/" TABLA_LIMITE=10 if (isNumeric(Request.QueryString("inicio"))) then inicio=CInt(Request.QueryString("inicio"))+0 else inicio=0 end if with objTemplate .TemplateFile = TMPLDIR & "bancoCasos.html" .AddToken "SELECT_CLASE",1, dominio chek="" dominio2="" if campo="C.titulo" then chek="selected" end if dominio2 =dominio2&"" chek="" if campo="E.empresa" then chek="selected" end if dominio2 =dominio2&"" .AddToken "SELECT_CAMPO",1, dominio2 SQL=buscar_sql(campo,txt_busqueda,campo,id_clase) set rs2=Server.CreateObject("ADODB.Recordset") rs2.Open SQL, oConn.Conn 'n_total_reg=rs2.getrows Dim miTabla If Not rs2.EOF Then miTabla = rs2.GetRows rs2.close n_total_reg=UBound(miTabla,2)+1 .AddToken "N_TOTAL_REG",1,n_total_reg if ((inicio/TABLA_LIMITE)>5) then if ((n_total_reg/TABLA_LIMITE)-(inicio/TABLA_LIMITE))<5 then num=0+((n_total_reg\TABLA_LIMITE)-11) if num<0 then num=0 end if fin=(inicio/TABLA_LIMITE)+((n_total_reg\TABLA_LIMITE)-(inicio/TABLA_LIMITE)) else num=0+(inicio/TABLA_LIMITE)-5 fin=TABLA_LIMITE+(inicio/TABLA_LIMITE)-5 end if else num=0 fin=(n_total_reg\TABLA_LIMITE) end if while num<=fin pag=num+1 ini2=num*TABLA_LIMITE if num=(inicio/TABLA_LIMITE) then numeros=numeros&" "&pag&" " else numeros=numeros&" "&pag&" " end if num=num+1 wend .AddToken "NUMEROS",1, numeros if inicio>0 then ini=inicio - TABLA_LIMITE .AddToken "ATRAS",1,"<<Atras" end if if inicio + TABLA_LIMITE Siguiente>>" end if .AddToken "INICIO",1,inicio + 1 limite=inicio + TABLA_LIMITE if limite" tabla=tabla&"" tabla=tabla&""&e&"
" tabla=tabla&" "&t&"
" ' tabla=tabla&" "&FormatDateTime(f1, 1)&"
" tabla=tabla&"" tabla=tabla&"
" tabla=tabla&"" tabla=tabla&"" rs.movenext i=1+i if i>10 then If Not rs.EOF Then rs.move n_total_reg-1 'Response.Write("
--->s"& rs.EOF) end if end if Loop Else tabla=tabla&"" tabla=tabla & "" tabla=tabla & "" tabla=tabla & "" tabla=tabla&"
No existen registros
" End If .AddToken "TABLA",1, tabla rs.close() .AddToken "TXT_BUSQUEDA",1, undosql(txt_busqueda) .parseTemplateFile end with set objTemplate = nothing %>