OK - It may not be so much that I'm struggling but moreso that I'm just completely lost.
I have a function that finds a value based on a date "asofdate" what I'm looking to do is find the value that the function would return for each of the days of the year. Then once I have all 365/366 values, I'd like to base another function off of those values.
For example: This is my function for finding which "step" an employee is at which changes based on years in position and contractual dates. Since this number can change at any given time, I'd like to have a list of what step a given employee would be at for every day of the year. This way I can base a "salary" calculation off of each of the returned "step" values to find what an employee's salary will be for every day of the year.
Here is my code for the step function:
I highlighted where the date is used.
I messed around with coming up with an array, but I don't know how to go about storing these values and reusing them in another function
Any help would be appreciated!
I have a function that finds a value based on a date "asofdate" what I'm looking to do is find the value that the function would return for each of the days of the year. Then once I have all 365/366 values, I'd like to base another function off of those values.
For example: This is my function for finding which "step" an employee is at which changes based on years in position and contractual dates. Since this number can change at any given time, I'd like to have a list of what step a given employee would be at for every day of the year. This way I can base a "salary" calculation off of each of the returned "step" values to find what an employee's salary will be for every day of the year.
Here is my code for the step function:
I highlighted where the date is used.
Code:
Function funEmpStep(blnOvrd As Boolean, bytStpOvrd As Byte, bytEmpUnion As Byte, _
strStpAnvDt, bytStp As Byte, dtPosStrt As Date, [COLOR=red]asOfDate As Date[/COLOR], _
bytTtlSteps As Byte)
Dim AnnivDate As Date, AnnivStep As Byte
'No Union or Union without Steps
If Nz(bytEmpUnion, 0) = 0 Then
'Step Override applies
If blnOvrd = -1 Then
funEmpStep = bytStpOvrd
'No Step Override
Else
funEmpStep = "N/A"
End If
'In Union with Steps
Else
Select Case Nz(strStpAnvDt, "N/A")
'No anniversary date
Case "N/A"
If (Nz(bytStp, 0) + bytStpOvrd) >= Nz(bytTtlSteps, (Nz(bytStp, 0) + bytStpOvrd)) Then
funEmpStep = Nz(bytTtlSteps, (Nz(bytStp, 0) + bytStpOvrd))
Else
funEmpStep = Fix(Nz(bytStp, 0) + bytStpOvrd)
End If
'Anniversary date
Case Else
AnnivDate = IIf(DateSerial(Year(dtPosStrt), Left(strStpAnvDt, 2), Right(strStpAnvDt, 2)) < dtPosStrt, _
DateSerial(Year(dtPosStrt) + 1, Left(strStpAnvDt, 2), Right(strStpAnvDt, 2)), _
DateSerial(Year(dtPosStrt), Left(strStpAnvDt, 2), Right(strStpAnvDt, 2)))
AnnivStep = (([COLOR=red]asOfDate[/COLOR] - AnnivDate) / 365.25) + bytStpOvrd
If (AnnivStep + bytStpOvrd) >= bytTtlSteps Then
funEmpStep = bytTtlSteps
Else
funEmpStep = Fix(AnnivStep + bytStpOvrd)
End If
End Select
End If
End Function
I messed around with coming up with an array, but I don't know how to go about storing these values and reusing them in another function
Any help would be appreciated!