# Calculate Vacation time

Hello,

I need to be able to calculate vaction time in hours and quarter hours - holidays - weekends  and taking in to account a maxium total of 8 hours per day with my result rounded to the nearest quarter hour

So an entry of StartDate 04/26/2002 Starttime 08:00
EndDate   04/29/2002 Endtime 12:30

Would result in 12.5 hours.

I am currently calling holidays like this
'Get the list of Holidays
Set hookview = db.GetView("Holidays")
Set hookdoc = hookview.GetDocumentByKey("Holidays",True)

###### Who is Participating?

Commented:
Here is a prototype for you,

sTime := [8:00 AM];
eTime := [5:00 PM];
StartDate := [04/26/2002 08:00:00];
EndDate := [04/30/2002 12:30:00];
@if( StartDate > EndDate; @Return(0); "" );

diffDays := @integer((EndDate - StartDate) / 86400) + 1;
strtDay := @Modulo(@Weekday(StartDate); 7);
endDay := @Modulo(@Weekday(EndDate); 7);
days := (diffDays - endDay + strtDay - 8) * 5 / 7 - @Max(-2; -strtDay) - @Min(1; endDay) + 5 - strtDay + endDay;
sTimeD := @Time(eTime) - @time(StartDate);
eTimeD := @Time(EndDate) - @time(sTime);
sTimeDiff := @if( sTimeD < 0; 0; sTimeD)/3600;
eTimeDiff := @if( eTimeD < 0; 0; eTimeD/3600);

total :=  (days-1) * 8 + eTimeDiff ;

@Prompt([OK]; "Total vacation hours" ;  @Text(total) )

~Hemanth
0

Commented:
Zvonko !!!
This is yours buddy!  I hate time calculations...
:-)
Arun.
0

Application EngineerCommented:
Nice Hemanth,

I would do this using LotusScript.

kplew,
Are the holidays registered in the Domino Directory ? (I'm supposing you're using R5).

If so, I can write a script to do the calculations for you. If not, you need to keep the holidays somewhere else and get them from there. Let me know how and where you keep the holidays for your company and I will write the script for you.
0

Commented:
Any progress ?
0

Application EngineerCommented:
None, I suppose :-)
0

Systems architectCommented:
kplew,
No comment has been added to this question in more than 717 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

RECOMMENDATION: Award points to HemanthaKumar http:#6972295

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Zvonko
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.