This is how I used to calculate things when I was selling my shareware app:
Per product sold:
Code:
Revenue = what the customer pays
Direct costs = payment processing fee + sales tax (if any)
Gross profit = revenue - direct costs
The other costs are indirect costs: they cannot be assigned on a per-product basis, so totals only here:
Code:
Indirect costs = web hosting + books + company insurance + ...
Net profit = total gross profit - indirect costs
Since I used to run a sole proprietorship, all profit went directly into my own pockets:
Code:
Personal costs = food + rent + medical insurance + ...
Personal profit = net profit - personal costs
If you are incorporated that last bit is a little different. There's more to it, but this should give you some idea.