Code to compute Price INCL of VAT [message #541236] |
Mon, 30 January 2012 03:07 |
Maverick27
Messages: 84 Registered: October 2008
|
Member |
|
|
HI - i have a Field item on my report which i would like to show "Price INCL of VAT". Can somebody pls give me the PL/SQL code or trigger to do this? VAT is 16%
I'm a Forms programmer, not so familiar with Reports.
I suspect, it should be something like this:
F_1 := F_1 * 1.16
Thanks
|
|
|
|
|
Re: Code to compute Price INCL of VAT [message #541242 is a reply to message #541237] |
Mon, 30 January 2012 03:38 |
Maverick27
Messages: 84 Registered: October 2008
|
Member |
|
|
Hi littlefoot - thanks for quick response.
We are not storing VAT in the database, so it's OK to hardcode.
Do i simply right click the field, goto PL/SQL editor; copy & paste the code return (:price * 1.16); btwn Begin & End ?
|
|
|
|
|
|
|
|
Re: Code to compute Price INCL of VAT [message #541266 is a reply to message #541260] |
Mon, 30 January 2012 04:10 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
A formula column (NOT "format trigger" you used) - as I said previously - should return NUMBER (not Boolean).
F_1 contains "price excl. VAT". You need to create a new field which will contain "price incl. VAT".
What you did is a mess. Please, forget everything you did so far, delete it and start over. This time, THINK and read what I already told you.
Also, when I ask "post your query (SELECT ... statement)", it is not because I don't have anything else to do, but when someone tries to assist, you should answer his/her questions. This time, mine.
|
|
|
Re: Code to compute Price INCL of VAT [message #541269 is a reply to message #541260] |
Mon, 30 January 2012 04:18 |
cookiemonster
Messages: 13958 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
F_1 is the name of an item in the layout. You can't use those in formulaes. You need to use the name of an item in the data model. Probably price.
Also you can't use a format trigger for this. Format triggers make items appear or disappear from the layout, they have no effect on the actual values of items.
As littlefoot said, create a formula column (in the data model), then put the correct calculation in it's formula property in the property palette.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|