Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/12/2007, 11:34
yenaiv
 
Fecha de Ingreso: diciembre-2007
Mensajes: 2
Antigüedad: 17 años, 5 meses
Puntos: 0
Re: actualizacion de status con una Bd Access

ESTE ES MI INDEX


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="comun/funciones.asp"-->
<%
Dim Conn, Rs, SQL, usuario,Pb
session("UsrConexion") = ""
usuario = Request.Form("usuario")
contra = Request.Form("contrasena")
'odbc = Request.Form("sucursal")' comentar esta linea para uso en sucursales
odbc = "CASAV22" 'quitar comentario a la linea para uso en sucursales

if usuario <> "" Then

' Ouverture de la connexion à la base

Set conn = Server.CreateObject("ADODB.Connection")
conn.open odbc

Set Session("BDD") = conn

SQL = "SELECT PE_IdPersonal, SU_IdSucursal, PE_Grupo, PE_Responsable, PE_Nombre, PE_ApPaterno, PE_ApMaterno FROM TPersonal WHERE UCASE(PE_Usuario)='" & UCASE(Replace(usuario, "'", "''")) & "'"
SQL = SQL & " AND PE_Password='" & UCASE(Replace(contra, "'", "''")) & "'"
Set Rs = Session("BDD").Execute(SQL)
if not Rs.EOF Then
session("sucursal") = Rs("SU_IdSucursal")
session("usuario") = usuario
session("grupo") = Rs("PE_Grupo")
session("responsable") = Rs("PE_Responsable")
session("UsrConexion") = Rs("PE_IdPersonal")
session.Timeout = 60
session("Nombre") = Rs("PE_Nombre") & " " & Rs("PE_ApPaterno") & " " & Rs("PE_ApMaterno")
TT = Scriptage()
RegistroConexion( Rs("PE_IdPersonal") )


Rs.Close
Set Rs = nothing
ScriptCorte2()
ok = 1
IP = Request.ServerVariables("REMOTE_HOST")
SQL= "SELECT * FROM TSeguridad WHERE SG_IP='" & IP & "' AND SU_IdSucursal=" & session("sucursal")
Set Rs = Session("BDD").Execute(SQL)
if not Rs.EOF Then
ok = 1
Rs.Close
Set Rs = nothing
Else
if IP = "127.0.0.1" OR UCASE(IP) = "LOCALHOST" OR CLng(session("sucursale")) = 0 OR CLng(Session("Responsable")) = 1 Then
ok = 1
Else
ok = 0
End if
End if
if ok = 1 Then
'Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")
Response.Redirect("menu.asp?" & tt)
Else
pb = "Esta máquina no es autorizada para tener acceso al sistema"
End if
Else
Pb = "Usuario o Contraseña no valido!"
End if

' Fermeture et destruction de la connexion et de ce qu'elle contient
End if

%>


<html>
<head>
<title>Prestomass - Casa de Empe&ntilde;o</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="Estilo.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="0" bgcolor="FFFFFF" onLoad="history.go(+1)">
<form action="index.asp" method="post" name="Login" id="Login">
<center><img src="presto_log.jpg" width="370" height="369">
<table width="45%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><font class="Texto">Usuario :</font></td>
<td><input class="unnamed2" name="usuario" type="text" id="usuario" tabindex="1"></td>
<td><font class="Texto">Contrase&ntilde;a :</font></td>
<td><input class="unnamed2" name="contrasena" type="password" id="contrasena2" tabindex="2"></td>
<td><input class="Texto" name="Aceptar" type="submit" id="Aceptar2" value="Aceptar" tabindex="3" style=""></td>
</tr>
</table>
<font face="Verdana, Arial, Helvetica, sans-serif" color="blue" size="2"><%= Pb %></font>
<INPUT TYPE="HIDDEN" NAME="sucursal" VALUE="<%=odbc%>">
</center>
</form>
<script language="JavaScript">
document.getElementById('usuario').focus()
</script>
</body>
</html>


ESTA ES MI FUNCION DE ESTATUS
Function Scriptage()
Dim SQL, Rs,Hoy,Liste,Vencida,Remate,i

i = 0

'Empezamos con las vencidas
SQLCR = "Select * FROM TCreditos"
Set RsCR = Session("BDD").Execute(SQLCR)

while not RsCR.eof
DiasRecuperar = RsCR("CR_DiasRecuperar")
IdCredito = RsCR("CR_IdCredito")

Hoy = DateAdd("d", DiasRecuperar, Now)
Hoy = Month(Hoy) & "/" & Day(Hoy) & "/" & Year(Hoy)

f1 = Month(now) & "/" & Day(now) & "/" & Year(now)
f2 = "9/19/2006"

if f1 = f2 then
SQL = "SELECT BO_IDBoleta FROM TBoletas WHERE BO_Estatus='E' AND ((BO_FcRemate=#"
SQL = SQL & "09/23/2006#) or (BO_FcRemate=#" & hoy & "#)) AND CR_IdCredito=" & IdCredito & " AND SU_IdSucursal="
SQL = SQL & session("sucursal")
else
SQL = "SELECT BO_IDBoleta FROM TBoletas WHERE BO_Estatus='E' AND BO_FcRemate=#" & Hoy & "# AND CR_IdCredito=" & IdCredito & " AND SU_IdSucursal=" & session("sucursal")
end if
Set Rs = Session("BDD").Execute(SQL)

while not Rs.EOF
i = i + 1
Liste = Rs("BO_IDBoleta") & "," & Liste
Rs.MoveNext
Wend

Rs.Close
Set Rs = Nothing

RsCR.MoveNext
wend
'termina para cada credito

'actualiza las boletas vencidas
if Len(liste) > 0 Then
Liste = Left(Liste, Len(liste)-1)
Vencida = CStr(i)
Hoy = Date
hoy = Month(Hoy) & "/" & Day(Hoy) & "/" & Year(Hoy)
SQL = "UPDATE TBoletas SET BO_Estatus='V', BO_FcSalida=#" & Hoy & "# WHERE BO_IDBoleta IN (" & Liste & ")"
Session("BDD").Execute(SQL)
End if

'Remate
Liste = ""
i = 0
Hoy = Date
hoy = Month(Hoy) & "/" & Day(Hoy) & "/" & Year(Hoy)
SQL = "SELECT BO_IDBoleta FROM TBoletas WHERE BO_Estatus='V' AND BO_FcRemate=#" & Hoy & "# AND SU_IdSucursal=" & session("sucursal")
Set Rs = Session("BDD").Execute(SQL)
while not Rs.EOF
Liste = Rs("BO_IDBoleta") & "," & Liste
i = i + 1
Rs.MoveNext
Wend

Rs.Close
Set Rs = Nothing

if Len(liste) > 0 Then
Liste = Left(Liste, Len(liste)-1)
Remate = CStr(i)
Hoy = Date
hoy = Month(Hoy) & "/" & Day(Hoy) & "/" & Year(Hoy)
SQL = "UPDATE TBoletas SET BO_Estatus='RM', BO_FcSalida=#" & Hoy & "# WHERE BO_IDBoleta IN (" & Liste & ")"
Session("BDD").Execute(SQL)
End if

Scriptage = "vencidas=" & vencida & "&remate=" & remate

End Function