|
C
|
cgphp 11/29/2011 |
|
In the "List page: After record processed" event enter this code: $record["fieldname_style"].='style="color:red"';
|
|
|
V
|
vettold author 11/29/2011 |
|
I only want it red if the balance is a credit or a negative amount. |
|
|
C
|
cgphp 11/29/2011 |
if($data['balance'] < 0) |
|
|
V
|
vettold author 11/29/2011 |
|
Will this retain its currency code? I need ($200.00) |
|
|
C
|
cgphp 11/29/2011 |
|
Try it. |
|
|
V
|
vettold author 11/29/2011 |
|
I tried before and after event with code below and neither puts the credit balance in red. |
|
|
C
|
cgphp 11/29/2011 |
|
I said the List page: After record processed event.
|
|
|
V
|
vettold author 11/29/2011 |
|
This is the code I am using: |
|
|
C
|
cgphp 11/29/2011 |
|
What is the type of the balance field in the database ? |
|
|
V
|
vettold author 11/29/2011 |
|
varchar(255) |
|
|
C
|
cgphp 11/29/2011 |
|
It should be a float to check if it is < 0 |
|
|
|
7542 11/29/2011 |
|
I would go to the visual editor, choose custom field and add the following code |
|
|
V
|
vettold author 11/29/2011 |
|
just tried and phpmyadmin says : 1063 - Incorrect column specifier for column 'balance' |
|
|
|
7542 11/29/2011 |
|
I tried the code before I posted |
|
|
V
|
vettold author 11/29/2011 |
|
you did it! Now is it possible to limit it to 2 decimal places? |
|
|
C
|
cgphp 11/29/2011 |
|
In phpmyadmin set the length of the balance field to 10,2 not 255. |
|
|
V
|
vettold author 11/29/2011 |
|
this is the error i get in phpmyadmin 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL' at line 1 |
|
|
|
7542 11/29/2011 |
|
Try this |
|
|
C
|
cgphp 11/29/2011 |
|
Not varchar but float(10,2) |
|
|
V
|
vettold author 11/29/2011 |
|
great it works. some users were confused when they saw (248.22) instead of -242.22 |
|