Hi,
I am brand new to Crystal so please bear with me :-)
I need to calculate and display an hourly longevity amount based on an employee's years of service. I'm connecting to a SQL view called AAIASALRPT. Among the fields in the view are one called adj_service_date (which is the date the employee started) and a field called hourtype (which may contain one of 4 values: lls, lr, coor or null). Each employee has an adj_service_date and a value or null in the hourtype field.
The longevity is based on the number of years of service (see below in the code) and will vary depending on which hourtype and number of years the employee has.
Here is the code that I've been trying to make work but obviously it doesn't. With this code I get the message "The ) is missing".
Any help with this code or pointers on what I should do to display the correct value for years of service (yos) would be greatly appreciated.
local NumberVar yos;
yos := truncate ((datediff("d",{AAIASALRPT.adj_service_date},currentdate)) / 365);
if {AAIASALRPT.HOURTYPE} = 'lls'
then
(if (yos >=5) and (yos <10)
then (.10)
if (yos >=10) and (yos <15)
then (.15)
if (yos >=15) and (yos <20)
then (.20)
if (yos >=20)
then (.25))
else if {AAIASALRPT.HOURTYPE} = 'lr'
then
(if (yos >=5) and (yos <10)
then (.50)
if (yos >=10) and (yos <15)
then (..55)
if (yos >=15) and (yos <20)
then (.60)
if (yos >=20)
then (.65))
else if {AAIASALRPT.HOURTYPE} = 'coor'
then
(if (yos >=5) and (yos <10)
then (.75)
if (yos >=10) and (yos <15)
then (.80)
if (yos >=15) and (yos <20)
then (.85)
if (yos >=20)
then (.90))
else (0.00);