I understand that cap hits take effect in the following year or trading/cutting a player...but how is the amount of money determined?

Is it the amount of total Salary that player was suppose to make that year or the amount of the bonus?

Any help?

Thankyou,