Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing Money Values the way I want to.
Message
From
23/06/1999 08:00:01
Kenneth Downs
Secure Data Software, Inc.
New York, United States
 
 
To
22/06/1999 20:32:17
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00232788
Message ID:
00232886
Views:
30
David,

>I'm having a hell of a time trying to get VFP to print my money fields the way I want them.
>

I suggest you write a little UDF, specifically because of the parentheses. I found in VFP 3 that VFP messed up columns of numbers that used parentheses. It would basically do this to a column on numbers:
12345.67
  (1.95)
 (23.47)
 9876.57
This drove me nuts until I finally decided the design team had simply not thought of the possibility of properly stacking a column of numbers and leaving a space on the right for positives so things would line up. Having written the UDF some years ago, I've been using it ever since. Yours might go something like this (season to taste):
PROCEDURE myFormat
LPARAM TheNumber,ThePicture
LOCAL lcRetVal

lcRetVal = TRANS(ABS(TheNumber),ThePicture)
IF TheNumber > 0
  lcRetVal = " " + lcRetVal + " "
ELSE
  lcRetVal = "(" + lcRetVal + ")"
ENDIF
RETURN "$ " + lcRetVal
Example uses would be:
Input                        Output
====================         =================
MyFormat(100,"999,999.99")      $      100.00 
MyFormat(-20000,"999,999.99")   $ ( 20,000.00)
MyFormat(.59,"999,999.99")      $         .59
MyFormat(-998457,"999,999.99")  $ (998,457.00)
Hope this helps.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform