General Ledger codes can be used on Invoices. But, unless a cost price is added, the Sales Analysis reports may not reflect the true costs involved in the transaction.
There is a flag that will prompt the user to add a cost when using GL ID's.
This is set up by going to Admin / Defaults / Manage Customer Defaults - Invoices
When a G/L is added to an invoice, a prompt appears asking for the Cost Price