Posted: Tue Jan 01, 2008 7:11 pm
This is what I do currentlyWell, use integers throughout your software, but add a dot before DISPLAYING them to Joe User, so 33.33 would be stored as 33333.

I use two procedures (because I might have to add a VAT as well for a customer... so I split it up)
Code: Select all
Procedure TOTALTAX()
;******** set tax rate in pref file - so read it!
ts$ = GetGadgetText(#Text_SUBT)
a.d = ValD(ts$)
pronk.d = a * Taxrate.d ; already loaded and global variable
pronk$ = StrD(pronk,2) ; clip it at 2nd place
SetGadgetText(#Text_TAX, pronk$) ; *** set tax
grand.d = a + pronk
grand$ = StrD(grand,2)
FRAGGIT$ = moneysign$+" " + grand$
SetGadgetText(#Text_PAYTHIS, FRAGGIT$)
EndProcedure
Procedure TOTALTICKET()
; *** RESET all variables each time this is called
Result = 0
Result$ = ""
Cost$ = ""
subtotal.d = 0
subtot.d = 0
; *** This is what holds the restaurant ticket
Result = CountGadgetItems(#ListIcon_TICKET)
For t = 0 To Result
Result$ = GetGadgetItemText(#ListIcon_TICKET, t, 2) ; money in #2 column
subtot.d = ValD(Result$) ; turn it into a number
subtotal.d = subtotal + subtot ; add it to grand total
Next
RESU$ = StrD(subtotal,2) ; round off at 2nd decimal place
SetGadgetText(#Text_SUBT, RESU$) ; plunk it
TOTALTAX() ; figure the tax
EndProcedure
