With early settlement discount you take 2.5% (or whatever rate it is) of the net amount and deduct it from the net amount and then calculate the VAT on this amount, giving you the total of the invoice.
With trade discount, you deduct this from the net amount first and then calculate the early settlement discount on this amount, and calculate VAT in the same way as above.
Hope this gives you the information you need to work out the above
I have a couple of queries, I think the Delivery taken off before working out trade discount and cash discount (adding it before calculating the VAT). Also the invoice total is net before cash discount plus delivery plus the VAT calculated after cash discount. Is this right?