A practical framework for deciding when to buy a SaaS tool and when custom software actually pays for itself.