Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/05/2008, 10:54
Avatar de mrjhon
mrjhon
 
Fecha de Ingreso: junio-2005
Mensajes: 155
Antigüedad: 19 años, 10 meses
Puntos: 0
Hacer diferencia entre una hora y otra ora...

hola amigos como estan.. bueno a lo que vinimos..
bueno tengo el siguiente problema estoy haciendo unprogramita para un internet en baces de datos acces.
entonces cuando yo quiero mostar el tiempo en que la persona inicia en internet y cuando voy a mostar el tiempo en que termina.. ahy es donde tengo el error., me sale siempre un ocho .... y no se como organizar esto ahyy voy a postear todos los codigos que tengo del problema.. es urgente graicas..

4 INTERNET 1 Reprog.
H.INI TIME H.FIN
11:29 30 8 11: <<<<<< este es el error. y me debe salir 11:59 . como lo organizo.. gracias de nuevo

<%@ LANGUAGE="VBSCRIPT" %>

<title>THeka2</title>
</head>

<body bgcolor="#2080A0">

<div align="center">
<%
Fech=Date()

REQMET = Request.ServerVariables("REQUEST_METHOD")

If REQMET = "POST" Then
T3=request.form("Temp")
T3A=Left(T3,5)
Pro =request.form("Lista1")

Set DB=Server.CreateObject("ADODB.Connection")
DB.Open "TELEFON"," ","digdream"

Busca= "SELECT * FROM Inter1"
Set Encontro=DB.Execute(Busca)

While not Encontro.eof

Ini=Encontro("TiempoIni")
Fin=Encontro("TiempoFin")
NPro=Encontro("TiempoTot")
Aho=Date&" "&Ini

Encontro.Movenext
Wend
If Fin="6:00:00" Then
T3A=Left(Ini,5)
If NPro=10000 Then
Final=Time()
Fin1=Fech&" "&Final
Ini1=Fech&" "&Ini
NPro=DateDiff("n",Ini1,Fin1)
End If
Hor=CInt(NPro)+CInt(Pro)
Tempo=DateAdd("n",Hor,Aho)
Tiemp1=Mid(Tempo,10,5)

ReGuarda= "UPDATE Inter1 SET TiempoTot=" & Hor & ""
Set ReAccion = DB.Execute(ReGuarda)

If Hor=10000 Then
Hor="OPEN"
Tiemp1=0
End If
Encontro.Close%>

<table border="1" cellpadding="1" cellspacing="0" width="100%" >
<tr>
<td><p align="left"><a href="THeka5.asp" STYLE="COLOR:#202060; TEXT-DECORATION:NONE";>
<font size="2.5" face="Arial Black">&nbsp;4</font></a></p></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;INTERNET 1</big></sup></font></td>
<td><p align="left"><a href="Heka2a.asp" STYLE="COLOR:#C0C0C0; TEXT-DECORATION:NONE";>
<font size="2.5" face="Arial Black">&nbsp;Reprog.</font></a></p></td>
</tr>
</table>

<table border="1" cellpadding="1" cellspacing="0" width="100%" >
<tr>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;H.INI</big></sup></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;TIME</big></sup></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;H.FIN</big></sup></font></td>
</tr>
<tr>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><big>&nbsp;<%=T3A%></big></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><big>&nbsp;<%=Hor%></big></font></td>
<td><font size="2.5" face="Arial Black" color="#202060"><big>&nbsp;<%=Tiemp1%></big></font></td>
</tr>
</table>

<%Else
If Pro="OPEN" Then
Pro=10000
End If
Guarda= "INSERT INTO Inter1 (TiempoIni,TiempoFin,TiempoTot)"
Guarda= Guarda & "VALUES ('" & T3 & "','6:00'," & Pro & ")"
Set Accion = DB.Execute(Guarda)%>
<table border="1" cellpadding="1" cellspacing="0" width="100%" >
<tr>
<td><p align="left"><a href="THeka5.asp" STYLE="COLOR:#202060; TEXT-DECORATION:NONE";>
<font size="2.5" face="Arial Black">&nbsp;4</font></a></p></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;INTERNET 1</big></sup></font></td>
<td><p align="left"><a href="Heka2a.asp" STYLE="COLOR:#C0C0C0; TEXT-DECORATION:NONE";>
<font size="2.5" face="Arial Black">&nbsp;Reprog.</font></a></p></td>
</tr>
</table>
<table border="1" cellpadding="1" cellspacing="0" width="100%" >
<tr>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;H.INI</big></sup></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;TIME</big></sup></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;H.FIN</big></sup></font></td>
</tr>
<% Select case Pro
Case "10000"
Hor="OPEN"
Tiemp1=0
Case "60"
Hor=Pro
Tempo=DateAdd("h",1,Now())
Tiemp1=Mid(Tempo,10,5)
Case Else
Hor=CInt(Pro)
Tempo=DateAdd("n",Hor,Now())
Tiemp1=Mid(Tempo,10,5)
End Select

etc....

cuando le doy a programar me sale este pagina y este es el codigo

<%@ LANGUAGE="VBSCRIPT" %>

<title>Heka2</title>
</head>

