Normal Topic Rounding to the dollar in my formula (Read 709 times)
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Rounding to the dollar in my formula
May 16th, 2005 at 3:04pm
Print Post Print Post  
I have programmed a new field in my database and for some reason, it is rounding to the dollar; not even the nearest dollar i.e.  $ 1,088.87 rounds to $ 1,088;  $ 1,088.25 rounds to $ 1,088 . 

I have checked the fields involved and they are all number fields formatted to two decimal places.

I went as far as inserting the @ROUND statement in my code but to no avail. 

Is there something I am missing ?

Here is my code if it helps.

Thanks,

Louis

var vJancomp as Int
var vNet as Int
var vNet1 as Int      

vJancomp = @ROUND(((ANNSALARY/12) + JANCOMM + JANHOLPAY + JANVACPAY + JANBONUS + JANOTHER), 2)
vNet = @ROUND(vJancomp - 7500.00, 2)
vNet1 = @ROUND(YRENDADVANC, 2)

//CALCULATES ADVANCES FOR THE MONTH
//ADVANCES ONLY PROVIDED TO TC'S AND BASED ON TC EARNING $ 7,500 GROSS BEFORE LOA DEDUCTION


If  DEPT = "ADM" OR DEPT = "CC" OR DEPT = "CS" OR DEPT = "EM" OR DEPT = "MKT" Then
{
     JANADVANCES = 0.00
}

ELSE

IF DEPT = "TC" AND vJancomp < 7500.00 THEN
{
     JANADVANCES = @ROUND(7500.00 - vJancomp, 2)
}
ELSE

IF DEPT = "TC" AND vJancomp > 7500.00 AND YRENDADVANC > 0.00 AND vNet > 0.00 THEN
{
     JANADVANCES = @ROUND(@MIN(vNet,vNet1), 2)  * -1.00
}
ELSE

IF DEPT = "TC" AND vJancomp > 7500.00 THEN
{
     JANADVANCES = 0.00
}


  

Louis Galvao
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Rounding to the dollar in my formula
Reply #1 - May 16th, 2005 at 4:02pm
Print Post Print Post  
Hello Louis,

You have declared vJancomp, vNet, and vNet1 as being of the type integer. Integers can not store decimal places. You will want to declare them as double instead.

Page 47 of the Sesame 1.0 Programming Manual or page 53 of the Sesame 1.1 Programming Manual have the different variable types.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Rounding to the dollar in my formula
Reply #2 - May 16th, 2005 at 4:15pm
Print Post Print Post  
Ray:

I knew you had the answer !  Worked great.

I assumed an Integer was a number that could recognize decimals.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged