E r g e b n i s / R e s u l t
This language call contains 3 numeric functions which can be used
within Database, Spreadsheet, or OAIII Programmer/Compiler.
These functions can be used to round a money amount to the nearest
five cents, or split the money amount into dollars and cents. (This
function will be of use when one and two cent coins are no longer
available in Australia).
B e s c h r e i b u n g / D e s c r i p t i o n
rndmoney - round to the nearest five cents
dollars - remove the cents
cents - remove the dollars
S y n t a x
Code:
correctamt = call("rndmoney",invoiceamt)
dollaramt = call("dollars",invoiceamt)
centamt = call("cents",invoiceamt) P a r a m e t e r
invoiceamt - The amount to round
R e t u r n s
The desired value.
B e i s p i e l / E x a m p l e
Code:
attach "money.oac"
invoiceamt = 0.00
put at 10,7 'Enter an Invoice Amount: '
get invoiceamt width 8 precision 2
put do clear screen
correctamt = 0.00
correctamt = call("rndmoney",invoiceamt)
dollaramt = 0.00
dollaramt = call("dollars",invoiceamt)
centamt = 0
centamt = call("cents",invoiceamt)
put at 10,3 ' Original Invoice: ', invoiceamt width 10 precision 2 left
put at 10,5 'Corrected Invoice: ', correctamt width 10 precision 2 left
put at 10,7 ' Dollars Only: ', dollaramt width 10 precision 2 left
put at 10,9 ' Cents Only: ', centamt width 2
put at 10,11
ok = true
get ok
detach "money.oac"