Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calculate date timestamp Post Reply Post New Topic
Author Message
Liz Williams
Newbie
Newbie
Avatar

Joined: 28 Aug 2009
Location: United States
Online Status: Offline
Posts: 11
Quote Liz Williams Replybullet Topic: Calculate date timestamp
     Posted: 12 Aug 2010 at 11:22am

Dead I need to calculate and provide a report showing if an employee has worked any “double backs” overtime hours.  If an employee works an 8hr shift and returns to work before they’ve had an 8hr rest period in between is considered a double back and requires a special pay rate. Our days run from 12:00am to 11:59pm, being a Casino the start and end times vary by employee.

 

This is the date timestamp files and format.

 

CKTIMHIM.TLATIM (Time In)

CKTIMHIM.TLATOM (Time Out)

  

 Clock In Time       Clock Out Time

20090101155300   20090102002600

20090102165300   20090103011100

20090105155300   20090105223500

 

Thanks in advance for your help.

 

 



Edited by Liz Williams - 12 Aug 2010 at 11:58am
Gamblers Go Broke
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 13 Aug 2010 at 3:46am
local datetimevar clockIn;
local datetimevar clockOut;
local stringvar str;
 
str := {cktimhim.tlatim};
//cdatetime(yyyy,mm,dd,hh,mm,ss)
clockIn := cdatetime(left(str,4), mid(str,5,2), mid(str,7,2), mid(9,2), mid(11,2), mid(13,2));
 
str := {cktimhim.tlatom};
clockOut := cdatetime(left(str,4), mid(str,5,2), mid(str,7,2), mid(9,2), mid(11,2), mid(13,2));
 
 
now you should be able to script your logic.  If you need to reference these value in the next record you can change the local to shared (don't forget to reset them if a group header when the user changes) or you can use the Next()/Previous() functions (again remember to check that they are for the same person).
 
HTH
IP IP Logged
Liz Williams
Newbie
Newbie
Avatar

Joined: 28 Aug 2009
Location: United States
Online Status: Offline
Posts: 11
Quote Liz Williams Replybullet Posted: 13 Aug 2010 at 5:15am

I forgot to mention that these are numer fields, please forgive me but I’m a newbie.

Thanks

Edited by Liz Williams - 13 Aug 2010 at 10:43am
Gamblers Go Broke
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 16 Aug 2010 at 3:18am

alter the str = {table.field} to:

str := totext({table.field}
 
totext will add a decimal point and 2 or 3 zeros onto the end, but since we are going by the position in the string, it won't affect the mid() or the left().
 
you can probably do the math to divide each number by a power of 10 to get the year, month, day, hour, minute, second...which might have to be done...or a cal to val(mid(str,x,y)).
 
lots of ways to skin the cat.
 
HTH
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum