BY haraam ways I have earned money suppose ($1000) and invest this all money in a business. What if I earn like $1500 through legal business and does a charity of invested money ($1000), then the profit income ($500) be will my income be halaal or haraam ?.
Even though you do charity of the complete amount but still the money will be considered Haram as it is earned by wrong means.
Suppose you steal $1000 from someone and afterwards you donate that amount to a church. But if you are caught and put to trial, you can't tell the judge not to punish you just because you later donated that amount.
Hope I have cleared out my point