How to work out the margin and VAT due using VAT margin schemes

How to work out the margin and VAT due and how to calculate the purchase and selling price.
Source: HMRC