PC Review


Reply
Thread Tools Rate Thread

Break on Calendar Year

 
 
=?Utf-8?B?Q2xheW1hbg==?=
Guest
Posts: n/a
 
      20th Aug 2007
I posted this in July under "Calculating Vacation" without a resonse. I
thought I had it working, but was tripped up when we went live. Any
assistance would be greatly appreciated.

I'm trying to calculate vacation accrual with the following specs:
- No vacation accrued for first 180 days
- After 180 days, 1.54 hours per week until calendar year break
- From first calendar year break it's incremental.

I've got the incremental down and my system works great if the employee was
hired before January 1, 2006.

Here is the code I'm using:

Select Case anniv
Case Is < 2
LAccrualRate = 1.54
' Calculate day of last day of hire year
DtEndOfYear = CDate("12/31/" & CStr(Year(hiredate)))
LCountDays = Day(DtEndOfYear) - Day(hiredate)
' Check to see if 180 days elapsed between hiredate and end of hire year
If LCountDays > 180 Then
' if so, was employee hired last year?
If Year(hiredate) < Year(Now) Then
' if so, hours accrued = 80
LHoursRemain = 80
Else
' if not, hours accrued = weeks * 1.54
LWeeksWorked = LCountDays / 7
LHoursRemain = LWeeksWorked * 1.54
End If
Else
' if 180 days not elapsed, hours accrued=0
LHoursRemain = 0
End If
Case 2 To 4
LHoursRemain = 80
LAccrualRate = 1.54
Case 5 To 14
LHoursRemain = 120
LAccrualRate = 2.31
Case Is > 14
LHoursRemain = 160
LAccrualRate = 3.08
End Select

--
Adios,
Clay Harryman
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      20th Aug 2007
You have an error in this line

from:
LCountDays = day(DtEndOfYea)r - day(hiredate)
to:
LCountDays = DtEndOfYear - hiredate


If you wqant an integer then
LCountDays = int(DtEndOfYear - hiredate)


"Clayman" wrote:

> I posted this in July under "Calculating Vacation" without a resonse. I
> thought I had it working, but was tripped up when we went live. Any
> assistance would be greatly appreciated.
>
> I'm trying to calculate vacation accrual with the following specs:
> - No vacation accrued for first 180 days
> - After 180 days, 1.54 hours per week until calendar year break
> - From first calendar year break it's incremental.
>
> I've got the incremental down and my system works great if the employee was
> hired before January 1, 2006.
>
> Here is the code I'm using:
>
> Select Case anniv
> Case Is < 2
> LAccrualRate = 1.54
> ' Calculate day of last day of hire year
> DtEndOfYear = CDate("12/31/" & CStr(Year(hiredate)))
> LCountDays = Day(DtEndOfYear) - Day(hiredate)
> ' Check to see if 180 days elapsed between hiredate and end of hire year
> If LCountDays > 180 Then
> ' if so, was employee hired last year?
> If Year(hiredate) < Year(Now) Then
> ' if so, hours accrued = 80
> LHoursRemain = 80
> Else
> ' if not, hours accrued = weeks * 1.54
> LWeeksWorked = LCountDays / 7
> LHoursRemain = LWeeksWorked * 1.54
> End If
> Else
> ' if 180 days not elapsed, hours accrued=0
> LHoursRemain = 0
> End If
> Case 2 To 4
> LHoursRemain = 80
> LAccrualRate = 1.54
> Case 5 To 14
> LHoursRemain = 120
> LAccrualRate = 2.31
> Case Is > 14
> LHoursRemain = 160
> LAccrualRate = 3.08
> End Select
>
> --
> Adios,
> Clay Harryman

 
Reply With Quote
 
=?Utf-8?B?Q2xheW1hbg==?=
Guest
Posts: n/a
 
      20th Aug 2007
Will the int(LCountDays) return a number of days that I can compare with 180?

I was thinking that day(x) would return the day of the year. After reading
your reply, I looked it up. It returns the day of the month.
--
Adios,
Clay Harryman


"Joel" wrote:

