First we have net sales, from which we deduct COGS and Depreciation. This gives us EBIT. From EBIT we deduct any interest paid. From that We have Earning Before Taxes, and from that we deduct taxes. The number after this is our Net income. If dividends are paid we deduct those and the remainder is the retained earnings.