Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adjusting clock in time

Status
Not open for further replies.
Jul 17, 2003
66
0
0
US
I have a SQlserver table with the following fields. Emp_id, clock_in, clock_out, and hours_worked. Clock_in and _out are datetime fields.

On my report I want to show the clock_in time as 7:00 if they clocked in between 6 and 7.

Also, if the clock_in time is set to 7 I obviously need to recalculate the hours_worked.

I assume I need two formulas to accomplish this, one for adjusted clock_in and one for adjusted hours_worked. I just need help creating them.

Thanks for any help ...

I'm using Crystal 8.5 and SQlserver 7.0.
 
Hi,
Do you really want to 'steal' up to 59 minutes of working time from an employee?

Anyway,use you could the Time() function to check and make the needed adjustments:
If Time({clock_in}) in 6:00:00 to 7:00:00 then 7
else
etc...

Use the output of this to compute hours worked..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
That formula gives me an error that the keyword then is missing.

I need more detailed information than that to complete these two formulas.





 
Here's a formula to convert clock-in time:
@Clock-in
Code:
DateTimeVar clockin := {Orders.Ship Date} ;
if Hour(clockin) in 6 to 7 then 
DateTime (Date(clockin),Time(7,0,0) )
else
clockin

Obviously, you'd need to replace the {Orders.Ship Date} field with your own original Clock-in field.

Then to calc the work hours, you'd use something like this:
Code:
Local DateTimeVar clockout := {@ClockOut} ;
DateDiff( 'h',{@Clock-in}, clockout)
Again, you'd replace {@ClockOut} with your clock-out field.
Note that this will return a whole number in hours. I'm not sure if that's what you want.


Bob Suruncle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top