Quote:In addition, I just noticed the following:
1. On some cheques, the cents are coming out as .2/100 for 20 cents
There are two lines of code in the function MoneyToWords that say
Cents = @Right(vNet, 2)
Cents = @Right("00" + Cents, 2)
Change those two lines to
Cents = @Right(vNet, @Len(vNet) - @Instr(vNet, "."))
Cents = @Left(Cents + "00", 2)
Quote:2. I have a negative amount in a cheque i.e. credit and it is appearing as -,191.06 when I print the cheque.
The FormatMoney() function that I gave you was not built to handle negative numbers as I did not figure checks would be printed with negative numbers. Give the FormatMoney function below a try and let me know if it handles the negative dollar amounts correctly.
Function FormatMoney(Val as Double) as String
Var vBack as String
Var vWhole as String
Var vFrac as String
Var vDub as Double
Var vNeg as Boolean
vNeg = 0
If Val < 0 Then
{
vNeg = 1
Val = @ABS(Val)
}
vWhole = @Str(@Int(Val))
vFrac = @Str(@Frac(Val)) + "00"
While @Len(vWhole) > 3
{
vBack = "," + @Right(vWhole, 3) + vBack
vWhole = @Left(vWhole, @Len(vWhole) - 3)
}
vBack = vWhole + vBack
If @Instr(vFrac, ".") > 0 Then
{
vDub = @ToNumber(vFrac)
vFrac = @Str(@Decimals(@Round(vDub, 2), 2))
vFrac = @Right(vFrac, 2)
}
vBack = "$" + vBack + "." + @Left(vFrac, 2)
If vNeg = 1 Then
{
vBack = "-" + vBack
}
Return vBack
End Function
b.t.w. Just out of curiosity, what is the purpose of printing a check with a negative value?
Quote:Just to let you know, the data I am working with was imported in from a CSV file, if that has anything to do with it.
Thanks,
Louis
You are welcome,
Ray