An Integrated Approach to Wastewater Treatment: Deciding Where, When, and How Much to Invest