i use this one it may help you
If ( Product code="Vehicle is not Homologated for Towing"; TextStyleAdd (Description INFO; HighlightYellow ); If (Product code="TBA" ;TextStyleAdd( Description INFO; Underline ); Description INFO ))
You could make the status field a calculation field, with the function you wrote. If(Debtfield=0;"Paid";"Debt").
Then use conditional formatting on the onvoice layout. Because the invoice is either paid or debt, you can set the field color to red and put a conditional formatting on it which changes the field color to green when the satus field contains "Paid". If you haven't used conditional formatting before, here is how you do it:
Select the fields in question, ricght-click and choose conditional formatting. Under "Condition", choose "Formula is" and enter Statusfield="Paid". Under "Format", choose the fill color you want.
There are many ways to accomplish the same result, I use this way because it lets me display the invoice differentely on an other layout.
THANK YOU OSKAR! WHEN I POSTED THE QUESTION I STARTED TO EXPERIMENT AND I DISCOVERED IT! EXCATLY WHAT I DID!