> You have an error in this line
>
> from:
> LCountDays = day(DtEndOfYea)r - day(hiredate)
> to:
> LCountDays = DtEndOfYear - hiredate
>
>
> If you wqant an integer then
> LCountDays = int(DtEndOfYear - hiredate)
>
>
> "Clayman" wrote:
>
> > I posted this in July under "Calculating Vacation" without a resonse. I
> > thought I had it working, but was tripped up when we went live. Any
> > assistance would be greatly appreciated.
> >
> > I'm trying to calculate vacation accrual with the following specs:
> > - No vacation accrued for first 180 days
> > - After 180 days, 1.54 hours per week until calendar year break
> > - From first calendar year break it's incremental.
> >
> > I've got the incremental down and my system works great if the employee was
> > hired before January 1, 2006.
> >
> > Here is the code I'm using:
> >
> > Select Case anniv
> > Case Is < 2
> > LAccrualRate = 1.54
> > ' Calculate day of last day of hire year
> > DtEndOfYear = CDate("12/31/" & CStr(Year(hiredate)))
> > LCountDays = Day(DtEndOfYear) - Day(hiredate)
> > ' Check to see if 180 days elapsed between hiredate and end of hire year
> > If LCountDays > 180 Then
> > ' if so, was employee hired last year?
> > If Year(hiredate) < Year(Now) Then
> > ' if so, hours accrued = 80
> > LHoursRemain = 80
> > Else
> > ' if not, hours accrued = weeks * 1.54
> > LWeeksWorked = LCountDays / 7
> > LHoursRemain = LWeeksWorked * 1.54
> > End If
> > Else
> > ' if 180 days not elapsed, hours accrued=0
> > LHoursRemain = 0
> > End If
> > Case 2 To 4
> > LHoursRemain = 80
> > LAccrualRate = 1.54
> > Case 5 To 14
> > LHoursRemain = 120
> > LAccrualRate = 2.31
> > Case Is > 14
> > LHoursRemain = 160
> > LAccrualRate = 3.08
> > End Select
> >
> > --
> > Adios,
> > Clay Harryman

 
Reply With Quote
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      20th Aug 2007
Yes, int can be compared to 180 but it rounds the number down. Not sure if
you want to go up or down one day.

"Clayman" wrote:

> Will the int(LCountDays) return a number of days that I can compare with 180?
>
> I was thinking that day(x) would return the day of the year. After reading
> your reply, I looked it up. It returns the day of the month.
> --
> Adios,
> Clay Harryman
>
>
> "Joel" wrote:
>
> > You have an error in this line
> >
> > from:
> > LCountDays = day(DtEndOfYea)r - day(hiredate)
> > to:
> > LCountDays = DtEndOfYear - hiredate
> >
> >
> > If you wqant an integer then
> > LCountDays = int(DtEndOfYear - hiredate)
> >
> >
> > "Clayman" wrote:
> >
> > > I posted this in July under "Calculating Vacation" without a resonse. I
> > > thought I had it working, but was tripped up when we went live. Any
> > > assistance would be greatly appreciated.
> > >
> > > I'm trying to calculate vacation accrual with the following specs:
> > > - No vacation accrued for first 180 days
> > > - After 180 days, 1.54 hours per week until calendar year break
> > > - From first calendar year break it's incremental.
> > >
> > > I've got the incremental down and my system works great if the employee was
> > > hired before January 1, 2006.
> > >
> > > Here is the code I'm using:
> > >
> > > Select Case anniv
> > > Case Is < 2
> > > LAccrualRate = 1.54
> > > ' Calculate day of last day of hire year
> > > DtEndOfYear = CDate("12/31/" & CStr(Year(hiredate)))
> > > LCountDays = Day(DtEndOfYear) - Day(hiredate)
> > > ' Check to see if 180 days elapsed between hiredate and end of hire year
> > > If LCountDays > 180 Then
> > > ' if so, was employee hired last year?
> > > If Year(hiredate) < Year(Now) Then
> > > ' if so, hours accrued = 80
> > > LHoursRemain = 80
> > > Else
> > > ' if not, hours accrued = weeks * 1.54
> > > LWeeksWorked = LCountDays / 7
> > > LHoursRemain = LWeeksWorked * 1.54
> > > End If
> > > Else
> > > ' if 180 days not elapsed, hours accrued=0
> > > LHoursRemain = 0
> > > End If
> > > Case 2 To 4
> > > LHoursRemain = 80
> > > LAccrualRate = 1.54
> > > Case 5 To 14
> > > LHoursRemain = 120
> > > LAccrualRate = 2.31
> > > Case Is > 14
> > > LHoursRemain = 160
> > > LAccrualRate = 3.08
> > > End Select
> > >
> > > --
> > > Adios,
> > > Clay Harryman

 
Reply With Quote
 
