Gross Profit is the percent of revenue retained by a company after they pay their Cost of Goods Sold (COGS). For a given month:
Gross Profit = Sum of revenue - COGS
For quarterly and annual aggregations, the sum of all months in the period is used for both revenue and COGS.
Gross Margin is Gross Profit as a percent of revenue.