The variable symbol is always primarily derived from the internal document number (when creating an invoice in the standard way).
However, the customer contracts module allows you to assign a variable symbol directly to a contract, meaning all invoices subsequently generated from that contract will contain the variable symbol specified on the contract in question.
For more information about the customer contracts module, please refer to the documentation.

