I've not had reason to do it since moving to the online version, but on the desktop QB I just put the purchase on the top line of the expense transaction, then the trade-in value on the next line (as a negative, obviously), then the final figure at the bottom should be the amount you paid out, with the VAT sorted correctly.
Either of the two above ways for Vat calulcation. Depends really how they accounted for it on their invoice to you whether you use each one. But both result in correct VAT.
However for capital...
I would say first one it better as the full £4k purchase will show on you asset register for depreciation. With the second way you risk only £2k being put against depreciation. That said you might have made an accounting profit on the machine sold as that might have been written off completely.