Calculating Commission

Calculating Commission

I would like to calculate commission from quotes as a % of GP.
Can this be done.
Can a formula be written that will draw data from custom fields in the product tab (eg cost) and from the quote tab (eg Price) giving GP which can then be used to calculate commission.

Thanks

Peter