<%
Tiemp=Time()
Tiemp1=Left(Time(),5)
%>
<table border="1" cellpadding="1" cellspacing="0" width="100%" ><form METHOD="POST" ACTION="THeka2.asp" name="Form16">
<input type="hidden" name="Temp" value="<%=Tiemp%>">
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>HORA ACT.</big></sup></font></td>
<td><center><font size="2.5" face="Arial Black" color="#202060"><sup><big><%=Tiemp1%></big></sup></font></center></td>
</tr>
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>PROG</big></sup></font></td>
<td><center><select name="lista1">
<option>15
<option selected>30
<option>60
<option>OPEN
</select></center></td>

etc...

este es el que tengo cuando le doy continuar algun tiempo 30 - 60 - o abierto o finalizar el tiempo y me sale el resultado en pesos = dinero

<title>Heka2</title>

<%
Tiemp=Time()
Tiemp1=Left(Time(),5)
%>
<table border="1" cellpadding="1" cellspacing="0" width="100%" ><form METHOD="POST" ACTION="THeka2.asp" name="Form16">
<input type="hidden" name="Temp" value="<%=Tiemp%>">
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>HORA ACT.</big></sup></font></td>
<td><center><font size="2.5" face="Arial Black" color="#202060"><sup><big><%=Tiemp1%></big></sup></font></center></td>
</tr>
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>PROG</big></sup></font></td>
<td><center><select name="lista1">
<option>15
<option selected>30
<option>60
<option>OPEN
</select></center></td>
</tr>

etc...

este es para reprogramar el tiempo en caso de reiniciar la pagina o se cierre el programa..

<%@ LANGUAGE="VBSCRIPT" %>
<%Response.Buffer = True %>
<title>Heka2c</title>

Set DB=Server.CreateObject("ADODB.Connection")
DB.Open "TELEFON"," ","digdream"

Busca= "SELECT * FROM Inter1"
Set Encontro=DB.Execute(Busca)

While not Encontro.eof

Ini=Encontro("TiempoIni")
Fin=Encontro("TiempoFin")
Pro=Encontro("TiempoTot")

Encontro.MoveNext
Wend

If Fin="6:00:00" Then

Saca= "UPDATE Inter1 SET TiempoTot='0'"
Set ReSaca=DB.Execute(Saca) %>


<% DB.Close

Else

Response.Clear
Response.Redirect "THeka2.asp"

End If%>
y este es el otro codigo

<%@ LANGUAGE="VBSCRIPT" %>

<title>HEKA2B</title>

<%
F1 = request.form("F1")
F2 = request.form("F2")

if F1 = "ON" and not F2 = "ON" then
%>

<table border="1" cellpadding="1" cellspacing="0" width="100%" ><form METHOD="POST" ACTION="THeka2.asp" name="Form16">
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>PROG</big></sup></font></td>
<td><center><select name="lista1">
<option>15
<option selected>30
<option>60
<option>OPEN
</select></center></td>

<%Else

if F2= "ON" and not F1="ON" then

Set DB=Server.CreateObject("ADODB.Connection")
DB.Open "TELEFON"," ","digdream"

Sacar= "SELECT TiempoIni,TiempoFin,TiempoTot FROM Inter1"
Set Encont=DB.Execute(Sacar)

While not Encont.eof

Fin=Encont("TiempoFin")
Dest=Encont("TiempoTot")
Ini=Encont("TiempoIni")

Encont.MoveNext
Wend

Fech=Date()
Final=Time()
Fin1=Fech&" "&Final
Ini1=Fech&" "&Ini
Gap=DateDiff("n",Ini1,Fin1)

if Dest="OPEN" Then
Dest=Gap
End if

VR1=Int(Gap/60)
VR2=Gap-(VR1*60)

Buscar= "SELECT Valor FROM PrecioInter WHERE Descripcion='Hor'"
Set Resultar = DB.Execute(Buscar)

Preh=Resultar("Valor")
Resultar.Close

If VR2>3 And VR2<=18 Then

Buscar1= "SELECT Valor FROM PrecioInter WHERE Descripcion='Qto'"
Set Resulta = DB.Execute(Buscar1)
Prem=Resulta("Valor")
Resulta.Close

End if
If VR2>18 And VR2<=33 Then
Buscar1= "SELECT Valor FROM PrecioInter WHERE Descripcion='Med'"
Set Resulta = DB.Execute(Buscar1)
Prem=Resulta("Valor")
Resulta.Close
End if
If VR2>33 And VR2<=48 Then
Buscar1= "SELECT Valor FROM PrecioInter WHERE Descripcion='Tqto'"
Set Resulta = DB.Execute(Buscar1)
Prem=Resulta("Valor")
Resulta.Close
End If
If VR2>48 And VR2<=59 Then
Prem=Preh
End If
Tot=(VR1*Preh)+Prem
Subt=Tot/1.16
Tax=(Subt*16)/100


Guarda= "INSERT INTO Internet(CodItem, Pc, TiempoIni, TiempoFin, TiempoTot, Subtotal, iva, Valor, Fecha)"
Guarda= Guarda & "VALUES('GC02','Heka2','" & Ini & "','" & Final & "','" & Gap & "','" & Subt & "','" & Tax & "','" & Tot & "','" & Fech & "')"
Set ReAccion = DB.Execute(Guarda)

Saca= "DELETE FROM Inter1 WHERE TiempoTot=" & Dest & ""
Set ReSaca=DB.Execute(Saca)%>

<etc...

gracias de antemano por la ayuda que me puedan brindar y perdonen postear todos esos codigos pero es para una mejor guia de mi error gracias....