This topic is locked

edit and inline edit

2/25/2009 5:04:43 AM
ASPRunnerPro General questions
A
akira_nagasaki author

i put this code before edit event

'********** CHECK DUPLICATION ************

' put your custom code here
strSQL = "select * from IFSAPP.MV_TRS_ACTIVITIES where " & strWhereClause

Set rsh = CustomQuery(strSQL)

rid=rsh("JOB_ID")

ren=rsh("EMPLOYEE_NO")
'dict("WORKING_DATE")=rsh("WORKING_DATE")

'dict("WEEKEND")=rsh("WEEKEND")
rsh.close: set rsh=nothing
rsh = "select * from IFSAPP.MV_TRS_ACTIVITIES WHERE JOB_ID<>'" & rid & "' and WORKING_DATE='" & dict("WORKING_DATE") & "' and EMPLOYEE_NO='" & ren & "'"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open rsh, dbConnection
while not rsTemp.eof

If (dict("HOUR_START")+ (dict("MINUTE_START")/60))>=(rsTemp("HOUR_START")+(rsTemp("MINUTE_START")/60)) and (dict("HOUR_START")+ (dict("MINUTE_START")/60))<(rsTemp("HOUR_FINISH")+(rsTemp("MINUTE_FINISH")/60)) or (dict("HOUR_FINISH") + (dict("MINUTE_FINISH")/60))>(rsTemp("HOUR_START")+(rsTemp("MINUTE_START")/60)) and (dict("HOUR_FINISH")+ (dict("MINUTE_FINISH")/60))<(rsTemp("HOUR_FINISH")+(rsTemp("MINUTE_FINISH")/60)) or (dict("HOUR_START")+ (dict("MINUTE_START")/60))<=(rsTemp("HOUR_START")+(rsTemp("MINUTE_START")/60))and (dict("HOUR_FINISH")+ (dict("MINUTE_FINISH")/60))>=(rsTemp("HOUR_FINISH")+(rsTemp("MINUTE_FINISH")/60))then

Response.Write "Error Input Time!"

BeforeEdit = False

rsTemp.close

exit function

end if

rsTemp.movenext

wend

rsTemp.close: set rsTemp=nothing
'********** TIME CALCULATION************

' put your custom code here
dict("DATE_APPROVED_SUPERVISOR") = Now()

dict("APPROVED_BY_S") = Session("UserID")
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 stime>etime then

Response.Write "Error Input Time!"

BeforeEdit = False

exit function

else

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!"

'BeforeAdd = False

'exit function

if 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!"

'BeforeAdd = False

'exit function

'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!"

'BeforeAdd = False

'exit function

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

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime

end if

end if

end if

case "SATURDAY"

if stime>etime then

Response.Write "Error Input Time!"

BeforeEdit = False

exit function

else

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime

end if
case "SUNDAY"

if stime>etime then

Response.Write "Error Input Time!"

BeforeEdit = False

exit function

else

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime

end if
case "PUBLIC HOLIDAY"

if stime>etime then

Response.Write "Error Input Time!"

BeforeEdit = False

exit function

else

dict("ACTUAL_TIME") = etime-stime

dict ("EXTRA_TIME") = etime-stime

end if

end select
BeforeEdit = True


the problem is the code is working fine in edit page.. but got error when update using inline edit. all the field below become empty. how to put case : if edit or inline edit? so i can make the code works only if user update using edit not inline edit
under list page, this is the field that i didn't put and it's become blank when update using inline edit.
field("WEEKEND")

field("HOUR_START")

field("MINUTE_START")

field("HOUR_FINISH")

field("MINUTE_FINISH")
field("WORKING_DATE") is list on the list page.. this field also getting blank when i update using inline edit..

J
Jane 3/3/2009

Hi,
here is a sample:

if inline=false then

...

end if

A
akira_nagasaki author 3/4/2009

Hi,

here is a sample:


hi jane, thanks. :-)
it's working perfectly now