=?Utf-8?B?Q2xheW1hbg==?=
Guest
Posts: n/a
 
      20th Aug 2007
Thank you, Joel.
Since I'll be dividing the number by 7 (the accrual rate is by week rather
than day), one day either way won't impact the end result too severely.

I've marked this as the answer.
--
Adios,
Clay Harryman


"Joel" wrote:

> Yes, int can be compared to 180 but it rounds the number down. Not sure if
> you want to go up or down one day.
>
> "Clayman" wrote:
>
> > Will the int(LCountDays) return a number of days that I can compare with 180?
> >
> > I was thinking that day(x) would return the day of the year. After reading
> > your reply, I looked it up. It returns the day of the month.
> > --
> > Adios,
> > Clay Harryman
> >
> >
> > "Joel" wrote:
> >
> > > You have an error in this line
> > >
> > > from:
> > > LCountDays = day(DtEndOfYea)r - day(hiredate)
> > > to:
> > > LCountDays = DtEndOfYear - hiredate
> > >
> > >
> > > If you wqant an integer then
> > > LCountDays = int(DtEndOfYear - hiredate)
> > >
> > >
> > > "Clayman" wrote:
> > >
> > > > I posted this in July under "Calculating Vacation" without a resonse. I
> > > > thought I had it working, but was tripped up when we went live. Any
> > > > assistance would be greatly appreciated.
> > > >
> > > > I'm trying to calculate vacation accrual with the following specs:
> > > > - No vacation accrued for first 180 days
> > > > - After 180 days, 1.54 hours per week until calendar year break
> > > > - From first calendar year break it's incremental.
> > > >
> > > > I've got the incremental down and my system works great if the employee was
> > > > hired before January 1, 2006.
> > > >
> > > > Here is the code I'm using:
> > > >
> > > > Select Case anniv
> > > > Case Is < 2
> > > > LAccrualRate = 1.54
> > > > ' Calculate day of last day of hire year
> > > > DtEndOfYear = CDate("12/31/" & CStr(Year(hiredate)))
> > > > LCountDays = Day(DtEndOfYear) - Day(hiredate)
> > > > ' Check to see if 180 days elapsed between hiredate and end of hire year
> > > > If LCountDays > 180 Then
> > > > ' if so, was employee hired last year?
> > > > If Year(hiredate) < Year(Now) Then
> > > > ' if so, hours accrued = 80
> > > > LHoursRemain = 80
> > > > Else
> > > > ' if not, hours accrued = weeks * 1.54
> > > > LWeeksWorked = LCountDays / 7
> > > > LHoursRemain = LWeeksWorked * 1.54
> > > > End If
> > > > Else
> > > > ' if 180 days not elapsed, hours accrued=0
> > > > LHoursRemain = 0
> > > > End If
> > > > Case 2 To 4
> > > > LHoursRemain = 80
> > > > LAccrualRate = 1.54
> > > > Case 5 To 14
> > > > LHoursRemain = 120
> > > > LAccrualRate = 2.31
> > > > Case Is > 14
> > > > LHoursRemain = 160
> > > > LAccrualRate = 3.08
> > > > End Select
> > > >
> > > > --
> > > > Adios,
> > > > Clay Harryman

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying the months on a graph by fiscal year not calendar year SMT Microsoft Access Queries 1 11th Feb 2008 10:59 PM
Program Year vs Calendar Year - Tracking the weeks Simon Jester Microsoft Access Queries 1 4th May 2007 03:26 AM
Can you print year calendar in Outlook (2002)? I mean a full year. =?Utf-8?B?dGVycnlyYg==?= Microsoft Outlook Discussion 1 14th Apr 2005 02:07 AM
Can I transfer my birthdays from year to year in a Word calendar? =?Utf-8?B?ZGVuemJ1bmNo?= Microsoft Word Document Management 1 17th Dec 2004 04:59 PM
Grouping data by fiscal year not calendar year Ted Hall Microsoft Access 1 26th Nov 2003 11:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:51 AM.