The company is ending up exactly as before, only difference is that the employees donate some part of their salary to charity.
The reason for this is that both salary and charitable donations are deductible from corporate tax, leaving the company in the exact same state in both cases (perhaps the charitable donations give the company a better image, but from an accountings point of view it is the same).
Consider below (simplified) example where Scenario A is before the donation and Scenario B is after.
|-------------------|------|------|
| Revenue | 1000 | 1000 |
| Salary costs | -200 | -199 |
| Charity | 0 | -1 |
|-------------------|------|------|
| Profit before tax | 800 | 800 |
| Tax (30%) | -240 | -240 |
|-------------------|------|------|
| Profit after tax | 560 | 560 |
|-------------------|------|------|
Basically in accounting you pay taxes out of your revenues, however you can deduct certain items from your revenue before tax is calculated; items such as cost of production, materials, labor, pension, finance expenses, charitable donations etc etc etc.
Profit is just a word to describe what you have left after you have deducted all these items from your revenue.