The order in which you spend your money makes a difference for your taxes — and your enjoyment of life.