If the value of custom variable A is equal to built-in variable B then print the built-in variable on sales invoice .
If the value of custom variable A is NOT equal to built-in variable B then print the value of custom A variable on sales invoice.
How can I do that? Is it feasible through HTML templates?