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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check time in formula

Status
Not open for further replies.

deliutza

Programmer
Feb 9, 2005
8
RO
I use in my project VB.NET with sqlserver2000 and Crystalreports.NET,ofcourse.
I have big problems in calculation of the time of work.
I will try to explain in my bad english...I hope that someone will understand what I mean.
I have a formula where I calculated time where I display time when begin and ends work in a normal day of work.
The pause time is between 10:00 - 10:25 (for breakfast...for example) and 13:00-13:20 (for lunch)
Sometimes it happens that a worker doesn't take his pause,so I must check to see if the worker doesn't take his pause and try to calculate his hours of work.
What I make until now is:
Calculate minutes of work in a day:
@minutes of work
\\calcul of minutes for lunch pause
local datetimeVar p3:=Cdatetime("13:00");
local datetimeVar p4:=Cdatetime("13:20");
local numbervar mittag:=DateDiff ("n", p3, p4);

\\calcul of minutes for breakfast pause
local datetimeVar p1:=Cdatetime("10:00");
local datetimeVar p2:=Cdatetime("10:25");
local numbervar freuh:=DateDiff ("n", p1, p2);
\\calcul of a normal work day
local dateTimeVar d1 := {@HourBeg};\\when StartHour begins
local dateTimeVar d2 := {@HourEnd};\\when EndHour ends
local numbervar normal:=DateDiff ("n", d1, d2);

\\I try to put the time values for pausen in a array
datetimevar array Pausen:=[ p1,p2,p3,p4];
if d2=Cdatetime(0,0,0) then 0
else
if tonumber({PAUSEN.FRUEHNICHTGEMACHT})=1 and (d1 in p1 to p2) then normal - freuh
else
normal;

This is not ok.I need to check if time for breakfast pause,for example there is between @Hourbeg to @HourEnd.
An example:
if he work between 08:00-11:00 and he take his pause then his time of work is 180 minutes-25minutes=155 minutes.
Thanks in advance for any kind of help!


 
How do you know if someone has taken their breakfast or lunch pause? Do they record the time? If they enter the time, is there only one datetime field that is used to record all in and out times?

Or is there some other field that tells you whether someone has taken their pauses?

-LB
 
The field who indicates if the pausen was taken or not is
({PAUSEN.FRUEHNICHTGEMACHT})=1 (this is if someone doesn't take breakfast pause 0 if is take it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top