There are many methods to use. Depends on the costing mode of stock you are using.
The general one is:
Gross Profit= Sales- Cost of sales
Net Profit= Gross Profit + Other Income - All Expenses
The general one is:
Gross Profit= Sales- Cost of sales
Net Profit= Gross Profit + Other Income - All Expenses