Re: missing formats
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Mar 19, 2002
- 381 views
George, Here's an improved version of my PrettyNumbers, this one handles cents and minus, with option to put minus sign to right of number; could easily change it to put a space between the minus sign & the number, on either side. The way it works, could easily make it do <1234>, but I'm not sure whether it's debits or credits, - or + that you would want to be bracketed. -------------------------- include misc.e -- takes an integer and makes a sequence with commas every 3 digits; -- set 2nd parameter to 0 for normal negative number format (eg:-3), -- set 2nd parameter to 1 for trailing minus sign (eg: 3-) function PrettyNumbers(object aNumber, integer rightNeg) sequence PrettyNumber, Temp, cents integer TriCounter, decPos, isNeg PrettyNumber = {} Temp = {} cents = {} isNeg = 0 TriCounter = 0 Temp = sprint(aNumber) decPos = find('.',Temp) if decPos then cents = Temp[decPos+1..length(Temp)] if length(cents) = 1 then cents &= "0" end if Temp = Temp[1..decPos-1] end if if Temp[1] = '-' then isNeg = 1 Temp = Temp[2..length(Temp)] end if for n = length(Temp) to 1 by -1 do PrettyNumber = prepend(PrettyNumber,Temp[n]) TriCounter += 1 if TriCounter = 3 and n != 1 then PrettyNumber = prepend(PrettyNumber,',') end if if TriCounter = 3 then TriCounter = 0 end if end for if length(cents) then PrettyNumber &= "." & cents end if if isNeg then if rightNeg then PrettyNumber = PrettyNumber & "-" else PrettyNumber = "-" & PrettyNumber end if end if return PrettyNumber end function puts(1, PrettyNumbers(-123456789.5,1)) -- the "1" makes minus show on right side. ----------------------------- Dan Moyer ----- Original Message ----- From: <gwalters at sc.rr.com> To: "EUforum" <EUforum at topica.com> Sent: Tuesday, March 19, 2002 4:08 AM Subject: missing formats > > I'm trying to write an accounting application and am running into some print > formats that I am accustomed to using that are missing in EU. Rob could you > perhaps add these to your enhancements on your next release. > > 1. A way to print large dollar figures with commas separating the > thousands.....perhaps "%,10.2d". > > 2. In the "general ledger" there is no such things as positive and > negative numbers. there are debits and credits "xxxxx.xx" and "<xxxxx.xx>". > So perhaps "%<10.2d", but then how do you do both commas and "<>"? > > 3. It is difficult in long tabular lists to find negative numbers if the > sign is to the left...so often a trailing negative sign is printed making it > a lot easier to find. > > Has anyone found solutions to these? > > george > >