Well, the initial investors usually get first dibs on cash, which they have the option of taking or pouring back into the company. Any income must then of course go to cover operating expenses including salaries and materials to stay in business tomorrow. If you have any non-shareholder employees, their salary must be paid for as a contractual obligation. After taking care of continuing business, any excess income (not profit, income) may be split between investing in future capabilities and paying down debt. Anything left over may be distributed to employees in the form of a cash bonus or an interest in the company as second-tier investors (typically non-voting I think), and they can either sell their shares for cash or put their value back into the company.
In short, the obligations are:
1. Initial investors and debt repayment.
2. Contractual obligations such as salaries, equipment or property leases, etc.
3. Continuing operations such as raw materials.
4. Capital investments for future operations, or paying down debt.
Saving up money to buy a new ice shaver for when the current one dies, can either fall under #3 or #4, depending on where you want your tax writeoff. Oh yea, they did track income and expenses for their tax returns, right?
In any case, bonuses as cash or shares in the company, or distributing excess available cash, comes last and must be approved by the initial investor(s) and company owner.