This topic is locked

calculate time field

2/12/2009 3:53:23 AM
ASPRunnerPro General questions
A
akira_nagasaki author

i have field name
HOUR_START

MINUTE_START
HOUR_FINISH

MINUTE_FINISH
START_TIME =CONCAT(HOUR_START,MINUTE_START)

FINISH_TIME =CONCAT(HOUR_FINISH,MINUTE_FINISH
how can i calculate the time.
Let say,
START_TIME = 10.00

FINISH_TIME = 16.15

ACTUAL_TIME = 6.25

EXTRA_TIME = 0.00
I also have Field Name ACTUAL_TIME and EXTRA_TIME
ACTUAL_TIME = FINISH_TIME - START_TIME
EXTRA_TIME = FINISH_TIME - START_TIME IF START_TIME > 17.30 OR FINISH_TIME > 17.30
Can anyone help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=10897&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />

A
akira_nagasaki author 2/17/2009

i found the solution
i put this script before add/ before edit

dim stime

dim etime
stime = dict("HOUR_START") + (dict("MINUTE_START")/60)

etime = dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60)
select case dict("WEEKEND")
case "WEEKDAY"

if dict("HOUR_START") + (dict("MINUTE_START")/60)< 8.5 then

if dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) < 8.5 then

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime

elseif dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) =>8.5 and dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) <= 17.5 then

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = "8.50"-stime

elseif dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60)> 17.5 then

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = ("8.50"-stime) + (etime-"17.50")

end if



elseif dict("HOUR_START") + (dict("MINUTE_START")/60)=> 8.5 and dict("HOUR_START") + (dict("MINUTE_START")/60) <= 17.5 then

if dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) < 8.5 then

Response.Write "Error Input Time!"

elseif dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) => 8.5 and dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) <= 17.5 then

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = "0.00"

elseif dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60)> 17.5 then

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-"17.50"

end if
elseif dict("HOUR_START") + (dict("MINUTE_START")/60)> 17.5 then

if dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) <8.5 then

Response.Write "Error Input Time!"

elseif dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) => 8.5 and dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60) <= 17.5 then

Response.Write "Error Input Time!"

elseif dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60)> 17.5 then

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime

end if

end if
case "SATURDAY"

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime
case "SUNDAY"

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime
case "PUBLIC HOLIDAY"

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime

end select


my problem only one, how can i make it alert or disable it from insert into the table
right now, the error is appear on the top of the page but data still insert in database. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37865&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />