This topic is locked

fill in a currency field with minus values

11/26/2007 11:59:50 PM
PHPRunner General questions
L
laonian author

I have a field (type decimal 9,2 in MySQL) set "View as/Edit as" currency (USD) in PHPRunner 4.1. It is working fine when I fill in with positive values like 1, 2.34, and so on. But I am not able to fill in any negative values like -1 or -2.34. I need this for cases such as refunds or credits rather than charges on an ordering account. Anybody have an idea? Thanks.

J
Jane 11/27/2007

Hi,
you can do it using Custom format on the "View as" settings dialog on the Visual Editor tab.

Here is a sample:

if ($value<0)

$value = "-".format_currency($value*(-1));

else

$value = format_currency($value);