Invoices include margin calculation. If the invoice line comes from a sale order line, the cost will come from the sale order line.