Hi everyone,
I have a little job application where I am trying to track employee's hours on a particular job. When the employee puts in their hours worked, I would like to keep a running total because it may be days worth of hours before the job is closed....anywhere I wrote the following code:
<cfquery name="gethrs" datasource="Intranet">
Select woid, hours_worked
From acsjob
where woid = #form.woid#
</cfquery>
<CFSET oldhours="#Gethrs.hours_worked#">
<CFSET newhours="#form.hours_worked#">
<CFTRY>
<CFSET Hours="#NumberFormat(oldhours + newhours, "9999.99")#">
<CFCATCH>
<CFSET Hours="0">
</CFCATCH>
</CFTRY>
What happens is that if someone is in the job to update data other then the hours worked, the code I wrote takes the hours worked and adds them together...so if 30 hours was in the field then it updates it to 60..
Not sure what I am doing wrong. any suggestions would be great. Thanks Sue
I have a little job application where I am trying to track employee's hours on a particular job. When the employee puts in their hours worked, I would like to keep a running total because it may be days worth of hours before the job is closed....anywhere I wrote the following code:
<cfquery name="gethrs" datasource="Intranet">
Select woid, hours_worked
From acsjob
where woid = #form.woid#
</cfquery>
<CFSET oldhours="#Gethrs.hours_worked#">
<CFSET newhours="#form.hours_worked#">
<CFTRY>
<CFSET Hours="#NumberFormat(oldhours + newhours, "9999.99")#">
<CFCATCH>
<CFSET Hours="0">
</CFCATCH>
</CFTRY>
What happens is that if someone is in the job to update data other then the hours worked, the code I wrote takes the hours worked and adds them together...so if 30 hours was in the field then it updates it to 60..
Not sure what I am doing wrong. any suggestions would be great. Thanks Sue