Gross margin takes into account the direct costs of producing and distributing a product for sale. It is a percentage calculated by dividing gross profit by sales. Operating margin is operating profit divided by sales. It tales into account not only the cost of goods sold, but also the actual costs of running the business.
Net margin is the final piece of the jigsaw.
Where net profit is the profit attributable to shareholders. This is almost the last number you will see in a typical profit and loss statement. Almost, but not quite. As you can see, it is calculated on a company's net profit rather than retained profit. From its net profit, a company can choose to pay a dividend to shareholders, like most UK companies, or choose to keep all the profits in the business, as a lot of the younger US companies do.