You can manage your margins using the purchase price entered in your catalog.
This is entirely automated: add a line to your catalog, and margins are automatically calculated.
You can also access expense details by clicking on the icon at the right of the margin: